Source Code Cross Referenced for JSplitPaneOperator.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: JSplitPaneOperator.java,v 1.10 2007/10/05 11:35:40 jskrivanek Exp $ $Revision: 1.10 $ $Date: 2007/10/05 11:35:40 $
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.Outputable;
053:        import org.netbeans.jemmy.TestOut;
054:        import org.netbeans.jemmy.Timeoutable;
055:        import org.netbeans.jemmy.TimeoutExpiredException;
056:        import org.netbeans.jemmy.Timeouts;
057:
058:        import org.netbeans.jemmy.util.EmptyVisualizer;
059:
060:        import org.netbeans.jemmy.drivers.DriverManager;
061:        import org.netbeans.jemmy.drivers.ScrollDriver;
062:
063:        import org.netbeans.jemmy.drivers.scrolling.ScrollAdjuster;
064:
065:        import java.awt.Component;
066:        import java.awt.Container;
067:
068:        import java.util.Hashtable;
069:
070:        import javax.swing.JButton;
071:        import javax.swing.JSplitPane;
072:
073:        import javax.swing.plaf.SplitPaneUI;
074:
075:        import javax.swing.plaf.basic.BasicSplitPaneDivider;
076:
077:        /**
078:         * <BR><BR>Timeouts used: <BR>
079:         * JSplitPaneOperator.ScrollClickTimeout - time for simple scroll click <BR>
080:         * JSplitPaneOperator.BetweenClickTimeout - time to sleep between scroll clicks <BR>
081:         * JSplitPaneOperator.WholeScrollTimeout - time for the whole scrolling <BR>
082:         * ComponentOperator.WaitComponentTimeout - time to wait component displayed <BR>.
083:         *
084:         * @see org.netbeans.jemmy.Timeouts
085:         *
086:         * @author Alexandre Iline (alexandre.iline@sun.com)
087:         *
088:         * Class to operate with javax.swing.JSplitPane component
089:         *	
090:         */
091:
092:        public class JSplitPaneOperator extends JComponentOperator implements 
093:                Timeoutable, Outputable {
094:
095:            /**
096:             * Identifier for a "minimum" property.
097:             * @see #getDump
098:             */
099:            public static final String MINIMUM_DPROP = "Minimum";
100:
101:            /**
102:             * Identifier for a "maximum" property.
103:             * @see #getDump
104:             */
105:            public static final String MAXIMUM_DPROP = "Maximum";
106:
107:            /**
108:             * Identifier for a "value" property.
109:             * @see #getDump
110:             */
111:            public static final String VALUE_DPROP = "Value";
112:
113:            /**
114:             * Identifier for a "orientation" property.
115:             * @see #getDump
116:             */
117:            public static final String ORIENTATION_DPROP = "Orientation";
118:
119:            /**
120:             * Identifier for a "HORIZONTAL" value of "orientation" property.
121:             * @see #getDump
122:             */
123:            public static final String HORIZONTAL_ORIENTATION_DPROP_VALUE = "HORIZONTAL";
124:
125:            /**
126:             * Identifier for a "VERTICAL" value of "orientation" property.
127:             * @see #getDump
128:             */
129:            public static final String VERTICAL_ORIENTATION_DPROP_VALUE = "VERTICAL";
130:
131:            /**
132:             * Identifier for a "one touch expendable" property.
133:             * @see #getDump
134:             */
135:            public static final String IS_ONE_TOUCH_EXPANDABLE_DPROP = "One touch expandable";
136:
137:            private final static long SCROLL_CLICK_TIMEOUT = 0;
138:            private final static long BETWEEN_CLICK_TIMEOUT = 0;
139:            private final static long WHOLE_SCROLL_TIMEOUT = 60000;
140:
141:            private Timeouts timeouts;
142:            private TestOut output;
143:            private ContainerOperator divider;
144:            private ScrollDriver driver;
145:
146:            /**
147:             * Constructor.
148:             * @param b JSplitPane component.
149:             */
150:            public JSplitPaneOperator(JSplitPane b) {
151:                super (b);
152:                driver = DriverManager.getScrollDriver(getClass());
153:            }
154:
155:            /**
156:             * Constructs a JSplitPaneOperator object.
157:             * @param cont a container
158:             * @param chooser a component chooser specifying searching criteria.
159:             * @param index an index between appropriate ones.
160:             */
161:            public JSplitPaneOperator(ContainerOperator cont,
162:                    ComponentChooser chooser, int index) {
163:                this ((JSplitPane) cont.waitSubComponent(new JSplitPaneFinder(
164:                        chooser), index));
165:                copyEnvironment(cont);
166:            }
167:
168:            /**
169:             * Constructs a JSplitPaneOperator object.
170:             * @param cont a container
171:             * @param chooser a component chooser specifying searching criteria.
172:             */
173:            public JSplitPaneOperator(ContainerOperator cont,
174:                    ComponentChooser chooser) {
175:                this (cont, chooser, 0);
176:            }
177:
178:            /**
179:             * Constructor.
180:             * Waits component in container first.
181:             * Uses cont's timeout and output for waiting and to init operator.
182:             * @param cont Operator pointing a container to search component in.
183:             * @param index Ordinal component index.
184:             * @throws TimeoutExpiredException
185:             */
186:            public JSplitPaneOperator(ContainerOperator cont, int index) {
187:                this ((JSplitPane) waitComponent(cont, new JSplitPaneFinder(),
188:                        index));
189:                copyEnvironment(cont);
190:            }
191:
192:            /**
193:             * Constructor.
194:             * Waits component in container first.
195:             * Uses cont's timeout and output for waiting and to init operator.
196:             * @param cont Operator pointing a container to search component in.
197:             * @throws TimeoutExpiredException
198:             */
199:            public JSplitPaneOperator(ContainerOperator cont) {
200:                this (cont, 0);
201:            }
202:
203:            /**
204:             * Searches JSplitPane in container.
205:             * @param cont Container to search component in.
206:             * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
207:             * @param index Ordinal component index.
208:             * @return JSplitPane instance or null if component was not found.
209:             */
210:            public static JSplitPane findJSplitPane(Container cont,
211:                    ComponentChooser chooser, int index) {
212:                return ((JSplitPane) findComponent(cont, new JSplitPaneFinder(
213:                        chooser), index));
214:            }
215:
216:            /**
217:             * Searches 0'th JSplitPane in container.
218:             * @param cont Container to search component in.
219:             * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
220:             * @return JSplitPane instance or null if component was not found.
221:             */
222:            public static JSplitPane findJSplitPane(Container cont,
223:                    ComponentChooser chooser) {
224:                return (findJSplitPane(cont, chooser, 0));
225:            }
226:
227:            /**
228:             * Searches JSplitPane in container.
229:             * @param cont Container to search component in.
230:             * @param index Ordinal component index.
231:             * @return JSplitPane instance or null if component was not found.
232:             */
233:            public static JSplitPane findJSplitPane(Container cont, int index) {
234:                return (findJSplitPane(cont, ComponentSearcher
235:                        .getTrueChooser(Integer.toString(index)
236:                                + "'th JSplitPane instance"), index));
237:            }
238:
239:            /**
240:             * Searches 0'th JSplitPane in container.
241:             * @param cont Container to search component in.
242:             * @return JSplitPane instance or null if component was not found.
243:             */
244:            public static JSplitPane findJSplitPane(Container cont) {
245:                return (findJSplitPane(cont, 0));
246:            }
247:
248:            /**
249:             * Searches JSplitPane object which component lies on.
250:             * @param comp Component to find JSplitPane under.
251:             * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
252:             * @return JSplitPane instance or null if component was not found.
253:             */
254:            public static JSplitPane findJSplitPaneUnder(Component comp,
255:                    ComponentChooser chooser) {
256:                return ((JSplitPane) findContainerUnder(comp,
257:                        new JSplitPaneFinder(chooser)));
258:            }
259:
260:            /**
261:             * Searches JSplitPane object which component lies on.
262:             * @param comp Component to find JSplitPane under.
263:             * @return JSplitPane instance or null if component was not found.
264:             */
265:            public static JSplitPane findJSplitPaneUnder(Component comp) {
266:                return (findJSplitPaneUnder(comp, new JSplitPaneFinder()));
267:            }
268:
269:            /**
270:             * Waits JSplitPane in container.
271:             * @param cont Container to search component in.
272:             * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
273:             * @param index Ordinal component index.
274:             * @return JSplitPane instance or null if component was not displayed.
275:             * @throws TimeoutExpiredException
276:             */
277:            public static JSplitPane waitJSplitPane(Container cont,
278:                    ComponentChooser chooser, int index) {
279:                return ((JSplitPane) waitComponent(cont, new JSplitPaneFinder(
280:                        chooser), index));
281:            }
282:
283:            /**
284:             * Waits 0'th JSplitPane in container.
285:             * @param cont Container to search component in.
286:             * @param chooser org.netbeans.jemmy.ComponentChooser implementation.
287:             * @return JSplitPane instance or null if component was not displayed.
288:             * @throws TimeoutExpiredException
289:             */
290:            public static JSplitPane waitJSplitPane(Container cont,
291:                    ComponentChooser chooser) {
292:                return (waitJSplitPane(cont, chooser, 0));
293:            }
294:
295:            /**
296:             * Waits JSplitPane in container.
297:             * @param cont Container to search component in.
298:             * @param index Ordinal component index.
299:             * @return JSplitPane instance or null if component was not displayed.
300:             * @throws TimeoutExpiredException
301:             */
302:            public static JSplitPane waitJSplitPane(Container cont, int index) {
303:                return (waitJSplitPane(cont, ComponentSearcher
304:                        .getTrueChooser(Integer.toString(index)
305:                                + "'th JSplitPane instance"), index));
306:            }
307:
308:            /**
309:             * Waits 0'th JSplitPane in container.
310:             * @param cont Container to search component in.
311:             * @return JSplitPane instance or null if component was not displayed.
312:             * @throws TimeoutExpiredException
313:             */
314:            public static JSplitPane waitJSplitPane(Container cont) {
315:                return (waitJSplitPane(cont, 0));
316:            }
317:
318:            static {
319:                Timeouts.initDefault("JSplitPaneOperator.ScrollClickTimeout",
320:                        SCROLL_CLICK_TIMEOUT);
321:                Timeouts.initDefault("JSplitPaneOperator.BetweenClickTimeout",
322:                        BETWEEN_CLICK_TIMEOUT);
323:                Timeouts.initDefault("JSplitPaneOperator.WholeScrollTimeout",
324:                        WHOLE_SCROLL_TIMEOUT);
325:            }
326:
327:            public void setTimeouts(Timeouts timeouts) {
328:                this .timeouts = timeouts;
329:                Timeouts times = timeouts;
330:                times.setTimeout("ComponentOperator.BeforeDragTimeout", 0);
331:                times.setTimeout("ComponentOperator.AfterDragTimeout", times
332:                        .getTimeout("JSplitPaneOperator.ScrollClickTimeout"));
333:                super .setTimeouts(times);
334:            }
335:
336:            public Timeouts getTimeouts() {
337:                return (timeouts);
338:            }
339:
340:            public void setOutput(TestOut out) {
341:                output = out;
342:                super .setOutput(output.createErrorOutput());
343:            }
344:
345:            public TestOut getOutput() {
346:                return (output);
347:            }
348:
349:            public void copyEnvironment(Operator anotherOperator) {
350:                super .copyEnvironment(anotherOperator);
351:                driver = (ScrollDriver) DriverManager.getDriver(
352:                        DriverManager.SCROLL_DRIVER_ID, getClass(),
353:                        anotherOperator.getProperties());
354:            }
355:
356:            /**
357:             * Searches divider inside split pane.
358:             * @return an operator for the divider.
359:             */
360:            public BasicSplitPaneDivider findDivider() {
361:                return ((BasicSplitPaneDivider) waitSubComponent(new ComponentChooser() {
362:                    public boolean checkComponent(Component comp) {
363:                        return (comp instanceof  BasicSplitPaneDivider);
364:                    }
365:
366:                    public String getDescription() {
367:                        return ("");
368:                    }
369:                }));
370:            }
371:
372:            /**
373:             * Searches divider inside split pane.
374:             * @return an operator for the divider.
375:             */
376:            public ContainerOperator getDivider() {
377:                if (divider == null) {
378:                    divider = new ContainerOperator(findDivider());
379:                    divider.copyEnvironment(this );
380:                    divider.setOutput(getOutput().createErrorOutput());
381:                }
382:                return (divider);
383:            }
384:
385:            /**
386:             * Scrolls to the position defined by a ScrollAdjuster implementation.
387:             * @param adj defines scrolling direction, and so on.
388:             * @throws TimeoutExpiredException
389:             */
390:            public void scrollTo(final ScrollAdjuster adj) {
391:                produceTimeRestricted(new Action() {
392:                    public Object launch(Object obj) {
393:                        driver.scroll(JSplitPaneOperator.this , adj);
394:                        return (null);
395:                    }
396:
397:                    public String getDescription() {
398:                        return ("Moving a divider");
399:                    }
400:                }, getTimeouts().getTimeout(
401:                        "JSplitPaneOperator.WholeScrollTimeout"));
402:            }
403:
404:            /**
405:             * Changes divider location.
406:             * @param dividerLocation location to move divider to.
407:             */
408:            public void moveDivider(int dividerLocation) {
409:                output.printTrace("Move JSplitPane divider to "
410:                        + Integer.toString(dividerLocation)
411:                        + " location. JSplitPane :    \n" + toStringSource());
412:                output.printGolden("Move JSplitPane divider to "
413:                        + Integer.toString(dividerLocation) + " location");
414:                scrollTo(new ValueScrollAdjuster(dividerLocation));
415:            }
416:
417:            /**
418:             * Changes divider location.
419:             * @param proportionalLocation Proportional location. 
420:             * Should be great then 0 and less then 1.
421:             */
422:            public void moveDivider(double proportionalLocation) {
423:                output.printTrace("Move JSplitPane divider to "
424:                        + Double.toString(proportionalLocation)
425:                        + " proportional location. JSplitPane :    \n"
426:                        + toStringSource());
427:                output.printGolden("Move JSplitPane divider to "
428:                        + Double.toString(proportionalLocation)
429:                        + " proportional location");
430:                scrollTo(new ValueScrollAdjuster(
431:                        getMinimumDividerLocation()
432:                                + (int) (proportionalLocation * (getMaximumDividerLocation() - getMinimumDividerLocation()))));
433:            }
434:
435:            /**
436:             * Moves the divider all the way to the left/top.
437:             */
438:            public void moveToMinimum() {
439:                output
440:                        .printTrace("Scroll JSplitPane to minimum. JSplitPane :    \n"
441:                                + toStringSource());
442:                output.printGolden("Scroll JSplitPane to minimum.");
443:                produceTimeRestricted(new Action() {
444:                    public Object launch(Object obj) {
445:                        driver.scrollToMinimum(JSplitPaneOperator.this ,
446:                                getOrientation());
447:                        return (null);
448:                    }
449:
450:                    public String getDescription() {
451:                        return ("Scrolling");
452:                    }
453:                }, getTimeouts().getTimeout(
454:                        "JSplitPaneOperator.WholeScrollTimeout"));
455:            }
456:
457:            /**
458:             * Moves the divider all the way to the right/bottom.
459:             */
460:            public void moveToMaximum() {
461:                output
462:                        .printTrace("Scroll JSplitPane to maximum. JSplitPane :    \n"
463:                                + toStringSource());
464:                output.printGolden("Scroll JSplitPane to maximum.");
465:                produceTimeRestricted(new Action() {
466:                    public Object launch(Object obj) {
467:                        driver.scrollToMaximum(JSplitPaneOperator.this ,
468:                                getOrientation());
469:                        return (null);
470:                    }
471:
472:                    public String getDescription() {
473:                        return ("Scrolling");
474:                    }
475:                }, getTimeouts().getTimeout(
476:                        "JSplitPaneOperator.WholeScrollTimeout"));
477:            }
478:
479:            /**
480:             * Pushes one time right(bottom) expand button.
481:             * @throws TimeoutExpiredException
482:             */
483:            public void expandRight() {
484:                String mess = "Expand ";
485:                if (getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
486:                    mess = mess + "right";
487:                } else {
488:                    mess = mess + "bottom";
489:                }
490:                output.printTrace(mess + " JSplitPane side. JSplitPane :    \n"
491:                        + toStringSource());
492:                output.printGolden(mess + " JSplitPane side.");
493:                expandTo(0);
494:            }
495:
496:            /**
497:             * Pushes one time left(top) expand button.
498:             * @throws TimeoutExpiredException
499:             */
500:            public void expandLeft() {
501:                String mess = "Expand ";
502:                if (getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
503:                    mess = mess + "left";
504:                } else {
505:                    mess = mess + "top";
506:                }
507:                output.printTrace(mess + " JSplitPane side. JSplitPane :    \n"
508:                        + toStringSource());
509:                output.printGolden(mess + " JSplitPane side.");
510:                expandTo(1);
511:            }
512:
513:            public Hashtable getDump() {
514:                Hashtable result = super .getDump();
515:                result.put(MINIMUM_DPROP, Integer
516:                        .toString(((JSplitPane) getSource())
517:                                .getMinimumDividerLocation()));
518:                result.put(MAXIMUM_DPROP, Integer
519:                        .toString(((JSplitPane) getSource())
520:                                .getMaximumDividerLocation()));
521:                result
522:                        .put(
523:                                ORIENTATION_DPROP,
524:                                (((JSplitPane) getSource()).getOrientation() == JSplitPane.HORIZONTAL_SPLIT) ? HORIZONTAL_ORIENTATION_DPROP_VALUE
525:                                        : VERTICAL_ORIENTATION_DPROP_VALUE);
526:                result.put(VALUE_DPROP, Integer
527:                        .toString(((JSplitPane) getSource())
528:                                .getDividerLocation()));
529:                result
530:                        .put(IS_ONE_TOUCH_EXPANDABLE_DPROP,
531:                                ((JSplitPane) getSource())
532:                                        .isOneTouchExpandable() ? "true"
533:                                        : "false");
534:                return (result);
535:            }
536:
537:            ////////////////////////////////////////////////////////
538:            //Mapping                                             //
539:
540:            /**Maps <code>JSplitPane.getBottomComponent()</code> through queue*/
541:            public Component getBottomComponent() {
542:                return ((Component) runMapping(new MapAction(
543:                        "getBottomComponent") {
544:                    public Object map() {
545:                        return (((JSplitPane) getSource()).getBottomComponent());
546:                    }
547:                }));
548:            }
549:
550:            /**Maps <code>JSplitPane.getDividerLocation()</code> through queue*/
551:            public int getDividerLocation() {
552:                return (runMapping(new MapIntegerAction("getDividerLocation") {
553:                    public int map() {
554:                        return (((JSplitPane) getSource()).getDividerLocation());
555:                    }
556:                }));
557:            }
558:
559:            /**Maps <code>JSplitPane.getDividerSize()</code> through queue*/
560:            public int getDividerSize() {
561:                return (runMapping(new MapIntegerAction("getDividerSize") {
562:                    public int map() {
563:                        return (((JSplitPane) getSource()).getDividerSize());
564:                    }
565:                }));
566:            }
567:
568:            /**Maps <code>JSplitPane.getLastDividerLocation()</code> through queue*/
569:            public int getLastDividerLocation() {
570:                return (runMapping(new MapIntegerAction(
571:                        "getLastDividerLocation") {
572:                    public int map() {
573:                        return (((JSplitPane) getSource())
574:                                .getLastDividerLocation());
575:                    }
576:                }));
577:            }
578:
579:            /**Maps <code>JSplitPane.getLeftComponent()</code> through queue*/
580:            public Component getLeftComponent() {
581:                return ((Component) runMapping(new MapAction("getLeftComponent") {
582:                    public Object map() {
583:                        return (((JSplitPane) getSource()).getLeftComponent());
584:                    }
585:                }));
586:            }
587:
588:            /**Maps <code>JSplitPane.getMaximumDividerLocation()</code> through queue*/
589:            public int getMaximumDividerLocation() {
590:                return (runMapping(new MapIntegerAction(
591:                        "getMaximumDividerLocation") {
592:                    public int map() {
593:                        return (((JSplitPane) getSource())
594:                                .getMaximumDividerLocation());
595:                    }
596:                }));
597:            }
598:
599:            /**Maps <code>JSplitPane.getMinimumDividerLocation()</code> through queue*/
600:            public int getMinimumDividerLocation() {
601:                return (runMapping(new MapIntegerAction(
602:                        "getMinimumDividerLocation") {
603:                    public int map() {
604:                        return (((JSplitPane) getSource())
605:                                .getMinimumDividerLocation());
606:                    }
607:                }));
608:            }
609:
610:            /**Maps <code>JSplitPane.getOrientation()</code> through queue*/
611:            public int getOrientation() {
612:                return (runMapping(new MapIntegerAction("getOrientation") {
613:                    public int map() {
614:                        return (((JSplitPane) getSource()).getOrientation());
615:                    }
616:                }));
617:            }
618:
619:            /**Maps <code>JSplitPane.getRightComponent()</code> through queue*/
620:            public Component getRightComponent() {
621:                return ((Component) runMapping(new MapAction(
622:                        "getRightComponent") {
623:                    public Object map() {
624:                        return (((JSplitPane) getSource()).getRightComponent());
625:                    }
626:                }));
627:            }
628:
629:            /**Maps <code>JSplitPane.getTopComponent()</code> through queue*/
630:            public Component getTopComponent() {
631:                return ((Component) runMapping(new MapAction("getTopComponent") {
632:                    public Object map() {
633:                        return (((JSplitPane) getSource()).getTopComponent());
634:                    }
635:                }));
636:            }
637:
638:            /**Maps <code>JSplitPane.getUI()</code> through queue*/
639:            public SplitPaneUI getUI() {
640:                return ((SplitPaneUI) runMapping(new MapAction("getUI") {
641:                    public Object map() {
642:                        return (((JSplitPane) getSource()).getUI());
643:                    }
644:                }));
645:            }
646:
647:            /**Maps <code>JSplitPane.isContinuousLayout()</code> through queue*/
648:            public boolean isContinuousLayout() {
649:                return (runMapping(new MapBooleanAction("isContinuousLayout") {
650:                    public boolean map() {
651:                        return (((JSplitPane) getSource()).isContinuousLayout());
652:                    }
653:                }));
654:            }
655:
656:            /**Maps <code>JSplitPane.isOneTouchExpandable()</code> through queue*/
657:            public boolean isOneTouchExpandable() {
658:                return (runMapping(new MapBooleanAction("isOneTouchExpandable") {
659:                    public boolean map() {
660:                        return (((JSplitPane) getSource())
661:                                .isOneTouchExpandable());
662:                    }
663:                }));
664:            }
665:
666:            /**Maps <code>JSplitPane.resetToPreferredSizes()</code> through queue*/
667:            public void resetToPreferredSizes() {
668:                runMapping(new MapVoidAction("resetToPreferredSizes") {
669:                    public void map() {
670:                        ((JSplitPane) getSource()).resetToPreferredSizes();
671:                    }
672:                });
673:            }
674:
675:            /**Maps <code>JSplitPane.setBottomComponent(Component)</code> through queue*/
676:            public void setBottomComponent(final Component component) {
677:                runMapping(new MapVoidAction("setBottomComponent") {
678:                    public void map() {
679:                        ((JSplitPane) getSource())
680:                                .setBottomComponent(component);
681:                    }
682:                });
683:            }
684:
685:            /**Maps <code>JSplitPane.setContinuousLayout(boolean)</code> through queue*/
686:            public void setContinuousLayout(final boolean b) {
687:                runMapping(new MapVoidAction("setContinuousLayout") {
688:                    public void map() {
689:                        ((JSplitPane) getSource()).setContinuousLayout(b);
690:                    }
691:                });
692:            }
693:
694:            /**Maps <code>JSplitPane.setDividerLocation(double)</code> through queue*/
695:            public void setDividerLocation(final double d) {
696:                runMapping(new MapVoidAction("setDividerLocation") {
697:                    public void map() {
698:                        ((JSplitPane) getSource()).setDividerLocation(d);
699:                    }
700:                });
701:            }
702:
703:            /**Maps <code>JSplitPane.setDividerLocation(int)</code> through queue*/
704:            public void setDividerLocation(final int i) {
705:                runMapping(new MapVoidAction("setDividerLocation") {
706:                    public void map() {
707:                        ((JSplitPane) getSource()).setDividerLocation(i);
708:                    }
709:                });
710:            }
711:
712:            /**Maps <code>JSplitPane.setDividerSize(int)</code> through queue*/
713:            public void setDividerSize(final int i) {
714:                runMapping(new MapVoidAction("setDividerSize") {
715:                    public void map() {
716:                        ((JSplitPane) getSource()).setDividerSize(i);
717:                    }
718:                });
719:            }
720:
721:            /**Maps <code>JSplitPane.setLastDividerLocation(int)</code> through queue*/
722:            public void setLastDividerLocation(final int i) {
723:                runMapping(new MapVoidAction("setLastDividerLocation") {
724:                    public void map() {
725:                        ((JSplitPane) getSource()).setLastDividerLocation(i);
726:                    }
727:                });
728:            }
729:
730:            /**Maps <code>JSplitPane.setLeftComponent(Component)</code> through queue*/
731:            public void setLeftComponent(final Component component) {
732:                runMapping(new MapVoidAction("setLeftComponent") {
733:                    public void map() {
734:                        ((JSplitPane) getSource()).setLeftComponent(component);
735:                    }
736:                });
737:            }
738:
739:            /**Maps <code>JSplitPane.setOneTouchExpandable(boolean)</code> through queue*/
740:            public void setOneTouchExpandable(final boolean b) {
741:                runMapping(new MapVoidAction("setOneTouchExpandable") {
742:                    public void map() {
743:                        ((JSplitPane) getSource()).setOneTouchExpandable(b);
744:                    }
745:                });
746:            }
747:
748:            /**Maps <code>JSplitPane.setOrientation(int)</code> through queue*/
749:            public void setOrientation(final int i) {
750:                runMapping(new MapVoidAction("setOrientation") {
751:                    public void map() {
752:                        ((JSplitPane) getSource()).setOrientation(i);
753:                    }
754:                });
755:            }
756:
757:            /**Maps <code>JSplitPane.setRightComponent(Component)</code> through queue*/
758:            public void setRightComponent(final Component component) {
759:                runMapping(new MapVoidAction("setRightComponent") {
760:                    public void map() {
761:                        ((JSplitPane) getSource()).setRightComponent(component);
762:                    }
763:                });
764:            }
765:
766:            /**Maps <code>JSplitPane.setTopComponent(Component)</code> through queue*/
767:            public void setTopComponent(final Component component) {
768:                runMapping(new MapVoidAction("setTopComponent") {
769:                    public void map() {
770:                        ((JSplitPane) getSource()).setTopComponent(component);
771:                    }
772:                });
773:            }
774:
775:            /**Maps <code>JSplitPane.setUI(SplitPaneUI)</code> through queue*/
776:            public void setUI(final SplitPaneUI splitPaneUI) {
777:                runMapping(new MapVoidAction("setUI") {
778:                    public void map() {
779:                        ((JSplitPane) getSource()).setUI(splitPaneUI);
780:                    }
781:                });
782:            }
783:
784:            //End of mapping                                      //
785:            ////////////////////////////////////////////////////////
786:
787:            private void expandTo(int index) {
788:                makeComponentVisible();
789:                JButtonOperator bo = new JButtonOperator((JButton) getDivider()
790:                        .waitSubComponent(
791:                                new JButtonOperator.JButtonFinder(
792:                                        ComponentSearcher
793:                                                .getTrueChooser("JButton")),
794:                                index));
795:                bo.copyEnvironment(getDivider());
796:                bo.setVisualizer(new EmptyVisualizer());
797:                bo.push();
798:            }
799:
800:            /**
801:             * Checks component type.
802:             */
803:            public static class JSplitPaneFinder extends Finder {
804:                /**
805:                 * Constructs JSplitPaneFinder.
806:                 * @param sf other searching criteria.
807:                 */
808:                public JSplitPaneFinder(ComponentChooser sf) {
809:                    super (JSplitPane.class, sf);
810:                }
811:
812:                /**
813:                 * Constructs JSplitPaneFinder.
814:                 */
815:                public JSplitPaneFinder() {
816:                    super (JSplitPane.class);
817:                }
818:            }
819:
820:            private class ValueScrollAdjuster implements  ScrollAdjuster {
821:                int value;
822:
823:                public ValueScrollAdjuster(int value) {
824:                    this .value = value;
825:                }
826:
827:                public int getScrollDirection() {
828:                    if (getDividerLocation() == value) {
829:                        return (ScrollAdjuster.DO_NOT_TOUCH_SCROLL_DIRECTION);
830:                    } else {
831:                        return ((getDividerLocation() < value) ? ScrollAdjuster.INCREASE_SCROLL_DIRECTION
832:                                : ScrollAdjuster.DECREASE_SCROLL_DIRECTION);
833:                    }
834:                }
835:
836:                public int getScrollOrientation() {
837:                    return (getOrientation());
838:                }
839:
840:                public String getDescription() {
841:                    return ("Scroll to " + Integer.toString(value) + " value");
842:                }
843:            }
844:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.