Source Code Cross Referenced for Button.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:         * Provides a object-oriented interface for a standard command button.
024:
025:         This class publishes the following model events:
026:
027:
028:         EXECUTE Ð when the user clicks on the enabled button, when the button has focus and the user presses the
029:         space or enter key, or when doExecute() is called on the button.
030:
031:         MENU Ð on a mouseup event with the right button when the button has a bound context menu.
032:         * @author Joe Walker [joe at getahead dot org]
033:         * @author DRAPGEN - Dwr Reverse Ajax Proxy GENerator
034:         */
035:        public class Button extends jsx3.gui.Block {
036:            /**
037:             * All reverse ajax proxies need context to work from
038:             * @param scriptProxy The place we are writing scripts to
039:             * @param context The script that got us to where we are now
040:             */
041:            public Button(Context context, String extension,
042:                    ScriptProxy scriptProxy) {
043:                super (context, extension, scriptProxy);
044:            }
045:
046:            /**
047:             * instance initializer
048:             * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
049:             * @param intLeft left position (in pixels) of the object relative to its parent container; not required if button is one of: jsx3.gui.Button.SYSTEMOPEN, jsx3.gui.Button.DIALOGCLOSE, jsx3.gui.Button.DIALOGALPHA, jsx3.gui.Button.DIALOGSHADE
050:             * @param intTop top position (in pixels) of the object relative to its parent container; not required if button is one of: jsx3.gui.Button.SYSTEMOPEN, jsx3.gui.Button.DIALOGCLOSE, jsx3.gui.Button.DIALOGALPHA, jsx3.gui.Button.DIALOGSHADE
051:             * @param intWidth width (in pixels) of the object; not required if button is one of: jsx3.gui.Button.SYSTEMOPEN, jsx3.gui.Button.DIALOGCLOSE, jsx3.gui.Button.DIALOGALPHA, jsx3.gui.Button.DIALOGSHADE
052:             * @param strText text to display in the given button; if null JSXTABLEHEADERCELL.DEFAULTTEXT is used
053:             */
054:            public Button(String strName, int intLeft, int intTop,
055:                    int intWidth, String strText) {
056:                super ((Context) null, (String) null, (ScriptProxy) null);
057:                ScriptBuffer script = new ScriptBuffer();
058:                script.appendCall("new Button", strName, intLeft, intTop,
059:                        intWidth, strText);
060:                setInitScript(script);
061:            }
062:
063:            /**
064:             * #e8e8f5
065:             */
066:            public static final String DEFAULTBACKGROUNDCOLOR = "#e8e8f5";
067:
068:            /**
069:             * #f6f6ff
070:             */
071:            public static final String DEFAULTHIGHLIGHT = "#f6f6ff";
072:
073:            /**
074:             * #a6a6af
075:             */
076:            public static final String DEFAULTSHADOW = "#a6a6af";
077:
078:            /**
079:             * 18
080:             */
081:            public static final int DEFAULTHEIGHT = 17;
082:
083:            /**
084:             * jsx30button
085:             */
086:            public static final String DEFAULTCLASSNAME = "jsx30button";
087:
088:            /**
089:             * Sets the validation state for the button and returns the validation state; always returns jsx3.gui.Form.STATEVALID (as buttons can only be valid)
090:             * @param callback jsx3.gui.Form.STATEVALID
091:             */
092:            @SuppressWarnings("unchecked")
093:            public void doValidate(
094:                    org.directwebremoting.proxy.Callback<Integer> callback) {
095:                ScriptBuffer script = new ScriptBuffer();
096:                String callbackPrefix = "";
097:
098:                if (callback != null) {
099:                    callbackPrefix = "var reply = ";
100:                }
101:
102:                script.appendCall(callbackPrefix + getContextPath()
103:                        + "doValidate");
104:
105:                if (callback != null) {
106:                    String key = org.directwebremoting.extend.CallbackHelper
107:                            .saveCallback(callback, Integer.class);
108:                    script
109:                            .appendCall("__System.activateCallback", key,
110:                                    "reply");
111:                }
112:
113:                getScriptProxy().addScript(script);
114:            }
115:
116:            /**
117:             * Invokes the EXECUTE model event of this button. Note that because the model event is invoked
118:            programmatically rather than by user interaction the objEVENT event parameter will be
119:            null if the objEvent parameter is undefined.
120:             * @param objEvent the browser event that caused the execution of this button. This argument is
121:            optional and should only be provided if the execute of this button is the result of a browser event. This
122:            parameter will be passed along to the model event as <code>objEVENT</code>.
123:             */
124:            public void doExecute(jsx3.gui.Event objEvent) {
125:                ScriptBuffer script = new ScriptBuffer();
126:                script.appendCall(getContextPath() + "doExecute", objEvent);
127:                getScriptProxy().addScript(script);
128:            }
129:
130:            /**
131:             * Because it implements the jsx3.gui.Form class, the jsx3.gui.Button class implements various form-related methods (validate, getValue, disable, etc); in the case of 'getValue', this method will return the button's text (caption)
132:             */
133:            @SuppressWarnings("unchecked")
134:            public void getValue(
135:                    org.directwebremoting.proxy.Callback<String> callback) {
136:                ScriptBuffer script = new ScriptBuffer();
137:                String callbackPrefix = "";
138:
139:                if (callback != null) {
140:                    callbackPrefix = "var reply = ";
141:                }
142:
143:                script.appendCall(callbackPrefix + getContextPath()
144:                        + "getValue");
145:
146:                if (callback != null) {
147:                    String key = org.directwebremoting.extend.CallbackHelper
148:                            .saveCallback(callback, String.class);
149:                    script
150:                            .appendCall("__System.activateCallback", key,
151:                                    "reply");
152:                }
153:
154:                getScriptProxy().addScript(script);
155:            }
156:
157:            /**
158:             * Binds the given key sequence to a callback function. Any object that has a key binding (specified with
159:            setKeyBinding()) will call this method when painted to register the key sequence with an appropriate
160:            ancestor of this form control. Any key down event that bubbles up to the ancestor without being intercepted
161:            and matches the given key sequence will invoke the given callback function.
162:
163:            As of 3.2: The hot key will be registered with the first ancestor found that is either a
164:            jsx3.gui.Window, a jsx3.gui.Dialog, or the root block of a jsx3.app.Server.
165:             * @param fctCallback JavaScript function to execute when the given sequence is keyed by the user.
166:             * @param strKeys a plus-delimited ('+') key sequence such as <code>ctrl+s</code> or
167:            <code>ctrl+shift+alt+h</code> or <code>shift+a</code>, etc. Any combination of shift, ctrl, and alt are
168:            supported, including none. Also supported as the final token are <code>enter</code>, <code>esc</code>,
169:            <code>tab</code>, <code>del</code>, and <code>space</code>. To specify the final token as a key code, the
170:            last token can be the key code contained in brackets, <code>[13]</code>.
171:             * @return the registered hot key.
172:             */
173:            @SuppressWarnings("unchecked")
174:            public jsx3.gui.HotKey doKeyBinding(
175:                    org.directwebremoting.proxy.CodeBlock fctCallback,
176:                    String strKeys) {
177:                String extension = "doKeyBinding(\"" + fctCallback + "\", \""
178:                        + strKeys + "\").";
179:                try {
180:                    java.lang.reflect.Constructor<jsx3.gui.HotKey> ctor = jsx3.gui.HotKey.class
181:                            .getConstructor(Context.class, String.class,
182:                                    ScriptProxy.class);
183:                    return ctor.newInstance(this , extension, getScriptProxy());
184:                } catch (Exception ex) {
185:                    throw new IllegalArgumentException("Unsupported type: "
186:                            + jsx3.gui.HotKey.class.getName());
187:                }
188:            }
189:
190:            /**
191:             * Resets the validation state of this control.
192:             * @return this object.
193:             */
194:            @SuppressWarnings("unchecked")
195:            public jsx3.gui.Form doReset() {
196:                String extension = "doReset().";
197:                try {
198:                    java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
199:                            .getConstructor(Context.class, String.class,
200:                                    ScriptProxy.class);
201:                    return ctor.newInstance(this , extension, getScriptProxy());
202:                } catch (Exception ex) {
203:                    throw new IllegalArgumentException("Unsupported type: "
204:                            + jsx3.gui.Form.class.getName());
205:                }
206:            }
207:
208:            /**
209:             * Resets the validation state of this control.
210:             * @param returnType The expected return type
211:             * @return this object.
212:             */
213:            @SuppressWarnings("unchecked")
214:            public <T> T doReset(Class<T> returnType) {
215:                String extension = "doReset().";
216:                try {
217:                    java.lang.reflect.Constructor<T> ctor = returnType
218:                            .getConstructor(Context.class, String.class,
219:                                    ScriptProxy.class);
220:                    return ctor.newInstance(this , extension, getScriptProxy());
221:                } catch (Exception ex) {
222:                    throw new IllegalArgumentException(
223:                            "Unsupported return type: " + returnType.getName());
224:                }
225:            }
226:
227:            /**
228:             * Returns the background color of this control when it is disabled.
229:             * @param callback valid CSS property value, (i.e., red, #ff0000)
230:             */
231:            @SuppressWarnings("unchecked")
232:            public void getDisabledBackgroundColor(
233:                    org.directwebremoting.proxy.Callback<String> callback) {
234:                ScriptBuffer script = new ScriptBuffer();
235:                String callbackPrefix = "";
236:
237:                if (callback != null) {
238:                    callbackPrefix = "var reply = ";
239:                }
240:
241:                script.appendCall(callbackPrefix + getContextPath()
242:                        + "getDisabledBackgroundColor");
243:
244:                if (callback != null) {
245:                    String key = org.directwebremoting.extend.CallbackHelper
246:                            .saveCallback(callback, String.class);
247:                    script
248:                            .appendCall("__System.activateCallback", key,
249:                                    "reply");
250:                }
251:
252:                getScriptProxy().addScript(script);
253:            }
254:
255:            /**
256:             * Returns the font color to use when this control is disabled.
257:             * @param callback valid CSS property value, (i.e., red, #ff0000)
258:             */
259:            @SuppressWarnings("unchecked")
260:            public void getDisabledColor(
261:                    org.directwebremoting.proxy.Callback<String> callback) {
262:                ScriptBuffer script = new ScriptBuffer();
263:                String callbackPrefix = "";
264:
265:                if (callback != null) {
266:                    callbackPrefix = "var reply = ";
267:                }
268:
269:                script.appendCall(callbackPrefix + getContextPath()
270:                        + "getDisabledColor");
271:
272:                if (callback != null) {
273:                    String key = org.directwebremoting.extend.CallbackHelper
274:                            .saveCallback(callback, String.class);
275:                    script
276:                            .appendCall("__System.activateCallback", key,
277:                                    "reply");
278:                }
279:
280:                getScriptProxy().addScript(script);
281:            }
282:
283:            /**
284:             * Returns the state for the form field control. If no enabled state is set, this method returns
285:            STATEENABLED.
286:             * @param callback <code>STATEDISABLED</code> or <code>STATEENABLED</code>.
287:             */
288:            @SuppressWarnings("unchecked")
289:            public void getEnabled(
290:                    org.directwebremoting.proxy.Callback<Integer> callback) {
291:                ScriptBuffer script = new ScriptBuffer();
292:                String callbackPrefix = "";
293:
294:                if (callback != null) {
295:                    callbackPrefix = "var reply = ";
296:                }
297:
298:                script.appendCall(callbackPrefix + getContextPath()
299:                        + "getEnabled");
300:
301:                if (callback != null) {
302:                    String key = org.directwebremoting.extend.CallbackHelper
303:                            .saveCallback(callback, Integer.class);
304:                    script
305:                            .appendCall("__System.activateCallback", key,
306:                                    "reply");
307:                }
308:
309:                getScriptProxy().addScript(script);
310:            }
311:
312:            /**
313:             * Returns the key binding that when keyed will fire the execute event for this control.
314:             * @param callback plus-delimited (e.g.,'+') key sequence such as ctrl+s or ctrl+shift+alt+h or shift+a, etc
315:             */
316:            @SuppressWarnings("unchecked")
317:            public void getKeyBinding(
318:                    org.directwebremoting.proxy.Callback<String> callback) {
319:                ScriptBuffer script = new ScriptBuffer();
320:                String callbackPrefix = "";
321:
322:                if (callback != null) {
323:                    callbackPrefix = "var reply = ";
324:                }
325:
326:                script.appendCall(callbackPrefix + getContextPath()
327:                        + "getKeyBinding");
328:
329:                if (callback != null) {
330:                    String key = org.directwebremoting.extend.CallbackHelper
331:                            .saveCallback(callback, String.class);
332:                    script
333:                            .appendCall("__System.activateCallback", key,
334:                                    "reply");
335:                }
336:
337:                getScriptProxy().addScript(script);
338:            }
339:
340:            /**
341:             * Returns whether or not this control is required. If the required property has never been set, this method returns
342:            OPTIONAL.
343:             * @param callback <code>REQUIRED</code> or <code>OPTIONAL</code>.
344:             */
345:            @SuppressWarnings("unchecked")
346:            public void getRequired(
347:                    org.directwebremoting.proxy.Callback<Integer> callback) {
348:                ScriptBuffer script = new ScriptBuffer();
349:                String callbackPrefix = "";
350:
351:                if (callback != null) {
352:                    callbackPrefix = "var reply = ";
353:                }
354:
355:                script.appendCall(callbackPrefix + getContextPath()
356:                        + "getRequired");
357:
358:                if (callback != null) {
359:                    String key = org.directwebremoting.extend.CallbackHelper
360:                            .saveCallback(callback, Integer.class);
361:                    script
362:                            .appendCall("__System.activateCallback", key,
363:                                    "reply");
364:                }
365:
366:                getScriptProxy().addScript(script);
367:            }
368:
369:            /**
370:             * Returns the validation state of this control. If the validationState property has never been set, this method returns
371:            STATEVALID.
372:             * @param callback <code>STATEINVALID</code> or <code>STATEVALID</code>.
373:             */
374:            @SuppressWarnings("unchecked")
375:            public void getValidationState(
376:                    org.directwebremoting.proxy.Callback<Integer> callback) {
377:                ScriptBuffer script = new ScriptBuffer();
378:                String callbackPrefix = "";
379:
380:                if (callback != null) {
381:                    callbackPrefix = "var reply = ";
382:                }
383:
384:                script.appendCall(callbackPrefix + getContextPath()
385:                        + "getValidationState");
386:
387:                if (callback != null) {
388:                    String key = org.directwebremoting.extend.CallbackHelper
389:                            .saveCallback(callback, Integer.class);
390:                    script
391:                            .appendCall("__System.activateCallback", key,
392:                                    "reply");
393:                }
394:
395:                getScriptProxy().addScript(script);
396:            }
397:
398:            /**
399:             * Sets the background color of this form control when it is disabled.
400:             * @param strColor valid CSS property value, (i.e., red, #ff0000)
401:             * @return this object.
402:             */
403:            @SuppressWarnings("unchecked")
404:            public jsx3.gui.Form setDisabledBackgroundColor(String strColor) {
405:                String extension = "setDisabledBackgroundColor(\"" + strColor
406:                        + "\").";
407:                try {
408:                    java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
409:                            .getConstructor(Context.class, String.class,
410:                                    ScriptProxy.class);
411:                    return ctor.newInstance(this , extension, getScriptProxy());
412:                } catch (Exception ex) {
413:                    throw new IllegalArgumentException("Unsupported type: "
414:                            + jsx3.gui.Form.class.getName());
415:                }
416:            }
417:
418:            /**
419:             * Sets the background color of this form control when it is disabled.
420:             * @param strColor valid CSS property value, (i.e., red, #ff0000)
421:             * @param returnType The expected return type
422:             * @return this object.
423:             */
424:            @SuppressWarnings("unchecked")
425:            public <T> T setDisabledBackgroundColor(String strColor,
426:                    Class<T> returnType) {
427:                String extension = "setDisabledBackgroundColor(\"" + strColor
428:                        + "\").";
429:                try {
430:                    java.lang.reflect.Constructor<T> ctor = returnType
431:                            .getConstructor(Context.class, String.class,
432:                                    ScriptProxy.class);
433:                    return ctor.newInstance(this , extension, getScriptProxy());
434:                } catch (Exception ex) {
435:                    throw new IllegalArgumentException(
436:                            "Unsupported return type: " + returnType.getName());
437:                }
438:            }
439:
440:            /**
441:             * Sets the font color to use when this control is disabled.
442:             * @param strColor valid CSS property value, (i.e., red, #ff0000)
443:             * @return this object.
444:             */
445:            @SuppressWarnings("unchecked")
446:            public jsx3.gui.Form setDisabledColor(String strColor) {
447:                String extension = "setDisabledColor(\"" + strColor + "\").";
448:                try {
449:                    java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
450:                            .getConstructor(Context.class, String.class,
451:                                    ScriptProxy.class);
452:                    return ctor.newInstance(this , extension, getScriptProxy());
453:                } catch (Exception ex) {
454:                    throw new IllegalArgumentException("Unsupported type: "
455:                            + jsx3.gui.Form.class.getName());
456:                }
457:            }
458:
459:            /**
460:             * Sets the font color to use when this control is disabled.
461:             * @param strColor valid CSS property value, (i.e., red, #ff0000)
462:             * @param returnType The expected return type
463:             * @return this object.
464:             */
465:            @SuppressWarnings("unchecked")
466:            public <T> T setDisabledColor(String strColor, Class<T> returnType) {
467:                String extension = "setDisabledColor(\"" + strColor + "\").";
468:                try {
469:                    java.lang.reflect.Constructor<T> ctor = returnType
470:                            .getConstructor(Context.class, String.class,
471:                                    ScriptProxy.class);
472:                    return ctor.newInstance(this , extension, getScriptProxy());
473:                } catch (Exception ex) {
474:                    throw new IllegalArgumentException(
475:                            "Unsupported return type: " + returnType.getName());
476:                }
477:            }
478:
479:            /**
480:             * Sets whether this control is enabled. Disabled controls do not respond to user interaction.
481:             * @param intEnabled <code>STATEDISABLED</code> or <code>STATEENABLED</code>. <code>null</code> is
482:            equivalent to <code>STATEENABLED</code>.
483:             * @param bRepaint if <code>true</code> this control is immediately repainted to reflect the new setting.
484:             */
485:            public void setEnabled(int intEnabled, boolean bRepaint) {
486:                ScriptBuffer script = new ScriptBuffer();
487:                script.appendCall(getContextPath() + "setEnabled", intEnabled,
488:                        bRepaint);
489:                getScriptProxy().addScript(script);
490:            }
491:
492:            /**
493:             * Sets the key binding that when keyed will fire the bound execute (jsx3.gui.Interactive.EXECUTE)
494:            event for this control.
495:             * @param strSequence plus-delimited (e.g.,'+') key sequence such as ctrl+s or ctrl+shift+alt+h or shift+a, etc
496:             * @return this object.
497:             */
498:            @SuppressWarnings("unchecked")
499:            public jsx3.gui.Form setKeyBinding(String strSequence) {
500:                String extension = "setKeyBinding(\"" + strSequence + "\").";
501:                try {
502:                    java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
503:                            .getConstructor(Context.class, String.class,
504:                                    ScriptProxy.class);
505:                    return ctor.newInstance(this , extension, getScriptProxy());
506:                } catch (Exception ex) {
507:                    throw new IllegalArgumentException("Unsupported type: "
508:                            + jsx3.gui.Form.class.getName());
509:                }
510:            }
511:
512:            /**
513:             * Sets the key binding that when keyed will fire the bound execute (jsx3.gui.Interactive.EXECUTE)
514:            event for this control.
515:             * @param strSequence plus-delimited (e.g.,'+') key sequence such as ctrl+s or ctrl+shift+alt+h or shift+a, etc
516:             * @param returnType The expected return type
517:             * @return this object.
518:             */
519:            @SuppressWarnings("unchecked")
520:            public <T> T setKeyBinding(String strSequence, Class<T> returnType) {
521:                String extension = "setKeyBinding(\"" + strSequence + "\").";
522:                try {
523:                    java.lang.reflect.Constructor<T> ctor = returnType
524:                            .getConstructor(Context.class, String.class,
525:                                    ScriptProxy.class);
526:                    return ctor.newInstance(this , extension, getScriptProxy());
527:                } catch (Exception ex) {
528:                    throw new IllegalArgumentException(
529:                            "Unsupported return type: " + returnType.getName());
530:                }
531:            }
532:
533:            /**
534:             * Sets whether or not this control is required.
535:             * @param required {int} <code>REQUIRED</code> or <code>OPTIONAL</code>.
536:             * @return this object.
537:             */
538:            @SuppressWarnings("unchecked")
539:            public jsx3.gui.Form setRequired(int required) {
540:                String extension = "setRequired(\"" + required + "\").";
541:                try {
542:                    java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
543:                            .getConstructor(Context.class, String.class,
544:                                    ScriptProxy.class);
545:                    return ctor.newInstance(this , extension, getScriptProxy());
546:                } catch (Exception ex) {
547:                    throw new IllegalArgumentException("Unsupported type: "
548:                            + jsx3.gui.Form.class.getName());
549:                }
550:            }
551:
552:            /**
553:             * Sets whether or not this control is required.
554:             * @param required {int} <code>REQUIRED</code> or <code>OPTIONAL</code>.
555:             * @param returnType The expected return type
556:             * @return this object.
557:             */
558:            @SuppressWarnings("unchecked")
559:            public <T> T setRequired(int required, Class<T> returnType) {
560:                String extension = "setRequired(\"" + required + "\").";
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:             * Sets the validation state of this control. The validation state of a control is not serialized.
574:             * @param intState <code>STATEINVALID</code> or <code>STATEVALID</code>.
575:             * @return this object.
576:             */
577:            @SuppressWarnings("unchecked")
578:            public jsx3.gui.Form setValidationState(int intState) {
579:                String extension = "setValidationState(\"" + intState + "\").";
580:                try {
581:                    java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
582:                            .getConstructor(Context.class, String.class,
583:                                    ScriptProxy.class);
584:                    return ctor.newInstance(this , extension, getScriptProxy());
585:                } catch (Exception ex) {
586:                    throw new IllegalArgumentException("Unsupported type: "
587:                            + jsx3.gui.Form.class.getName());
588:                }
589:            }
590:
591:            /**
592:             * Sets the validation state of this control. The validation state of a control is not serialized.
593:             * @param intState <code>STATEINVALID</code> or <code>STATEVALID</code>.
594:             * @param returnType The expected return type
595:             * @return this object.
596:             */
597:            @SuppressWarnings("unchecked")
598:            public <T> T setValidationState(int intState, Class<T> returnType) {
599:                String extension = "setValidationState(\"" + intState + "\").";
600:                try {
601:                    java.lang.reflect.Constructor<T> ctor = returnType
602:                            .getConstructor(Context.class, String.class,
603:                                    ScriptProxy.class);
604:                    return ctor.newInstance(this , extension, getScriptProxy());
605:                } catch (Exception ex) {
606:                    throw new IllegalArgumentException(
607:                            "Unsupported return type: " + returnType.getName());
608:                }
609:            }
610:
611:            /**
612:             * Sets the value of this control.
613:             * @param vntValue string/int value for the component
614:             * @return this object.
615:             */
616:            @SuppressWarnings("unchecked")
617:            public jsx3.gui.Form setValue(Integer vntValue) {
618:                String extension = "setValue(\"" + vntValue + "\").";
619:                try {
620:                    java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
621:                            .getConstructor(Context.class, String.class,
622:                                    ScriptProxy.class);
623:                    return ctor.newInstance(this , extension, getScriptProxy());
624:                } catch (Exception ex) {
625:                    throw new IllegalArgumentException("Unsupported type: "
626:                            + jsx3.gui.Form.class.getName());
627:                }
628:            }
629:
630:            /**
631:             * Sets the value of this control.
632:             * @param vntValue string/int value for the component
633:             * @param returnType The expected return type
634:             * @return this object.
635:             */
636:            @SuppressWarnings("unchecked")
637:            public <T> T setValue(Integer vntValue, Class<T> returnType) {
638:                String extension = "setValue(\"" + vntValue + "\").";
639:                try {
640:                    java.lang.reflect.Constructor<T> ctor = returnType
641:                            .getConstructor(Context.class, String.class,
642:                                    ScriptProxy.class);
643:                    return ctor.newInstance(this , extension, getScriptProxy());
644:                } catch (Exception ex) {
645:                    throw new IllegalArgumentException(
646:                            "Unsupported return type: " + returnType.getName());
647:                }
648:            }
649:
650:            /**
651:             * Sets the value of this control.
652:             * @param vntValue string/int value for the component
653:             * @return this object.
654:             */
655:            @SuppressWarnings("unchecked")
656:            public jsx3.gui.Form setValue(String vntValue) {
657:                String extension = "setValue(\"" + vntValue + "\").";
658:                try {
659:                    java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
660:                            .getConstructor(Context.class, String.class,
661:                                    ScriptProxy.class);
662:                    return ctor.newInstance(this , extension, getScriptProxy());
663:                } catch (Exception ex) {
664:                    throw new IllegalArgumentException("Unsupported type: "
665:                            + jsx3.gui.Form.class.getName());
666:                }
667:            }
668:
669:            /**
670:             * Sets the value of this control.
671:             * @param vntValue string/int value for the component
672:             * @param returnType The expected return type
673:             * @return this object.
674:             */
675:            @SuppressWarnings("unchecked")
676:            public <T> T setValue(String vntValue, Class<T> returnType) {
677:                String extension = "setValue(\"" + vntValue + "\").";
678:                try {
679:                    java.lang.reflect.Constructor<T> ctor = returnType
680:                            .getConstructor(Context.class, String.class,
681:                                    ScriptProxy.class);
682:                    return ctor.newInstance(this , extension, getScriptProxy());
683:                } catch (Exception ex) {
684:                    throw new IllegalArgumentException(
685:                            "Unsupported return type: " + returnType.getName());
686:                }
687:            }
688:
689:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.