0001: /*
0002: * Copyright 2005 Joe Walker
0003: *
0004: * Licensed under the Apache License, Version 2.0 (the "License");
0005: * you may not use this file except in compliance with the License.
0006: * You may obtain a copy of the License at
0007: *
0008: * http://www.apache.org/licenses/LICENSE-2.0
0009: *
0010: * Unless required by applicable law or agreed to in writing, software
0011: * distributed under the License is distributed on an "AS IS" BASIS,
0012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0013: * See the License for the specific language governing permissions and
0014: * limitations under the License.
0015: */
0016: package jsx3.gui;
0017:
0018: import org.directwebremoting.ScriptBuffer;
0019: import org.directwebremoting.proxy.ScriptProxy;
0020: import org.directwebremoting.proxy.io.Context;
0021:
0022: /**
0023: * A form element that allows for the selection of an arbitrary date by showing a navigable calendar.
0024:
0025: This control is localized to the server locale. Users with computers set to other locales may see a version of the
0026: control appropriate for their locale.
0027:
0028: This class uses the jsx3.util.DateFormat class to both format and parse dates. Dates are formatted
0029: before they are displayed in the text box of the date picker. Dates are parsed after a user manually changes the
0030: text in the text box. Parsing with DateFormat is fairly strict. If parsing fails, the value of
0031: the date picker is unchanged and the displayed value refreshes.
0032:
0033: The calendar calculates dates in the time of the local machine, not UTC (Greenwich Mean Time). Date values chosen
0034: with the calendar are always 0h:00m local time.
0035:
0036: Date pickers publish the following model events:
0037:
0038:
0039: CHANGE Ñ when the value of the control is changed by the user selecting a date in the
0040: calendar or editing the formatted date in the text box.
0041:
0042: SHOW Ñ whenever the calendar is shown.
0043:
0044: HIDE Ñ whenever the calendar is hidden.
0045: * @author Joe Walker [joe at getahead dot org]
0046: * @author DRAPGEN - Dwr Reverse Ajax Proxy GENerator
0047: */
0048: public class DatePicker extends jsx3.gui.Block {
0049: /**
0050: * All reverse ajax proxies need context to work from
0051: * @param scriptProxy The place we are writing scripts to
0052: * @param context The script that got us to where we are now
0053: */
0054: public DatePicker(Context context, String extension,
0055: ScriptProxy scriptProxy) {
0056: super (context, extension, scriptProxy);
0057: }
0058:
0059: /**
0060: * The instance initializer.
0061: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0062: * @param intLeft 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
0063: * @param intTop 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
0064: * @param intWidth 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
0065: * @param intHeight 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
0066: */
0067: public DatePicker(String strName, String intLeft, String intTop,
0068: int intWidth, int intHeight) {
0069: super ((Context) null, (String) null, (ScriptProxy) null);
0070: ScriptBuffer script = new ScriptBuffer();
0071: script.appendCall("new DatePicker", strName, intLeft, intTop,
0072: intWidth, intHeight);
0073: setInitScript(script);
0074: }
0075:
0076: /**
0077: * The instance initializer.
0078: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0079: * @param intLeft 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
0080: * @param intTop 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
0081: * @param intWidth 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
0082: * @param intHeight 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
0083: */
0084: public DatePicker(String strName, int intLeft, String intTop,
0085: int intWidth, int intHeight) {
0086: super ((Context) null, (String) null, (ScriptProxy) null);
0087: ScriptBuffer script = new ScriptBuffer();
0088: script.appendCall("new DatePicker", strName, intLeft, intTop,
0089: intWidth, intHeight);
0090: setInitScript(script);
0091: }
0092:
0093: /**
0094: * The instance initializer.
0095: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0096: * @param intLeft 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
0097: * @param intTop 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
0098: * @param intWidth 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
0099: * @param intHeight 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
0100: */
0101: public DatePicker(String strName, String intLeft, int intTop,
0102: int intWidth, String intHeight) {
0103: super ((Context) null, (String) null, (ScriptProxy) null);
0104: ScriptBuffer script = new ScriptBuffer();
0105: script.appendCall("new DatePicker", strName, intLeft, intTop,
0106: intWidth, intHeight);
0107: setInitScript(script);
0108: }
0109:
0110: /**
0111: * The instance initializer.
0112: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0113: * @param intLeft 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
0114: * @param intTop 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
0115: * @param intWidth 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
0116: * @param intHeight 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
0117: */
0118: public DatePicker(String strName, int intLeft, String intTop,
0119: String intWidth, int intHeight) {
0120: super ((Context) null, (String) null, (ScriptProxy) null);
0121: ScriptBuffer script = new ScriptBuffer();
0122: script.appendCall("new DatePicker", strName, intLeft, intTop,
0123: intWidth, intHeight);
0124: setInitScript(script);
0125: }
0126:
0127: /**
0128: * The instance initializer.
0129: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0130: * @param intLeft 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
0131: * @param intTop 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
0132: * @param intWidth 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
0133: * @param intHeight 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
0134: */
0135: public DatePicker(String strName, String intLeft, String intTop,
0136: String intWidth, int intHeight) {
0137: super ((Context) null, (String) null, (ScriptProxy) null);
0138: ScriptBuffer script = new ScriptBuffer();
0139: script.appendCall("new DatePicker", strName, intLeft, intTop,
0140: intWidth, intHeight);
0141: setInitScript(script);
0142: }
0143:
0144: /**
0145: * The instance initializer.
0146: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0147: * @param intLeft 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
0148: * @param intTop 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
0149: * @param intWidth 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
0150: * @param intHeight 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
0151: */
0152: public DatePicker(String strName, String intLeft, int intTop,
0153: String intWidth, int intHeight) {
0154: super ((Context) null, (String) null, (ScriptProxy) null);
0155: ScriptBuffer script = new ScriptBuffer();
0156: script.appendCall("new DatePicker", strName, intLeft, intTop,
0157: intWidth, intHeight);
0158: setInitScript(script);
0159: }
0160:
0161: /**
0162: * The instance initializer.
0163: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0164: * @param intLeft 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
0165: * @param intTop 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
0166: * @param intWidth 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
0167: * @param intHeight 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
0168: */
0169: public DatePicker(String strName, int intLeft, String intTop,
0170: String intWidth, String intHeight) {
0171: super ((Context) null, (String) null, (ScriptProxy) null);
0172: ScriptBuffer script = new ScriptBuffer();
0173: script.appendCall("new DatePicker", strName, intLeft, intTop,
0174: intWidth, intHeight);
0175: setInitScript(script);
0176: }
0177:
0178: /**
0179: * The instance initializer.
0180: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0181: * @param intLeft 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
0182: * @param intTop 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
0183: * @param intWidth 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
0184: * @param intHeight 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
0185: */
0186: public DatePicker(String strName, int intLeft, int intTop,
0187: int intWidth, String intHeight) {
0188: super ((Context) null, (String) null, (ScriptProxy) null);
0189: ScriptBuffer script = new ScriptBuffer();
0190: script.appendCall("new DatePicker", strName, intLeft, intTop,
0191: intWidth, intHeight);
0192: setInitScript(script);
0193: }
0194:
0195: /**
0196: * The instance initializer.
0197: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0198: * @param intLeft 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
0199: * @param intTop 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
0200: * @param intWidth 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
0201: * @param intHeight 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
0202: */
0203: public DatePicker(String strName, String intLeft, int intTop,
0204: String intWidth, String intHeight) {
0205: super ((Context) null, (String) null, (ScriptProxy) null);
0206: ScriptBuffer script = new ScriptBuffer();
0207: script.appendCall("new DatePicker", strName, intLeft, intTop,
0208: intWidth, intHeight);
0209: setInitScript(script);
0210: }
0211:
0212: /**
0213: * The instance initializer.
0214: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0215: * @param intLeft 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
0216: * @param intTop 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
0217: * @param intWidth 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
0218: * @param intHeight 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
0219: */
0220: public DatePicker(String strName, String intLeft, int intTop,
0221: int intWidth, int intHeight) {
0222: super ((Context) null, (String) null, (ScriptProxy) null);
0223: ScriptBuffer script = new ScriptBuffer();
0224: script.appendCall("new DatePicker", strName, intLeft, intTop,
0225: intWidth, intHeight);
0226: setInitScript(script);
0227: }
0228:
0229: /**
0230: * The instance initializer.
0231: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0232: * @param intLeft 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
0233: * @param intTop 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
0234: * @param intWidth 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
0235: * @param intHeight 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
0236: */
0237: public DatePicker(String strName, int intLeft, String intTop,
0238: int intWidth, String intHeight) {
0239: super ((Context) null, (String) null, (ScriptProxy) null);
0240: ScriptBuffer script = new ScriptBuffer();
0241: script.appendCall("new DatePicker", strName, intLeft, intTop,
0242: intWidth, intHeight);
0243: setInitScript(script);
0244: }
0245:
0246: /**
0247: * The instance initializer.
0248: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0249: * @param intLeft 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
0250: * @param intTop 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
0251: * @param intWidth 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
0252: * @param intHeight 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
0253: */
0254: public DatePicker(String strName, int intLeft, int intTop,
0255: String intWidth, String intHeight) {
0256: super ((Context) null, (String) null, (ScriptProxy) null);
0257: ScriptBuffer script = new ScriptBuffer();
0258: script.appendCall("new DatePicker", strName, intLeft, intTop,
0259: intWidth, intHeight);
0260: setInitScript(script);
0261: }
0262:
0263: /**
0264: * The instance initializer.
0265: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0266: * @param intLeft 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
0267: * @param intTop 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
0268: * @param intWidth 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
0269: * @param intHeight 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
0270: */
0271: public DatePicker(String strName, String intLeft, String intTop,
0272: int intWidth, String intHeight) {
0273: super ((Context) null, (String) null, (ScriptProxy) null);
0274: ScriptBuffer script = new ScriptBuffer();
0275: script.appendCall("new DatePicker", strName, intLeft, intTop,
0276: intWidth, intHeight);
0277: setInitScript(script);
0278: }
0279:
0280: /**
0281: * The instance initializer.
0282: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0283: * @param intLeft 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
0284: * @param intTop 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
0285: * @param intWidth 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
0286: * @param intHeight 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
0287: */
0288: public DatePicker(String strName, String intLeft, String intTop,
0289: String intWidth, String intHeight) {
0290: super ((Context) null, (String) null, (ScriptProxy) null);
0291: ScriptBuffer script = new ScriptBuffer();
0292: script.appendCall("new DatePicker", strName, intLeft, intTop,
0293: intWidth, intHeight);
0294: setInitScript(script);
0295: }
0296:
0297: /**
0298: * The instance initializer.
0299: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0300: * @param intLeft 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
0301: * @param intTop 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
0302: * @param intWidth 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
0303: * @param intHeight 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
0304: */
0305: public DatePicker(String strName, int intLeft, int intTop,
0306: int intWidth, int intHeight) {
0307: super ((Context) null, (String) null, (ScriptProxy) null);
0308: ScriptBuffer script = new ScriptBuffer();
0309: script.appendCall("new DatePicker", strName, intLeft, intTop,
0310: intWidth, intHeight);
0311: setInitScript(script);
0312: }
0313:
0314: /**
0315: * The instance initializer.
0316: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0317: * @param intLeft 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
0318: * @param intTop 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
0319: * @param intWidth 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
0320: * @param intHeight 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
0321: */
0322: public DatePicker(String strName, int intLeft, int intTop,
0323: String intWidth, int intHeight) {
0324: super ((Context) null, (String) null, (ScriptProxy) null);
0325: ScriptBuffer script = new ScriptBuffer();
0326: script.appendCall("new DatePicker", strName, intLeft, intTop,
0327: intWidth, intHeight);
0328: setInitScript(script);
0329: }
0330:
0331: /**
0332: * Shows the calendar for this date picker and places focus within the calendar as though the user had clicked
0333: on the show calendar button. The calendar hides automatically when focus leaves the calendar.
0334: */
0335: public void focusCalendar() {
0336: ScriptBuffer script = new ScriptBuffer();
0337: script.appendCall(getContextPath() + "focusCalendar");
0338: getScriptProxy().addScript(script);
0339: }
0340:
0341: /**
0342: * Returns the jsxformat field
0343: * @param callback jsxformat
0344: */
0345: @SuppressWarnings("unchecked")
0346: public void getFormat(
0347: org.directwebremoting.proxy.Callback<String> callback) {
0348: ScriptBuffer script = new ScriptBuffer();
0349: String callbackPrefix = "";
0350:
0351: if (callback != null) {
0352: callbackPrefix = "var reply = ";
0353: }
0354:
0355: script.appendCall(callbackPrefix + getContextPath()
0356: + "getFormat");
0357:
0358: if (callback != null) {
0359: String key = org.directwebremoting.extend.CallbackHelper
0360: .saveCallback(callback, String.class);
0361: script
0362: .appendCall("__System.activateCallback", key,
0363: "reply");
0364: }
0365:
0366: getScriptProxy().addScript(script);
0367: }
0368:
0369: /**
0370: * Sets the format of this date picker. The format should conform to the syntax of jsx3.util.DatePicker.
0371: The provided format may also be an integer, in which case it is intepreted as one of of the fields of
0372: DatePicker - SHORT, MEDIUM, LONG, or FULL - and
0373: the displayed format will be localized accordingly.
0374: * @param jsxformat the new format.
0375: */
0376: public void setFormat(int jsxformat) {
0377: ScriptBuffer script = new ScriptBuffer();
0378: script.appendCall(getContextPath() + "setFormat", jsxformat);
0379: getScriptProxy().addScript(script);
0380: }
0381:
0382: /**
0383: * Sets the format of this date picker. The format should conform to the syntax of jsx3.util.DatePicker.
0384: The provided format may also be an integer, in which case it is intepreted as one of of the fields of
0385: DatePicker - SHORT, MEDIUM, LONG, or FULL - and
0386: the displayed format will be localized accordingly.
0387: * @param jsxformat the new format.
0388: */
0389: public void setFormat(String jsxformat) {
0390: ScriptBuffer script = new ScriptBuffer();
0391: script.appendCall(getContextPath() + "setFormat", jsxformat);
0392: getScriptProxy().addScript(script);
0393: }
0394:
0395: /**
0396: * Returns the jsxfirstweekday field
0397: * @param callback jsxfirstweekday
0398: */
0399: @SuppressWarnings("unchecked")
0400: public void getFirstDayOfWeek(
0401: org.directwebremoting.proxy.Callback<Integer> callback) {
0402: ScriptBuffer script = new ScriptBuffer();
0403: String callbackPrefix = "";
0404:
0405: if (callback != null) {
0406: callbackPrefix = "var reply = ";
0407: }
0408:
0409: script.appendCall(callbackPrefix + getContextPath()
0410: + "getFirstDayOfWeek");
0411:
0412: if (callback != null) {
0413: String key = org.directwebremoting.extend.CallbackHelper
0414: .saveCallback(callback, Integer.class);
0415: script
0416: .appendCall("__System.activateCallback", key,
0417: "reply");
0418: }
0419:
0420: getScriptProxy().addScript(script);
0421: }
0422:
0423: /**
0424: * Sets the jsxfirstweekday field
0425: * @param jsxfirstweekday the new value for jsxfirstweekday
0426: */
0427: public void setFirstDayOfWeek(int jsxfirstweekday) {
0428: ScriptBuffer script = new ScriptBuffer();
0429: script.appendCall(getContextPath() + "setFirstDayOfWeek",
0430: jsxfirstweekday);
0431: getScriptProxy().addScript(script);
0432: }
0433:
0434: /**
0435: * Returns the current value of this form field as a JavaScript Date object.
0436: */
0437: @SuppressWarnings("unchecked")
0438: public void getDate(
0439: org.directwebremoting.proxy.Callback<java.util.Date> callback) {
0440: ScriptBuffer script = new ScriptBuffer();
0441: String callbackPrefix = "";
0442:
0443: if (callback != null) {
0444: callbackPrefix = "var reply = ";
0445: }
0446:
0447: script
0448: .appendCall(callbackPrefix + getContextPath()
0449: + "getDate");
0450:
0451: if (callback != null) {
0452: String key = org.directwebremoting.extend.CallbackHelper
0453: .saveCallback(callback, java.util.Date.class);
0454: script
0455: .appendCall("__System.activateCallback", key,
0456: "reply");
0457: }
0458:
0459: getScriptProxy().addScript(script);
0460: }
0461:
0462: /**
0463: * Returns the value of this form field (the string displayed in the text box).
0464: */
0465: @SuppressWarnings("unchecked")
0466: public void getValue(
0467: org.directwebremoting.proxy.Callback<String> callback) {
0468: ScriptBuffer script = new ScriptBuffer();
0469: String callbackPrefix = "";
0470:
0471: if (callback != null) {
0472: callbackPrefix = "var reply = ";
0473: }
0474:
0475: script.appendCall(callbackPrefix + getContextPath()
0476: + "getValue");
0477:
0478: if (callback != null) {
0479: String key = org.directwebremoting.extend.CallbackHelper
0480: .saveCallback(callback, String.class);
0481: script
0482: .appendCall("__System.activateCallback", key,
0483: "reply");
0484: }
0485:
0486: getScriptProxy().addScript(script);
0487: }
0488:
0489: /**
0490: * set the value of this form field
0491: * @param date may be null to clear the value of the form field
0492: */
0493: public void setDate(java.util.Date date) {
0494: ScriptBuffer script = new ScriptBuffer();
0495: script.appendCall(getContextPath() + "setDate", date);
0496: getScriptProxy().addScript(script);
0497: }
0498:
0499: /**
0500: *
0501: */
0502: @SuppressWarnings("unchecked")
0503: public void doValidate(
0504: org.directwebremoting.proxy.Callback<Integer> callback) {
0505: ScriptBuffer script = new ScriptBuffer();
0506: String callbackPrefix = "";
0507:
0508: if (callback != null) {
0509: callbackPrefix = "var reply = ";
0510: }
0511:
0512: script.appendCall(callbackPrefix + getContextPath()
0513: + "doValidate");
0514:
0515: if (callback != null) {
0516: String key = org.directwebremoting.extend.CallbackHelper
0517: .saveCallback(callback, Integer.class);
0518: script
0519: .appendCall("__System.activateCallback", key,
0520: "reply");
0521: }
0522:
0523: getScriptProxy().addScript(script);
0524: }
0525:
0526: /**
0527: * Binds the given key sequence to a callback function. Any object that has a key binding (specified with
0528: setKeyBinding()) will call this method when painted to register the key sequence with an appropriate
0529: ancestor of this form control. Any key down event that bubbles up to the ancestor without being intercepted
0530: and matches the given key sequence will invoke the given callback function.
0531:
0532: As of 3.2: The hot key will be registered with the first ancestor found that is either a
0533: jsx3.gui.Window, a jsx3.gui.Dialog, or the root block of a jsx3.app.Server.
0534: * @param fctCallback JavaScript function to execute when the given sequence is keyed by the user.
0535: * @param strKeys a plus-delimited ('+') key sequence such as <code>ctrl+s</code> or
0536: <code>ctrl+shift+alt+h</code> or <code>shift+a</code>, etc. Any combination of shift, ctrl, and alt are
0537: supported, including none. Also supported as the final token are <code>enter</code>, <code>esc</code>,
0538: <code>tab</code>, <code>del</code>, and <code>space</code>. To specify the final token as a key code, the
0539: last token can be the key code contained in brackets, <code>[13]</code>.
0540: * @return the registered hot key.
0541: */
0542: @SuppressWarnings("unchecked")
0543: public jsx3.gui.HotKey doKeyBinding(
0544: org.directwebremoting.proxy.CodeBlock fctCallback,
0545: String strKeys) {
0546: String extension = "doKeyBinding(\"" + fctCallback + "\", \""
0547: + strKeys + "\").";
0548: try {
0549: java.lang.reflect.Constructor<jsx3.gui.HotKey> ctor = jsx3.gui.HotKey.class
0550: .getConstructor(Context.class, String.class,
0551: ScriptProxy.class);
0552: return ctor.newInstance(this , extension, getScriptProxy());
0553: } catch (Exception ex) {
0554: throw new IllegalArgumentException("Unsupported type: "
0555: + jsx3.gui.HotKey.class.getName());
0556: }
0557: }
0558:
0559: /**
0560: * Resets the validation state of this control.
0561: * @return this object.
0562: */
0563: @SuppressWarnings("unchecked")
0564: public jsx3.gui.Form doReset() {
0565: String extension = "doReset().";
0566: try {
0567: java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
0568: .getConstructor(Context.class, String.class,
0569: ScriptProxy.class);
0570: return ctor.newInstance(this , extension, getScriptProxy());
0571: } catch (Exception ex) {
0572: throw new IllegalArgumentException("Unsupported type: "
0573: + jsx3.gui.Form.class.getName());
0574: }
0575: }
0576:
0577: /**
0578: * Resets the validation state of this control.
0579: * @param returnType The expected return type
0580: * @return this object.
0581: */
0582: @SuppressWarnings("unchecked")
0583: public <T> T doReset(Class<T> returnType) {
0584: String extension = "doReset().";
0585: try {
0586: java.lang.reflect.Constructor<T> ctor = returnType
0587: .getConstructor(Context.class, String.class,
0588: ScriptProxy.class);
0589: return ctor.newInstance(this , extension, getScriptProxy());
0590: } catch (Exception ex) {
0591: throw new IllegalArgumentException(
0592: "Unsupported return type: " + returnType.getName());
0593: }
0594: }
0595:
0596: /**
0597: * Returns the background color of this control when it is disabled.
0598: * @param callback valid CSS property value, (i.e., red, #ff0000)
0599: */
0600: @SuppressWarnings("unchecked")
0601: public void getDisabledBackgroundColor(
0602: org.directwebremoting.proxy.Callback<String> callback) {
0603: ScriptBuffer script = new ScriptBuffer();
0604: String callbackPrefix = "";
0605:
0606: if (callback != null) {
0607: callbackPrefix = "var reply = ";
0608: }
0609:
0610: script.appendCall(callbackPrefix + getContextPath()
0611: + "getDisabledBackgroundColor");
0612:
0613: if (callback != null) {
0614: String key = org.directwebremoting.extend.CallbackHelper
0615: .saveCallback(callback, String.class);
0616: script
0617: .appendCall("__System.activateCallback", key,
0618: "reply");
0619: }
0620:
0621: getScriptProxy().addScript(script);
0622: }
0623:
0624: /**
0625: * Returns the font color to use when this control is disabled.
0626: * @param callback valid CSS property value, (i.e., red, #ff0000)
0627: */
0628: @SuppressWarnings("unchecked")
0629: public void getDisabledColor(
0630: org.directwebremoting.proxy.Callback<String> callback) {
0631: ScriptBuffer script = new ScriptBuffer();
0632: String callbackPrefix = "";
0633:
0634: if (callback != null) {
0635: callbackPrefix = "var reply = ";
0636: }
0637:
0638: script.appendCall(callbackPrefix + getContextPath()
0639: + "getDisabledColor");
0640:
0641: if (callback != null) {
0642: String key = org.directwebremoting.extend.CallbackHelper
0643: .saveCallback(callback, String.class);
0644: script
0645: .appendCall("__System.activateCallback", key,
0646: "reply");
0647: }
0648:
0649: getScriptProxy().addScript(script);
0650: }
0651:
0652: /**
0653: * Returns the state for the form field control. If no enabled state is set, this method returns
0654: STATEENABLED.
0655: * @param callback <code>STATEDISABLED</code> or <code>STATEENABLED</code>.
0656: */
0657: @SuppressWarnings("unchecked")
0658: public void getEnabled(
0659: org.directwebremoting.proxy.Callback<Integer> callback) {
0660: ScriptBuffer script = new ScriptBuffer();
0661: String callbackPrefix = "";
0662:
0663: if (callback != null) {
0664: callbackPrefix = "var reply = ";
0665: }
0666:
0667: script.appendCall(callbackPrefix + getContextPath()
0668: + "getEnabled");
0669:
0670: if (callback != null) {
0671: String key = org.directwebremoting.extend.CallbackHelper
0672: .saveCallback(callback, Integer.class);
0673: script
0674: .appendCall("__System.activateCallback", key,
0675: "reply");
0676: }
0677:
0678: getScriptProxy().addScript(script);
0679: }
0680:
0681: /**
0682: * Returns the key binding that when keyed will fire the execute event for this control.
0683: * @param callback plus-delimited (e.g.,'+') key sequence such as ctrl+s or ctrl+shift+alt+h or shift+a, etc
0684: */
0685: @SuppressWarnings("unchecked")
0686: public void getKeyBinding(
0687: org.directwebremoting.proxy.Callback<String> callback) {
0688: ScriptBuffer script = new ScriptBuffer();
0689: String callbackPrefix = "";
0690:
0691: if (callback != null) {
0692: callbackPrefix = "var reply = ";
0693: }
0694:
0695: script.appendCall(callbackPrefix + getContextPath()
0696: + "getKeyBinding");
0697:
0698: if (callback != null) {
0699: String key = org.directwebremoting.extend.CallbackHelper
0700: .saveCallback(callback, String.class);
0701: script
0702: .appendCall("__System.activateCallback", key,
0703: "reply");
0704: }
0705:
0706: getScriptProxy().addScript(script);
0707: }
0708:
0709: /**
0710: * Returns whether or not this control is required. If the required property has never been set, this method returns
0711: OPTIONAL.
0712: * @param callback <code>REQUIRED</code> or <code>OPTIONAL</code>.
0713: */
0714: @SuppressWarnings("unchecked")
0715: public void getRequired(
0716: org.directwebremoting.proxy.Callback<Integer> callback) {
0717: ScriptBuffer script = new ScriptBuffer();
0718: String callbackPrefix = "";
0719:
0720: if (callback != null) {
0721: callbackPrefix = "var reply = ";
0722: }
0723:
0724: script.appendCall(callbackPrefix + getContextPath()
0725: + "getRequired");
0726:
0727: if (callback != null) {
0728: String key = org.directwebremoting.extend.CallbackHelper
0729: .saveCallback(callback, Integer.class);
0730: script
0731: .appendCall("__System.activateCallback", key,
0732: "reply");
0733: }
0734:
0735: getScriptProxy().addScript(script);
0736: }
0737:
0738: /**
0739: * Returns the validation state of this control. If the validationState property has never been set, this method returns
0740: STATEVALID.
0741: * @param callback <code>STATEINVALID</code> or <code>STATEVALID</code>.
0742: */
0743: @SuppressWarnings("unchecked")
0744: public void getValidationState(
0745: org.directwebremoting.proxy.Callback<Integer> callback) {
0746: ScriptBuffer script = new ScriptBuffer();
0747: String callbackPrefix = "";
0748:
0749: if (callback != null) {
0750: callbackPrefix = "var reply = ";
0751: }
0752:
0753: script.appendCall(callbackPrefix + getContextPath()
0754: + "getValidationState");
0755:
0756: if (callback != null) {
0757: String key = org.directwebremoting.extend.CallbackHelper
0758: .saveCallback(callback, Integer.class);
0759: script
0760: .appendCall("__System.activateCallback", key,
0761: "reply");
0762: }
0763:
0764: getScriptProxy().addScript(script);
0765: }
0766:
0767: /**
0768: * Sets the background color of this form control when it is disabled.
0769: * @param strColor valid CSS property value, (i.e., red, #ff0000)
0770: * @return this object.
0771: */
0772: @SuppressWarnings("unchecked")
0773: public jsx3.gui.Form setDisabledBackgroundColor(String strColor) {
0774: String extension = "setDisabledBackgroundColor(\"" + strColor
0775: + "\").";
0776: try {
0777: java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
0778: .getConstructor(Context.class, String.class,
0779: ScriptProxy.class);
0780: return ctor.newInstance(this , extension, getScriptProxy());
0781: } catch (Exception ex) {
0782: throw new IllegalArgumentException("Unsupported type: "
0783: + jsx3.gui.Form.class.getName());
0784: }
0785: }
0786:
0787: /**
0788: * Sets the background color of this form control when it is disabled.
0789: * @param strColor valid CSS property value, (i.e., red, #ff0000)
0790: * @param returnType The expected return type
0791: * @return this object.
0792: */
0793: @SuppressWarnings("unchecked")
0794: public <T> T setDisabledBackgroundColor(String strColor,
0795: Class<T> returnType) {
0796: String extension = "setDisabledBackgroundColor(\"" + strColor
0797: + "\").";
0798: try {
0799: java.lang.reflect.Constructor<T> ctor = returnType
0800: .getConstructor(Context.class, String.class,
0801: ScriptProxy.class);
0802: return ctor.newInstance(this , extension, getScriptProxy());
0803: } catch (Exception ex) {
0804: throw new IllegalArgumentException(
0805: "Unsupported return type: " + returnType.getName());
0806: }
0807: }
0808:
0809: /**
0810: * Sets the font color to use when this control is disabled.
0811: * @param strColor valid CSS property value, (i.e., red, #ff0000)
0812: * @return this object.
0813: */
0814: @SuppressWarnings("unchecked")
0815: public jsx3.gui.Form setDisabledColor(String strColor) {
0816: String extension = "setDisabledColor(\"" + strColor + "\").";
0817: try {
0818: java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
0819: .getConstructor(Context.class, String.class,
0820: ScriptProxy.class);
0821: return ctor.newInstance(this , extension, getScriptProxy());
0822: } catch (Exception ex) {
0823: throw new IllegalArgumentException("Unsupported type: "
0824: + jsx3.gui.Form.class.getName());
0825: }
0826: }
0827:
0828: /**
0829: * Sets the font color to use when this control is disabled.
0830: * @param strColor valid CSS property value, (i.e., red, #ff0000)
0831: * @param returnType The expected return type
0832: * @return this object.
0833: */
0834: @SuppressWarnings("unchecked")
0835: public <T> T setDisabledColor(String strColor, Class<T> returnType) {
0836: String extension = "setDisabledColor(\"" + strColor + "\").";
0837: try {
0838: java.lang.reflect.Constructor<T> ctor = returnType
0839: .getConstructor(Context.class, String.class,
0840: ScriptProxy.class);
0841: return ctor.newInstance(this , extension, getScriptProxy());
0842: } catch (Exception ex) {
0843: throw new IllegalArgumentException(
0844: "Unsupported return type: " + returnType.getName());
0845: }
0846: }
0847:
0848: /**
0849: * Sets whether this control is enabled. Disabled controls do not respond to user interaction.
0850: * @param intEnabled <code>STATEDISABLED</code> or <code>STATEENABLED</code>. <code>null</code> is
0851: equivalent to <code>STATEENABLED</code>.
0852: * @param bRepaint if <code>true</code> this control is immediately repainted to reflect the new setting.
0853: */
0854: public void setEnabled(int intEnabled, boolean bRepaint) {
0855: ScriptBuffer script = new ScriptBuffer();
0856: script.appendCall(getContextPath() + "setEnabled", intEnabled,
0857: bRepaint);
0858: getScriptProxy().addScript(script);
0859: }
0860:
0861: /**
0862: * Sets the key binding that when keyed will fire the bound execute (jsx3.gui.Interactive.EXECUTE)
0863: event for this control.
0864: * @param strSequence plus-delimited (e.g.,'+') key sequence such as ctrl+s or ctrl+shift+alt+h or shift+a, etc
0865: * @return this object.
0866: */
0867: @SuppressWarnings("unchecked")
0868: public jsx3.gui.Form setKeyBinding(String strSequence) {
0869: String extension = "setKeyBinding(\"" + strSequence + "\").";
0870: try {
0871: java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
0872: .getConstructor(Context.class, String.class,
0873: ScriptProxy.class);
0874: return ctor.newInstance(this , extension, getScriptProxy());
0875: } catch (Exception ex) {
0876: throw new IllegalArgumentException("Unsupported type: "
0877: + jsx3.gui.Form.class.getName());
0878: }
0879: }
0880:
0881: /**
0882: * Sets the key binding that when keyed will fire the bound execute (jsx3.gui.Interactive.EXECUTE)
0883: event for this control.
0884: * @param strSequence plus-delimited (e.g.,'+') key sequence such as ctrl+s or ctrl+shift+alt+h or shift+a, etc
0885: * @param returnType The expected return type
0886: * @return this object.
0887: */
0888: @SuppressWarnings("unchecked")
0889: public <T> T setKeyBinding(String strSequence, Class<T> returnType) {
0890: String extension = "setKeyBinding(\"" + strSequence + "\").";
0891: try {
0892: java.lang.reflect.Constructor<T> ctor = returnType
0893: .getConstructor(Context.class, String.class,
0894: ScriptProxy.class);
0895: return ctor.newInstance(this , extension, getScriptProxy());
0896: } catch (Exception ex) {
0897: throw new IllegalArgumentException(
0898: "Unsupported return type: " + returnType.getName());
0899: }
0900: }
0901:
0902: /**
0903: * Sets whether or not this control is required.
0904: * @param required {int} <code>REQUIRED</code> or <code>OPTIONAL</code>.
0905: * @return this object.
0906: */
0907: @SuppressWarnings("unchecked")
0908: public jsx3.gui.Form setRequired(int required) {
0909: String extension = "setRequired(\"" + required + "\").";
0910: try {
0911: java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
0912: .getConstructor(Context.class, String.class,
0913: ScriptProxy.class);
0914: return ctor.newInstance(this , extension, getScriptProxy());
0915: } catch (Exception ex) {
0916: throw new IllegalArgumentException("Unsupported type: "
0917: + jsx3.gui.Form.class.getName());
0918: }
0919: }
0920:
0921: /**
0922: * Sets whether or not this control is required.
0923: * @param required {int} <code>REQUIRED</code> or <code>OPTIONAL</code>.
0924: * @param returnType The expected return type
0925: * @return this object.
0926: */
0927: @SuppressWarnings("unchecked")
0928: public <T> T setRequired(int required, Class<T> returnType) {
0929: String extension = "setRequired(\"" + required + "\").";
0930: try {
0931: java.lang.reflect.Constructor<T> ctor = returnType
0932: .getConstructor(Context.class, String.class,
0933: ScriptProxy.class);
0934: return ctor.newInstance(this , extension, getScriptProxy());
0935: } catch (Exception ex) {
0936: throw new IllegalArgumentException(
0937: "Unsupported return type: " + returnType.getName());
0938: }
0939: }
0940:
0941: /**
0942: * Sets the validation state of this control. The validation state of a control is not serialized.
0943: * @param intState <code>STATEINVALID</code> or <code>STATEVALID</code>.
0944: * @return this object.
0945: */
0946: @SuppressWarnings("unchecked")
0947: public jsx3.gui.Form setValidationState(int intState) {
0948: String extension = "setValidationState(\"" + intState + "\").";
0949: try {
0950: java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
0951: .getConstructor(Context.class, String.class,
0952: ScriptProxy.class);
0953: return ctor.newInstance(this , extension, getScriptProxy());
0954: } catch (Exception ex) {
0955: throw new IllegalArgumentException("Unsupported type: "
0956: + jsx3.gui.Form.class.getName());
0957: }
0958: }
0959:
0960: /**
0961: * Sets the validation state of this control. The validation state of a control is not serialized.
0962: * @param intState <code>STATEINVALID</code> or <code>STATEVALID</code>.
0963: * @param returnType The expected return type
0964: * @return this object.
0965: */
0966: @SuppressWarnings("unchecked")
0967: public <T> T setValidationState(int intState, Class<T> returnType) {
0968: String extension = "setValidationState(\"" + intState + "\").";
0969: try {
0970: java.lang.reflect.Constructor<T> ctor = returnType
0971: .getConstructor(Context.class, String.class,
0972: ScriptProxy.class);
0973: return ctor.newInstance(this , extension, getScriptProxy());
0974: } catch (Exception ex) {
0975: throw new IllegalArgumentException(
0976: "Unsupported return type: " + returnType.getName());
0977: }
0978: }
0979:
0980: /**
0981: * Sets the value of this control.
0982: * @param vntValue string/int value for the component
0983: * @return this object.
0984: */
0985: @SuppressWarnings("unchecked")
0986: public jsx3.gui.Form setValue(Integer vntValue) {
0987: String extension = "setValue(\"" + vntValue + "\").";
0988: try {
0989: java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
0990: .getConstructor(Context.class, String.class,
0991: ScriptProxy.class);
0992: return ctor.newInstance(this , extension, getScriptProxy());
0993: } catch (Exception ex) {
0994: throw new IllegalArgumentException("Unsupported type: "
0995: + jsx3.gui.Form.class.getName());
0996: }
0997: }
0998:
0999: /**
1000: * Sets the value of this control.
1001: * @param vntValue string/int value for the component
1002: * @param returnType The expected return type
1003: * @return this object.
1004: */
1005: @SuppressWarnings("unchecked")
1006: public <T> T setValue(Integer vntValue, Class<T> returnType) {
1007: String extension = "setValue(\"" + vntValue + "\").";
1008: try {
1009: java.lang.reflect.Constructor<T> ctor = returnType
1010: .getConstructor(Context.class, String.class,
1011: ScriptProxy.class);
1012: return ctor.newInstance(this , extension, getScriptProxy());
1013: } catch (Exception ex) {
1014: throw new IllegalArgumentException(
1015: "Unsupported return type: " + returnType.getName());
1016: }
1017: }
1018:
1019: /**
1020: * Sets the value of this control.
1021: * @param vntValue string/int value for the component
1022: * @return this object.
1023: */
1024: @SuppressWarnings("unchecked")
1025: public jsx3.gui.Form setValue(String vntValue) {
1026: String extension = "setValue(\"" + vntValue + "\").";
1027: try {
1028: java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
1029: .getConstructor(Context.class, String.class,
1030: ScriptProxy.class);
1031: return ctor.newInstance(this , extension, getScriptProxy());
1032: } catch (Exception ex) {
1033: throw new IllegalArgumentException("Unsupported type: "
1034: + jsx3.gui.Form.class.getName());
1035: }
1036: }
1037:
1038: /**
1039: * Sets the value of this control.
1040: * @param vntValue string/int value for the component
1041: * @param returnType The expected return type
1042: * @return this object.
1043: */
1044: @SuppressWarnings("unchecked")
1045: public <T> T setValue(String vntValue, Class<T> returnType) {
1046: String extension = "setValue(\"" + vntValue + "\").";
1047: try {
1048: java.lang.reflect.Constructor<T> ctor = returnType
1049: .getConstructor(Context.class, String.class,
1050: ScriptProxy.class);
1051: return ctor.newInstance(this , extension, getScriptProxy());
1052: } catch (Exception ex) {
1053: throw new IllegalArgumentException(
1054: "Unsupported return type: " + returnType.getName());
1055: }
1056: }
1057:
1058: }
|