Source Code Cross Referenced for ColorPicker.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 class that allows the user to pick a color using an HSB (hue-saturation-brightness) picker.
024:         * @author Joe Walker [joe at getahead dot org]
025:         * @author DRAPGEN - Dwr Reverse Ajax Proxy GENerator
026:         */
027:        public class ColorPicker extends jsx3.gui.Block {
028:            /**
029:             * All reverse ajax proxies need context to work from
030:             * @param scriptProxy The place we are writing scripts to
031:             * @param context The script that got us to where we are now
032:             */
033:            public ColorPicker(Context context, String extension,
034:                    ScriptProxy scriptProxy) {
035:                super (context, extension, scriptProxy);
036:            }
037:
038:            /**
039:             * The instance initializer.
040:             * @param strName 
041:             * @param vntLeft 
042:             * @param vntTop 
043:             * @param vntWidth 
044:             * @param vntHeight 
045:             */
046:            public ColorPicker(String strName, String vntLeft, int vntTop,
047:                    int vntWidth, int vntHeight) {
048:                super ((Context) null, (String) null, (ScriptProxy) null);
049:                ScriptBuffer script = new ScriptBuffer();
050:                script.appendCall("new ColorPicker", strName, vntLeft, vntTop,
051:                        vntWidth, vntHeight);
052:                setInitScript(script);
053:            }
054:
055:            /**
056:             * The instance initializer.
057:             * @param strName 
058:             * @param vntLeft 
059:             * @param vntTop 
060:             * @param vntWidth 
061:             * @param vntHeight 
062:             */
063:            public ColorPicker(String strName, String vntLeft, String vntTop,
064:                    int vntWidth, int vntHeight) {
065:                super ((Context) null, (String) null, (ScriptProxy) null);
066:                ScriptBuffer script = new ScriptBuffer();
067:                script.appendCall("new ColorPicker", strName, vntLeft, vntTop,
068:                        vntWidth, vntHeight);
069:                setInitScript(script);
070:            }
071:
072:            /**
073:             * The instance initializer.
074:             * @param strName 
075:             * @param vntLeft 
076:             * @param vntTop 
077:             * @param vntWidth 
078:             * @param vntHeight 
079:             */
080:            public ColorPicker(String strName, int vntLeft, int vntTop,
081:                    int vntWidth, int vntHeight) {
082:                super ((Context) null, (String) null, (ScriptProxy) null);
083:                ScriptBuffer script = new ScriptBuffer();
084:                script.appendCall("new ColorPicker", strName, vntLeft, vntTop,
085:                        vntWidth, vntHeight);
086:                setInitScript(script);
087:            }
088:
089:            /**
090:             * The instance initializer.
091:             * @param strName 
092:             * @param vntLeft 
093:             * @param vntTop 
094:             * @param vntWidth 
095:             * @param vntHeight 
096:             */
097:            public ColorPicker(String strName, int vntLeft, String vntTop,
098:                    int vntWidth, int vntHeight) {
099:                super ((Context) null, (String) null, (ScriptProxy) null);
100:                ScriptBuffer script = new ScriptBuffer();
101:                script.appendCall("new ColorPicker", strName, vntLeft, vntTop,
102:                        vntWidth, vntHeight);
103:                setInitScript(script);
104:            }
105:
106:            /**
107:             * The default rendered width of this control if no width is specified.
108:             */
109:            public static final int DEFAULT_WIDTH = 324;
110:
111:            /**
112:             * The default rendered height of this control if no height is specified.
113:             */
114:            public static final int DEFAULT_HEIGHT = 300;
115:
116:            /**
117:             * Value for the axis property indicating a hue axis.
118:             */
119:            public static final int HUE = 1;
120:
121:            /**
122:             * Value for the axis property indicating a saturation axis.
123:             */
124:            public static final int SATURATION = 2;
125:
126:            /**
127:             * Value for the axis property indicating a brightness axis.
128:             */
129:            public static final int BRIGHTNESS = 3;
130:
131:            /**
132:             * Returns the RGB value of the currently selected color as an integer. The return value is
133:            a 24-bit number of the form 0xRRGGBB.
134:             */
135:            @SuppressWarnings("unchecked")
136:            public void getValue(
137:                    org.directwebremoting.proxy.Callback<Integer> callback) {
138:                ScriptBuffer script = new ScriptBuffer();
139:                String callbackPrefix = "";
140:
141:                if (callback != null) {
142:                    callbackPrefix = "var reply = ";
143:                }
144:
145:                script.appendCall(callbackPrefix + getContextPath()
146:                        + "getValue");
147:
148:                if (callback != null) {
149:                    String key = org.directwebremoting.extend.CallbackHelper
150:                            .saveCallback(callback, Integer.class);
151:                    script
152:                            .appendCall("__System.activateCallback", key,
153:                                    "reply");
154:                }
155:
156:                getScriptProxy().addScript(script);
157:            }
158:
159:            /**
160:             * Sets the RGB value of this color picker.
161:             * @param strValue the supported formats are: RGB integer value as number or string and HTML hex
162:            code, <code>"#000000"</code>.
163:             */
164:            public void setValue(int strValue) {
165:                ScriptBuffer script = new ScriptBuffer();
166:                script.appendCall(getContextPath() + "setValue", strValue);
167:                getScriptProxy().addScript(script);
168:            }
169:
170:            /**
171:             * Sets the RGB value of this color picker.
172:             * @param strValue the supported formats are: RGB integer value as number or string and HTML hex
173:            code, <code>"#000000"</code>.
174:             */
175:            public void setValue(String strValue) {
176:                ScriptBuffer script = new ScriptBuffer();
177:                script.appendCall(getContextPath() + "setValue", strValue);
178:                getScriptProxy().addScript(script);
179:            }
180:
181:            /**
182:             * 
183:             * @param callback always <code>jsx3.gui.Form.STATEVALID</code>.
184:             */
185:            @SuppressWarnings("unchecked")
186:            public void doValidate(
187:                    org.directwebremoting.proxy.Callback<Integer> callback) {
188:                ScriptBuffer script = new ScriptBuffer();
189:                String callbackPrefix = "";
190:
191:                if (callback != null) {
192:                    callbackPrefix = "var reply = ";
193:                }
194:
195:                script.appendCall(callbackPrefix + getContextPath()
196:                        + "doValidate");
197:
198:                if (callback != null) {
199:                    String key = org.directwebremoting.extend.CallbackHelper
200:                            .saveCallback(callback, Integer.class);
201:                    script
202:                            .appendCall("__System.activateCallback", key,
203:                                    "reply");
204:                }
205:
206:                getScriptProxy().addScript(script);
207:            }
208:
209:            /**
210:             * Returns the RGB value of the currently selected color as an integer. The return value is 
211:            a 24-bit number of the form 0xRRGGBB.
212:             */
213:            @SuppressWarnings("unchecked")
214:            public void getRGB(
215:                    org.directwebremoting.proxy.Callback<Integer> callback) {
216:                ScriptBuffer script = new ScriptBuffer();
217:                String callbackPrefix = "";
218:
219:                if (callback != null) {
220:                    callbackPrefix = "var reply = ";
221:                }
222:
223:                script.appendCall(callbackPrefix + getContextPath() + "getRGB");
224:
225:                if (callback != null) {
226:                    String key = org.directwebremoting.extend.CallbackHelper
227:                            .saveCallback(callback, Integer.class);
228:                    script
229:                            .appendCall("__System.activateCallback", key,
230:                                    "reply");
231:                }
232:
233:                getScriptProxy().addScript(script);
234:            }
235:
236:            /**
237:             * Sets the currently selected color by RGB. The view is updated to reflect the change in value.
238:             * @param rgb a 24-bit integer of the form <code>0xRRGGBB</code>.
239:             */
240:            public void setRGB(int rgb) {
241:                ScriptBuffer script = new ScriptBuffer();
242:                script.appendCall(getContextPath() + "setRGB", rgb);
243:                getScriptProxy().addScript(script);
244:            }
245:
246:            /**
247:             * 
248:             * @param callback <code>HUE</code>, <code>SATURATION</code>, or <code>BRIGHTNESS</code>.
249:             */
250:            @SuppressWarnings("unchecked")
251:            public void getAxis(
252:                    org.directwebremoting.proxy.Callback<Integer> callback) {
253:                ScriptBuffer script = new ScriptBuffer();
254:                String callbackPrefix = "";
255:
256:                if (callback != null) {
257:                    callbackPrefix = "var reply = ";
258:                }
259:
260:                script
261:                        .appendCall(callbackPrefix + getContextPath()
262:                                + "getAxis");
263:
264:                if (callback != null) {
265:                    String key = org.directwebremoting.extend.CallbackHelper
266:                            .saveCallback(callback, Integer.class);
267:                    script
268:                            .appendCall("__System.activateCallback", key,
269:                                    "reply");
270:                }
271:
272:                getScriptProxy().addScript(script);
273:            }
274:
275:            /**
276:             * Sets the color axis shown on the right side of the control. The other two axes are displayed in a box on the
277:            left side.
278:             * @param intAxis <code>HUE</code>, <code>SATURATION</code>, or <code>BRIGHTNESS</code>.
279:             */
280:            public jsx3.gui.ColorPicker setAxis(int intAxis) {
281:                ScriptBuffer script = new ScriptBuffer();
282:                script.appendCall(getContextPath() + "setAxis", intAxis);
283:                getScriptProxy().addScript(script);
284:                return this ;
285:            }
286:
287:            /**
288:             * Sets the currently selected color by HSB components.
289:             * @param h The hue component, <code>[0.0, 1.0]</code>.
290:             * @param s The saturation component, <code>[0.0, 1.0]</code>.
291:             * @param b The brightness component, <code>[0.0, 1.0]</code>.
292:             */
293:            public void setHSB(float h, float s, float b) {
294:                ScriptBuffer script = new ScriptBuffer();
295:                script.appendCall(getContextPath() + "setHSB", h, s, b);
296:                getScriptProxy().addScript(script);
297:            }
298:
299:            /**
300:             * Converts HSB color components to RGB components.
301:             * @param h The hue component, [0.0, 1.0].
302:             * @param s The saturation component, [0.0, 1.0].
303:             * @param l The brightness component, [0.0, 1.0].
304:             * @param callback <code>[r, g, b]</code>. Each component is an integer [0, 255].
305:             */
306:            @SuppressWarnings("unchecked")
307:            public void HSBtoRGB(float h, float s, float l,
308:                    org.directwebremoting.proxy.Callback<Object[]> callback) {
309:                ScriptBuffer script = new ScriptBuffer();
310:                String callbackPrefix = "";
311:
312:                if (callback != null) {
313:                    callbackPrefix = "var reply = ";
314:                }
315:
316:                script.appendCall(callbackPrefix + getContextPath()
317:                        + "HSBtoRGB", h, s, l);
318:
319:                if (callback != null) {
320:                    String key = org.directwebremoting.extend.CallbackHelper
321:                            .saveCallback(callback, Object[].class);
322:                    script
323:                            .appendCall("__System.activateCallback", key,
324:                                    "reply");
325:                }
326:
327:                getScriptProxy().addScript(script);
328:            }
329:
330:            /**
331:             * Converts RGB color components to HSB components.
332:             * @param r The red component, <code>[0, 255]</code>. If only one parameter is passed, this parameter
333:            may be a 24-bit integer of the form <code>0xRRGGBB</code>.
334:             * @param g The green component, <code>[0, 255]</code>.
335:             * @param b The blue component, <code>[0, 255]</code>.
336:             * @param callback <code>[h, s, b]</code>. Each component is a float <code>[0.0, 1.0]</code>.
337:             */
338:            @SuppressWarnings("unchecked")
339:            public void RGBtoHSB(int r, int g, int b,
340:                    org.directwebremoting.proxy.Callback<Object[]> callback) {
341:                ScriptBuffer script = new ScriptBuffer();
342:                String callbackPrefix = "";
343:
344:                if (callback != null) {
345:                    callbackPrefix = "var reply = ";
346:                }
347:
348:                script.appendCall(callbackPrefix + getContextPath()
349:                        + "RGBtoHSB", r, g, b);
350:
351:                if (callback != null) {
352:                    String key = org.directwebremoting.extend.CallbackHelper
353:                            .saveCallback(callback, Object[].class);
354:                    script
355:                            .appendCall("__System.activateCallback", key,
356:                                    "reply");
357:                }
358:
359:                getScriptProxy().addScript(script);
360:            }
361:
362:            /**
363:             * Binds the given key sequence to a callback function. Any object that has a key binding (specified with
364:            setKeyBinding()) will call this method when painted to register the key sequence with an appropriate
365:            ancestor of this form control. Any key down event that bubbles up to the ancestor without being intercepted
366:            and matches the given key sequence will invoke the given callback function.
367:
368:            As of 3.2: The hot key will be registered with the first ancestor found that is either a
369:            jsx3.gui.Window, a jsx3.gui.Dialog, or the root block of a jsx3.app.Server.
370:             * @param fctCallback JavaScript function to execute when the given sequence is keyed by the user.
371:             * @param strKeys a plus-delimited ('+') key sequence such as <code>ctrl+s</code> or
372:            <code>ctrl+shift+alt+h</code> or <code>shift+a</code>, etc. Any combination of shift, ctrl, and alt are
373:            supported, including none. Also supported as the final token are <code>enter</code>, <code>esc</code>,
374:            <code>tab</code>, <code>del</code>, and <code>space</code>. To specify the final token as a key code, the
375:            last token can be the key code contained in brackets, <code>[13]</code>.
376:             * @return the registered hot key.
377:             */
378:            @SuppressWarnings("unchecked")
379:            public jsx3.gui.HotKey doKeyBinding(
380:                    org.directwebremoting.proxy.CodeBlock fctCallback,
381:                    String strKeys) {
382:                String extension = "doKeyBinding(\"" + fctCallback + "\", \""
383:                        + strKeys + "\").";
384:                try {
385:                    java.lang.reflect.Constructor<jsx3.gui.HotKey> ctor = jsx3.gui.HotKey.class
386:                            .getConstructor(Context.class, String.class,
387:                                    ScriptProxy.class);
388:                    return ctor.newInstance(this , extension, getScriptProxy());
389:                } catch (Exception ex) {
390:                    throw new IllegalArgumentException("Unsupported type: "
391:                            + jsx3.gui.HotKey.class.getName());
392:                }
393:            }
394:
395:            /**
396:             * Resets the validation state of this control.
397:             * @return this object.
398:             */
399:            @SuppressWarnings("unchecked")
400:            public jsx3.gui.Form doReset() {
401:                String extension = "doReset().";
402:                try {
403:                    java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
404:                            .getConstructor(Context.class, String.class,
405:                                    ScriptProxy.class);
406:                    return ctor.newInstance(this , extension, getScriptProxy());
407:                } catch (Exception ex) {
408:                    throw new IllegalArgumentException("Unsupported type: "
409:                            + jsx3.gui.Form.class.getName());
410:                }
411:            }
412:
413:            /**
414:             * Resets the validation state of this control.
415:             * @param returnType The expected return type
416:             * @return this object.
417:             */
418:            @SuppressWarnings("unchecked")
419:            public <T> T doReset(Class<T> returnType) {
420:                String extension = "doReset().";
421:                try {
422:                    java.lang.reflect.Constructor<T> ctor = returnType
423:                            .getConstructor(Context.class, String.class,
424:                                    ScriptProxy.class);
425:                    return ctor.newInstance(this , extension, getScriptProxy());
426:                } catch (Exception ex) {
427:                    throw new IllegalArgumentException(
428:                            "Unsupported return type: " + returnType.getName());
429:                }
430:            }
431:
432:            /**
433:             * Returns the background color of this control when it is disabled.
434:             * @param callback valid CSS property value, (i.e., red, #ff0000)
435:             */
436:            @SuppressWarnings("unchecked")
437:            public void getDisabledBackgroundColor(
438:                    org.directwebremoting.proxy.Callback<String> callback) {
439:                ScriptBuffer script = new ScriptBuffer();
440:                String callbackPrefix = "";
441:
442:                if (callback != null) {
443:                    callbackPrefix = "var reply = ";
444:                }
445:
446:                script.appendCall(callbackPrefix + getContextPath()
447:                        + "getDisabledBackgroundColor");
448:
449:                if (callback != null) {
450:                    String key = org.directwebremoting.extend.CallbackHelper
451:                            .saveCallback(callback, String.class);
452:                    script
453:                            .appendCall("__System.activateCallback", key,
454:                                    "reply");
455:                }
456:
457:                getScriptProxy().addScript(script);
458:            }
459:
460:            /**
461:             * Returns the font color to use when this control is disabled.
462:             * @param callback valid CSS property value, (i.e., red, #ff0000)
463:             */
464:            @SuppressWarnings("unchecked")
465:            public void getDisabledColor(
466:                    org.directwebremoting.proxy.Callback<String> callback) {
467:                ScriptBuffer script = new ScriptBuffer();
468:                String callbackPrefix = "";
469:
470:                if (callback != null) {
471:                    callbackPrefix = "var reply = ";
472:                }
473:
474:                script.appendCall(callbackPrefix + getContextPath()
475:                        + "getDisabledColor");
476:
477:                if (callback != null) {
478:                    String key = org.directwebremoting.extend.CallbackHelper
479:                            .saveCallback(callback, String.class);
480:                    script
481:                            .appendCall("__System.activateCallback", key,
482:                                    "reply");
483:                }
484:
485:                getScriptProxy().addScript(script);
486:            }
487:
488:            /**
489:             * Returns the state for the form field control. If no enabled state is set, this method returns
490:            STATEENABLED.
491:             * @param callback <code>STATEDISABLED</code> or <code>STATEENABLED</code>.
492:             */
493:            @SuppressWarnings("unchecked")
494:            public void getEnabled(
495:                    org.directwebremoting.proxy.Callback<Integer> callback) {
496:                ScriptBuffer script = new ScriptBuffer();
497:                String callbackPrefix = "";
498:
499:                if (callback != null) {
500:                    callbackPrefix = "var reply = ";
501:                }
502:
503:                script.appendCall(callbackPrefix + getContextPath()
504:                        + "getEnabled");
505:
506:                if (callback != null) {
507:                    String key = org.directwebremoting.extend.CallbackHelper
508:                            .saveCallback(callback, Integer.class);
509:                    script
510:                            .appendCall("__System.activateCallback", key,
511:                                    "reply");
512:                }
513:
514:                getScriptProxy().addScript(script);
515:            }
516:
517:            /**
518:             * Returns the key binding that when keyed will fire the execute event for this control.
519:             * @param callback plus-delimited (e.g.,'+') key sequence such as ctrl+s or ctrl+shift+alt+h or shift+a, etc
520:             */
521:            @SuppressWarnings("unchecked")
522:            public void getKeyBinding(
523:                    org.directwebremoting.proxy.Callback<String> callback) {
524:                ScriptBuffer script = new ScriptBuffer();
525:                String callbackPrefix = "";
526:
527:                if (callback != null) {
528:                    callbackPrefix = "var reply = ";
529:                }
530:
531:                script.appendCall(callbackPrefix + getContextPath()
532:                        + "getKeyBinding");
533:
534:                if (callback != null) {
535:                    String key = org.directwebremoting.extend.CallbackHelper
536:                            .saveCallback(callback, String.class);
537:                    script
538:                            .appendCall("__System.activateCallback", key,
539:                                    "reply");
540:                }
541:
542:                getScriptProxy().addScript(script);
543:            }
544:
545:            /**
546:             * Returns whether or not this control is required. If the required property has never been set, this method returns
547:            OPTIONAL.
548:             * @param callback <code>REQUIRED</code> or <code>OPTIONAL</code>.
549:             */
550:            @SuppressWarnings("unchecked")
551:            public void getRequired(
552:                    org.directwebremoting.proxy.Callback<Integer> callback) {
553:                ScriptBuffer script = new ScriptBuffer();
554:                String callbackPrefix = "";
555:
556:                if (callback != null) {
557:                    callbackPrefix = "var reply = ";
558:                }
559:
560:                script.appendCall(callbackPrefix + getContextPath()
561:                        + "getRequired");
562:
563:                if (callback != null) {
564:                    String key = org.directwebremoting.extend.CallbackHelper
565:                            .saveCallback(callback, Integer.class);
566:                    script
567:                            .appendCall("__System.activateCallback", key,
568:                                    "reply");
569:                }
570:
571:                getScriptProxy().addScript(script);
572:            }
573:
574:            /**
575:             * Returns the validation state of this control. If the validationState property has never been set, this method returns
576:            STATEVALID.
577:             * @param callback <code>STATEINVALID</code> or <code>STATEVALID</code>.
578:             */
579:            @SuppressWarnings("unchecked")
580:            public void getValidationState(
581:                    org.directwebremoting.proxy.Callback<Integer> callback) {
582:                ScriptBuffer script = new ScriptBuffer();
583:                String callbackPrefix = "";
584:
585:                if (callback != null) {
586:                    callbackPrefix = "var reply = ";
587:                }
588:
589:                script.appendCall(callbackPrefix + getContextPath()
590:                        + "getValidationState");
591:
592:                if (callback != null) {
593:                    String key = org.directwebremoting.extend.CallbackHelper
594:                            .saveCallback(callback, Integer.class);
595:                    script
596:                            .appendCall("__System.activateCallback", key,
597:                                    "reply");
598:                }
599:
600:                getScriptProxy().addScript(script);
601:            }
602:
603:            /**
604:             * Sets the background color of this form control when it is disabled.
605:             * @param strColor valid CSS property value, (i.e., red, #ff0000)
606:             * @return this object.
607:             */
608:            @SuppressWarnings("unchecked")
609:            public jsx3.gui.Form setDisabledBackgroundColor(String strColor) {
610:                String extension = "setDisabledBackgroundColor(\"" + strColor
611:                        + "\").";
612:                try {
613:                    java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
614:                            .getConstructor(Context.class, String.class,
615:                                    ScriptProxy.class);
616:                    return ctor.newInstance(this , extension, getScriptProxy());
617:                } catch (Exception ex) {
618:                    throw new IllegalArgumentException("Unsupported type: "
619:                            + jsx3.gui.Form.class.getName());
620:                }
621:            }
622:
623:            /**
624:             * Sets the background color of this form control when it is disabled.
625:             * @param strColor valid CSS property value, (i.e., red, #ff0000)
626:             * @param returnType The expected return type
627:             * @return this object.
628:             */
629:            @SuppressWarnings("unchecked")
630:            public <T> T setDisabledBackgroundColor(String strColor,
631:                    Class<T> returnType) {
632:                String extension = "setDisabledBackgroundColor(\"" + strColor
633:                        + "\").";
634:                try {
635:                    java.lang.reflect.Constructor<T> ctor = returnType
636:                            .getConstructor(Context.class, String.class,
637:                                    ScriptProxy.class);
638:                    return ctor.newInstance(this , extension, getScriptProxy());
639:                } catch (Exception ex) {
640:                    throw new IllegalArgumentException(
641:                            "Unsupported return type: " + returnType.getName());
642:                }
643:            }
644:
645:            /**
646:             * Sets the font color to use when this control is disabled.
647:             * @param strColor valid CSS property value, (i.e., red, #ff0000)
648:             * @return this object.
649:             */
650:            @SuppressWarnings("unchecked")
651:            public jsx3.gui.Form setDisabledColor(String strColor) {
652:                String extension = "setDisabledColor(\"" + strColor + "\").";
653:                try {
654:                    java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
655:                            .getConstructor(Context.class, String.class,
656:                                    ScriptProxy.class);
657:                    return ctor.newInstance(this , extension, getScriptProxy());
658:                } catch (Exception ex) {
659:                    throw new IllegalArgumentException("Unsupported type: "
660:                            + jsx3.gui.Form.class.getName());
661:                }
662:            }
663:
664:            /**
665:             * Sets the font color to use when this control is disabled.
666:             * @param strColor valid CSS property value, (i.e., red, #ff0000)
667:             * @param returnType The expected return type
668:             * @return this object.
669:             */
670:            @SuppressWarnings("unchecked")
671:            public <T> T setDisabledColor(String strColor, Class<T> returnType) {
672:                String extension = "setDisabledColor(\"" + strColor + "\").";
673:                try {
674:                    java.lang.reflect.Constructor<T> ctor = returnType
675:                            .getConstructor(Context.class, String.class,
676:                                    ScriptProxy.class);
677:                    return ctor.newInstance(this , extension, getScriptProxy());
678:                } catch (Exception ex) {
679:                    throw new IllegalArgumentException(
680:                            "Unsupported return type: " + returnType.getName());
681:                }
682:            }
683:
684:            /**
685:             * Sets whether this control is enabled. Disabled controls do not respond to user interaction.
686:             * @param intEnabled <code>STATEDISABLED</code> or <code>STATEENABLED</code>. <code>null</code> is
687:            equivalent to <code>STATEENABLED</code>.
688:             * @param bRepaint if <code>true</code> this control is immediately repainted to reflect the new setting.
689:             */
690:            public void setEnabled(int intEnabled, boolean bRepaint) {
691:                ScriptBuffer script = new ScriptBuffer();
692:                script.appendCall(getContextPath() + "setEnabled", intEnabled,
693:                        bRepaint);
694:                getScriptProxy().addScript(script);
695:            }
696:
697:            /**
698:             * Sets the key binding that when keyed will fire the bound execute (jsx3.gui.Interactive.EXECUTE)
699:            event for this control.
700:             * @param strSequence plus-delimited (e.g.,'+') key sequence such as ctrl+s or ctrl+shift+alt+h or shift+a, etc
701:             * @return this object.
702:             */
703:            @SuppressWarnings("unchecked")
704:            public jsx3.gui.Form setKeyBinding(String strSequence) {
705:                String extension = "setKeyBinding(\"" + strSequence + "\").";
706:                try {
707:                    java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
708:                            .getConstructor(Context.class, String.class,
709:                                    ScriptProxy.class);
710:                    return ctor.newInstance(this , extension, getScriptProxy());
711:                } catch (Exception ex) {
712:                    throw new IllegalArgumentException("Unsupported type: "
713:                            + jsx3.gui.Form.class.getName());
714:                }
715:            }
716:
717:            /**
718:             * Sets the key binding that when keyed will fire the bound execute (jsx3.gui.Interactive.EXECUTE)
719:            event for this control.
720:             * @param strSequence plus-delimited (e.g.,'+') key sequence such as ctrl+s or ctrl+shift+alt+h or shift+a, etc
721:             * @param returnType The expected return type
722:             * @return this object.
723:             */
724:            @SuppressWarnings("unchecked")
725:            public <T> T setKeyBinding(String strSequence, Class<T> returnType) {
726:                String extension = "setKeyBinding(\"" + strSequence + "\").";
727:                try {
728:                    java.lang.reflect.Constructor<T> ctor = returnType
729:                            .getConstructor(Context.class, String.class,
730:                                    ScriptProxy.class);
731:                    return ctor.newInstance(this , extension, getScriptProxy());
732:                } catch (Exception ex) {
733:                    throw new IllegalArgumentException(
734:                            "Unsupported return type: " + returnType.getName());
735:                }
736:            }
737:
738:            /**
739:             * Sets whether or not this control is required.
740:             * @param required {int} <code>REQUIRED</code> or <code>OPTIONAL</code>.
741:             * @return this object.
742:             */
743:            @SuppressWarnings("unchecked")
744:            public jsx3.gui.Form setRequired(int required) {
745:                String extension = "setRequired(\"" + required + "\").";
746:                try {
747:                    java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
748:                            .getConstructor(Context.class, String.class,
749:                                    ScriptProxy.class);
750:                    return ctor.newInstance(this , extension, getScriptProxy());
751:                } catch (Exception ex) {
752:                    throw new IllegalArgumentException("Unsupported type: "
753:                            + jsx3.gui.Form.class.getName());
754:                }
755:            }
756:
757:            /**
758:             * Sets whether or not this control is required.
759:             * @param required {int} <code>REQUIRED</code> or <code>OPTIONAL</code>.
760:             * @param returnType The expected return type
761:             * @return this object.
762:             */
763:            @SuppressWarnings("unchecked")
764:            public <T> T setRequired(int required, Class<T> returnType) {
765:                String extension = "setRequired(\"" + required + "\").";
766:                try {
767:                    java.lang.reflect.Constructor<T> ctor = returnType
768:                            .getConstructor(Context.class, String.class,
769:                                    ScriptProxy.class);
770:                    return ctor.newInstance(this , extension, getScriptProxy());
771:                } catch (Exception ex) {
772:                    throw new IllegalArgumentException(
773:                            "Unsupported return type: " + returnType.getName());
774:                }
775:            }
776:
777:            /**
778:             * Sets the validation state of this control. The validation state of a control is not serialized.
779:             * @param intState <code>STATEINVALID</code> or <code>STATEVALID</code>.
780:             * @return this object.
781:             */
782:            @SuppressWarnings("unchecked")
783:            public jsx3.gui.Form setValidationState(int intState) {
784:                String extension = "setValidationState(\"" + intState + "\").";
785:                try {
786:                    java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
787:                            .getConstructor(Context.class, String.class,
788:                                    ScriptProxy.class);
789:                    return ctor.newInstance(this , extension, getScriptProxy());
790:                } catch (Exception ex) {
791:                    throw new IllegalArgumentException("Unsupported type: "
792:                            + jsx3.gui.Form.class.getName());
793:                }
794:            }
795:
796:            /**
797:             * Sets the validation state of this control. The validation state of a control is not serialized.
798:             * @param intState <code>STATEINVALID</code> or <code>STATEVALID</code>.
799:             * @param returnType The expected return type
800:             * @return this object.
801:             */
802:            @SuppressWarnings("unchecked")
803:            public <T> T setValidationState(int intState, Class<T> returnType) {
804:                String extension = "setValidationState(\"" + intState + "\").";
805:                try {
806:                    java.lang.reflect.Constructor<T> ctor = returnType
807:                            .getConstructor(Context.class, String.class,
808:                                    ScriptProxy.class);
809:                    return ctor.newInstance(this , extension, getScriptProxy());
810:                } catch (Exception ex) {
811:                    throw new IllegalArgumentException(
812:                            "Unsupported return type: " + returnType.getName());
813:                }
814:            }
815:
816:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.