Source Code Cross Referenced for Slider.java in  » Ajax » dwr » jsx3 » gui » 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 » Ajax » dwr » jsx3.gui 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2005 Joe Walker
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *     http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:        package jsx3.gui;
017:
018:        import org.directwebremoting.ScriptBuffer;
019:        import org.directwebremoting.proxy.ScriptProxy;
020:        import org.directwebremoting.proxy.io.Context;
021:
022:        /**
023:         * A GUI control that implements a draggable slider. The slider is draggable along a fixed-length line representing a linear
024:         range of values. Events are provided for incremental drag events as well as the end drag (change) event.
025:
026:         The range of values of a slider is always [0,100]. 0 is at the far left side of a horizontal slider and bottom
027:         edge of a vertical slider. The value is available as a floating point number with the getValue()
028:         method as well as the event handlers.
029:         * @author Joe Walker [joe at getahead dot org]
030:         * @author DRAPGEN - Dwr Reverse Ajax Proxy GENerator
031:         */
032:        public class Slider extends jsx3.gui.Block {
033:            /**
034:             * All reverse ajax proxies need context to work from
035:             * @param scriptProxy The place we are writing scripts to
036:             * @param context The script that got us to where we are now
037:             */
038:            public Slider(Context context, String extension,
039:                    ScriptProxy scriptProxy) {
040:                super (context, extension, scriptProxy);
041:            }
042:
043:            /**
044:             * The instance initializer.
045:             * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
046:             * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
047:             * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
048:             * @param vntLength the length of the control along the draggable axis
049:             */
050:            public Slider(String strName, int vntLeft, int vntTop,
051:                    String vntLength) {
052:                super ((Context) null, (String) null, (ScriptProxy) null);
053:                ScriptBuffer script = new ScriptBuffer();
054:                script.appendCall("new Slider", strName, vntLeft, vntTop,
055:                        vntLength);
056:                setInitScript(script);
057:            }
058:
059:            /**
060:             * The instance initializer.
061:             * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
062:             * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
063:             * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
064:             * @param vntLength the length of the control along the draggable axis
065:             */
066:            public Slider(String strName, int vntLeft, String vntTop,
067:                    String vntLength) {
068:                super ((Context) null, (String) null, (ScriptProxy) null);
069:                ScriptBuffer script = new ScriptBuffer();
070:                script.appendCall("new Slider", strName, vntLeft, vntTop,
071:                        vntLength);
072:                setInitScript(script);
073:            }
074:
075:            /**
076:             * The instance initializer.
077:             * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
078:             * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
079:             * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
080:             * @param vntLength the length of the control along the draggable axis
081:             */
082:            public Slider(String strName, String vntLeft, String vntTop,
083:                    int vntLength) {
084:                super ((Context) null, (String) null, (ScriptProxy) null);
085:                ScriptBuffer script = new ScriptBuffer();
086:                script.appendCall("new Slider", strName, vntLeft, vntTop,
087:                        vntLength);
088:                setInitScript(script);
089:            }
090:
091:            /**
092:             * The instance initializer.
093:             * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
094:             * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
095:             * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
096:             * @param vntLength the length of the control along the draggable axis
097:             */
098:            public Slider(String strName, int vntLeft, String vntTop,
099:                    int vntLength) {
100:                super ((Context) null, (String) null, (ScriptProxy) null);
101:                ScriptBuffer script = new ScriptBuffer();
102:                script.appendCall("new Slider", strName, vntLeft, vntTop,
103:                        vntLength);
104:                setInitScript(script);
105:            }
106:
107:            /**
108:             * The instance initializer.
109:             * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
110:             * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
111:             * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
112:             * @param vntLength the length of the control along the draggable axis
113:             */
114:            public Slider(String strName, String vntLeft, String vntTop,
115:                    String vntLength) {
116:                super ((Context) null, (String) null, (ScriptProxy) null);
117:                ScriptBuffer script = new ScriptBuffer();
118:                script.appendCall("new Slider", strName, vntLeft, vntTop,
119:                        vntLength);
120:                setInitScript(script);
121:            }
122:
123:            /**
124:             * The instance initializer.
125:             * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
126:             * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
127:             * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
128:             * @param vntLength the length of the control along the draggable axis
129:             */
130:            public Slider(String strName, String vntLeft, int vntTop,
131:                    String vntLength) {
132:                super ((Context) null, (String) null, (ScriptProxy) null);
133:                ScriptBuffer script = new ScriptBuffer();
134:                script.appendCall("new Slider", strName, vntLeft, vntTop,
135:                        vntLength);
136:                setInitScript(script);
137:            }
138:
139:            /**
140:             * The instance initializer.
141:             * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
142:             * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
143:             * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
144:             * @param vntLength the length of the control along the draggable axis
145:             */
146:            public Slider(String strName, String vntLeft, int vntTop,
147:                    int vntLength) {
148:                super ((Context) null, (String) null, (ScriptProxy) null);
149:                ScriptBuffer script = new ScriptBuffer();
150:                script.appendCall("new Slider", strName, vntLeft, vntTop,
151:                        vntLength);
152:                setInitScript(script);
153:            }
154:
155:            /**
156:             * The instance initializer.
157:             * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
158:             * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
159:             * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
160:             * @param vntLength the length of the control along the draggable axis
161:             */
162:            public Slider(String strName, int vntLeft, int vntTop, int vntLength) {
163:                super ((Context) null, (String) null, (ScriptProxy) null);
164:                ScriptBuffer script = new ScriptBuffer();
165:                script.appendCall("new Slider", strName, vntLeft, vntTop,
166:                        vntLength);
167:                setInitScript(script);
168:            }
169:
170:            /**
171:             * Orientation value for a horizontal slider.
172:             */
173:            public static final int HORIZONTAL = 0;
174:
175:            /**
176:             * Orientation value for a vertical slider.
177:             */
178:            public static final int VERTICAL = 1;
179:
180:            /**
181:             * Returns the value of this slider.
182:             * @param callback between 0 and 100.
183:             */
184:            @SuppressWarnings("unchecked")
185:            public void getValue(
186:                    org.directwebremoting.proxy.Callback<Integer> callback) {
187:                ScriptBuffer script = new ScriptBuffer();
188:                String callbackPrefix = "";
189:
190:                if (callback != null) {
191:                    callbackPrefix = "var reply = ";
192:                }
193:
194:                script.appendCall(callbackPrefix + getContextPath()
195:                        + "getValue");
196:
197:                if (callback != null) {
198:                    String key = org.directwebremoting.extend.CallbackHelper
199:                            .saveCallback(callback, Integer.class);
200:                    script
201:                            .appendCall("__System.activateCallback", key,
202:                                    "reply");
203:                }
204:
205:                getScriptProxy().addScript(script);
206:            }
207:
208:            /**
209:             * Sets the value of this slider and repositions the handle.
210:             * @param fpValue the new value, between 0 and 100.
211:             * @return this object.
212:             */
213:            public jsx3.gui.Slider setValue(Integer fpValue) {
214:                ScriptBuffer script = new ScriptBuffer();
215:                script.appendCall(getContextPath() + "setValue", fpValue);
216:                getScriptProxy().addScript(script);
217:                return this ;
218:            }
219:
220:            /**
221:             * Sets the validation state for this slider and returns the validation state.
222:             * @param callback <code>jsx3.gui.Form.STATEVALID</code>.
223:             */
224:            @SuppressWarnings("unchecked")
225:            public void doValidate(
226:                    org.directwebremoting.proxy.Callback<Integer> callback) {
227:                ScriptBuffer script = new ScriptBuffer();
228:                String callbackPrefix = "";
229:
230:                if (callback != null) {
231:                    callbackPrefix = "var reply = ";
232:                }
233:
234:                script.appendCall(callbackPrefix + getContextPath()
235:                        + "doValidate");
236:
237:                if (callback != null) {
238:                    String key = org.directwebremoting.extend.CallbackHelper
239:                            .saveCallback(callback, Integer.class);
240:                    script
241:                            .appendCall("__System.activateCallback", key,
242:                                    "reply");
243:                }
244:
245:                getScriptProxy().addScript(script);
246:            }
247:
248:            /**
249:             * Returns the value of the length field, the size of the dimension along this slider axis.
250:             * @param callback the length field
251:             */
252:            @SuppressWarnings("unchecked")
253:            public void getLength(
254:                    org.directwebremoting.proxy.Callback<Integer> callback) {
255:                ScriptBuffer script = new ScriptBuffer();
256:                String callbackPrefix = "";
257:
258:                if (callback != null) {
259:                    callbackPrefix = "var reply = ";
260:                }
261:
262:                script.appendCall(callbackPrefix + getContextPath()
263:                        + "getLength");
264:
265:                if (callback != null) {
266:                    String key = org.directwebremoting.extend.CallbackHelper
267:                            .saveCallback(callback, Integer.class);
268:                    script
269:                            .appendCall("__System.activateCallback", key,
270:                                    "reply");
271:                }
272:
273:                getScriptProxy().addScript(script);
274:            }
275:
276:            /**
277:             * Sets the length of this slider.
278:             * @param vntLength e.g. 100[px] or "100%".
279:             * @param bRepaint whether to repaint this slider immediately to reflect the change.
280:             * @return this object.
281:             */
282:            public jsx3.gui.Slider setLength(int vntLength, boolean bRepaint) {
283:                ScriptBuffer script = new ScriptBuffer();
284:                script.appendCall(getContextPath() + "setLength", vntLength,
285:                        bRepaint);
286:                getScriptProxy().addScript(script);
287:                return this ;
288:            }
289:
290:            /**
291:             * Sets the length of this slider.
292:             * @param vntLength e.g. 100[px] or "100%".
293:             * @param bRepaint whether to repaint this slider immediately to reflect the change.
294:             * @return this object.
295:             */
296:            public jsx3.gui.Slider setLength(String vntLength, boolean bRepaint) {
297:                ScriptBuffer script = new ScriptBuffer();
298:                script.appendCall(getContextPath() + "setLength", vntLength,
299:                        bRepaint);
300:                getScriptProxy().addScript(script);
301:                return this ;
302:            }
303:
304:            /**
305:             * Returns the orientation of this slider.
306:             * @param callback <code>HORIZONTAL</code> or <code>VERTICAL</code>.
307:             */
308:            @SuppressWarnings("unchecked")
309:            public void getOrientation(
310:                    org.directwebremoting.proxy.Callback<Integer> callback) {
311:                ScriptBuffer script = new ScriptBuffer();
312:                String callbackPrefix = "";
313:
314:                if (callback != null) {
315:                    callbackPrefix = "var reply = ";
316:                }
317:
318:                script.appendCall(callbackPrefix + getContextPath()
319:                        + "getOrientation");
320:
321:                if (callback != null) {
322:                    String key = org.directwebremoting.extend.CallbackHelper
323:                            .saveCallback(callback, Integer.class);
324:                    script
325:                            .appendCall("__System.activateCallback", key,
326:                                    "reply");
327:                }
328:
329:                getScriptProxy().addScript(script);
330:            }
331:
332:            /**
333:             * Sets the orientation of this slider.
334:             * @param intValue <code>HORIZONTAL</code> or <code>VERTICAL</code>.
335:             * @return this object.
336:             */
337:            public jsx3.gui.Slider setOrientation(int intValue) {
338:                ScriptBuffer script = new ScriptBuffer();
339:                script
340:                        .appendCall(getContextPath() + "setOrientation",
341:                                intValue);
342:                getScriptProxy().addScript(script);
343:                return this ;
344:            }
345:
346:            /**
347:             * Returns whether the track is painted.
348:             * @param callback <code>jsx3.Boolean.TRUE</code> or <code>jsx3.Boolean.FALSE</code>
349:             */
350:            @SuppressWarnings("unchecked")
351:            public void getPaintTrack(
352:                    org.directwebremoting.proxy.Callback<Integer> callback) {
353:                ScriptBuffer script = new ScriptBuffer();
354:                String callbackPrefix = "";
355:
356:                if (callback != null) {
357:                    callbackPrefix = "var reply = ";
358:                }
359:
360:                script.appendCall(callbackPrefix + getContextPath()
361:                        + "getPaintTrack");
362:
363:                if (callback != null) {
364:                    String key = org.directwebremoting.extend.CallbackHelper
365:                            .saveCallback(callback, Integer.class);
366:                    script
367:                            .appendCall("__System.activateCallback", key,
368:                                    "reply");
369:                }
370:
371:                getScriptProxy().addScript(script);
372:            }
373:
374:            /**
375:             * Sets whether the track is painted.
376:             * @param bValue <code>jsx3.Boolean.TRUE</code> or <code>jsx3.Boolean.FALSE</code>.
377:             * @return this object.
378:             */
379:            public jsx3.gui.Slider setPaintTrack(int bValue) {
380:                ScriptBuffer script = new ScriptBuffer();
381:                script.appendCall(getContextPath() + "setPaintTrack", bValue);
382:                getScriptProxy().addScript(script);
383:                return this ;
384:            }
385:
386:            /**
387:             * Returns whether clicking the track moves the handle to that point.
388:             * @param callback <code>jsx3.Boolean.TRUE</code> or <code>jsx3.Boolean.FALSE</code>.
389:             */
390:            @SuppressWarnings("unchecked")
391:            public void getTrackClickable(
392:                    org.directwebremoting.proxy.Callback<Integer> callback) {
393:                ScriptBuffer script = new ScriptBuffer();
394:                String callbackPrefix = "";
395:
396:                if (callback != null) {
397:                    callbackPrefix = "var reply = ";
398:                }
399:
400:                script.appendCall(callbackPrefix + getContextPath()
401:                        + "getTrackClickable");
402:
403:                if (callback != null) {
404:                    String key = org.directwebremoting.extend.CallbackHelper
405:                            .saveCallback(callback, Integer.class);
406:                    script
407:                            .appendCall("__System.activateCallback", key,
408:                                    "reply");
409:                }
410:
411:                getScriptProxy().addScript(script);
412:            }
413:
414:            /**
415:             * Sets whether clicking the track moves the handle to that point.
416:             * @param bValue <code>jsx3.Boolean.TRUE</code> or <code>jsx3.Boolean.FALSE</code>.
417:             * @return this object.
418:             */
419:            public jsx3.gui.Slider setTrackClickable(int bValue) {
420:                ScriptBuffer script = new ScriptBuffer();
421:                script.appendCall(getContextPath() + "setTrackClickable",
422:                        bValue);
423:                getScriptProxy().addScript(script);
424:                return this ;
425:            }
426:
427:            /**
428:             * Returns the URL of the image to use for the handle.
429:             */
430:            @SuppressWarnings("unchecked")
431:            public void getHandleImage(
432:                    org.directwebremoting.proxy.Callback<String> callback) {
433:                ScriptBuffer script = new ScriptBuffer();
434:                String callbackPrefix = "";
435:
436:                if (callback != null) {
437:                    callbackPrefix = "var reply = ";
438:                }
439:
440:                script.appendCall(callbackPrefix + getContextPath()
441:                        + "getHandleImage");
442:
443:                if (callback != null) {
444:                    String key = org.directwebremoting.extend.CallbackHelper
445:                            .saveCallback(callback, String.class);
446:                    script
447:                            .appendCall("__System.activateCallback", key,
448:                                    "reply");
449:                }
450:
451:                getScriptProxy().addScript(script);
452:            }
453:
454:            /**
455:             * Sets the URL of the image to use for the handle. If no URL is set, a default image is used.
456:             * @param strUrl 
457:             * @return this object.
458:             */
459:            public jsx3.gui.Slider setHandleImage(String strUrl) {
460:                ScriptBuffer script = new ScriptBuffer();
461:                script.appendCall(getContextPath() + "setHandleImage", strUrl);
462:                getScriptProxy().addScript(script);
463:                return this ;
464:            }
465:
466:            /**
467:             * Constrains a possible slider value to a legal value. This implementation ensures that the resulting value is
468:            within the legal range of [0,100].Override this method on an instance of jsx3.gui.Slider to
469:            create a "notched" slider. The following code creates a slider that allows its handle to be in a location
470:            corresponding to a value that is a multiple of 10:
471:
472:            objSlider.constrainValue = function(fpValue) {
473:            return Math.max(0, Math.min(100, jsx3.util.numRound(fpValue, 10)));
474:            }
475:             * @param fpValue the value to validate, usually corresponds to a value along that slider that the handle is being dragged.
476:             * @param callback the validated value, usually the nearest value to <code>fpValue</code> that is legal for this slider.
477:             */
478:            @SuppressWarnings("unchecked")
479:            public void constrainValue(Integer fpValue,
480:                    org.directwebremoting.proxy.Callback<Integer> callback) {
481:                ScriptBuffer script = new ScriptBuffer();
482:                String callbackPrefix = "";
483:
484:                if (callback != null) {
485:                    callbackPrefix = "var reply = ";
486:                }
487:
488:                script.appendCall(callbackPrefix + getContextPath()
489:                        + "constrainValue", fpValue);
490:
491:                if (callback != null) {
492:                    String key = org.directwebremoting.extend.CallbackHelper
493:                            .saveCallback(callback, Integer.class);
494:                    script
495:                            .appendCall("__System.activateCallback", key,
496:                                    "reply");
497:                }
498:
499:                getScriptProxy().addScript(script);
500:            }
501:
502:            /**
503:             * Binds the given key sequence to a callback function. Any object that has a key binding (specified with
504:            setKeyBinding()) will call this method when painted to register the key sequence with an appropriate
505:            ancestor of this form control. Any key down event that bubbles up to the ancestor without being intercepted
506:            and matches the given key sequence will invoke the given callback function.
507:
508:            As of 3.2: The hot key will be registered with the first ancestor found that is either a
509:            jsx3.gui.Window, a jsx3.gui.Dialog, or the root block of a jsx3.app.Server.
510:             * @param fctCallback JavaScript function to execute when the given sequence is keyed by the user.
511:             * @param strKeys a plus-delimited ('+') key sequence such as <code>ctrl+s</code> or
512:            <code>ctrl+shift+alt+h</code> or <code>shift+a</code>, etc. Any combination of shift, ctrl, and alt are
513:            supported, including none. Also supported as the final token are <code>enter</code>, <code>esc</code>,
514:            <code>tab</code>, <code>del</code>, and <code>space</code>. To specify the final token as a key code, the
515:            last token can be the key code contained in brackets, <code>[13]</code>.
516:             * @return the registered hot key.
517:             */
518:            @SuppressWarnings("unchecked")
519:            public jsx3.gui.HotKey doKeyBinding(
520:                    org.directwebremoting.proxy.CodeBlock fctCallback,
521:                    String strKeys) {
522:                String extension = "doKeyBinding(\"" + fctCallback + "\", \""
523:                        + strKeys + "\").";
524:                try {
525:                    java.lang.reflect.Constructor<jsx3.gui.HotKey> ctor = jsx3.gui.HotKey.class
526:                            .getConstructor(Context.class, String.class,
527:                                    ScriptProxy.class);
528:                    return ctor.newInstance(this , extension, getScriptProxy());
529:                } catch (Exception ex) {
530:                    throw new IllegalArgumentException("Unsupported type: "
531:                            + jsx3.gui.HotKey.class.getName());
532:                }
533:            }
534:
535:            /**
536:             * Resets the validation state of this control.
537:             * @return this object.
538:             */
539:            @SuppressWarnings("unchecked")
540:            public jsx3.gui.Form doReset() {
541:                String extension = "doReset().";
542:                try {
543:                    java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
544:                            .getConstructor(Context.class, String.class,
545:                                    ScriptProxy.class);
546:                    return ctor.newInstance(this , extension, getScriptProxy());
547:                } catch (Exception ex) {
548:                    throw new IllegalArgumentException("Unsupported type: "
549:                            + jsx3.gui.Form.class.getName());
550:                }
551:            }
552:
553:            /**
554:             * Resets the validation state of this control.
555:             * @param returnType The expected return type
556:             * @return this object.
557:             */
558:            @SuppressWarnings("unchecked")
559:            public <T> T doReset(Class<T> returnType) {
560:                String extension = "doReset().";
561:                try {
562:                    java.lang.reflect.Constructor<T> ctor = returnType
563:                            .getConstructor(Context.class, String.class,
564:                                    ScriptProxy.class);
565:                    return ctor.newInstance(this , extension, getScriptProxy());
566:                } catch (Exception ex) {
567:                    throw new IllegalArgumentException(
568:                            "Unsupported return type: " + returnType.getName());
569:                }
570:            }
571:
572:            /**
573:             * Returns the background color of this control when it is disabled.
574:             * @param callback valid CSS property value, (i.e., red, #ff0000)
575:             */
576:            @SuppressWarnings("unchecked")
577:            public void getDisabledBackgroundColor(
578:                    org.directwebremoting.proxy.Callback<String> callback) {
579:                ScriptBuffer script = new ScriptBuffer();
580:                String callbackPrefix = "";
581:
582:                if (callback != null) {
583:                    callbackPrefix = "var reply = ";
584:                }
585:
586:                script.appendCall(callbackPrefix + getContextPath()
587:                        + "getDisabledBackgroundColor");
588:
589:                if (callback != null) {
590:                    String key = org.directwebremoting.extend.CallbackHelper
591:                            .saveCallback(callback, String.class);
592:                    script
593:                            .appendCall("__System.activateCallback", key,
594:                                    "reply");
595:                }
596:
597:                getScriptProxy().addScript(script);
598:            }
599:
600:            /**
601:             * Returns the font color to use when this control is disabled.
602:             * @param callback valid CSS property value, (i.e., red, #ff0000)
603:             */
604:            @SuppressWarnings("unchecked")
605:            public void getDisabledColor(
606:                    org.directwebremoting.proxy.Callback<String> callback) {
607:                ScriptBuffer script = new ScriptBuffer();
608:                String callbackPrefix = "";
609:
610:                if (callback != null) {
611:                    callbackPrefix = "var reply = ";
612:                }
613:
614:                script.appendCall(callbackPrefix + getContextPath()
615:                        + "getDisabledColor");
616:
617:                if (callback != null) {
618:                    String key = org.directwebremoting.extend.CallbackHelper
619:                            .saveCallback(callback, String.class);
620:                    script
621:                            .appendCall("__System.activateCallback", key,
622:                                    "reply");
623:                }
624:
625:                getScriptProxy().addScript(script);
626:            }
627:
628:            /**
629:             * Returns the state for the form field control. If no enabled state is set, this method returns
630:            STATEENABLED.
631:             * @param callback <code>STATEDISABLED</code> or <code>STATEENABLED</code>.
632:             */
633:            @SuppressWarnings("unchecked")
634:            public void getEnabled(
635:                    org.directwebremoting.proxy.Callback<Integer> callback) {
636:                ScriptBuffer script = new ScriptBuffer();
637:                String callbackPrefix = "";
638:
639:                if (callback != null) {
640:                    callbackPrefix = "var reply = ";
641:                }
642:
643:                script.appendCall(callbackPrefix + getContextPath()
644:                        + "getEnabled");
645:
646:                if (callback != null) {
647:                    String key = org.directwebremoting.extend.CallbackHelper
648:                            .saveCallback(callback, Integer.class);
649:                    script
650:                            .appendCall("__System.activateCallback", key,
651:                                    "reply");
652:                }
653:
654:                getScriptProxy().addScript(script);
655:            }
656:
657:            /**
658:             * Returns the key binding that when keyed will fire the execute event for this control.
659:             * @param callback plus-delimited (e.g.,'+') key sequence such as ctrl+s or ctrl+shift+alt+h or shift+a, etc
660:             */
661:            @SuppressWarnings("unchecked")
662:            public void getKeyBinding(
663:                    org.directwebremoting.proxy.Callback<String> callback) {
664:                ScriptBuffer script = new ScriptBuffer();
665:                String callbackPrefix = "";
666:
667:                if (callback != null) {
668:                    callbackPrefix = "var reply = ";
669:                }
670:
671:                script.appendCall(callbackPrefix + getContextPath()
672:                        + "getKeyBinding");
673:
674:                if (callback != null) {
675:                    String key = org.directwebremoting.extend.CallbackHelper
676:                            .saveCallback(callback, String.class);
677:                    script
678:                            .appendCall("__System.activateCallback", key,
679:                                    "reply");
680:                }
681:
682:                getScriptProxy().addScript(script);
683:            }
684:
685:            /**
686:             * Returns whether or not this control is required. If the required property has never been set, this method returns
687:            OPTIONAL.
688:             * @param callback <code>REQUIRED</code> or <code>OPTIONAL</code>.
689:             */
690:            @SuppressWarnings("unchecked")
691:            public void getRequired(
692:                    org.directwebremoting.proxy.Callback<Integer> callback) {
693:                ScriptBuffer script = new ScriptBuffer();
694:                String callbackPrefix = "";
695:
696:                if (callback != null) {
697:                    callbackPrefix = "var reply = ";
698:                }
699:
700:                script.appendCall(callbackPrefix + getContextPath()
701:                        + "getRequired");
702:
703:                if (callback != null) {
704:                    String key = org.directwebremoting.extend.CallbackHelper
705:                            .saveCallback(callback, Integer.class);
706:                    script
707:                            .appendCall("__System.activateCallback", key,
708:                                    "reply");
709:                }
710:
711:                getScriptProxy().addScript(script);
712:            }
713:
714:            /**
715:             * Returns the validation state of this control. If the validationState property has never been set, this method returns
716:            STATEVALID.
717:             * @param callback <code>STATEINVALID</code> or <code>STATEVALID</code>.
718:             */
719:            @SuppressWarnings("unchecked")
720:            public void getValidationState(
721:                    org.directwebremoting.proxy.Callback<Integer> callback) {
722:                ScriptBuffer script = new ScriptBuffer();
723:                String callbackPrefix = "";
724:
725:                if (callback != null) {
726:                    callbackPrefix = "var reply = ";
727:                }
728:
729:                script.appendCall(callbackPrefix + getContextPath()
730:                        + "getValidationState");
731:
732:                if (callback != null) {
733:                    String key = org.directwebremoting.extend.CallbackHelper
734:                            .saveCallback(callback, Integer.class);
735:                    script
736:                            .appendCall("__System.activateCallback", key,
737:                                    "reply");
738:                }
739:
740:                getScriptProxy().addScript(script);
741:            }
742:
743:            /**
744:             * Sets the background color of this form control when it is disabled.
745:             * @param strColor valid CSS property value, (i.e., red, #ff0000)
746:             * @return this object.
747:             */
748:            @SuppressWarnings("unchecked")
749:            public jsx3.gui.Form setDisabledBackgroundColor(String strColor) {
750:                String extension = "setDisabledBackgroundColor(\"" + strColor
751:                        + "\").";
752:                try {
753:                    java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
754:                            .getConstructor(Context.class, String.class,
755:                                    ScriptProxy.class);
756:                    return ctor.newInstance(this , extension, getScriptProxy());
757:                } catch (Exception ex) {
758:                    throw new IllegalArgumentException("Unsupported type: "
759:                            + jsx3.gui.Form.class.getName());
760:                }
761:            }
762:
763:            /**
764:             * Sets the background color of this form control when it is disabled.
765:             * @param strColor valid CSS property value, (i.e., red, #ff0000)
766:             * @param returnType The expected return type
767:             * @return this object.
768:             */
769:            @SuppressWarnings("unchecked")
770:            public <T> T setDisabledBackgroundColor(String strColor,
771:                    Class<T> returnType) {
772:                String extension = "setDisabledBackgroundColor(\"" + strColor
773:                        + "\").";
774:                try {
775:                    java.lang.reflect.Constructor<T> ctor = returnType
776:                            .getConstructor(Context.class, String.class,
777:                                    ScriptProxy.class);
778:                    return ctor.newInstance(this , extension, getScriptProxy());
779:                } catch (Exception ex) {
780:                    throw new IllegalArgumentException(
781:                            "Unsupported return type: " + returnType.getName());
782:                }
783:            }
784:
785:            /**
786:             * Sets the font color to use when this control is disabled.
787:             * @param strColor valid CSS property value, (i.e., red, #ff0000)
788:             * @return this object.
789:             */
790:            @SuppressWarnings("unchecked")
791:            public jsx3.gui.Form setDisabledColor(String strColor) {
792:                String extension = "setDisabledColor(\"" + strColor + "\").";
793:                try {
794:                    java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
795:                            .getConstructor(Context.class, String.class,
796:                                    ScriptProxy.class);
797:                    return ctor.newInstance(this , extension, getScriptProxy());
798:                } catch (Exception ex) {
799:                    throw new IllegalArgumentException("Unsupported type: "
800:                            + jsx3.gui.Form.class.getName());
801:                }
802:            }
803:
804:            /**
805:             * Sets the font color to use when this control is disabled.
806:             * @param strColor valid CSS property value, (i.e., red, #ff0000)
807:             * @param returnType The expected return type
808:             * @return this object.
809:             */
810:            @SuppressWarnings("unchecked")
811:            public <T> T setDisabledColor(String strColor, Class<T> returnType) {
812:                String extension = "setDisabledColor(\"" + strColor + "\").";
813:                try {
814:                    java.lang.reflect.Constructor<T> ctor = returnType
815:                            .getConstructor(Context.class, String.class,
816:                                    ScriptProxy.class);
817:                    return ctor.newInstance(this , extension, getScriptProxy());
818:                } catch (Exception ex) {
819:                    throw new IllegalArgumentException(
820:                            "Unsupported return type: " + returnType.getName());
821:                }
822:            }
823:
824:            /**
825:             * Sets whether this control is enabled. Disabled controls do not respond to user interaction.
826:             * @param intEnabled <code>STATEDISABLED</code> or <code>STATEENABLED</code>. <code>null</code> is
827:            equivalent to <code>STATEENABLED</code>.
828:             * @param bRepaint if <code>true</code> this control is immediately repainted to reflect the new setting.
829:             */
830:            public void setEnabled(int intEnabled, boolean bRepaint) {
831:                ScriptBuffer script = new ScriptBuffer();
832:                script.appendCall(getContextPath() + "setEnabled", intEnabled,
833:                        bRepaint);
834:                getScriptProxy().addScript(script);
835:            }
836:
837:            /**
838:             * Sets the key binding that when keyed will fire the bound execute (jsx3.gui.Interactive.EXECUTE)
839:            event for this control.
840:             * @param strSequence plus-delimited (e.g.,'+') key sequence such as ctrl+s or ctrl+shift+alt+h or shift+a, etc
841:             * @return this object.
842:             */
843:            @SuppressWarnings("unchecked")
844:            public jsx3.gui.Form setKeyBinding(String strSequence) {
845:                String extension = "setKeyBinding(\"" + strSequence + "\").";
846:                try {
847:                    java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
848:                            .getConstructor(Context.class, String.class,
849:                                    ScriptProxy.class);
850:                    return ctor.newInstance(this , extension, getScriptProxy());
851:                } catch (Exception ex) {
852:                    throw new IllegalArgumentException("Unsupported type: "
853:                            + jsx3.gui.Form.class.getName());
854:                }
855:            }
856:
857:            /**
858:             * Sets the key binding that when keyed will fire the bound execute (jsx3.gui.Interactive.EXECUTE)
859:            event for this control.
860:             * @param strSequence plus-delimited (e.g.,'+') key sequence such as ctrl+s or ctrl+shift+alt+h or shift+a, etc
861:             * @param returnType The expected return type
862:             * @return this object.
863:             */
864:            @SuppressWarnings("unchecked")
865:            public <T> T setKeyBinding(String strSequence, Class<T> returnType) {
866:                String extension = "setKeyBinding(\"" + strSequence + "\").";
867:                try {
868:                    java.lang.reflect.Constructor<T> ctor = returnType
869:                            .getConstructor(Context.class, String.class,
870:                                    ScriptProxy.class);
871:                    return ctor.newInstance(this , extension, getScriptProxy());
872:                } catch (Exception ex) {
873:                    throw new IllegalArgumentException(
874:                            "Unsupported return type: " + returnType.getName());
875:                }
876:            }
877:
878:            /**
879:             * Sets whether or not this control is required.
880:             * @param required {int} <code>REQUIRED</code> or <code>OPTIONAL</code>.
881:             * @return this object.
882:             */
883:            @SuppressWarnings("unchecked")
884:            public jsx3.gui.Form setRequired(int required) {
885:                String extension = "setRequired(\"" + required + "\").";
886:                try {
887:                    java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
888:                            .getConstructor(Context.class, String.class,
889:                                    ScriptProxy.class);
890:                    return ctor.newInstance(this , extension, getScriptProxy());
891:                } catch (Exception ex) {
892:                    throw new IllegalArgumentException("Unsupported type: "
893:                            + jsx3.gui.Form.class.getName());
894:                }
895:            }
896:
897:            /**
898:             * Sets whether or not this control is required.
899:             * @param required {int} <code>REQUIRED</code> or <code>OPTIONAL</code>.
900:             * @param returnType The expected return type
901:             * @return this object.
902:             */
903:            @SuppressWarnings("unchecked")
904:            public <T> T setRequired(int required, Class<T> returnType) {
905:                String extension = "setRequired(\"" + required + "\").";
906:                try {
907:                    java.lang.reflect.Constructor<T> ctor = returnType
908:                            .getConstructor(Context.class, String.class,
909:                                    ScriptProxy.class);
910:                    return ctor.newInstance(this , extension, getScriptProxy());
911:                } catch (Exception ex) {
912:                    throw new IllegalArgumentException(
913:                            "Unsupported return type: " + returnType.getName());
914:                }
915:            }
916:
917:            /**
918:             * Sets the validation state of this control. The validation state of a control is not serialized.
919:             * @param intState <code>STATEINVALID</code> or <code>STATEVALID</code>.
920:             * @return this object.
921:             */
922:            @SuppressWarnings("unchecked")
923:            public jsx3.gui.Form setValidationState(int intState) {
924:                String extension = "setValidationState(\"" + intState + "\").";
925:                try {
926:                    java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
927:                            .getConstructor(Context.class, String.class,
928:                                    ScriptProxy.class);
929:                    return ctor.newInstance(this , extension, getScriptProxy());
930:                } catch (Exception ex) {
931:                    throw new IllegalArgumentException("Unsupported type: "
932:                            + jsx3.gui.Form.class.getName());
933:                }
934:            }
935:
936:            /**
937:             * Sets the validation state of this control. The validation state of a control is not serialized.
938:             * @param intState <code>STATEINVALID</code> or <code>STATEVALID</code>.
939:             * @param returnType The expected return type
940:             * @return this object.
941:             */
942:            @SuppressWarnings("unchecked")
943:            public <T> T setValidationState(int intState, Class<T> returnType) {
944:                String extension = "setValidationState(\"" + intState + "\").";
945:                try {
946:                    java.lang.reflect.Constructor<T> ctor = returnType
947:                            .getConstructor(Context.class, String.class,
948:                                    ScriptProxy.class);
949:                    return ctor.newInstance(this , extension, getScriptProxy());
950:                } catch (Exception ex) {
951:                    throw new IllegalArgumentException(
952:                            "Unsupported return type: " + returnType.getName());
953:                }
954:            }
955:
956:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.