Source Code Cross Referenced for ScrollbarOperator.java in  » Testing » jemmy » org » netbeans » jemmy » operators » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Testing » jemmy » org.netbeans.jemmy.operators 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s): Alexandre Iline.
025:         *
026:         * The Original Software is the Jemmy library.
027:         * The Initial Developer of the Original Software is Alexandre Iline.
028:         * All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         *
041:         *
042:         *
043:         * $Id: ScrollbarOperator.java,v 1.7 2007/10/05 11:35:30 jskrivanek Exp $ $Revision: 1.7 $ $Date: 2007/10/05 11:35:30 $
044:         *
045:         */
046:
047:        package org.netbeans.jemmy.operators;
048:
049:        import org.netbeans.jemmy.Action;
050:        import org.netbeans.jemmy.ComponentSearcher;
051:        import org.netbeans.jemmy.ComponentChooser;
052:        import org.netbeans.jemmy.JemmyProperties;
053:        import org.netbeans.jemmy.Outputable;
054:        import org.netbeans.jemmy.TestOut;
055:        import org.netbeans.jemmy.Timeoutable;
056:        import org.netbeans.jemmy.TimeoutExpiredException;
057:        import org.netbeans.jemmy.Timeouts;
058:        import org.netbeans.jemmy.Waitable;
059:        import org.netbeans.jemmy.Waiter;
060:
061:        import org.netbeans.jemmy.drivers.DriverManager;
062:        import org.netbeans.jemmy.drivers.ScrollDriver;
063:
064:        import org.netbeans.jemmy.drivers.scrolling.ScrollAdjuster;
065:
066:        import java.awt.Component;
067:        import java.awt.Container;
068:        import java.awt.Point;
069:        import java.awt.Scrollbar;
070:
071:        import java.awt.event.AdjustmentListener;
072:
073:        import java.util.Hashtable;
074:
075:        /**
076:         * <BR><BR>Timeouts used: <BR>
077:         * ScrollbarOperator.WholeScrollTimeout - time for one scroll click <BR>
078:         * ComponentOperator.WaitComponentTimeout - time to wait component displayed <BR>.
079:         *
080:         * @see org.netbeans.jemmy.Timeouts
081:         *
082:         * @author Alexandre Iline (alexandre.iline@sun.com)
083:         *	
084:         */
085:        public class ScrollbarOperator extends ComponentOperator implements 
086:                Timeoutable, Outputable {
087:
088:            private final static long ONE_SCROLL_CLICK_TIMEOUT = 0;
089:            private final static long WHOLE_SCROLL_TIMEOUT = 60000;
090:            private final static long BEFORE_DROP_TIMEOUT = 0;
091:            private final static long DRAG_AND_DROP_SCROLLING_DELTA = 0;
092:
093:            private static final int MINIMAL_PAD_SIZE = 10;
094:
095:            private static final int MINIMAL_DRAGGER_SIZE = 5;
096:
097:            private Timeouts timeouts;
098:            private TestOut output;
099:
100:            private ScrollDriver driver;
101:
102:            /**
103:             * Constructs a ScrollbarOperator object.
104:             * @param b a component
105:             */
106:            public ScrollbarOperator(Scrollbar b) {
107:                super (b);
108:                driver = DriverManager.getScrollDriver(getClass());
109:            }
110:
111:            /**
112:             * Constructs a ScrollbarOperator object.
113:             * @param cont a container
114:             * @param chooser a component chooser specifying searching criteria.
115:             * @param index an index between appropriate ones.
116:             */
117:            public ScrollbarOperator(ContainerOperator cont,
118:                    ComponentChooser chooser, int index) {
119:                this ((Scrollbar) cont.waitSubComponent(new ScrollbarFinder(
120:                        chooser), index));
121:                copyEnvironment(cont);
122:            }
123:
124:            /**
125:             * Constructs a ScrollbarOperator object.
126:             * @param cont a container
127:             * @param chooser a component chooser specifying searching criteria.
128:             */
129:            public ScrollbarOperator(ContainerOperator cont,
130:                    ComponentChooser chooser) {
131:                this (cont, chooser, 0);
132:            }
133:
134:            /**
135:             * Constructs a ScrollbarOperator object.
136:             * @param cont a container
137:             * @param index an index between appropriate ones.
138:             */
139:            public ScrollbarOperator(ContainerOperator cont, int index) {
140:                this ((Scrollbar) waitComponent(cont, new ScrollbarFinder(),
141:                        index));
142:                copyEnvironment(cont);
143:            }
144:
145:            /**
146:             * Constructs a ScrollbarOperator object.
147:             * @param cont a container
148:             */
149:            public ScrollbarOperator(ContainerOperator cont) {
150:                this (cont, 0);
151:            }
152:
153:            /**
154:             * Finds a scrollbar.
155:             * @param cont a container
156:             * @param chooser a component chooser specifying searching criteria.
157:             * @param index an index between appropriate ones.
158:             * @return the scrollbar fitting searching criteria
159:             */
160:            public static Scrollbar findScrollbar(Container cont,
161:                    ComponentChooser chooser, int index) {
162:                return ((Scrollbar) findComponent(cont, new ScrollbarFinder(
163:                        chooser), index));
164:            }
165:
166:            /**
167:             * Finds a scrollbar.
168:             * @param cont a container
169:             * @param chooser a component chooser specifying searching criteria.
170:             * @return the scrollbar fitting searching criteria
171:             */
172:            public static Scrollbar findScrollbar(Container cont,
173:                    ComponentChooser chooser) {
174:                return (findScrollbar(cont, chooser, 0));
175:            }
176:
177:            /**
178:             * Finds a scrollbar.
179:             * @param cont a container
180:             * @param index an index between appropriate ones.
181:             * @return the scrollbar fitting searching criteria
182:             */
183:            public static Scrollbar findScrollbar(Container cont, int index) {
184:                return (findScrollbar(cont, ComponentSearcher
185:                        .getTrueChooser(Integer.toString(index)
186:                                + "'th Scrollbar instance"), index));
187:            }
188:
189:            /**
190:             * Finds a scrollbar.
191:             * @param cont a container
192:             * @return the scrollbar fitting searching criteria
193:             */
194:            public static Scrollbar findScrollbar(Container cont) {
195:                return (findScrollbar(cont, 0));
196:            }
197:
198:            /**
199:             * Waits a scrollbar.
200:             * @param cont a container
201:             * @param chooser a component chooser specifying searching criteria.
202:             * @param index an index between appropriate ones.
203:             * @return the scrollbar fitting searching criteria
204:             */
205:            public static Scrollbar waitScrollbar(Container cont,
206:                    ComponentChooser chooser, int index) {
207:                return ((Scrollbar) waitComponent(cont, new ScrollbarFinder(
208:                        chooser), index));
209:            }
210:
211:            /**
212:             * Waits a scrollbar.
213:             * @param cont a container
214:             * @param chooser a component chooser specifying searching criteria.
215:             * @return the scrollbar fitting searching criteria
216:             */
217:            public static Scrollbar waitScrollbar(Container cont,
218:                    ComponentChooser chooser) {
219:                return (waitScrollbar(cont, chooser, 0));
220:            }
221:
222:            /**
223:             * Waits a scrollbar.
224:             * @param cont a container
225:             * @param index an index between appropriate ones.
226:             * @return the scrollbar fitting searching criteria
227:             */
228:            public static Scrollbar waitScrollbar(Container cont, int index) {
229:                return (waitScrollbar(cont, ComponentSearcher
230:                        .getTrueChooser(Integer.toString(index)
231:                                + "'th Scrollbar instance"), index));
232:            }
233:
234:            /**
235:             * Waits a scrollbar.
236:             * @param cont a container
237:             * @return the scrollbar fitting searching criteria
238:             */
239:            public static Scrollbar waitScrollbar(Container cont) {
240:                return (waitScrollbar(cont, 0));
241:            }
242:
243:            static {
244:                Timeouts.initDefault("ScrollbarOperator.OneScrollClickTimeout",
245:                        ONE_SCROLL_CLICK_TIMEOUT);
246:                Timeouts.initDefault("ScrollbarOperator.WholeScrollTimeout",
247:                        WHOLE_SCROLL_TIMEOUT);
248:                Timeouts.initDefault("ScrollbarOperator.BeforeDropTimeout",
249:                        BEFORE_DROP_TIMEOUT);
250:                Timeouts.initDefault(
251:                        "ScrollbarOperator.DragAndDropScrollingDelta",
252:                        DRAG_AND_DROP_SCROLLING_DELTA);
253:            }
254:
255:            public void setOutput(TestOut out) {
256:                output = out;
257:                super .setOutput(output.createErrorOutput());
258:            }
259:
260:            public TestOut getOutput() {
261:                return (output);
262:            }
263:
264:            public void setTimeouts(Timeouts timeouts) {
265:                this .timeouts = timeouts;
266:                super .setTimeouts(timeouts);
267:            }
268:
269:            public Timeouts getTimeouts() {
270:                return (timeouts);
271:            }
272:
273:            public void copyEnvironment(Operator anotherOperator) {
274:                super .copyEnvironment(anotherOperator);
275:                driver = (ScrollDriver) DriverManager.getDriver(
276:                        DriverManager.SCROLL_DRIVER_ID, getClass(),
277:                        anotherOperator.getProperties());
278:            }
279:
280:            /**
281:             * Scrolls scrollbar to the position defined by w parameter.
282:             * Uses ScrollDriver registered to this operator type.
283:             * @param w Scrolling is stopped when w.actionProduced(waiterParam) != null
284:             * @param waiterParam a waiting parameter.
285:             * @param increase a scrolling direction.
286:             * @throws TimeoutExpiredException
287:             */
288:            public void scrollTo(Waitable w, Object waiterParam,
289:                    boolean increase) {
290:                scrollTo(new WaitableChecker(w, waiterParam, increase, this ));
291:            }
292:
293:            /**
294:             * Scrolls scrollbar to the position defined by a ScrollAdjuster implementation.
295:             * @param adj defines scrolling direction, and so on.
296:             * @throws TimeoutExpiredException
297:             */
298:            public void scrollTo(final ScrollAdjuster adj) {
299:                produceTimeRestricted(new Action() {
300:                    public Object launch(Object obj) {
301:                        driver.scroll(ScrollbarOperator.this , adj);
302:                        return (null);
303:                    }
304:
305:                    public String getDescription() {
306:                        return ("Scrolling");
307:                    }
308:                }, getTimeouts().getTimeout(
309:                        "ScrollbarOperator.WholeScrollTimeout"));
310:            }
311:
312:            /**
313:             * Scrolls scroll bar to necessary value.
314:             * @param value Scroll bar value to scroll to.
315:             * @throws TimeoutExpiredException
316:             */
317:            public void scrollToValue(int value) {
318:                output.printTrace("Scroll Scrollbar to "
319:                        + Integer.toString(value) + " value\n"
320:                        + toStringSource());
321:                output.printGolden("Scroll Scrollbar to "
322:                        + Integer.toString(value) + " value");
323:                scrollTo(new ValueScrollAdjuster(value));
324:            }
325:
326:            /**
327:             * Scrolls scroll bar to necessary proportional value.
328:             * @param proportionalValue Proportional scroll to. Must be >= 0 and <= 1.
329:             * @throws TimeoutExpiredException
330:             */
331:            public void scrollToValue(double proportionalValue) {
332:                output.printTrace("Scroll Scrollbar to "
333:                        + Double.toString(proportionalValue)
334:                        + " proportional value\n" + toStringSource());
335:                output.printGolden("Scroll Scrollbar to "
336:                        + Double.toString(proportionalValue)
337:                        + " proportional value");
338:                scrollTo(new ValueScrollAdjuster(
339:                        (int) (getMinimum() + (getMaximum()
340:                                - getVisibleAmount() - getMinimum())
341:                                * proportionalValue)));
342:            }
343:
344:            /**
345:             * Scrolls to minimum value.
346:             * @throws TimeoutExpiredException
347:             */
348:            public void scrollToMinimum() {
349:                output.printTrace("Scroll Scrollbar to minimum value\n"
350:                        + toStringSource());
351:                output.printGolden("Scroll Scrollbar to minimum value");
352:                produceTimeRestricted(new Action() {
353:                    public Object launch(Object obj) {
354:                        driver.scrollToMinimum(ScrollbarOperator.this ,
355:                                getOrientation());
356:                        return (null);
357:                    }
358:
359:                    public String getDescription() {
360:                        return ("Scrolling");
361:                    }
362:                }, getTimeouts().getTimeout(
363:                        "ScrollbarOperator.WholeScrollTimeout"));
364:            }
365:
366:            /**
367:             * Scrolls to maximum value.
368:             * @throws TimeoutExpiredException
369:             */
370:            public void scrollToMaximum() {
371:                output.printTrace("Scroll Scrollbar to maximum value\n"
372:                        + toStringSource());
373:                output.printGolden("Scroll Scrollbar to maximum value");
374:                produceTimeRestricted(new Action() {
375:                    public Object launch(Object obj) {
376:                        driver.scrollToMaximum(ScrollbarOperator.this ,
377:                                getOrientation());
378:                        return (null);
379:                    }
380:
381:                    public String getDescription() {
382:                        return ("Scrolling");
383:                    }
384:                }, getTimeouts().getTimeout(
385:                        "ScrollbarOperator.WholeScrollTimeout"));
386:            }
387:
388:            ////////////////////////////////////////////////////////
389:            //Mapping                                             //
390:
391:            /**Maps <code>Scrollbar.addAdjustmentListener(AdjustmentListener)</code> through queue*/
392:            public void addAdjustmentListener(
393:                    final AdjustmentListener adjustmentListener) {
394:                runMapping(new MapVoidAction("addAdjustmentListener") {
395:                    public void map() {
396:                        ((Scrollbar) getSource())
397:                                .addAdjustmentListener(adjustmentListener);
398:                    }
399:                });
400:            }
401:
402:            /**Maps <code>Scrollbar.getBlockIncrement()</code> through queue*/
403:            public int getBlockIncrement() {
404:                return (runMapping(new MapIntegerAction("getBlockIncrement") {
405:                    public int map() {
406:                        return (((Scrollbar) getSource()).getBlockIncrement());
407:                    }
408:                }));
409:            }
410:
411:            /**Maps <code>Scrollbar.getMaximum()</code> through queue*/
412:            public int getMaximum() {
413:                return (runMapping(new MapIntegerAction("getMaximum") {
414:                    public int map() {
415:                        return (((Scrollbar) getSource()).getMaximum());
416:                    }
417:                }));
418:            }
419:
420:            /**Maps <code>Scrollbar.getMinimum()</code> through queue*/
421:            public int getMinimum() {
422:                return (runMapping(new MapIntegerAction("getMinimum") {
423:                    public int map() {
424:                        return (((Scrollbar) getSource()).getMinimum());
425:                    }
426:                }));
427:            }
428:
429:            /**Maps <code>Scrollbar.getOrientation()</code> through queue*/
430:            public int getOrientation() {
431:                return (runMapping(new MapIntegerAction("getOrientation") {
432:                    public int map() {
433:                        return (((Scrollbar) getSource()).getOrientation());
434:                    }
435:                }));
436:            }
437:
438:            /**Maps <code>Scrollbar.getUnitIncrement()</code> through queue*/
439:            public int getUnitIncrement() {
440:                return (runMapping(new MapIntegerAction("getUnitIncrement") {
441:                    public int map() {
442:                        return (((Scrollbar) getSource()).getUnitIncrement());
443:                    }
444:                }));
445:            }
446:
447:            /**Maps <code>Scrollbar.getValue()</code> through queue*/
448:            public int getValue() {
449:                return (runMapping(new MapIntegerAction("getValue") {
450:                    public int map() {
451:                        return (((Scrollbar) getSource()).getValue());
452:                    }
453:                }));
454:            }
455:
456:            /**Maps <code>Scrollbar.getVisibleAmount()</code> through queue*/
457:            public int getVisibleAmount() {
458:                return (runMapping(new MapIntegerAction("getVisibleAmount") {
459:                    public int map() {
460:                        return (((Scrollbar) getSource()).getVisibleAmount());
461:                    }
462:                }));
463:            }
464:
465:            /**Maps <code>Scrollbar.removeAdjustmentListener(AdjustmentListener)</code> through queue*/
466:            public void removeAdjustmentListener(
467:                    final AdjustmentListener adjustmentListener) {
468:                runMapping(new MapVoidAction("removeAdjustmentListener") {
469:                    public void map() {
470:                        ((Scrollbar) getSource())
471:                                .removeAdjustmentListener(adjustmentListener);
472:                    }
473:                });
474:            }
475:
476:            /**Maps <code>Scrollbar.setBlockIncrement(int)</code> through queue*/
477:            public void setBlockIncrement(final int i) {
478:                runMapping(new MapVoidAction("setBlockIncrement") {
479:                    public void map() {
480:                        ((Scrollbar) getSource()).setBlockIncrement(i);
481:                    }
482:                });
483:            }
484:
485:            /**Maps <code>Scrollbar.setMaximum(int)</code> through queue*/
486:            public void setMaximum(final int i) {
487:                runMapping(new MapVoidAction("setMaximum") {
488:                    public void map() {
489:                        ((Scrollbar) getSource()).setMaximum(i);
490:                    }
491:                });
492:            }
493:
494:            /**Maps <code>Scrollbar.setMinimum(int)</code> through queue*/
495:            public void setMinimum(final int i) {
496:                runMapping(new MapVoidAction("setMinimum") {
497:                    public void map() {
498:                        ((Scrollbar) getSource()).setMinimum(i);
499:                    }
500:                });
501:            }
502:
503:            /**Maps <code>Scrollbar.setOrientation(int)</code> through queue*/
504:            public void setOrientation(final int i) {
505:                runMapping(new MapVoidAction("setOrientation") {
506:                    public void map() {
507:                        ((Scrollbar) getSource()).setOrientation(i);
508:                    }
509:                });
510:            }
511:
512:            /**Maps <code>Scrollbar.setUnitIncrement(int)</code> through queue*/
513:            public void setUnitIncrement(final int i) {
514:                runMapping(new MapVoidAction("setUnitIncrement") {
515:                    public void map() {
516:                        ((Scrollbar) getSource()).setUnitIncrement(i);
517:                    }
518:                });
519:            }
520:
521:            /**Maps <code>Scrollbar.setValue(int)</code> through queue*/
522:            public void setValue(final int i) {
523:                runMapping(new MapVoidAction("setValue") {
524:                    public void map() {
525:                        ((Scrollbar) getSource()).setValue(i);
526:                    }
527:                });
528:            }
529:
530:            /**Maps <code>Scrollbar.setValues(int, int, int, int)</code> through queue*/
531:            public void setValues(final int i, final int i1, final int i2,
532:                    final int i3) {
533:                runMapping(new MapVoidAction("setValues") {
534:                    public void map() {
535:                        ((Scrollbar) getSource()).setValues(i, i1, i2, i3);
536:                    }
537:                });
538:            }
539:
540:            /**Maps <code>Scrollbar.setVisibleAmount(int)</code> through queue*/
541:            public void setVisibleAmount(final int i) {
542:                runMapping(new MapVoidAction("setVisibleAmount") {
543:                    public void map() {
544:                        ((Scrollbar) getSource()).setVisibleAmount(i);
545:                    }
546:                });
547:            }
548:
549:            //End of mapping                                      //
550:            ////////////////////////////////////////////////////////
551:
552:            private class ValueScrollAdjuster implements  ScrollAdjuster {
553:                int value;
554:
555:                public ValueScrollAdjuster(int value) {
556:                    this .value = value;
557:                }
558:
559:                public int getScrollDirection() {
560:                    if (getValue() == value) {
561:                        return (ScrollAdjuster.DO_NOT_TOUCH_SCROLL_DIRECTION);
562:                    } else {
563:                        return ((getValue() < value) ? ScrollAdjuster.INCREASE_SCROLL_DIRECTION
564:                                : ScrollAdjuster.DECREASE_SCROLL_DIRECTION);
565:                    }
566:                }
567:
568:                public int getScrollOrientation() {
569:                    return (getOrientation());
570:                }
571:
572:                public String getDescription() {
573:                    return ("Scroll to " + Integer.toString(value) + " value");
574:                }
575:            }
576:
577:            private class WaitableChecker implements  ScrollAdjuster {
578:                Waitable w;
579:                Object waitParam;
580:                boolean increase;
581:                boolean reached = false;
582:                ScrollbarOperator oper;
583:
584:                public WaitableChecker(Waitable w, Object waitParam,
585:                        boolean increase, ScrollbarOperator oper) {
586:                    this .w = w;
587:                    this .waitParam = waitParam;
588:                    this .increase = increase;
589:                    this .oper = oper;
590:                }
591:
592:                public int getScrollDirection() {
593:                    if (!reached && w.actionProduced(waitParam) != null) {
594:                        reached = true;
595:                    }
596:                    if (reached) {
597:                        return (this .DO_NOT_TOUCH_SCROLL_DIRECTION);
598:                    } else {
599:                        return (increase ? this .INCREASE_SCROLL_DIRECTION
600:                                : this .DECREASE_SCROLL_DIRECTION);
601:                    }
602:                }
603:
604:                public int getScrollOrientation() {
605:                    return (getOrientation());
606:                }
607:
608:                public String getDescription() {
609:                    return (w.getDescription());
610:                }
611:            }
612:
613:            /**
614:             * Checks component type.
615:             */
616:            public static class ScrollbarFinder extends Finder {
617:                /**
618:                 * Constructs ScrollbarFinder.
619:                 * @param sf other searching criteria.
620:                 */
621:                public ScrollbarFinder(ComponentChooser sf) {
622:                    super (Scrollbar.class, sf);
623:                }
624:
625:                /**
626:                 * Constructs ScrollbarFinder.
627:                 */
628:                public ScrollbarFinder() {
629:                    super (Scrollbar.class);
630:                }
631:            }
632:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.