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