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 lightweight control that displays CDF data in an HTML table. Supports both single- and multi-selection
0024: modes. Data can be sorted by clicking on column labels. Output and output formatting can be customized using
0025: a combination of XSLT, inline CSS properties, or named CSS rules. The columns
0026: for this control are defined within the object model and are not defined
0027: in the DOM as child objects.
0028:
0029: The Table class by default supports the following CDF attributes:
0030:
0031:
0032: jsxid
0033:
0034:
0035: jsxselected
0036:
0037:
0038: jsxstyle
0039:
0040:
0041: jsxclass
0042:
0043:
0044: jsximg
0045:
0046:
0047: jsxtip
0048:
0049:
0050: jsxunselectable
0051:
0052:
0053: jsxexecute
0054:
0055:
0056: This class publishes the following model events:
0057:
0058:
0059: EXECUTE Ð
0060:
0061: MENU Ð
0062:
0063: CHANGE Ð
0064:
0065: SPYGLASS Ð
0066: * @author Joe Walker [joe at getahead dot org]
0067: * @author DRAPGEN - Dwr Reverse Ajax Proxy GENerator
0068: */
0069: public class Table extends jsx3.gui.Block {
0070: /**
0071: * All reverse ajax proxies need context to work from
0072: * @param scriptProxy The place we are writing scripts to
0073: * @param context The script that got us to where we are now
0074: */
0075: public Table(Context context, String extension,
0076: ScriptProxy scriptProxy) {
0077: super (context, extension, scriptProxy);
0078: }
0079:
0080: /**
0081: * instance initializer
0082: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0083: */
0084: public Table(String strName) {
0085: super ((Context) null, (String) null, (ScriptProxy) null);
0086: ScriptBuffer script = new ScriptBuffer();
0087: script.appendCall("new Table", strName);
0088: setInitScript(script);
0089: }
0090:
0091: /**
0092: *
0093: */
0094: public static final String DEFAULTXSLURL = null;
0095:
0096: /**
0097: * text (default)
0098: */
0099: public static final String TYPE_TEXT = "text";
0100:
0101: /**
0102: * number
0103: */
0104: public static final String TYPE_NUMBER = "number";
0105:
0106: /**
0107: * jsx:///images/table/select.gif
0108: */
0109: public static final String SELECTION_BG = "jsx:///images/table/select.gif";
0110:
0111: /**
0112: * Enum value for the multiSelect property indicating an unselectable table.
0113: */
0114: public static final int SELECTION_UNSELECTABLE = 0;
0115:
0116: /**
0117: * Enum value for the multiSelect property indicating a multi-select table.
0118: */
0119: public static final int SELECTION_ROW = 1;
0120:
0121: /**
0122: * Enum value for the multiSelect property indicating a single-select table.
0123: */
0124: public static final int SELECTION_MULTI_ROW = 2;
0125:
0126: /**
0127: * ascending
0128: */
0129: public static final String SORT_ASCENDING = "ascending";
0130:
0131: /**
0132: * descending
0133: */
0134: public static final String SORT_DESCENDING = "descending";
0135:
0136: /**
0137: * jsx:///images/table/sort_desc.gif (default)
0138: */
0139: public static final String SORT_DESCENDING_IMG = null;
0140:
0141: /**
0142: * jsx:///images/table/sort_asc.gif (default)
0143: */
0144: public static final String SORT_ASCENDING_IMG = null;
0145:
0146: /**
0147: * 20
0148: */
0149: public static final int DEFAULT_HEADER_HEIGHT = 20;
0150:
0151: /**
0152: * validates the Table; if the Table is set to 'required', a selection must be made to pass validation. Otherwise, a Table will always pass validation
0153: * @param callback one of: jsx3.gui.Form.STATEINVALID or jsx3.gui.Form.STATEVALID
0154: */
0155: @SuppressWarnings("unchecked")
0156: public void doValidate(
0157: org.directwebremoting.proxy.Callback<Integer> callback) {
0158: ScriptBuffer script = new ScriptBuffer();
0159: String callbackPrefix = "";
0160:
0161: if (callback != null) {
0162: callbackPrefix = "var reply = ";
0163: }
0164:
0165: script.appendCall(callbackPrefix + getContextPath()
0166: + "doValidate");
0167:
0168: if (callback != null) {
0169: String key = org.directwebremoting.extend.CallbackHelper
0170: .saveCallback(callback, Integer.class);
0171: script
0172: .appendCall("__System.activateCallback", key,
0173: "reply");
0174: }
0175:
0176: getScriptProxy().addScript(script);
0177: }
0178:
0179: /**
0180: * Returns an array of selected values (or empty array) if the selection model is Table.SELECTION_MULTI_ROW. Returns a string (or null)
0181: for the other selection models
0182: */
0183: @SuppressWarnings("unchecked")
0184: public void getValue(
0185: org.directwebremoting.proxy.Callback<String> callback) {
0186: ScriptBuffer script = new ScriptBuffer();
0187: String callbackPrefix = "";
0188:
0189: if (callback != null) {
0190: callbackPrefix = "var reply = ";
0191: }
0192:
0193: script.appendCall(callbackPrefix + getContextPath()
0194: + "getValue");
0195:
0196: if (callback != null) {
0197: String key = org.directwebremoting.extend.CallbackHelper
0198: .saveCallback(callback, String.class);
0199: script
0200: .appendCall("__System.activateCallback", key,
0201: "reply");
0202: }
0203:
0204: getScriptProxy().addScript(script);
0205: }
0206:
0207: /**
0208: * Sets the value of this table. Deselects all existing selections. Scrolls the first record into view.
0209: * @param strId jsxid attribute for the CDF record(s) to select
0210: * @return this object.
0211: */
0212: public jsx3.gui.Table setValue(String strId) {
0213: ScriptBuffer script = new ScriptBuffer();
0214: script.appendCall(getContextPath() + "setValue", strId);
0215: getScriptProxy().addScript(script);
0216: return this ;
0217: }
0218:
0219: /**
0220: * Sets the value of this table. Deselects all existing selections. Scrolls the first record into view.
0221: * @param strId jsxid attribute for the CDF record(s) to select
0222: * @return this object.
0223: */
0224: public jsx3.gui.Table setValue(Object[] strId) {
0225: ScriptBuffer script = new ScriptBuffer();
0226: script.appendCall(getContextPath() + "setValue", strId);
0227: getScriptProxy().addScript(script);
0228: return this ;
0229: }
0230:
0231: /**
0232: * Returns the on-screen cell that represents the intersection of the row identified
0233: by strCdfId and the first cell mapped to the named CDF attribute, strAttName.
0234: * @param strCdfId jsxid property for CDF record
0235: * @param strAttName attribute name on the CDF record. For example, <code>jsxtext</code>
0236: */
0237: @SuppressWarnings("unchecked")
0238: public void getContentElement(String strCdfId, String strAttName,
0239: org.directwebremoting.proxy.Callback<String> callback) {
0240: ScriptBuffer script = new ScriptBuffer();
0241: String callbackPrefix = "";
0242:
0243: if (callback != null) {
0244: callbackPrefix = "var reply = ";
0245: }
0246:
0247: script.appendCall(callbackPrefix + getContextPath()
0248: + "getContentElement", strCdfId, strAttName);
0249:
0250: if (callback != null) {
0251: String key = org.directwebremoting.extend.CallbackHelper
0252: .saveCallback(callback, String.class);
0253: script
0254: .appendCall("__System.activateCallback", key,
0255: "reply");
0256: }
0257:
0258: getScriptProxy().addScript(script);
0259: }
0260:
0261: /**
0262: * Applies focus to the on-screen row indentified by the CDF record id that generated it
0263: * @param strCdfId jsxid property for the corresponding CDF record
0264: */
0265: public void focusRowById(String strCdfId) {
0266: ScriptBuffer script = new ScriptBuffer();
0267: script.appendCall(getContextPath() + "focusRowById", strCdfId);
0268: getScriptProxy().addScript(script);
0269: }
0270:
0271: /**
0272: * Returns the selection model. If no selection type is specified, the instance will employ single row selection (SELECTION_ROW)
0273: * @param strDefault The default value to use if null
0274: */
0275: @SuppressWarnings("unchecked")
0276: public void getSelectionModel(String strDefault,
0277: org.directwebremoting.proxy.Callback<Integer> callback) {
0278: ScriptBuffer script = new ScriptBuffer();
0279: String callbackPrefix = "";
0280:
0281: if (callback != null) {
0282: callbackPrefix = "var reply = ";
0283: }
0284:
0285: script.appendCall(callbackPrefix + getContextPath()
0286: + "getSelectionModel", strDefault);
0287:
0288: if (callback != null) {
0289: String key = org.directwebremoting.extend.CallbackHelper
0290: .saveCallback(callback, Integer.class);
0291: script
0292: .appendCall("__System.activateCallback", key,
0293: "reply");
0294: }
0295:
0296: getScriptProxy().addScript(script);
0297: }
0298:
0299: /**
0300: * Sets the selection model
0301: * @param intType one of Table: .SELECTION_UNSELECTABLE, .SELECTION_ROW, .SELECTION_MULTI_ROW
0302: */
0303: public void setSelectionModel(int intType) {
0304: ScriptBuffer script = new ScriptBuffer();
0305: script.appendCall(getContextPath() + "setSelectionModel",
0306: intType);
0307: getScriptProxy().addScript(script);
0308: }
0309:
0310: /**
0311: * Returns the CSS string to apply to a Row/Cell when it has focus
0312: * @param strDefault The default value to use if null (Table.SELECTION_BG)
0313: */
0314: @SuppressWarnings("unchecked")
0315: public void getSelectionBG(String strDefault,
0316: org.directwebremoting.proxy.Callback<String> callback) {
0317: ScriptBuffer script = new ScriptBuffer();
0318: String callbackPrefix = "";
0319:
0320: if (callback != null) {
0321: callbackPrefix = "var reply = ";
0322: }
0323:
0324: script.appendCall(callbackPrefix + getContextPath()
0325: + "getSelectionBG", strDefault);
0326:
0327: if (callback != null) {
0328: String key = org.directwebremoting.extend.CallbackHelper
0329: .saveCallback(callback, String.class);
0330: script
0331: .appendCall("__System.activateCallback", key,
0332: "reply");
0333: }
0334:
0335: getScriptProxy().addScript(script);
0336: }
0337:
0338: /**
0339: * Sets the URL for the image to use (as the repeating background image) to denote selection.
0340: * @param strURL
0341: */
0342: public void setSelectionBG(String strURL) {
0343: ScriptBuffer script = new ScriptBuffer();
0344: script.appendCall(getContextPath() + "setSelectionBG", strURL);
0345: getScriptProxy().addScript(script);
0346: }
0347:
0348: /**
0349: * Returns the collection of selected records.
0350: */
0351: @SuppressWarnings("unchecked")
0352: public void getSelectedNodes(
0353: org.directwebremoting.proxy.Callback<java.util.List> callback) {
0354: ScriptBuffer script = new ScriptBuffer();
0355: String callbackPrefix = "";
0356:
0357: if (callback != null) {
0358: callbackPrefix = "var reply = ";
0359: }
0360:
0361: script.appendCall(callbackPrefix + getContextPath()
0362: + "getSelectedNodes");
0363:
0364: if (callback != null) {
0365: String key = org.directwebremoting.extend.CallbackHelper
0366: .saveCallback(callback, java.util.List.class);
0367: script
0368: .appendCall("__System.activateCallback", key,
0369: "reply");
0370: }
0371:
0372: getScriptProxy().addScript(script);
0373: }
0374:
0375: /**
0376: * Returns the jsxid(s) for the selected record(s). Equivalent to this.getValue() except that the return value is always an Array.
0377: * @param callback JavaScript array of stings
0378: */
0379: @SuppressWarnings("unchecked")
0380: public void getSelectedIds(
0381: org.directwebremoting.proxy.Callback<Object[]> callback) {
0382: ScriptBuffer script = new ScriptBuffer();
0383: String callbackPrefix = "";
0384:
0385: if (callback != null) {
0386: callbackPrefix = "var reply = ";
0387: }
0388:
0389: script.appendCall(callbackPrefix + getContextPath()
0390: + "getSelectedIds");
0391:
0392: if (callback != null) {
0393: String key = org.directwebremoting.extend.CallbackHelper
0394: .saveCallback(callback, Object[].class);
0395: script
0396: .appendCall("__System.activateCallback", key,
0397: "reply");
0398: }
0399:
0400: getScriptProxy().addScript(script);
0401: }
0402:
0403: /**
0404: * Selects a CDF record of this list. The item will be highlighted in the view and the CDF data will be updated
0405: accordingly. If this list is a multi-select list then this selection will be added to any previous selection.
0406: * @param strRecordId the jsxid of the record to select.
0407: */
0408: public void selectRecord(String strRecordId) {
0409: ScriptBuffer script = new ScriptBuffer();
0410: script.appendCall(getContextPath() + "selectRecord",
0411: strRecordId);
0412: getScriptProxy().addScript(script);
0413: }
0414:
0415: /**
0416: * Deselects a CDF record within the Table. Both the view and the data model (CDF) will be updated
0417: * @param strRecordId the jsxid of the record to deselect.
0418: */
0419: public void deselectRecord(String strRecordId) {
0420: ScriptBuffer script = new ScriptBuffer();
0421: script.appendCall(getContextPath() + "deselectRecord",
0422: strRecordId);
0423: getScriptProxy().addScript(script);
0424: }
0425:
0426: /**
0427: * Deselects all selected CDF records.
0428: */
0429: public void deselectAllRecords() {
0430: ScriptBuffer script = new ScriptBuffer();
0431: script.appendCall(getContextPath() + "deselectAllRecords");
0432: getScriptProxy().addScript(script);
0433: }
0434:
0435: /**
0436: * Sorts according to the current sort path. If no sort direction is specified, the sort direction will be toggled.
0437: * @param intSortDir <code>jsx3.gui.Table.SORT_ASCENDING</code> or <code>jsx3.gui.Table.SORT_DESCENDING</code>.
0438: */
0439: public void doSort(String intSortDir) {
0440: ScriptBuffer script = new ScriptBuffer();
0441: script.appendCall(getContextPath() + "doSort", intSortDir);
0442: getScriptProxy().addScript(script);
0443: }
0444:
0445: /**
0446: * Returns the name of the CDF attribute to sort on. If no value is set an empty string is returned by default.
0447: */
0448: @SuppressWarnings("unchecked")
0449: public void getSortPath(
0450: org.directwebremoting.proxy.Callback<String> callback) {
0451: ScriptBuffer script = new ScriptBuffer();
0452: String callbackPrefix = "";
0453:
0454: if (callback != null) {
0455: callbackPrefix = "var reply = ";
0456: }
0457:
0458: script.appendCall(callbackPrefix + getContextPath()
0459: + "getSortPath");
0460:
0461: if (callback != null) {
0462: String key = org.directwebremoting.extend.CallbackHelper
0463: .saveCallback(callback, String.class);
0464: script
0465: .appendCall("__System.activateCallback", key,
0466: "reply");
0467: }
0468:
0469: getScriptProxy().addScript(script);
0470: }
0471:
0472: /**
0473: * Sets the name of the CDF attribute to sort on. The records in the data source of this table are sorted
0474: on this attribute before being painted to screen.
0475: * @param strAttr
0476: */
0477: public void setSortPath(String strAttr) {
0478: ScriptBuffer script = new ScriptBuffer();
0479: script.appendCall(getContextPath() + "setSortPath", strAttr);
0480: getScriptProxy().addScript(script);
0481: }
0482:
0483: /**
0484: * Returns the data type to be used for sorting this list.
0485: * @param callback <code>jsx3.gui.Table.TYPE_TEXT</code> or <code>jsx3.gui.Table.TYPE_NUMBER</code>
0486: */
0487: @SuppressWarnings("unchecked")
0488: public void getSortType(
0489: org.directwebremoting.proxy.Callback<String> callback) {
0490: ScriptBuffer script = new ScriptBuffer();
0491: String callbackPrefix = "";
0492:
0493: if (callback != null) {
0494: callbackPrefix = "var reply = ";
0495: }
0496:
0497: script.appendCall(callbackPrefix + getContextPath()
0498: + "getSortType");
0499:
0500: if (callback != null) {
0501: String key = org.directwebremoting.extend.CallbackHelper
0502: .saveCallback(callback, String.class);
0503: script
0504: .appendCall("__System.activateCallback", key,
0505: "reply");
0506: }
0507:
0508: getScriptProxy().addScript(script);
0509: }
0510:
0511: /**
0512: * Sets the data type for the list.
0513: * @param DATATYPE data type for this column's data. Valid types include: jsx3.gui.Table.TYPE_TEXT and jsx3.gui.Table.TYPE_NUMBER
0514: */
0515: public void setSortType(String DATATYPE) {
0516: ScriptBuffer script = new ScriptBuffer();
0517: script.appendCall(getContextPath() + "setSortType", DATATYPE);
0518: getScriptProxy().addScript(script);
0519: }
0520:
0521: /**
0522: * Returns the direction (jsx3.gui.Table.SORT_ASCENDING or jsx3.gui.Table.SORT_DESCENDING) for the sorted column; if no direction specified, ascending is returned
0523: * @param callback one of: jsx3.gui.Table.SORT_ASCENDING or jsx3.gui.Table.SORT_DESCENDING
0524: */
0525: @SuppressWarnings("unchecked")
0526: public void getSortDirection(
0527: org.directwebremoting.proxy.Callback<String> callback) {
0528: ScriptBuffer script = new ScriptBuffer();
0529: String callbackPrefix = "";
0530:
0531: if (callback != null) {
0532: callbackPrefix = "var reply = ";
0533: }
0534:
0535: script.appendCall(callbackPrefix + getContextPath()
0536: + "getSortDirection");
0537:
0538: if (callback != null) {
0539: String key = org.directwebremoting.extend.CallbackHelper
0540: .saveCallback(callback, String.class);
0541: script
0542: .appendCall("__System.activateCallback", key,
0543: "reply");
0544: }
0545:
0546: getScriptProxy().addScript(script);
0547: }
0548:
0549: /**
0550: * Sets the direction (ascending or descending) for the sorted column.
0551: * @param intSortDir one of: jsx3.gui.Table.SORT_ASCENDING or jsx3.gui.Table.SORT_DESCENDING
0552: */
0553: public void setSortDirection(String intSortDir) {
0554: ScriptBuffer script = new ScriptBuffer();
0555: script.appendCall(getContextPath() + "setSortDirection",
0556: intSortDir);
0557: getScriptProxy().addScript(script);
0558: }
0559:
0560: /**
0561: * Returns whether the table is sortable. If null or jsx3.Boolean.TRUE, the instance is sortable.
0562: */
0563: @SuppressWarnings("unchecked")
0564: public void getCanSort(
0565: org.directwebremoting.proxy.Callback<Integer> callback) {
0566: ScriptBuffer script = new ScriptBuffer();
0567: String callbackPrefix = "";
0568:
0569: if (callback != null) {
0570: callbackPrefix = "var reply = ";
0571: }
0572:
0573: script.appendCall(callbackPrefix + getContextPath()
0574: + "getCanSort");
0575:
0576: if (callback != null) {
0577: String key = org.directwebremoting.extend.CallbackHelper
0578: .saveCallback(callback, Integer.class);
0579: script
0580: .appendCall("__System.activateCallback", key,
0581: "reply");
0582: }
0583:
0584: getScriptProxy().addScript(script);
0585: }
0586:
0587: /**
0588: * Sets whether the table is sortable.
0589: * @param SORT one of <code>jsx3.Boolean.TRUE</code> or <code>jsx3.Boolean.FALSE</code>
0590: */
0591: public void setCanSort(int SORT) {
0592: ScriptBuffer script = new ScriptBuffer();
0593: script.appendCall(getContextPath() + "setCanSort", SORT);
0594: getScriptProxy().addScript(script);
0595: }
0596:
0597: /**
0598: * This method implements redraw support by repainting the entire control.
0599: * @param strRecordId
0600: * @param ACTION
0601: * @return this object
0602: */
0603: @SuppressWarnings("unchecked")
0604: public jsx3.gui.Table redrawRecord(String strRecordId,
0605: java.lang.Object ACTION) {
0606: String extension = "redrawRecord(\"" + strRecordId + "\", \""
0607: + ACTION + "\").";
0608: try {
0609: java.lang.reflect.Constructor<jsx3.gui.Table> ctor = jsx3.gui.Table.class
0610: .getConstructor(Context.class, String.class,
0611: ScriptProxy.class);
0612: return ctor.newInstance(this , extension, getScriptProxy());
0613: } catch (Exception ex) {
0614: throw new IllegalArgumentException("Unsupported type: "
0615: + jsx3.gui.Table.class.getName());
0616: }
0617: }
0618:
0619: /**
0620: * Paints only the header row. Call for quick repainting of the header row and not the data rows.
0621: */
0622: public void repaintHead() {
0623: ScriptBuffer script = new ScriptBuffer();
0624: script.appendCall(getContextPath() + "repaintHead");
0625: getScriptProxy().addScript(script);
0626: }
0627:
0628: /**
0629: * Paints only the data rows. Call for quick repainting of the data rows when only the source data
0630: has changed. Does not recalculate and reprofile the box profile and resulting XSLT. Retains scroll position when possible.
0631: */
0632: public void repaintData() {
0633: ScriptBuffer script = new ScriptBuffer();
0634: script.appendCall(getContextPath() + "repaintData");
0635: getScriptProxy().addScript(script);
0636: }
0637:
0638: /**
0639: * Returns the CSS style for the HTML row containing the column headers.
0640: * @param strDefault
0641: */
0642: @SuppressWarnings("unchecked")
0643: public void getHeaderStyle(String strDefault,
0644: org.directwebremoting.proxy.Callback<String> callback) {
0645: ScriptBuffer script = new ScriptBuffer();
0646: String callbackPrefix = "";
0647:
0648: if (callback != null) {
0649: callbackPrefix = "var reply = ";
0650: }
0651:
0652: script.appendCall(callbackPrefix + getContextPath()
0653: + "getHeaderStyle", strDefault);
0654:
0655: if (callback != null) {
0656: String key = org.directwebremoting.extend.CallbackHelper
0657: .saveCallback(callback, String.class);
0658: script
0659: .appendCall("__System.activateCallback", key,
0660: "reply");
0661: }
0662:
0663: getScriptProxy().addScript(script);
0664: }
0665:
0666: /**
0667: * Sets the CSS style properties for the HTML row containing the column headers. Multiple properties are supported.
0668: For example: background-image:url(JSXAPPS/myproject/images/bg.gif);font-family:Arial;.
0669: The following CSS properties (those affecting layout and position) are not allowed: width, height,
0670: left, top, position, overflow, border, padding, margin.
0671: * @param strCSS
0672: */
0673: public void setHeaderStyle(String strCSS) {
0674: ScriptBuffer script = new ScriptBuffer();
0675: script.appendCall(getContextPath() + "setHeaderStyle", strCSS);
0676: getScriptProxy().addScript(script);
0677: }
0678:
0679: /**
0680: * Returns the CSS rule for the HTML row containing the column headers.
0681: * @param strDefault
0682: */
0683: @SuppressWarnings("unchecked")
0684: public void getHeaderClass(String strDefault,
0685: org.directwebremoting.proxy.Callback<String> callback) {
0686: ScriptBuffer script = new ScriptBuffer();
0687: String callbackPrefix = "";
0688:
0689: if (callback != null) {
0690: callbackPrefix = "var reply = ";
0691: }
0692:
0693: script.appendCall(callbackPrefix + getContextPath()
0694: + "getHeaderClass", strDefault);
0695:
0696: if (callback != null) {
0697: String key = org.directwebremoting.extend.CallbackHelper
0698: .saveCallback(callback, String.class);
0699: script
0700: .appendCall("__System.activateCallback", key,
0701: "reply");
0702: }
0703:
0704: getScriptProxy().addScript(script);
0705: }
0706:
0707: /**
0708: * Sets the CSS rule for the HTML row containing the column headers. Multiple rules are supported.
0709: For example: boldText titleText.
0710: The following CSS properties (those affecting layout and position) are not allowed for the rule: width, height,
0711: left, top, position, overflow, border, padding, margin.
0712: * @param strRuleName
0713: */
0714: public void setHeaderClass(String strRuleName) {
0715: ScriptBuffer script = new ScriptBuffer();
0716: script.appendCall(getContextPath() + "setHeaderClass",
0717: strRuleName);
0718: getScriptProxy().addScript(script);
0719: }
0720:
0721: /**
0722: * Returns the CSS properties for the HTML row elements(s) containing the table data.
0723: */
0724: @SuppressWarnings("unchecked")
0725: public void getRowStyle(
0726: org.directwebremoting.proxy.Callback<String> callback) {
0727: ScriptBuffer script = new ScriptBuffer();
0728: String callbackPrefix = "";
0729:
0730: if (callback != null) {
0731: callbackPrefix = "var reply = ";
0732: }
0733:
0734: script.appendCall(callbackPrefix + getContextPath()
0735: + "getRowStyle");
0736:
0737: if (callback != null) {
0738: String key = org.directwebremoting.extend.CallbackHelper
0739: .saveCallback(callback, String.class);
0740: script
0741: .appendCall("__System.activateCallback", key,
0742: "reply");
0743: }
0744:
0745: getScriptProxy().addScript(script);
0746: }
0747:
0748: /**
0749: * Sets the CSS properties for the HTML row element(s) containing the table data. Every row will
0750: apply the properties defined by this value, unless an alternate row style is used, in which case, the properties are alternated
0751: between this value and the value applied by setAlternateRowStyle. Multiple properties are supported.
0752: For example: background-color:white;font-family:Arial;.
0753: * @param strCSS
0754: */
0755: public void setRowStyle(String strCSS) {
0756: ScriptBuffer script = new ScriptBuffer();
0757: script.appendCall(getContextPath() + "setRowStyle", strCSS);
0758: getScriptProxy().addScript(script);
0759: }
0760:
0761: /**
0762: * Returns the CSS properties for the HTML row element(s) containing the alternating table data rows.
0763: * @param strDefault
0764: */
0765: @SuppressWarnings("unchecked")
0766: public void getAlternateRowStyle(String strDefault,
0767: org.directwebremoting.proxy.Callback<String> callback) {
0768: ScriptBuffer script = new ScriptBuffer();
0769: String callbackPrefix = "";
0770:
0771: if (callback != null) {
0772: callbackPrefix = "var reply = ";
0773: }
0774:
0775: script.appendCall(callbackPrefix + getContextPath()
0776: + "getAlternateRowStyle", strDefault);
0777:
0778: if (callback != null) {
0779: String key = org.directwebremoting.extend.CallbackHelper
0780: .saveCallback(callback, String.class);
0781: script
0782: .appendCall("__System.activateCallback", key,
0783: "reply");
0784: }
0785:
0786: getScriptProxy().addScript(script);
0787: }
0788:
0789: /**
0790: * Sets the CSS properties for the HTML row element(s) containing the alternating table data rows. Multiple properties are supported.
0791: For example: background-color:red;font-family:Arial;.
0792: * @param strCSS
0793: */
0794: public void setAlternateRowStyle(String strCSS) {
0795: ScriptBuffer script = new ScriptBuffer();
0796: script.appendCall(getContextPath() + "setAlternateRowStyle",
0797: strCSS);
0798: getScriptProxy().addScript(script);
0799: }
0800:
0801: /**
0802: * Returns the CSS properties that will be inlined on every HTML cell in the body of the table.
0803: */
0804: @SuppressWarnings("unchecked")
0805: public void getCellStyle(
0806: org.directwebremoting.proxy.Callback<String> callback) {
0807: ScriptBuffer script = new ScriptBuffer();
0808: String callbackPrefix = "";
0809:
0810: if (callback != null) {
0811: callbackPrefix = "var reply = ";
0812: }
0813:
0814: script.appendCall(callbackPrefix + getContextPath()
0815: + "getCellStyle");
0816:
0817: if (callback != null) {
0818: String key = org.directwebremoting.extend.CallbackHelper
0819: .saveCallback(callback, String.class);
0820: script
0821: .appendCall("__System.activateCallback", key,
0822: "reply");
0823: }
0824:
0825: getScriptProxy().addScript(script);
0826: }
0827:
0828: /**
0829: * Sets the CSS properties that will be inlined on every HTML cell in the body of the table. Multiple properties are supported.
0830: For example: text-align:right;background-color:#eeeeee;border-bottom:solid 1px #aeaeae;.
0831: * @param strCSS
0832: */
0833: public void setCellStyle(String strCSS) {
0834: ScriptBuffer script = new ScriptBuffer();
0835: script.appendCall(getContextPath() + "setCellStyle", strCSS);
0836: getScriptProxy().addScript(script);
0837: }
0838:
0839: /**
0840: * Returns the CSS rule for the HTML row element(s) containing the table data.
0841: */
0842: @SuppressWarnings("unchecked")
0843: public void getRowClass(
0844: org.directwebremoting.proxy.Callback<String> callback) {
0845: ScriptBuffer script = new ScriptBuffer();
0846: String callbackPrefix = "";
0847:
0848: if (callback != null) {
0849: callbackPrefix = "var reply = ";
0850: }
0851:
0852: script.appendCall(callbackPrefix + getContextPath()
0853: + "getRowClass");
0854:
0855: if (callback != null) {
0856: String key = org.directwebremoting.extend.CallbackHelper
0857: .saveCallback(callback, String.class);
0858: script
0859: .appendCall("__System.activateCallback", key,
0860: "reply");
0861: }
0862:
0863: getScriptProxy().addScript(script);
0864: }
0865:
0866: /**
0867: * Sets the CSS rule for the HTML row element(s) containing the table data. Every row will
0868: apply the rule defined by this value, unless an alternate row rule is used, in which case, the rule (classname) is alternated
0869: between this value and the value applied by setAlternateRowClass. Multiple rules are supported.
0870: For example: bodyText normalText.
0871: * @param strRuleName
0872: */
0873: public void setRowClass(String strRuleName) {
0874: ScriptBuffer script = new ScriptBuffer();
0875: script
0876: .appendCall(getContextPath() + "setRowClass",
0877: strRuleName);
0878: getScriptProxy().addScript(script);
0879: }
0880:
0881: /**
0882: * Returns the CSS rule for the HTML row element(s) containing the alternating table data rows.
0883: * @param strDefault
0884: */
0885: @SuppressWarnings("unchecked")
0886: public void getAlternateRowClass(String strDefault,
0887: org.directwebremoting.proxy.Callback<String> callback) {
0888: ScriptBuffer script = new ScriptBuffer();
0889: String callbackPrefix = "";
0890:
0891: if (callback != null) {
0892: callbackPrefix = "var reply = ";
0893: }
0894:
0895: script.appendCall(callbackPrefix + getContextPath()
0896: + "getAlternateRowClass", strDefault);
0897:
0898: if (callback != null) {
0899: String key = org.directwebremoting.extend.CallbackHelper
0900: .saveCallback(callback, String.class);
0901: script
0902: .appendCall("__System.activateCallback", key,
0903: "reply");
0904: }
0905:
0906: getScriptProxy().addScript(script);
0907: }
0908:
0909: /**
0910: * Sets the CSS rule for the HTML row element(s) containing the alternating table data rows. Multiple rules are supported.
0911: For example: bodyText, normalText.
0912: * @param strRuleName
0913: */
0914: public void setAlternateRowClass(String strRuleName) {
0915: ScriptBuffer script = new ScriptBuffer();
0916: script.appendCall(getContextPath() + "setAlternateRowClass",
0917: strRuleName);
0918: getScriptProxy().addScript(script);
0919: }
0920:
0921: /**
0922: * Returns the CSS rule that will be applied to every HTML cell in the body of the table.
0923: */
0924: @SuppressWarnings("unchecked")
0925: public void getCellClass(
0926: org.directwebremoting.proxy.Callback<String> callback) {
0927: ScriptBuffer script = new ScriptBuffer();
0928: String callbackPrefix = "";
0929:
0930: if (callback != null) {
0931: callbackPrefix = "var reply = ";
0932: }
0933:
0934: script.appendCall(callbackPrefix + getContextPath()
0935: + "getCellClass");
0936:
0937: if (callback != null) {
0938: String key = org.directwebremoting.extend.CallbackHelper
0939: .saveCallback(callback, String.class);
0940: script
0941: .appendCall("__System.activateCallback", key,
0942: "reply");
0943: }
0944:
0945: getScriptProxy().addScript(script);
0946: }
0947:
0948: /**
0949: * Sets the CSS rule that will be applied to every HTML cell in the body of the table.
0950: Multiple rules are supported. For example: boldText titleText.
0951: * @param strRuleName
0952: */
0953: public void setCellClass(String strRuleName) {
0954: ScriptBuffer script = new ScriptBuffer();
0955: script.appendCall(getContextPath() + "setCellClass",
0956: strRuleName);
0957: getScriptProxy().addScript(script);
0958: }
0959:
0960: /**
0961: * Returns whether or not the table's data cells support text-wrapping and expand vertically to display their wrapped content. If this
0962: property is not set, the cell content will not wrap.
0963: * @param strDefault
0964: * @param callback <code>jsx3.Boolean.TRUE</code> or <code>jsx3.Boolean.FALSE</code>
0965: */
0966: @SuppressWarnings("unchecked")
0967: public void getWrap(String strDefault,
0968: org.directwebremoting.proxy.Callback<Integer> callback) {
0969: ScriptBuffer script = new ScriptBuffer();
0970: String callbackPrefix = "";
0971:
0972: if (callback != null) {
0973: callbackPrefix = "var reply = ";
0974: }
0975:
0976: script.appendCall(
0977: callbackPrefix + getContextPath() + "getWrap",
0978: strDefault);
0979:
0980: if (callback != null) {
0981: String key = org.directwebremoting.extend.CallbackHelper
0982: .saveCallback(callback, Integer.class);
0983: script
0984: .appendCall("__System.activateCallback", key,
0985: "reply");
0986: }
0987:
0988: getScriptProxy().addScript(script);
0989: }
0990:
0991: /**
0992: * Sets whether or not the table's data cells support text-wrapping and expand vertically to display their wrapped content.
0993: * @param WRAP <code>jsx3.Boolean.TRUE</code> or <code>jsx3.Boolean.FALSE</code>
0994: */
0995: public void setWrap(int WRAP) {
0996: ScriptBuffer script = new ScriptBuffer();
0997: script.appendCall(getContextPath() + "setWrap", WRAP);
0998: getScriptProxy().addScript(script);
0999: }
1000:
1001: /**
1002: * Returns the text/HTML to display on-screen when the xml/xsl transformation for this object results in a null or empty result set
1003: * @param callback text/HTML
1004: */
1005: @SuppressWarnings("unchecked")
1006: public void getNoDataMessage(
1007: org.directwebremoting.proxy.Callback<String> callback) {
1008: ScriptBuffer script = new ScriptBuffer();
1009: String callbackPrefix = "";
1010:
1011: if (callback != null) {
1012: callbackPrefix = "var reply = ";
1013: }
1014:
1015: script.appendCall(callbackPrefix + getContextPath()
1016: + "getNoDataMessage");
1017:
1018: if (callback != null) {
1019: String key = org.directwebremoting.extend.CallbackHelper
1020: .saveCallback(callback, String.class);
1021: script
1022: .appendCall("__System.activateCallback", key,
1023: "reply");
1024: }
1025:
1026: getScriptProxy().addScript(script);
1027: }
1028:
1029: /**
1030: * Returns XSLT for the Table, prioritizing the acquisition in the following order: 1) check cache; 2) check jsxxsl; 3) check jsxxslurl; 4) use default
1031: * @return jsx3.xml.Document instance containing valid XSL stylesheet
1032: */
1033: @SuppressWarnings("unchecked")
1034: public jsx3.xml.CdfDocument getXSL() {
1035: String extension = "getXSL().";
1036: try {
1037: java.lang.reflect.Constructor<jsx3.xml.CdfDocument> ctor = jsx3.xml.CdfDocument.class
1038: .getConstructor(Context.class, String.class,
1039: ScriptProxy.class);
1040: return ctor.newInstance(this , extension, getScriptProxy());
1041: } catch (Exception ex) {
1042: throw new IllegalArgumentException("Unsupported type: "
1043: + jsx3.xml.CdfDocument.class.getName());
1044: }
1045: }
1046:
1047: /**
1048: * Returns XSLT for the Table, prioritizing the acquisition in the following order: 1) check cache; 2) check jsxxsl; 3) check jsxxslurl; 4) use default
1049: * @param returnType The expected return type
1050: * @return jsx3.xml.Document instance containing valid XSL stylesheet
1051: */
1052: @SuppressWarnings("unchecked")
1053: public <T> T getXSL(Class<T> returnType) {
1054: String extension = "getXSL().";
1055: try {
1056: java.lang.reflect.Constructor<T> ctor = returnType
1057: .getConstructor(Context.class, String.class,
1058: ScriptProxy.class);
1059: return ctor.newInstance(this , extension, getScriptProxy());
1060: } catch (Exception ex) {
1061: throw new IllegalArgumentException(
1062: "Unsupported return type: " + returnType.getName());
1063: }
1064: }
1065:
1066: /**
1067: * Gets the user-defined XSL template (xsl:template) that will override the defualt template defined by Table.DEFAULT_CELL_VALUE_TEMPLATE.
1068: * @param strDefault xsl:template
1069: */
1070: @SuppressWarnings("unchecked")
1071: public void getValueTemplate(String strDefault,
1072: org.directwebremoting.proxy.Callback<String> callback) {
1073: ScriptBuffer script = new ScriptBuffer();
1074: String callbackPrefix = "";
1075:
1076: if (callback != null) {
1077: callbackPrefix = "var reply = ";
1078: }
1079:
1080: script.appendCall(callbackPrefix + getContextPath()
1081: + "getValueTemplate", strDefault);
1082:
1083: if (callback != null) {
1084: String key = org.directwebremoting.extend.CallbackHelper
1085: .saveCallback(callback, String.class);
1086: script
1087: .appendCall("__System.activateCallback", key,
1088: "reply");
1089: }
1090:
1091: getScriptProxy().addScript(script);
1092: }
1093:
1094: /**
1095: * Sets the user-defined XSL template that will override the defualt template defined by Table.DEFAULT_CELL_VALUE_TEMPLATE.
1096: The template must resolve to a valid XSL Template when parsed. The template should match on a record (match="record"). The template
1097: will be passed a single XSL param (xsl:param) named attname.
1098: * @param TEMPLATE valid xsl:template
1099: */
1100: public void setValueTemplate(String TEMPLATE) {
1101: ScriptBuffer script = new ScriptBuffer();
1102: script.appendCall(getContextPath() + "setValueTemplate",
1103: TEMPLATE);
1104: getScriptProxy().addScript(script);
1105: }
1106:
1107: /**
1108: * Returns a clone of the CDF document used internally to define the Columns (text, order, mapped attributes, etc).
1109: The order of the records in this document reflects the order of the columns in the Table. If the column profile document defined
1110: by getColumnProfile is not a valid XML document, an empty CDF Document will be returned instead.
1111: Note that if you make changes to the Document returned by this method, those
1112: changes will only be reflected by calling setColumnProfile (to update the model),
1113: followed by a call to repaint (to update the view).
1114: */
1115: @SuppressWarnings("unchecked")
1116: public jsx3.xml.CdfDocument getColumnProfileDocument() {
1117: String extension = "getColumnProfileDocument().";
1118: try {
1119: java.lang.reflect.Constructor<jsx3.xml.CdfDocument> ctor = jsx3.xml.CdfDocument.class
1120: .getConstructor(Context.class, String.class,
1121: ScriptProxy.class);
1122: return ctor.newInstance(this , extension, getScriptProxy());
1123: } catch (Exception ex) {
1124: throw new IllegalArgumentException("Unsupported type: "
1125: + jsx3.xml.CdfDocument.class.getName());
1126: }
1127: }
1128:
1129: /**
1130: * Returns a clone of the CDF document used internally to define the Columns (text, order, mapped attributes, etc).
1131: The order of the records in this document reflects the order of the columns in the Table. If the column profile document defined
1132: by getColumnProfile is not a valid XML document, an empty CDF Document will be returned instead.
1133: Note that if you make changes to the Document returned by this method, those
1134: changes will only be reflected by calling setColumnProfile (to update the model),
1135: followed by a call to repaint (to update the view).
1136: * @param returnType The expected return type
1137: */
1138: @SuppressWarnings("unchecked")
1139: public <T> T getColumnProfileDocument(Class<T> returnType) {
1140: String extension = "getColumnProfileDocument().";
1141: try {
1142: java.lang.reflect.Constructor<T> ctor = returnType
1143: .getConstructor(Context.class, String.class,
1144: ScriptProxy.class);
1145: return ctor.newInstance(this , extension, getScriptProxy());
1146: } catch (Exception ex) {
1147: throw new IllegalArgumentException(
1148: "Unsupported return type: " + returnType.getName());
1149: }
1150: }
1151:
1152: /**
1153: * Returns the string of XML in CDF format representing the Column Profile Document.
1154: */
1155: @SuppressWarnings("unchecked")
1156: public void getColumnProfile(
1157: org.directwebremoting.proxy.Callback<String> callback) {
1158: ScriptBuffer script = new ScriptBuffer();
1159: String callbackPrefix = "";
1160:
1161: if (callback != null) {
1162: callbackPrefix = "var reply = ";
1163: }
1164:
1165: script.appendCall(callbackPrefix + getContextPath()
1166: + "getColumnProfile");
1167:
1168: if (callback != null) {
1169: String key = org.directwebremoting.extend.CallbackHelper
1170: .saveCallback(callback, String.class);
1171: script
1172: .appendCall("__System.activateCallback", key,
1173: "reply");
1174: }
1175:
1176: getScriptProxy().addScript(script);
1177: }
1178:
1179: /**
1180: * Sets a string of XML (in CDF format) or an actual jsx3.xml.CDF.Document instance representing the Column Profile Document.
1181: Each record in this document defines the profile for a column in the Table. The following attributes are supported on each record:
1182:
1183: jsxid: The unique ID for the record (REQUIRED).
1184: jsxtext: HTML or text content to use as the column label.
1185: jsxwidth: The width of the column (pixel units are implied). For example: 300, or 25%.
1186: jsxpath: The name of the attribute to which this column maps (REQUIRED).
1187: jsxpathtype: The data type for the attribute. One of: text (default) or number.
1188:
1189:
1190: For example:
1191:
1192: <data jsxid="jsxroot">
1193: <record jsxid="a1" jsxtext="<b>Column 1</b>" jsxpath="jsxtext"/>
1194: <record jsxid="a2" jsxtext="Column 2" jsxwidth="100" jsxpath="value" jsxpathtype="number"/>
1195: </data>
1196: * @param objCDF
1197: */
1198: public void setColumnProfile(jsx3.xml.CdfDocument objCDF) {
1199: ScriptBuffer script = new ScriptBuffer();
1200: script
1201: .appendCall(getContextPath() + "setColumnProfile",
1202: objCDF);
1203: getScriptProxy().addScript(script);
1204: }
1205:
1206: /**
1207: * Sets a string of XML (in CDF format) or an actual jsx3.xml.CDF.Document instance representing the Column Profile Document.
1208: Each record in this document defines the profile for a column in the Table. The following attributes are supported on each record:
1209:
1210: jsxid: The unique ID for the record (REQUIRED).
1211: jsxtext: HTML or text content to use as the column label.
1212: jsxwidth: The width of the column (pixel units are implied). For example: 300, or 25%.
1213: jsxpath: The name of the attribute to which this column maps (REQUIRED).
1214: jsxpathtype: The data type for the attribute. One of: text (default) or number.
1215:
1216:
1217: For example:
1218:
1219: <data jsxid="jsxroot">
1220: <record jsxid="a1" jsxtext="<b>Column 1</b>" jsxpath="jsxtext"/>
1221: <record jsxid="a2" jsxtext="Column 2" jsxwidth="100" jsxpath="value" jsxpathtype="number"/>
1222: </data>
1223: * @param objCDF
1224: */
1225: public void setColumnProfile(String objCDF) {
1226: ScriptBuffer script = new ScriptBuffer();
1227: script
1228: .appendCall(getContextPath() + "setColumnProfile",
1229: objCDF);
1230: getScriptProxy().addScript(script);
1231: }
1232:
1233: /**
1234: * Returns the jsxid of the CDF record that will serve as the origin when rendering the data on-screen. If not set, the
1235: id, jsxroot, (which is the id for the root node, <data>) will be used.
1236: * @param strDefault The default value to use if null
1237: */
1238: @SuppressWarnings("unchecked")
1239: public void getRenderingContext(String strDefault,
1240: org.directwebremoting.proxy.Callback<String> callback) {
1241: ScriptBuffer script = new ScriptBuffer();
1242: String callbackPrefix = "";
1243:
1244: if (callback != null) {
1245: callbackPrefix = "var reply = ";
1246: }
1247:
1248: script.appendCall(callbackPrefix + getContextPath()
1249: + "getRenderingContext", strDefault);
1250:
1251: if (callback != null) {
1252: String key = org.directwebremoting.extend.CallbackHelper
1253: .saveCallback(callback, String.class);
1254: script
1255: .appendCall("__System.activateCallback", key,
1256: "reply");
1257: }
1258:
1259: getScriptProxy().addScript(script);
1260: }
1261:
1262: /**
1263: * Sets the jsxid of the CDF record that will serve as the origin when rendering the data on-screen.
1264: * @param strJsxId jsxid property for the CDF record to use as the contextual root when rendering data on-screen.
1265: * @param bSuppressRepaint Pass <code>true</code> to stop the default repaint from occurring.
1266: */
1267: public void setRenderingContext(String strJsxId,
1268: boolean bSuppressRepaint) {
1269: ScriptBuffer script = new ScriptBuffer();
1270: script.appendCall(getContextPath() + "setRenderingContext",
1271: strJsxId, bSuppressRepaint);
1272: getScriptProxy().addScript(script);
1273: }
1274:
1275: /**
1276: * Returns the height of the header row in pixels. If this value is not set (null), the list will render with
1277: the default value of jsx3.gui.Table.DEFAULT_HEADER_HEIGHT.
1278: * @param strDefault The default value to use if null
1279: */
1280: @SuppressWarnings("unchecked")
1281: public void getHeaderHeight(String strDefault,
1282: org.directwebremoting.proxy.Callback<Integer> callback) {
1283: ScriptBuffer script = new ScriptBuffer();
1284: String callbackPrefix = "";
1285:
1286: if (callback != null) {
1287: callbackPrefix = "var reply = ";
1288: }
1289:
1290: script.appendCall(callbackPrefix + getContextPath()
1291: + "getHeaderHeight", strDefault);
1292:
1293: if (callback != null) {
1294: String key = org.directwebremoting.extend.CallbackHelper
1295: .saveCallback(callback, Integer.class);
1296: script
1297: .appendCall("__System.activateCallback", key,
1298: "reply");
1299: }
1300:
1301: getScriptProxy().addScript(script);
1302: }
1303:
1304: /**
1305: * Sets the height of the header row in pixels. Set to zero (0) to hide the header row and only render the body rows.
1306: * @param intHeight
1307: * @param bSuppressRepaint Pass <code>true</code> to stop the default repaint from occurring.
1308: Typically property updates that affect the browser-specific box model (such as height) are repainted
1309: immediately to keep the box model abstraction in sync with the native view. However, the repaint can be
1310: suppressed to avoid unnecessary reparsing of the XSLT during repeated property updates.
1311: */
1312: public void setHeaderHeight(int intHeight, boolean bSuppressRepaint) {
1313: ScriptBuffer script = new ScriptBuffer();
1314: script.appendCall(getContextPath() + "setHeaderHeight",
1315: intHeight, bSuppressRepaint);
1316: getScriptProxy().addScript(script);
1317: }
1318:
1319: /**
1320: * Binds the given key sequence to a callback function. Any object that has a key binding (specified with
1321: setKeyBinding()) will call this method when painted to register the key sequence with an appropriate
1322: ancestor of this form control. Any key down event that bubbles up to the ancestor without being intercepted
1323: and matches the given key sequence will invoke the given callback function.
1324:
1325: As of 3.2: The hot key will be registered with the first ancestor found that is either a
1326: jsx3.gui.Window, a jsx3.gui.Dialog, or the root block of a jsx3.app.Server.
1327: * @param fctCallback JavaScript function to execute when the given sequence is keyed by the user.
1328: * @param strKeys a plus-delimited ('+') key sequence such as <code>ctrl+s</code> or
1329: <code>ctrl+shift+alt+h</code> or <code>shift+a</code>, etc. Any combination of shift, ctrl, and alt are
1330: supported, including none. Also supported as the final token are <code>enter</code>, <code>esc</code>,
1331: <code>tab</code>, <code>del</code>, and <code>space</code>. To specify the final token as a key code, the
1332: last token can be the key code contained in brackets, <code>[13]</code>.
1333: * @return the registered hot key.
1334: */
1335: @SuppressWarnings("unchecked")
1336: public jsx3.gui.HotKey doKeyBinding(
1337: org.directwebremoting.proxy.CodeBlock fctCallback,
1338: String strKeys) {
1339: String extension = "doKeyBinding(\"" + fctCallback + "\", \""
1340: + strKeys + "\").";
1341: try {
1342: java.lang.reflect.Constructor<jsx3.gui.HotKey> ctor = jsx3.gui.HotKey.class
1343: .getConstructor(Context.class, String.class,
1344: ScriptProxy.class);
1345: return ctor.newInstance(this , extension, getScriptProxy());
1346: } catch (Exception ex) {
1347: throw new IllegalArgumentException("Unsupported type: "
1348: + jsx3.gui.HotKey.class.getName());
1349: }
1350: }
1351:
1352: /**
1353: * Resets the validation state of this control.
1354: * @return this object.
1355: */
1356: @SuppressWarnings("unchecked")
1357: public jsx3.gui.Form doReset() {
1358: String extension = "doReset().";
1359: try {
1360: java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
1361: .getConstructor(Context.class, String.class,
1362: ScriptProxy.class);
1363: return ctor.newInstance(this , extension, getScriptProxy());
1364: } catch (Exception ex) {
1365: throw new IllegalArgumentException("Unsupported type: "
1366: + jsx3.gui.Form.class.getName());
1367: }
1368: }
1369:
1370: /**
1371: * Resets the validation state of this control.
1372: * @param returnType The expected return type
1373: * @return this object.
1374: */
1375: @SuppressWarnings("unchecked")
1376: public <T> T doReset(Class<T> returnType) {
1377: String extension = "doReset().";
1378: try {
1379: java.lang.reflect.Constructor<T> ctor = returnType
1380: .getConstructor(Context.class, String.class,
1381: ScriptProxy.class);
1382: return ctor.newInstance(this , extension, getScriptProxy());
1383: } catch (Exception ex) {
1384: throw new IllegalArgumentException(
1385: "Unsupported return type: " + returnType.getName());
1386: }
1387: }
1388:
1389: /**
1390: * Returns the background color of this control when it is disabled.
1391: * @param callback valid CSS property value, (i.e., red, #ff0000)
1392: */
1393: @SuppressWarnings("unchecked")
1394: public void getDisabledBackgroundColor(
1395: org.directwebremoting.proxy.Callback<String> callback) {
1396: ScriptBuffer script = new ScriptBuffer();
1397: String callbackPrefix = "";
1398:
1399: if (callback != null) {
1400: callbackPrefix = "var reply = ";
1401: }
1402:
1403: script.appendCall(callbackPrefix + getContextPath()
1404: + "getDisabledBackgroundColor");
1405:
1406: if (callback != null) {
1407: String key = org.directwebremoting.extend.CallbackHelper
1408: .saveCallback(callback, String.class);
1409: script
1410: .appendCall("__System.activateCallback", key,
1411: "reply");
1412: }
1413:
1414: getScriptProxy().addScript(script);
1415: }
1416:
1417: /**
1418: * Returns the font color to use when this control is disabled.
1419: * @param callback valid CSS property value, (i.e., red, #ff0000)
1420: */
1421: @SuppressWarnings("unchecked")
1422: public void getDisabledColor(
1423: org.directwebremoting.proxy.Callback<String> callback) {
1424: ScriptBuffer script = new ScriptBuffer();
1425: String callbackPrefix = "";
1426:
1427: if (callback != null) {
1428: callbackPrefix = "var reply = ";
1429: }
1430:
1431: script.appendCall(callbackPrefix + getContextPath()
1432: + "getDisabledColor");
1433:
1434: if (callback != null) {
1435: String key = org.directwebremoting.extend.CallbackHelper
1436: .saveCallback(callback, String.class);
1437: script
1438: .appendCall("__System.activateCallback", key,
1439: "reply");
1440: }
1441:
1442: getScriptProxy().addScript(script);
1443: }
1444:
1445: /**
1446: * Returns the state for the form field control. If no enabled state is set, this method returns
1447: STATEENABLED.
1448: * @param callback <code>STATEDISABLED</code> or <code>STATEENABLED</code>.
1449: */
1450: @SuppressWarnings("unchecked")
1451: public void getEnabled(
1452: org.directwebremoting.proxy.Callback<Integer> callback) {
1453: ScriptBuffer script = new ScriptBuffer();
1454: String callbackPrefix = "";
1455:
1456: if (callback != null) {
1457: callbackPrefix = "var reply = ";
1458: }
1459:
1460: script.appendCall(callbackPrefix + getContextPath()
1461: + "getEnabled");
1462:
1463: if (callback != null) {
1464: String key = org.directwebremoting.extend.CallbackHelper
1465: .saveCallback(callback, Integer.class);
1466: script
1467: .appendCall("__System.activateCallback", key,
1468: "reply");
1469: }
1470:
1471: getScriptProxy().addScript(script);
1472: }
1473:
1474: /**
1475: * Returns the key binding that when keyed will fire the execute event for this control.
1476: * @param callback plus-delimited (e.g.,'+') key sequence such as ctrl+s or ctrl+shift+alt+h or shift+a, etc
1477: */
1478: @SuppressWarnings("unchecked")
1479: public void getKeyBinding(
1480: org.directwebremoting.proxy.Callback<String> callback) {
1481: ScriptBuffer script = new ScriptBuffer();
1482: String callbackPrefix = "";
1483:
1484: if (callback != null) {
1485: callbackPrefix = "var reply = ";
1486: }
1487:
1488: script.appendCall(callbackPrefix + getContextPath()
1489: + "getKeyBinding");
1490:
1491: if (callback != null) {
1492: String key = org.directwebremoting.extend.CallbackHelper
1493: .saveCallback(callback, String.class);
1494: script
1495: .appendCall("__System.activateCallback", key,
1496: "reply");
1497: }
1498:
1499: getScriptProxy().addScript(script);
1500: }
1501:
1502: /**
1503: * Returns whether or not this control is required. If the required property has never been set, this method returns
1504: OPTIONAL.
1505: * @param callback <code>REQUIRED</code> or <code>OPTIONAL</code>.
1506: */
1507: @SuppressWarnings("unchecked")
1508: public void getRequired(
1509: org.directwebremoting.proxy.Callback<Integer> callback) {
1510: ScriptBuffer script = new ScriptBuffer();
1511: String callbackPrefix = "";
1512:
1513: if (callback != null) {
1514: callbackPrefix = "var reply = ";
1515: }
1516:
1517: script.appendCall(callbackPrefix + getContextPath()
1518: + "getRequired");
1519:
1520: if (callback != null) {
1521: String key = org.directwebremoting.extend.CallbackHelper
1522: .saveCallback(callback, Integer.class);
1523: script
1524: .appendCall("__System.activateCallback", key,
1525: "reply");
1526: }
1527:
1528: getScriptProxy().addScript(script);
1529: }
1530:
1531: /**
1532: * Returns the validation state of this control. If the validationState property has never been set, this method returns
1533: STATEVALID.
1534: * @param callback <code>STATEINVALID</code> or <code>STATEVALID</code>.
1535: */
1536: @SuppressWarnings("unchecked")
1537: public void getValidationState(
1538: org.directwebremoting.proxy.Callback<Integer> callback) {
1539: ScriptBuffer script = new ScriptBuffer();
1540: String callbackPrefix = "";
1541:
1542: if (callback != null) {
1543: callbackPrefix = "var reply = ";
1544: }
1545:
1546: script.appendCall(callbackPrefix + getContextPath()
1547: + "getValidationState");
1548:
1549: if (callback != null) {
1550: String key = org.directwebremoting.extend.CallbackHelper
1551: .saveCallback(callback, Integer.class);
1552: script
1553: .appendCall("__System.activateCallback", key,
1554: "reply");
1555: }
1556:
1557: getScriptProxy().addScript(script);
1558: }
1559:
1560: /**
1561: * Sets the background color of this form control when it is disabled.
1562: * @param strColor valid CSS property value, (i.e., red, #ff0000)
1563: * @return this object.
1564: */
1565: @SuppressWarnings("unchecked")
1566: public jsx3.gui.Form setDisabledBackgroundColor(String strColor) {
1567: String extension = "setDisabledBackgroundColor(\"" + strColor
1568: + "\").";
1569: try {
1570: java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
1571: .getConstructor(Context.class, String.class,
1572: ScriptProxy.class);
1573: return ctor.newInstance(this , extension, getScriptProxy());
1574: } catch (Exception ex) {
1575: throw new IllegalArgumentException("Unsupported type: "
1576: + jsx3.gui.Form.class.getName());
1577: }
1578: }
1579:
1580: /**
1581: * Sets the background color of this form control when it is disabled.
1582: * @param strColor valid CSS property value, (i.e., red, #ff0000)
1583: * @param returnType The expected return type
1584: * @return this object.
1585: */
1586: @SuppressWarnings("unchecked")
1587: public <T> T setDisabledBackgroundColor(String strColor,
1588: Class<T> returnType) {
1589: String extension = "setDisabledBackgroundColor(\"" + strColor
1590: + "\").";
1591: try {
1592: java.lang.reflect.Constructor<T> ctor = returnType
1593: .getConstructor(Context.class, String.class,
1594: ScriptProxy.class);
1595: return ctor.newInstance(this , extension, getScriptProxy());
1596: } catch (Exception ex) {
1597: throw new IllegalArgumentException(
1598: "Unsupported return type: " + returnType.getName());
1599: }
1600: }
1601:
1602: /**
1603: * Sets the font color to use when this control is disabled.
1604: * @param strColor valid CSS property value, (i.e., red, #ff0000)
1605: * @return this object.
1606: */
1607: @SuppressWarnings("unchecked")
1608: public jsx3.gui.Form setDisabledColor(String strColor) {
1609: String extension = "setDisabledColor(\"" + strColor + "\").";
1610: try {
1611: java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
1612: .getConstructor(Context.class, String.class,
1613: ScriptProxy.class);
1614: return ctor.newInstance(this , extension, getScriptProxy());
1615: } catch (Exception ex) {
1616: throw new IllegalArgumentException("Unsupported type: "
1617: + jsx3.gui.Form.class.getName());
1618: }
1619: }
1620:
1621: /**
1622: * Sets the font color to use when this control is disabled.
1623: * @param strColor valid CSS property value, (i.e., red, #ff0000)
1624: * @param returnType The expected return type
1625: * @return this object.
1626: */
1627: @SuppressWarnings("unchecked")
1628: public <T> T setDisabledColor(String strColor, Class<T> returnType) {
1629: String extension = "setDisabledColor(\"" + strColor + "\").";
1630: try {
1631: java.lang.reflect.Constructor<T> ctor = returnType
1632: .getConstructor(Context.class, String.class,
1633: ScriptProxy.class);
1634: return ctor.newInstance(this , extension, getScriptProxy());
1635: } catch (Exception ex) {
1636: throw new IllegalArgumentException(
1637: "Unsupported return type: " + returnType.getName());
1638: }
1639: }
1640:
1641: /**
1642: * Sets whether this control is enabled. Disabled controls do not respond to user interaction.
1643: * @param intEnabled <code>STATEDISABLED</code> or <code>STATEENABLED</code>. <code>null</code> is
1644: equivalent to <code>STATEENABLED</code>.
1645: * @param bRepaint if <code>true</code> this control is immediately repainted to reflect the new setting.
1646: */
1647: public void setEnabled(int intEnabled, boolean bRepaint) {
1648: ScriptBuffer script = new ScriptBuffer();
1649: script.appendCall(getContextPath() + "setEnabled", intEnabled,
1650: bRepaint);
1651: getScriptProxy().addScript(script);
1652: }
1653:
1654: /**
1655: * Sets the key binding that when keyed will fire the bound execute (jsx3.gui.Interactive.EXECUTE)
1656: event for this control.
1657: * @param strSequence plus-delimited (e.g.,'+') key sequence such as ctrl+s or ctrl+shift+alt+h or shift+a, etc
1658: * @return this object.
1659: */
1660: @SuppressWarnings("unchecked")
1661: public jsx3.gui.Form setKeyBinding(String strSequence) {
1662: String extension = "setKeyBinding(\"" + strSequence + "\").";
1663: try {
1664: java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
1665: .getConstructor(Context.class, String.class,
1666: ScriptProxy.class);
1667: return ctor.newInstance(this , extension, getScriptProxy());
1668: } catch (Exception ex) {
1669: throw new IllegalArgumentException("Unsupported type: "
1670: + jsx3.gui.Form.class.getName());
1671: }
1672: }
1673:
1674: /**
1675: * Sets the key binding that when keyed will fire the bound execute (jsx3.gui.Interactive.EXECUTE)
1676: event for this control.
1677: * @param strSequence plus-delimited (e.g.,'+') key sequence such as ctrl+s or ctrl+shift+alt+h or shift+a, etc
1678: * @param returnType The expected return type
1679: * @return this object.
1680: */
1681: @SuppressWarnings("unchecked")
1682: public <T> T setKeyBinding(String strSequence, Class<T> returnType) {
1683: String extension = "setKeyBinding(\"" + strSequence + "\").";
1684: try {
1685: java.lang.reflect.Constructor<T> ctor = returnType
1686: .getConstructor(Context.class, String.class,
1687: ScriptProxy.class);
1688: return ctor.newInstance(this , extension, getScriptProxy());
1689: } catch (Exception ex) {
1690: throw new IllegalArgumentException(
1691: "Unsupported return type: " + returnType.getName());
1692: }
1693: }
1694:
1695: /**
1696: * Sets whether or not this control is required.
1697: * @param required {int} <code>REQUIRED</code> or <code>OPTIONAL</code>.
1698: * @return this object.
1699: */
1700: @SuppressWarnings("unchecked")
1701: public jsx3.gui.Form setRequired(int required) {
1702: String extension = "setRequired(\"" + required + "\").";
1703: try {
1704: java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
1705: .getConstructor(Context.class, String.class,
1706: ScriptProxy.class);
1707: return ctor.newInstance(this , extension, getScriptProxy());
1708: } catch (Exception ex) {
1709: throw new IllegalArgumentException("Unsupported type: "
1710: + jsx3.gui.Form.class.getName());
1711: }
1712: }
1713:
1714: /**
1715: * Sets whether or not this control is required.
1716: * @param required {int} <code>REQUIRED</code> or <code>OPTIONAL</code>.
1717: * @param returnType The expected return type
1718: * @return this object.
1719: */
1720: @SuppressWarnings("unchecked")
1721: public <T> T setRequired(int required, Class<T> returnType) {
1722: String extension = "setRequired(\"" + required + "\").";
1723: try {
1724: java.lang.reflect.Constructor<T> ctor = returnType
1725: .getConstructor(Context.class, String.class,
1726: ScriptProxy.class);
1727: return ctor.newInstance(this , extension, getScriptProxy());
1728: } catch (Exception ex) {
1729: throw new IllegalArgumentException(
1730: "Unsupported return type: " + returnType.getName());
1731: }
1732: }
1733:
1734: /**
1735: * Sets the validation state of this control. The validation state of a control is not serialized.
1736: * @param intState <code>STATEINVALID</code> or <code>STATEVALID</code>.
1737: * @return this object.
1738: */
1739: @SuppressWarnings("unchecked")
1740: public jsx3.gui.Form setValidationState(int intState) {
1741: String extension = "setValidationState(\"" + intState + "\").";
1742: try {
1743: java.lang.reflect.Constructor<jsx3.gui.Form> ctor = jsx3.gui.Form.class
1744: .getConstructor(Context.class, String.class,
1745: ScriptProxy.class);
1746: return ctor.newInstance(this , extension, getScriptProxy());
1747: } catch (Exception ex) {
1748: throw new IllegalArgumentException("Unsupported type: "
1749: + jsx3.gui.Form.class.getName());
1750: }
1751: }
1752:
1753: /**
1754: * Sets the validation state of this control. The validation state of a control is not serialized.
1755: * @param intState <code>STATEINVALID</code> or <code>STATEVALID</code>.
1756: * @param returnType The expected return type
1757: * @return this object.
1758: */
1759: @SuppressWarnings("unchecked")
1760: public <T> T setValidationState(int intState, Class<T> returnType) {
1761: String extension = "setValidationState(\"" + intState + "\").";
1762: try {
1763: java.lang.reflect.Constructor<T> ctor = returnType
1764: .getConstructor(Context.class, String.class,
1765: ScriptProxy.class);
1766: return ctor.newInstance(this , extension, getScriptProxy());
1767: } catch (Exception ex) {
1768: throw new IllegalArgumentException(
1769: "Unsupported return type: " + returnType.getName());
1770: }
1771: }
1772:
1773: /**
1774: * Resets the XML source document stored in the server cache under the XML ID of this object to an empty CDF
1775: document.
1776: */
1777: public void clearXmlData() {
1778: ScriptBuffer script = new ScriptBuffer();
1779: script.appendCall(getContextPath() + "clearXmlData");
1780: getScriptProxy().addScript(script);
1781: }
1782:
1783: /**
1784: * Returns whether this object removes its XML and XSL source documents from the cache of its server when it
1785: is destroyed.
1786: * @param callback <code>CLEANUPRESOURCES</code> or <code>SHARERESOURCES</code>.
1787: */
1788: @SuppressWarnings("unchecked")
1789: public void getShareResources(
1790: org.directwebremoting.proxy.Callback<Integer> callback) {
1791: ScriptBuffer script = new ScriptBuffer();
1792: String callbackPrefix = "";
1793:
1794: if (callback != null) {
1795: callbackPrefix = "var reply = ";
1796: }
1797:
1798: script.appendCall(callbackPrefix + getContextPath()
1799: + "getShareResources");
1800:
1801: if (callback != null) {
1802: String key = org.directwebremoting.extend.CallbackHelper
1803: .saveCallback(callback, Integer.class);
1804: script
1805: .appendCall("__System.activateCallback", key,
1806: "reply");
1807: }
1808:
1809: getScriptProxy().addScript(script);
1810: }
1811:
1812: /**
1813: * Returns the XML source document of this object. The XML document is determined by the following steps:
1814:
1815: If an XML document exists in the server cache under an ID equal to the XML ID of this object, that
1816: document is returned.
1817: If the XML string of this object is not empty, a new document is created by parsing this string.
1818: If the XML URL of this object is not empty, a new document is created by parsing the file at the location
1819: specified by the URL resolved against the server owning this object.
1820: Otherwise, an empty CDF document is returned.
1821:
1822: If a new document is created for this object (any of the steps listed above except for the first one), the
1823: following actions are also taken:
1824:
1825: If creating the document resulted in an error (XML parsing error, file not found error, etc) the offending
1826: document is returned immediately.
1827: Otherwise, setSourceXML is called on this object, passing in the created document.
1828: */
1829: @SuppressWarnings("unchecked")
1830: public jsx3.xml.CdfDocument getXML() {
1831: String extension = "getXML().";
1832: try {
1833: java.lang.reflect.Constructor<jsx3.xml.CdfDocument> ctor = jsx3.xml.CdfDocument.class
1834: .getConstructor(Context.class, String.class,
1835: ScriptProxy.class);
1836: return ctor.newInstance(this , extension, getScriptProxy());
1837: } catch (Exception ex) {
1838: throw new IllegalArgumentException("Unsupported type: "
1839: + jsx3.xml.CdfDocument.class.getName());
1840: }
1841: }
1842:
1843: /**
1844: * Returns the XML source document of this object. The XML document is determined by the following steps:
1845:
1846: If an XML document exists in the server cache under an ID equal to the XML ID of this object, that
1847: document is returned.
1848: If the XML string of this object is not empty, a new document is created by parsing this string.
1849: If the XML URL of this object is not empty, a new document is created by parsing the file at the location
1850: specified by the URL resolved against the server owning this object.
1851: Otherwise, an empty CDF document is returned.
1852:
1853: If a new document is created for this object (any of the steps listed above except for the first one), the
1854: following actions are also taken:
1855:
1856: If creating the document resulted in an error (XML parsing error, file not found error, etc) the offending
1857: document is returned immediately.
1858: Otherwise, setSourceXML is called on this object, passing in the created document.
1859: * @param returnType The expected return type
1860: */
1861: @SuppressWarnings("unchecked")
1862: public <T> T getXML(Class<T> returnType) {
1863: String extension = "getXML().";
1864: try {
1865: java.lang.reflect.Constructor<T> ctor = returnType
1866: .getConstructor(Context.class, String.class,
1867: ScriptProxy.class);
1868: return ctor.newInstance(this , extension, getScriptProxy());
1869: } catch (Exception ex) {
1870: throw new IllegalArgumentException(
1871: "Unsupported return type: " + returnType.getName());
1872: }
1873: }
1874:
1875: /**
1876: * Returns the XML ID of this object.
1877: * @param callback the XML ID.
1878: */
1879: @SuppressWarnings("unchecked")
1880: public void getXMLId(
1881: org.directwebremoting.proxy.Callback<String> callback) {
1882: ScriptBuffer script = new ScriptBuffer();
1883: String callbackPrefix = "";
1884:
1885: if (callback != null) {
1886: callbackPrefix = "var reply = ";
1887: }
1888:
1889: script.appendCall(callbackPrefix + getContextPath()
1890: + "getXMLId");
1891:
1892: if (callback != null) {
1893: String key = org.directwebremoting.extend.CallbackHelper
1894: .saveCallback(callback, String.class);
1895: script
1896: .appendCall("__System.activateCallback", key,
1897: "reply");
1898: }
1899:
1900: getScriptProxy().addScript(script);
1901: }
1902:
1903: /**
1904: * Returns the XML string of this object.
1905: */
1906: @SuppressWarnings("unchecked")
1907: public void getXMLString(
1908: org.directwebremoting.proxy.Callback<String> callback) {
1909: ScriptBuffer script = new ScriptBuffer();
1910: String callbackPrefix = "";
1911:
1912: if (callback != null) {
1913: callbackPrefix = "var reply = ";
1914: }
1915:
1916: script.appendCall(callbackPrefix + getContextPath()
1917: + "getXMLString");
1918:
1919: if (callback != null) {
1920: String key = org.directwebremoting.extend.CallbackHelper
1921: .saveCallback(callback, String.class);
1922: script
1923: .appendCall("__System.activateCallback", key,
1924: "reply");
1925: }
1926:
1927: getScriptProxy().addScript(script);
1928: }
1929:
1930: /**
1931: * Returns the list of XML transformers of this object.
1932: */
1933: @SuppressWarnings("unchecked")
1934: public void getXMLTransformers(
1935: org.directwebremoting.proxy.Callback<Object[]> callback) {
1936: ScriptBuffer script = new ScriptBuffer();
1937: String callbackPrefix = "";
1938:
1939: if (callback != null) {
1940: callbackPrefix = "var reply = ";
1941: }
1942:
1943: script.appendCall(callbackPrefix + getContextPath()
1944: + "getXMLTransformers");
1945:
1946: if (callback != null) {
1947: String key = org.directwebremoting.extend.CallbackHelper
1948: .saveCallback(callback, Object[].class);
1949: script
1950: .appendCall("__System.activateCallback", key,
1951: "reply");
1952: }
1953:
1954: getScriptProxy().addScript(script);
1955: }
1956:
1957: /**
1958: * Returns the XML URL of this object.
1959: */
1960: @SuppressWarnings("unchecked")
1961: public void getXMLURL(
1962: org.directwebremoting.proxy.Callback<String> callback) {
1963: ScriptBuffer script = new ScriptBuffer();
1964: String callbackPrefix = "";
1965:
1966: if (callback != null) {
1967: callbackPrefix = "var reply = ";
1968: }
1969:
1970: script.appendCall(callbackPrefix + getContextPath()
1971: + "getXMLURL");
1972:
1973: if (callback != null) {
1974: String key = org.directwebremoting.extend.CallbackHelper
1975: .saveCallback(callback, String.class);
1976: script
1977: .appendCall("__System.activateCallback", key,
1978: "reply");
1979: }
1980:
1981: getScriptProxy().addScript(script);
1982: }
1983:
1984: /**
1985: * Returns the XSL ID of this object.
1986: */
1987: @SuppressWarnings("unchecked")
1988: public void getXSLId(
1989: org.directwebremoting.proxy.Callback<String> callback) {
1990: ScriptBuffer script = new ScriptBuffer();
1991: String callbackPrefix = "";
1992:
1993: if (callback != null) {
1994: callbackPrefix = "var reply = ";
1995: }
1996:
1997: script.appendCall(callbackPrefix + getContextPath()
1998: + "getXSLId");
1999:
2000: if (callback != null) {
2001: String key = org.directwebremoting.extend.CallbackHelper
2002: .saveCallback(callback, String.class);
2003: script
2004: .appendCall("__System.activateCallback", key,
2005: "reply");
2006: }
2007:
2008: getScriptProxy().addScript(script);
2009: }
2010:
2011: /**
2012: * Returns a map containing all the parameters to pass to the XSL stylesheet during transformation.
2013: */
2014: @SuppressWarnings("unchecked")
2015: public jsx3.lang.Object getXSLParams() {
2016: String extension = "getXSLParams().";
2017: try {
2018: java.lang.reflect.Constructor<jsx3.lang.Object> ctor = jsx3.lang.Object.class
2019: .getConstructor(Context.class, String.class,
2020: ScriptProxy.class);
2021: return ctor.newInstance(this , extension, getScriptProxy());
2022: } catch (Exception ex) {
2023: throw new IllegalArgumentException("Unsupported type: "
2024: + jsx3.lang.Object.class.getName());
2025: }
2026: }
2027:
2028: /**
2029: * Returns a map containing all the parameters to pass to the XSL stylesheet during transformation.
2030: * @param returnType The expected return type
2031: */
2032: @SuppressWarnings("unchecked")
2033: public <T> T getXSLParams(Class<T> returnType) {
2034: String extension = "getXSLParams().";
2035: try {
2036: java.lang.reflect.Constructor<T> ctor = returnType
2037: .getConstructor(Context.class, String.class,
2038: ScriptProxy.class);
2039: return ctor.newInstance(this , extension, getScriptProxy());
2040: } catch (Exception ex) {
2041: throw new IllegalArgumentException(
2042: "Unsupported return type: " + returnType.getName());
2043: }
2044: }
2045:
2046: /**
2047: * Returns whether the XML data source of this object is loaded asynchronously.
2048: * @param callback <code>0</code> or <code>1</code>.
2049: */
2050: @SuppressWarnings("unchecked")
2051: public void getXmlAsync(
2052: org.directwebremoting.proxy.Callback<Integer> callback) {
2053: ScriptBuffer script = new ScriptBuffer();
2054: String callbackPrefix = "";
2055:
2056: if (callback != null) {
2057: callbackPrefix = "var reply = ";
2058: }
2059:
2060: script.appendCall(callbackPrefix + getContextPath()
2061: + "getXmlAsync");
2062:
2063: if (callback != null) {
2064: String key = org.directwebremoting.extend.CallbackHelper
2065: .saveCallback(callback, Integer.class);
2066: script
2067: .appendCall("__System.activateCallback", key,
2068: "reply");
2069: }
2070:
2071: getScriptProxy().addScript(script);
2072: }
2073:
2074: /**
2075: * Returns whether this object is bound to the XML document stored in the data cache.
2076: * @param callback <code>0</code> or <code>1</code>.
2077: */
2078: @SuppressWarnings("unchecked")
2079: public void getXmlBind(
2080: org.directwebremoting.proxy.Callback<Integer> callback) {
2081: ScriptBuffer script = new ScriptBuffer();
2082: String callbackPrefix = "";
2083:
2084: if (callback != null) {
2085: callbackPrefix = "var reply = ";
2086: }
2087:
2088: script.appendCall(callbackPrefix + getContextPath()
2089: + "getXmlBind");
2090:
2091: if (callback != null) {
2092: String key = org.directwebremoting.extend.CallbackHelper
2093: .saveCallback(callback, Integer.class);
2094: script
2095: .appendCall("__System.activateCallback", key,
2096: "reply");
2097: }
2098:
2099: getScriptProxy().addScript(script);
2100: }
2101:
2102: /**
2103: * This method is called in two situations:
2104:
2105: When the datasource of this object finishes loading (success, error, or timeout), if the
2106: xmlAsync property of this object is true, its datasource is specified as an
2107: XML URL, and the first time doTransform() was called the datasource was still loading.
2108: Any time the value stored in the server XML cache under the key equal to the XML Id of this object
2109: changes, if the xmlBind property of this object is true.
2110:
2111: Any methods overriding this method should begin with a call to jsxsupermix().
2112: * @param objEvent the event published by the cache.
2113: */
2114: public void onXmlBinding(jsx3.lang.Object objEvent) {
2115: ScriptBuffer script = new ScriptBuffer();
2116: script.appendCall(getContextPath() + "onXmlBinding", objEvent);
2117: getScriptProxy().addScript(script);
2118: }
2119:
2120: /**
2121: * Removes a parameter from the list of parameters to pass to the XSL stylesheet during transformation.
2122: * @param strName the name of the XSL parameter to remove.
2123: * @return this object.
2124: */
2125: @SuppressWarnings("unchecked")
2126: public jsx3.xml.Cacheable removeXSLParam(String strName) {
2127: String extension = "removeXSLParam(\"" + strName + "\").";
2128: try {
2129: java.lang.reflect.Constructor<jsx3.xml.Cacheable> ctor = jsx3.xml.Cacheable.class
2130: .getConstructor(Context.class, String.class,
2131: ScriptProxy.class);
2132: return ctor.newInstance(this , extension, getScriptProxy());
2133: } catch (Exception ex) {
2134: throw new IllegalArgumentException("Unsupported type: "
2135: + jsx3.xml.Cacheable.class.getName());
2136: }
2137: }
2138:
2139: /**
2140: * Removes a parameter from the list of parameters to pass to the XSL stylesheet during transformation.
2141: * @param strName the name of the XSL parameter to remove.
2142: * @param returnType The expected return type
2143: * @return this object.
2144: */
2145: @SuppressWarnings("unchecked")
2146: public <T> T removeXSLParam(String strName, Class<T> returnType) {
2147: String extension = "removeXSLParam(\"" + strName + "\").";
2148: try {
2149: java.lang.reflect.Constructor<T> ctor = returnType
2150: .getConstructor(Context.class, String.class,
2151: ScriptProxy.class);
2152: return ctor.newInstance(this , extension, getScriptProxy());
2153: } catch (Exception ex) {
2154: throw new IllegalArgumentException(
2155: "Unsupported return type: " + returnType.getName());
2156: }
2157: }
2158:
2159: /**
2160: * Removes all parameters from the list of parameters to pass to the XSL stylesheet during transformation.
2161: * @return this object.
2162: */
2163: @SuppressWarnings("unchecked")
2164: public jsx3.xml.Cacheable removeXSLParams() {
2165: String extension = "removeXSLParams().";
2166: try {
2167: java.lang.reflect.Constructor<jsx3.xml.Cacheable> ctor = jsx3.xml.Cacheable.class
2168: .getConstructor(Context.class, String.class,
2169: ScriptProxy.class);
2170: return ctor.newInstance(this , extension, getScriptProxy());
2171: } catch (Exception ex) {
2172: throw new IllegalArgumentException("Unsupported type: "
2173: + jsx3.xml.Cacheable.class.getName());
2174: }
2175: }
2176:
2177: /**
2178: * Removes all parameters from the list of parameters to pass to the XSL stylesheet during transformation.
2179: * @param returnType The expected return type
2180: * @return this object.
2181: */
2182: @SuppressWarnings("unchecked")
2183: public <T> T removeXSLParams(Class<T> returnType) {
2184: String extension = "removeXSLParams().";
2185: try {
2186: java.lang.reflect.Constructor<T> ctor = returnType
2187: .getConstructor(Context.class, String.class,
2188: ScriptProxy.class);
2189: return ctor.newInstance(this , extension, getScriptProxy());
2190: } catch (Exception ex) {
2191: throw new IllegalArgumentException(
2192: "Unsupported return type: " + returnType.getName());
2193: }
2194: }
2195:
2196: /**
2197: * Removes the XML and XSL source documents from the server cache.
2198: * @param objServer the server owning the cache to modify. This is a required argument only if
2199: <code>this.getServer()</code> does not returns a server instance.
2200: */
2201: public void resetCacheData(jsx3.app.Server objServer) {
2202: ScriptBuffer script = new ScriptBuffer();
2203: script.appendCall(getContextPath() + "resetCacheData",
2204: objServer);
2205: getScriptProxy().addScript(script);
2206: }
2207:
2208: /**
2209: * Removes the XML source document stored under the XML ID of this object from the server cache.
2210: * @param objServer the server owning the cache to modify. This is a required argument only if
2211: <code>this.getServer()</code> does not returns a server instance.
2212: */
2213: public void resetXmlCacheData(jsx3.app.Server objServer) {
2214: ScriptBuffer script = new ScriptBuffer();
2215: script.appendCall(getContextPath() + "resetXmlCacheData",
2216: objServer);
2217: getScriptProxy().addScript(script);
2218: }
2219:
2220: /**
2221: * Sets whether this object removes its XML and XSL source documents from the cache of its server when it
2222: is destroyed.
2223: * @param intShare <code>CLEANUPRESOURCES</code> or <code>SHARERESOURCES</code>. <code>CLEANUPRESOURCES</code>
2224: is the default value if the property is <code>null</code>.
2225: * @return this object.
2226: */
2227: @SuppressWarnings("unchecked")
2228: public jsx3.xml.Cacheable setShareResources(int intShare) {
2229: String extension = "setShareResources(\"" + intShare + "\").";
2230: try {
2231: java.lang.reflect.Constructor<jsx3.xml.Cacheable> ctor = jsx3.xml.Cacheable.class
2232: .getConstructor(Context.class, String.class,
2233: ScriptProxy.class);
2234: return ctor.newInstance(this , extension, getScriptProxy());
2235: } catch (Exception ex) {
2236: throw new IllegalArgumentException("Unsupported type: "
2237: + jsx3.xml.Cacheable.class.getName());
2238: }
2239: }
2240:
2241: /**
2242: * Sets whether this object removes its XML and XSL source documents from the cache of its server when it
2243: is destroyed.
2244: * @param intShare <code>CLEANUPRESOURCES</code> or <code>SHARERESOURCES</code>. <code>CLEANUPRESOURCES</code>
2245: is the default value if the property is <code>null</code>.
2246: * @param returnType The expected return type
2247: * @return this object.
2248: */
2249: @SuppressWarnings("unchecked")
2250: public <T> T setShareResources(int intShare, Class<T> returnType) {
2251: String extension = "setShareResources(\"" + intShare + "\").";
2252: try {
2253: java.lang.reflect.Constructor<T> ctor = returnType
2254: .getConstructor(Context.class, String.class,
2255: ScriptProxy.class);
2256: return ctor.newInstance(this , extension, getScriptProxy());
2257: } catch (Exception ex) {
2258: throw new IllegalArgumentException(
2259: "Unsupported return type: " + returnType.getName());
2260: }
2261: }
2262:
2263: /**
2264: * Sets the source document of this object as though objDoc were retrieved from the XML URL or XML
2265: string of this object. This method executes the following steps:
2266:
2267: The document is transformed serially by each XML transformers of this object.
2268: The XML document is saved in the server cache under the XML ID of this object.
2269: If this object is an instance of jsx3.xml.CDF and the root node is a <data> element
2270: and its jsxassignids attribute is equal to 1, all <record> elements without a
2271: jsxid attribute are assigned a unique jsxid.
2272: If this object is an instance of jsx3.xml.CDF, convertProperties() is called
2273: on this object.
2274: * @param objDoc
2275: * @param objCache
2276: * @return the document stored in the server cache as the data source of this object. If
2277: transformers were run, this value will not be equal to the <code>objDoc</code> parameter.
2278: */
2279: @SuppressWarnings("unchecked")
2280: public jsx3.xml.CdfDocument setSourceXML(
2281: jsx3.xml.CdfDocument objDoc, jsx3.app.Cache objCache) {
2282: String extension = "setSourceXML(\"" + objDoc + "\", \""
2283: + objCache + "\").";
2284: try {
2285: java.lang.reflect.Constructor<jsx3.xml.CdfDocument> ctor = jsx3.xml.CdfDocument.class
2286: .getConstructor(Context.class, String.class,
2287: ScriptProxy.class);
2288: return ctor.newInstance(this , extension, getScriptProxy());
2289: } catch (Exception ex) {
2290: throw new IllegalArgumentException("Unsupported type: "
2291: + jsx3.xml.CdfDocument.class.getName());
2292: }
2293: }
2294:
2295: /**
2296: * Sets the source document of this object as though objDoc were retrieved from the XML URL or XML
2297: string of this object. This method executes the following steps:
2298:
2299: The document is transformed serially by each XML transformers of this object.
2300: The XML document is saved in the server cache under the XML ID of this object.
2301: If this object is an instance of jsx3.xml.CDF and the root node is a <data> element
2302: and its jsxassignids attribute is equal to 1, all <record> elements without a
2303: jsxid attribute are assigned a unique jsxid.
2304: If this object is an instance of jsx3.xml.CDF, convertProperties() is called
2305: on this object.
2306: * @param objDoc
2307: * @param objCache
2308: * @param returnType The expected return type
2309: * @return the document stored in the server cache as the data source of this object. If
2310: transformers were run, this value will not be equal to the <code>objDoc</code> parameter.
2311: */
2312: @SuppressWarnings("unchecked")
2313: public <T> T setSourceXML(jsx3.xml.CdfDocument objDoc,
2314: jsx3.app.Cache objCache, Class<T> returnType) {
2315: String extension = "setSourceXML(\"" + objDoc + "\", \""
2316: + objCache + "\").";
2317: try {
2318: java.lang.reflect.Constructor<T> ctor = returnType
2319: .getConstructor(Context.class, String.class,
2320: ScriptProxy.class);
2321: return ctor.newInstance(this , extension, getScriptProxy());
2322: } catch (Exception ex) {
2323: throw new IllegalArgumentException(
2324: "Unsupported return type: " + returnType.getName());
2325: }
2326: }
2327:
2328: /**
2329: * Sets the XML ID of this object. This value is the key under which the XML source document of this object is
2330: saved in the cache of the server owning this object. The developer may specify either a unique or shared value.
2331: If no value is specified, a unique id is generated.
2332: * @param strXMLId
2333: * @return this object.
2334: */
2335: @SuppressWarnings("unchecked")
2336: public jsx3.xml.Cacheable setXMLId(String strXMLId) {
2337: String extension = "setXMLId(\"" + strXMLId + "\").";
2338: try {
2339: java.lang.reflect.Constructor<jsx3.xml.Cacheable> ctor = jsx3.xml.Cacheable.class
2340: .getConstructor(Context.class, String.class,
2341: ScriptProxy.class);
2342: return ctor.newInstance(this , extension, getScriptProxy());
2343: } catch (Exception ex) {
2344: throw new IllegalArgumentException("Unsupported type: "
2345: + jsx3.xml.Cacheable.class.getName());
2346: }
2347: }
2348:
2349: /**
2350: * Sets the XML ID of this object. This value is the key under which the XML source document of this object is
2351: saved in the cache of the server owning this object. The developer may specify either a unique or shared value.
2352: If no value is specified, a unique id is generated.
2353: * @param strXMLId
2354: * @param returnType The expected return type
2355: * @return this object.
2356: */
2357: @SuppressWarnings("unchecked")
2358: public <T> T setXMLId(String strXMLId, Class<T> returnType) {
2359: String extension = "setXMLId(\"" + strXMLId + "\").";
2360: try {
2361: java.lang.reflect.Constructor<T> ctor = returnType
2362: .getConstructor(Context.class, String.class,
2363: ScriptProxy.class);
2364: return ctor.newInstance(this , extension, getScriptProxy());
2365: } catch (Exception ex) {
2366: throw new IllegalArgumentException(
2367: "Unsupported return type: " + returnType.getName());
2368: }
2369: }
2370:
2371: /**
2372: * Sets the XML string of this object. Setting this value to the string serialization of an XML document is one
2373: way of specifying the source XML document of this object.
2374: * @param strXML <code>null</code> or a well-formed serialized XML element.
2375: * @return this object.
2376: */
2377: @SuppressWarnings("unchecked")
2378: public jsx3.xml.Cacheable setXMLString(String strXML) {
2379: String extension = "setXMLString(\"" + strXML + "\").";
2380: try {
2381: java.lang.reflect.Constructor<jsx3.xml.Cacheable> ctor = jsx3.xml.Cacheable.class
2382: .getConstructor(Context.class, String.class,
2383: ScriptProxy.class);
2384: return ctor.newInstance(this , extension, getScriptProxy());
2385: } catch (Exception ex) {
2386: throw new IllegalArgumentException("Unsupported type: "
2387: + jsx3.xml.Cacheable.class.getName());
2388: }
2389: }
2390:
2391: /**
2392: * Sets the XML string of this object. Setting this value to the string serialization of an XML document is one
2393: way of specifying the source XML document of this object.
2394: * @param strXML <code>null</code> or a well-formed serialized XML element.
2395: * @param returnType The expected return type
2396: * @return this object.
2397: */
2398: @SuppressWarnings("unchecked")
2399: public <T> T setXMLString(String strXML, Class<T> returnType) {
2400: String extension = "setXMLString(\"" + strXML + "\").";
2401: try {
2402: java.lang.reflect.Constructor<T> ctor = returnType
2403: .getConstructor(Context.class, String.class,
2404: ScriptProxy.class);
2405: return ctor.newInstance(this , extension, getScriptProxy());
2406: } catch (Exception ex) {
2407: throw new IllegalArgumentException(
2408: "Unsupported return type: " + returnType.getName());
2409: }
2410: }
2411:
2412: /**
2413: * Sets the list of XML transformers of this object. The XML source document of this object is transformed
2414: serially by each of these transformers before it is placed in the XML cache.
2415:
2416: Each transformer is either the URI of an XSLT document (which will be resolved against the
2417: the server of this object) or the cache id of a XSLT document in the XML cache of the server
2418: of this object. When any transformer is loaded from a URI it is placed in the server cache under the id
2419: equal to its resolved URI. Any transformer that does not correspond to a valid XSLT document will be skipped
2420: without throwing an error.
2421: * @param arrTrans
2422: */
2423: public void setXMLTransformers(Object[] arrTrans) {
2424: ScriptBuffer script = new ScriptBuffer();
2425: script.appendCall(getContextPath() + "setXMLTransformers",
2426: arrTrans);
2427: getScriptProxy().addScript(script);
2428: }
2429:
2430: /**
2431: * Sets the XML URL of this object. Settings this value to the URI of an XML document is one way of specifying the
2432: source XML document of this object.
2433: * @param strXMLURL <code>null</code> or a URI that when resolved against the server owning this object
2434: specifies a valid XML document.
2435: * @return this object.
2436: */
2437: @SuppressWarnings("unchecked")
2438: public jsx3.xml.Cacheable setXMLURL(String strXMLURL) {
2439: String extension = "setXMLURL(\"" + strXMLURL + "\").";
2440: try {
2441: java.lang.reflect.Constructor<jsx3.xml.Cacheable> ctor = jsx3.xml.Cacheable.class
2442: .getConstructor(Context.class, String.class,
2443: ScriptProxy.class);
2444: return ctor.newInstance(this , extension, getScriptProxy());
2445: } catch (Exception ex) {
2446: throw new IllegalArgumentException("Unsupported type: "
2447: + jsx3.xml.Cacheable.class.getName());
2448: }
2449: }
2450:
2451: /**
2452: * Sets the XML URL of this object. Settings this value to the URI of an XML document is one way of specifying the
2453: source XML document of this object.
2454: * @param strXMLURL <code>null</code> or a URI that when resolved against the server owning this object
2455: specifies a valid XML document.
2456: * @param returnType The expected return type
2457: * @return this object.
2458: */
2459: @SuppressWarnings("unchecked")
2460: public <T> T setXMLURL(String strXMLURL, Class<T> returnType) {
2461: String extension = "setXMLURL(\"" + strXMLURL + "\").";
2462: try {
2463: java.lang.reflect.Constructor<T> ctor = returnType
2464: .getConstructor(Context.class, String.class,
2465: ScriptProxy.class);
2466: return ctor.newInstance(this , extension, getScriptProxy());
2467: } catch (Exception ex) {
2468: throw new IllegalArgumentException(
2469: "Unsupported return type: " + returnType.getName());
2470: }
2471: }
2472:
2473: /**
2474: * Adds a name/value pair to the list of parameters to pass to the XSL stylesheet during transformation. If
2475: strValue is null the parameter is removed.
2476: * @param strName the name of the XSL parameter to add.
2477: * @param strValue the value of the XSL parameter to add.
2478: * @return this object.
2479: */
2480: @SuppressWarnings("unchecked")
2481: public jsx3.xml.Cacheable setXSLParam(String strName,
2482: String strValue) {
2483: String extension = "setXSLParam(\"" + strName + "\", \""
2484: + strValue + "\").";
2485: try {
2486: java.lang.reflect.Constructor<jsx3.xml.Cacheable> ctor = jsx3.xml.Cacheable.class
2487: .getConstructor(Context.class, String.class,
2488: ScriptProxy.class);
2489: return ctor.newInstance(this , extension, getScriptProxy());
2490: } catch (Exception ex) {
2491: throw new IllegalArgumentException("Unsupported type: "
2492: + jsx3.xml.Cacheable.class.getName());
2493: }
2494: }
2495:
2496: /**
2497: * Adds a name/value pair to the list of parameters to pass to the XSL stylesheet during transformation. If
2498: strValue is null the parameter is removed.
2499: * @param strName the name of the XSL parameter to add.
2500: * @param strValue the value of the XSL parameter to add.
2501: * @param returnType The expected return type
2502: * @return this object.
2503: */
2504: @SuppressWarnings("unchecked")
2505: public <T> T setXSLParam(String strName, String strValue,
2506: Class<T> returnType) {
2507: String extension = "setXSLParam(\"" + strName + "\", \""
2508: + strValue + "\").";
2509: try {
2510: java.lang.reflect.Constructor<T> ctor = returnType
2511: .getConstructor(Context.class, String.class,
2512: ScriptProxy.class);
2513: return ctor.newInstance(this , extension, getScriptProxy());
2514: } catch (Exception ex) {
2515: throw new IllegalArgumentException(
2516: "Unsupported return type: " + returnType.getName());
2517: }
2518: }
2519:
2520: /**
2521: * Sets whether the XML data source of this object is loaded asynchronously. This setting only applies to
2522: data sources loaded from an XML URL.
2523: * @param bAsync
2524: * @return this object.
2525: */
2526: @SuppressWarnings("unchecked")
2527: public jsx3.xml.Cacheable setXmlAsync(boolean bAsync) {
2528: String extension = "setXmlAsync(\"" + bAsync + "\").";
2529: try {
2530: java.lang.reflect.Constructor<jsx3.xml.Cacheable> ctor = jsx3.xml.Cacheable.class
2531: .getConstructor(Context.class, String.class,
2532: ScriptProxy.class);
2533: return ctor.newInstance(this , extension, getScriptProxy());
2534: } catch (Exception ex) {
2535: throw new IllegalArgumentException("Unsupported type: "
2536: + jsx3.xml.Cacheable.class.getName());
2537: }
2538: }
2539:
2540: /**
2541: * Sets whether the XML data source of this object is loaded asynchronously. This setting only applies to
2542: data sources loaded from an XML URL.
2543: * @param bAsync
2544: * @param returnType The expected return type
2545: * @return this object.
2546: */
2547: @SuppressWarnings("unchecked")
2548: public <T> T setXmlAsync(boolean bAsync, Class<T> returnType) {
2549: String extension = "setXmlAsync(\"" + bAsync + "\").";
2550: try {
2551: java.lang.reflect.Constructor<T> ctor = returnType
2552: .getConstructor(Context.class, String.class,
2553: ScriptProxy.class);
2554: return ctor.newInstance(this , extension, getScriptProxy());
2555: } catch (Exception ex) {
2556: throw new IllegalArgumentException(
2557: "Unsupported return type: " + returnType.getName());
2558: }
2559: }
2560:
2561: /**
2562: * Sets whether this object is bound to the XML document stored in the data cache. If this object is bound to the
2563: cache, then the onXmlBinding() method of this object is called any time the document stored in
2564: the cache under the XML Id of this object changes.
2565: * @param bBind
2566: * @param callback <code>0</code> or <code>1</code>.
2567: */
2568: @SuppressWarnings("unchecked")
2569: public void setXmlBind(boolean bBind,
2570: org.directwebremoting.proxy.Callback<Integer> callback) {
2571: ScriptBuffer script = new ScriptBuffer();
2572: String callbackPrefix = "";
2573:
2574: if (callback != null) {
2575: callbackPrefix = "var reply = ";
2576: }
2577:
2578: script.appendCall(callbackPrefix + getContextPath()
2579: + "setXmlBind", bBind);
2580:
2581: if (callback != null) {
2582: String key = org.directwebremoting.extend.CallbackHelper
2583: .saveCallback(callback, Integer.class);
2584: script
2585: .appendCall("__System.activateCallback", key,
2586: "reply");
2587: }
2588:
2589: getScriptProxy().addScript(script);
2590: }
2591:
2592: /**
2593: * Transfers a CDF record from another object to this object. If no XML data source exists
2594: yet for this object, an empty one is created before adding the new record. This method always updates the
2595: on-screen view of both the source and destination objects.
2596:
2597: This method fails quietly if any of the following conditions apply:
2598:
2599: there is no object with id equal to strSourceId
2600:
2601: there is no record in the source object with jsxid equal to strRecordId
2602:
2603:
2604: strParentRecordId is specified and there is no record in this object with
2605: jsxid equal to strParentRecordId
2606:
2607: the this object already has a record with jsxid equal to the record to adopt
2608: * @param strSourceId <span style="text-decoration: line-through;">either the id of the source object or the</span> source object itself.
2609: * @param strRecordId the <code>jsxid</code> attribute of the data record in the source object to transfer.
2610: * @param strParentRecordId the unique <code>jsxid</code> of an existing record. If this optional parameter
2611: is provided, the adopted record will be added as a child of this record. Otherwise, the adopted record will
2612: be added to the root <code>data</code> element.
2613: * @param bRedraw forces suppression of the insert event
2614: * @return the adopted record.
2615: */
2616: @SuppressWarnings("unchecked")
2617: public jsx3.xml.Node adoptRecord(jsx3.xml.CdfDocument strSourceId,
2618: String strRecordId, String strParentRecordId,
2619: boolean bRedraw) {
2620: String extension = "adoptRecord(\"" + strSourceId + "\", \""
2621: + strRecordId + "\", \"" + strParentRecordId + "\", \""
2622: + bRedraw + "\").";
2623: try {
2624: java.lang.reflect.Constructor<jsx3.xml.Node> ctor = jsx3.xml.Node.class
2625: .getConstructor(Context.class, String.class,
2626: ScriptProxy.class);
2627: return ctor.newInstance(this , extension, getScriptProxy());
2628: } catch (Exception ex) {
2629: throw new IllegalArgumentException("Unsupported type: "
2630: + jsx3.xml.Node.class.getName());
2631: }
2632: }
2633:
2634: /**
2635: * Transfers a CDF record from another object to this object. If no XML data source exists
2636: yet for this object, an empty one is created before adding the new record. This method always updates the
2637: on-screen view of both the source and destination objects.
2638:
2639: This method fails quietly if any of the following conditions apply:
2640:
2641: there is no object with id equal to strSourceId
2642:
2643: there is no record in the source object with jsxid equal to strRecordId
2644:
2645:
2646: strParentRecordId is specified and there is no record in this object with
2647: jsxid equal to strParentRecordId
2648:
2649: the this object already has a record with jsxid equal to the record to adopt
2650: * @param strSourceId <span style="text-decoration: line-through;">either the id of the source object or the</span> source object itself.
2651: * @param strRecordId the <code>jsxid</code> attribute of the data record in the source object to transfer.
2652: * @param strParentRecordId the unique <code>jsxid</code> of an existing record. If this optional parameter
2653: is provided, the adopted record will be added as a child of this record. Otherwise, the adopted record will
2654: be added to the root <code>data</code> element.
2655: * @param bRedraw forces suppression of the insert event
2656: * @return the adopted record.
2657: */
2658: @SuppressWarnings("unchecked")
2659: public jsx3.xml.Node adoptRecord(String strSourceId,
2660: String strRecordId, String strParentRecordId,
2661: boolean bRedraw) {
2662: String extension = "adoptRecord(\"" + strSourceId + "\", \""
2663: + strRecordId + "\", \"" + strParentRecordId + "\", \""
2664: + bRedraw + "\").";
2665: try {
2666: java.lang.reflect.Constructor<jsx3.xml.Node> ctor = jsx3.xml.Node.class
2667: .getConstructor(Context.class, String.class,
2668: ScriptProxy.class);
2669: return ctor.newInstance(this , extension, getScriptProxy());
2670: } catch (Exception ex) {
2671: throw new IllegalArgumentException("Unsupported type: "
2672: + jsx3.xml.Node.class.getName());
2673: }
2674: }
2675:
2676: /**
2677: * Equivalent to adoptRecord, except that the to-be relationship is as a previousSibling to the CDF record identified by the parameter, strSiblingRecordId
2678:
2679: This method fails quietly if any of the following conditions apply:
2680:
2681: there is no record with a jsxid equal to strSourceId
2682:
2683: there is no record in the source object with a jsxid equal to strRecordId
2684:
2685:
2686: strSiblingRecordId is specified and there is no record in this object with a
2687: jsxid equal to strParentRecordId
2688:
2689: this object already has a record with jsxid equal to the record to adopt
2690: * @param strSourceId <span style="text-decoration: line-through;">either the id of the source object or the</span> source object itself.
2691: * @param strRecordId the <code>jsxid</code> attribute of the data record in the source object to transfer.
2692: * @param strSiblingRecordId the unique <code>jsxid</code> of an existing record in front of
2693: which the record identified by strSourceId will be placed
2694: * @param bRedraw if <code>true</code> or <code>null</code>, the on-screen view of this object is
2695: immediately updated to reflect the deleted record.
2696: * @return the adopted record.
2697: */
2698: @SuppressWarnings("unchecked")
2699: public jsx3.xml.Node adoptRecordBefore(
2700: jsx3.xml.CdfDocument strSourceId, String strRecordId,
2701: String strSiblingRecordId, boolean bRedraw) {
2702: String extension = "adoptRecordBefore(\"" + strSourceId
2703: + "\", \"" + strRecordId + "\", \""
2704: + strSiblingRecordId + "\", \"" + bRedraw + "\").";
2705: try {
2706: java.lang.reflect.Constructor<jsx3.xml.Node> ctor = jsx3.xml.Node.class
2707: .getConstructor(Context.class, String.class,
2708: ScriptProxy.class);
2709: return ctor.newInstance(this , extension, getScriptProxy());
2710: } catch (Exception ex) {
2711: throw new IllegalArgumentException("Unsupported type: "
2712: + jsx3.xml.Node.class.getName());
2713: }
2714: }
2715:
2716: /**
2717: * Equivalent to adoptRecord, except that the to-be relationship is as a previousSibling to the CDF record identified by the parameter, strSiblingRecordId
2718:
2719: This method fails quietly if any of the following conditions apply:
2720:
2721: there is no record with a jsxid equal to strSourceId
2722:
2723: there is no record in the source object with a jsxid equal to strRecordId
2724:
2725:
2726: strSiblingRecordId is specified and there is no record in this object with a
2727: jsxid equal to strParentRecordId
2728:
2729: this object already has a record with jsxid equal to the record to adopt
2730: * @param strSourceId <span style="text-decoration: line-through;">either the id of the source object or the</span> source object itself.
2731: * @param strRecordId the <code>jsxid</code> attribute of the data record in the source object to transfer.
2732: * @param strSiblingRecordId the unique <code>jsxid</code> of an existing record in front of
2733: which the record identified by strSourceId will be placed
2734: * @param bRedraw if <code>true</code> or <code>null</code>, the on-screen view of this object is
2735: immediately updated to reflect the deleted record.
2736: * @return the adopted record.
2737: */
2738: @SuppressWarnings("unchecked")
2739: public jsx3.xml.Node adoptRecordBefore(String strSourceId,
2740: String strRecordId, String strSiblingRecordId,
2741: boolean bRedraw) {
2742: String extension = "adoptRecordBefore(\"" + strSourceId
2743: + "\", \"" + strRecordId + "\", \""
2744: + strSiblingRecordId + "\", \"" + bRedraw + "\").";
2745: try {
2746: java.lang.reflect.Constructor<jsx3.xml.Node> ctor = jsx3.xml.Node.class
2747: .getConstructor(Context.class, String.class,
2748: ScriptProxy.class);
2749: return ctor.newInstance(this , extension, getScriptProxy());
2750: } catch (Exception ex) {
2751: throw new IllegalArgumentException("Unsupported type: "
2752: + jsx3.xml.Node.class.getName());
2753: }
2754: }
2755:
2756: /**
2757: * Converts all attributes in this CDF document that are property keys of the form {key} to
2758: the value of the property.
2759: * @param objProps the properties repository to query.
2760: * @param arrProps if provided, these attributes are converted rather than the default set of
2761: attributes.
2762: * @param bUnion if <code>true</code>, <code>arrProps</code> is combined with the default set of
2763: attributes and those attributes are converted.
2764: */
2765: public void convertProperties(java.util.Properties objProps,
2766: Object[] arrProps, boolean bUnion) {
2767: ScriptBuffer script = new ScriptBuffer();
2768: script.appendCall(getContextPath() + "convertProperties",
2769: objProps, arrProps, bUnion);
2770: getScriptProxy().addScript(script);
2771: }
2772:
2773: /**
2774: * Removes a record from the XML data source of this object.
2775: * @param strRecordId the <code>jsxid</code> attribute of the data record to remove.
2776: * @param bRedraw if <code>true</code> or <code>null</code>, the on-screen view of this object is
2777: immediately updated to reflect the deleted record.
2778: * @return the record removed from the data source or <code>null</code> if no such record found.
2779: */
2780: @SuppressWarnings("unchecked")
2781: public jsx3.xml.Node deleteRecord(String strRecordId,
2782: boolean bRedraw) {
2783: String extension = "deleteRecord(\"" + strRecordId + "\", \""
2784: + bRedraw + "\").";
2785: try {
2786: java.lang.reflect.Constructor<jsx3.xml.Node> ctor = jsx3.xml.Node.class
2787: .getConstructor(Context.class, String.class,
2788: ScriptProxy.class);
2789: return ctor.newInstance(this , extension, getScriptProxy());
2790: } catch (Exception ex) {
2791: throw new IllegalArgumentException("Unsupported type: "
2792: + jsx3.xml.Node.class.getName());
2793: }
2794: }
2795:
2796: /**
2797: * Removes a specific property from a record. If no such record exists in the XML document, this method fails quietly.
2798: * @param strRecordId the <code>jsxid</code> attribute of the data record to modify.
2799: * @param strPropName the name of the property to remove from the record.
2800: * @param bRedraw if <code>true</code> or <code>null</code>, the on-screen view of this object is
2801: immediately updated to reflect the deleted property.
2802: */
2803: public void deleteRecordProperty(String strRecordId,
2804: String strPropName, boolean bRedraw) {
2805: ScriptBuffer script = new ScriptBuffer();
2806: script.appendCall(getContextPath() + "deleteRecordProperty",
2807: strRecordId, strPropName, bRedraw);
2808: getScriptProxy().addScript(script);
2809: }
2810:
2811: /**
2812: * Returns an object containing the attributes of a particular CDF record as property/value pairs. The object returned by this
2813: method is a copy of the underlying data. Therefore, updates to this object will not affect the underlying data.
2814:
2815: The following two lines of code evaluate to the same value:
2816:
2817: objCDF.getRecord(strId).propName;
2818: objCDF.getRecordNode(strId).getAttribute("propName");
2819: * @param strRecordId the <code>jsxid</code> attribute of the data record to return.
2820: * @return the object representation of a CDF node or <code>null</code> if no such record found.
2821: */
2822: @SuppressWarnings("unchecked")
2823: public jsx3.lang.Object getRecord(String strRecordId) {
2824: String extension = "getRecord(\"" + strRecordId + "\").";
2825: try {
2826: java.lang.reflect.Constructor<jsx3.lang.Object> ctor = jsx3.lang.Object.class
2827: .getConstructor(Context.class, String.class,
2828: ScriptProxy.class);
2829: return ctor.newInstance(this , extension, getScriptProxy());
2830: } catch (Exception ex) {
2831: throw new IllegalArgumentException("Unsupported type: "
2832: + jsx3.lang.Object.class.getName());
2833: }
2834: }
2835:
2836: /**
2837: * Returns an object containing the attributes of a particular CDF record as property/value pairs. The object returned by this
2838: method is a copy of the underlying data. Therefore, updates to this object will not affect the underlying data.
2839:
2840: The following two lines of code evaluate to the same value:
2841:
2842: objCDF.getRecord(strId).propName;
2843: objCDF.getRecordNode(strId).getAttribute("propName");
2844: * @param strRecordId the <code>jsxid</code> attribute of the data record to return.
2845: * @param returnType The expected return type
2846: * @return the object representation of a CDF node or <code>null</code> if no such record found.
2847: */
2848: @SuppressWarnings("unchecked")
2849: public <T> T getRecord(String strRecordId, Class<T> returnType) {
2850: String extension = "getRecord(\"" + strRecordId + "\").";
2851: try {
2852: java.lang.reflect.Constructor<T> ctor = returnType
2853: .getConstructor(Context.class, String.class,
2854: ScriptProxy.class);
2855: return ctor.newInstance(this , extension, getScriptProxy());
2856: } catch (Exception ex) {
2857: throw new IllegalArgumentException(
2858: "Unsupported return type: " + returnType.getName());
2859: }
2860: }
2861:
2862: /**
2863: * Returns a record from the XML data source of this object. This returned value is a handle to the record and
2864: not a clone. Therefore, any updates made to the returned value with update the XML document of this object.
2865: To reflect such changes in the on-screen view of this object, call
2866: redrawRecord(strRecordId, jsx3.xml.CDF.UPDATE); on this object.
2867: * @param strRecordId the <code>jsxid</code> attribute of the data record to return.
2868: * @return the record node or <code>null</code> if none exists with a <code>jsxid</code>
2869: attribute equal to <code>strRecordId</code>.
2870: */
2871: @SuppressWarnings("unchecked")
2872: public jsx3.xml.Node getRecordNode(String strRecordId) {
2873: String extension = "getRecordNode(\"" + strRecordId + "\").";
2874: try {
2875: java.lang.reflect.Constructor<jsx3.xml.Node> ctor = jsx3.xml.Node.class
2876: .getConstructor(Context.class, String.class,
2877: ScriptProxy.class);
2878: return ctor.newInstance(this , extension, getScriptProxy());
2879: } catch (Exception ex) {
2880: throw new IllegalArgumentException("Unsupported type: "
2881: + jsx3.xml.Node.class.getName());
2882: }
2883: }
2884:
2885: /**
2886: * Inserts a new record into the XML data source of this object. If no XML data source exists
2887: yet for this object, an empty one is created before adding the new record.
2888: If a record already exists with an id equal to the jsxid property of objRecord,
2889: the operation is treated as an update, meaning the existing record is completely removed and a new record with
2890: the given jsxid is inserted.
2891: * @param objRecord a JavaScript object containing property/value pairs that define the
2892: attributes of the XML entity to create. Note that most classes that implement this interface require that all
2893: records have an attribute named <code>jsxid</code> that is unique across all records in the XML document.
2894: All property values will be treated as strings. Additionally, the following 3 characters are escaped:
2895: <code>" > <</code>.
2896: * @param strParentRecordId the unique <code>jsxid</code> of an existing record. If this optional parameter
2897: is provided and a record exists with a matching <code>jsxid</code> attribute, the new record will be added as a child of
2898: this record. Otherwise, the new record will be added to the root <code>data</code> element. However, if a
2899: record already exists with a <code>jsxid</code> attribute equal to the <code>jsxid</code> property of
2900: <code>objRecord</code>, this parameter will be ignored. In this case <code>adoptRecord()</code> must be called
2901: to change the parent of the record.
2902: * @param bRedraw if <code>true</code> or <code>null</code>, the on-screen view of this object is
2903: immediately updated to reflect the additional record.
2904: * @return the newly created or updated entity.
2905: */
2906: @SuppressWarnings("unchecked")
2907: public jsx3.xml.Node insertRecord(jsx3.lang.Object objRecord,
2908: String strParentRecordId, boolean bRedraw) {
2909: String extension = "insertRecord(\"" + objRecord + "\", \""
2910: + strParentRecordId + "\", \"" + bRedraw + "\").";
2911: try {
2912: java.lang.reflect.Constructor<jsx3.xml.Node> ctor = jsx3.xml.Node.class
2913: .getConstructor(Context.class, String.class,
2914: ScriptProxy.class);
2915: return ctor.newInstance(this , extension, getScriptProxy());
2916: } catch (Exception ex) {
2917: throw new IllegalArgumentException("Unsupported type: "
2918: + jsx3.xml.Node.class.getName());
2919: }
2920: }
2921:
2922: /**
2923: * Creates a new CDF record and inserts it into the CDF data source of this object, before the record identified by strSiblingRecordId.
2924:
2925: This method fails quietly if any of the following conditions apply:
2926:
2927: there is no existing record with a jsxid equal to strSiblingRecordId
2928:
2929: there is an existing record with jsxid equal to objRecord.jsxid
2930: * @param objRecord a JavaScript object containing property/value pairs that define the
2931: attributes of the XML entity to create. Note that most classes that implement this interface require that all
2932: records have an attribute named <code>jsxid</code> that is unique across all records in the XML document.
2933: All property values will be treated as strings. Additionally, the following 3 characters are escaped:
2934: <code>" > <</code>.
2935: * @param strSiblingRecordId the unique <code>jsxid</code> of an existing record before which the new record will be inserted.
2936: * @param bRedraw if <code>true</code> or <code>null</code>, the on-screen view of this object is
2937: immediately updated to reflect the additional record.
2938: * @return the newly created entity.
2939: */
2940: @SuppressWarnings("unchecked")
2941: public jsx3.xml.Node insertRecordBefore(jsx3.lang.Object objRecord,
2942: String strSiblingRecordId, boolean bRedraw) {
2943: String extension = "insertRecordBefore(\"" + objRecord
2944: + "\", \"" + strSiblingRecordId + "\", \"" + bRedraw
2945: + "\").";
2946: try {
2947: java.lang.reflect.Constructor<jsx3.xml.Node> ctor = jsx3.xml.Node.class
2948: .getConstructor(Context.class, String.class,
2949: ScriptProxy.class);
2950: return ctor.newInstance(this , extension, getScriptProxy());
2951: } catch (Exception ex) {
2952: throw new IllegalArgumentException("Unsupported type: "
2953: + jsx3.xml.Node.class.getName());
2954: }
2955: }
2956:
2957: /**
2958: * Inserts a new record into the XML data source of this object. This method is the same as
2959: insertRecord() except that its first parameter is of type jsx3.xml.Entity rather than
2960: Object.
2961: * @param objRecordNode an XML element of name <code>record</code>. Note that most classes that
2962: implement this interface require that all records have an attribute named <code>jsxid</code> that is unique
2963: across all records in the XML document.
2964: * @param strParentRecordId the unique <code>jsxid</code> of an existing record. If this optional parameter
2965: is provided and a record exists with a matching <code>jsxid</code> attribute, the new record will be added as a child of
2966: this record. Otherwise, the new record will be added to the root <code>data</code> element.
2967: * @param bRedraw if <code>true</code> or <code>null</code>, the on-screen view of this object is
2968: immediately updated to reflect the additional record.
2969: */
2970: public void insertRecordNode(jsx3.xml.Node objRecordNode,
2971: String strParentRecordId, boolean bRedraw) {
2972: ScriptBuffer script = new ScriptBuffer();
2973: script.appendCall(getContextPath() + "insertRecordNode",
2974: objRecordNode, strParentRecordId, bRedraw);
2975: getScriptProxy().addScript(script);
2976: }
2977:
2978: /**
2979: * Inserts a new property into an existing record with jsxid equal to strRecordId.
2980: If the property already exists, the existing property value will be updated. If no such record exists
2981: in the XML document, this method fails quietly.
2982: * @param strRecordId the <code>jsxid</code> attribute of the data record to modify.
2983: * @param strPropName the name of the property to insert into the record.
2984: * @param strPropValue the value of the property to insert.
2985: * @param bRedraw if <code>true</code> or <code>null</code>, the on-screen view of this object is
2986: immediately updated to reflect the inserted property.
2987: * @return this object.
2988: */
2989: @SuppressWarnings("unchecked")
2990: public jsx3.xml.CdfDocument insertRecordProperty(
2991: String strRecordId, String strPropName,
2992: String strPropValue, boolean bRedraw) {
2993: String extension = "insertRecordProperty(\"" + strRecordId
2994: + "\", \"" + strPropName + "\", \"" + strPropValue
2995: + "\", \"" + bRedraw + "\").";
2996: try {
2997: java.lang.reflect.Constructor<jsx3.xml.CdfDocument> ctor = jsx3.xml.CdfDocument.class
2998: .getConstructor(Context.class, String.class,
2999: ScriptProxy.class);
3000: return ctor.newInstance(this , extension, getScriptProxy());
3001: } catch (Exception ex) {
3002: throw new IllegalArgumentException("Unsupported type: "
3003: + jsx3.xml.CdfDocument.class.getName());
3004: }
3005: }
3006:
3007: /**
3008: * Inserts a new property into an existing record with jsxid equal to strRecordId.
3009: If the property already exists, the existing property value will be updated. If no such record exists
3010: in the XML document, this method fails quietly.
3011: * @param strRecordId the <code>jsxid</code> attribute of the data record to modify.
3012: * @param strPropName the name of the property to insert into the record.
3013: * @param strPropValue the value of the property to insert.
3014: * @param bRedraw if <code>true</code> or <code>null</code>, the on-screen view of this object is
3015: immediately updated to reflect the inserted property.
3016: * @param returnType The expected return type
3017: * @return this object.
3018: */
3019: @SuppressWarnings("unchecked")
3020: public <T> T insertRecordProperty(String strRecordId,
3021: String strPropName, String strPropValue, boolean bRedraw,
3022: Class<T> returnType) {
3023: String extension = "insertRecordProperty(\"" + strRecordId
3024: + "\", \"" + strPropName + "\", \"" + strPropValue
3025: + "\", \"" + bRedraw + "\").";
3026: try {
3027: java.lang.reflect.Constructor<T> ctor = returnType
3028: .getConstructor(Context.class, String.class,
3029: ScriptProxy.class);
3030: return ctor.newInstance(this , extension, getScriptProxy());
3031: } catch (Exception ex) {
3032: throw new IllegalArgumentException(
3033: "Unsupported return type: " + returnType.getName());
3034: }
3035: }
3036:
3037: }
|