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: * Paints the result of an XSL transformation in an Block. A transformation is performed on the XML source document
0024: with the XSL source document. The result is serialized HTML, which is painted to screen.
0025: * @author Joe Walker [joe at getahead dot org]
0026: * @author DRAPGEN - Dwr Reverse Ajax Proxy GENerator
0027: */
0028: public class BlockX extends jsx3.gui.Block {
0029: /**
0030: * All reverse ajax proxies need context to work from
0031: * @param scriptProxy The place we are writing scripts to
0032: * @param context The script that got us to where we are now
0033: */
0034: public BlockX(Context context, String extension,
0035: ScriptProxy scriptProxy) {
0036: super (context, extension, scriptProxy);
0037: }
0038:
0039: /**
0040: * instance initializer
0041: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0042: * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0043: * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0044: * @param vntWidth either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0045: * @param vntHeight either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0046: */
0047: public BlockX(String strName, int vntLeft, int vntTop,
0048: String vntWidth, int vntHeight) {
0049: super ((Context) null, (String) null, (ScriptProxy) null);
0050: ScriptBuffer script = new ScriptBuffer();
0051: script.appendCall("new BlockX", strName, vntLeft, vntTop,
0052: vntWidth, vntHeight);
0053: setInitScript(script);
0054: }
0055:
0056: /**
0057: * instance initializer
0058: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0059: * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0060: * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0061: * @param vntWidth either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0062: * @param vntHeight either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0063: */
0064: public BlockX(String strName, int vntLeft, String vntTop,
0065: String vntWidth, int vntHeight) {
0066: super ((Context) null, (String) null, (ScriptProxy) null);
0067: ScriptBuffer script = new ScriptBuffer();
0068: script.appendCall("new BlockX", strName, vntLeft, vntTop,
0069: vntWidth, vntHeight);
0070: setInitScript(script);
0071: }
0072:
0073: /**
0074: * instance initializer
0075: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0076: * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0077: * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0078: * @param vntWidth either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0079: * @param vntHeight either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0080: */
0081: public BlockX(String strName, String vntLeft, String vntTop,
0082: int vntWidth, int vntHeight) {
0083: super ((Context) null, (String) null, (ScriptProxy) null);
0084: ScriptBuffer script = new ScriptBuffer();
0085: script.appendCall("new BlockX", strName, vntLeft, vntTop,
0086: vntWidth, vntHeight);
0087: setInitScript(script);
0088: }
0089:
0090: /**
0091: * instance initializer
0092: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0093: * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0094: * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0095: * @param vntWidth either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0096: * @param vntHeight either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0097: */
0098: public BlockX(String strName, String vntLeft, int vntTop,
0099: String vntWidth, String vntHeight) {
0100: super ((Context) null, (String) null, (ScriptProxy) null);
0101: ScriptBuffer script = new ScriptBuffer();
0102: script.appendCall("new BlockX", strName, vntLeft, vntTop,
0103: vntWidth, vntHeight);
0104: setInitScript(script);
0105: }
0106:
0107: /**
0108: * instance initializer
0109: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0110: * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0111: * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0112: * @param vntWidth either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0113: * @param vntHeight either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0114: */
0115: public BlockX(String strName, String vntLeft, int vntTop,
0116: int vntWidth, String vntHeight) {
0117: super ((Context) null, (String) null, (ScriptProxy) null);
0118: ScriptBuffer script = new ScriptBuffer();
0119: script.appendCall("new BlockX", strName, vntLeft, vntTop,
0120: vntWidth, vntHeight);
0121: setInitScript(script);
0122: }
0123:
0124: /**
0125: * instance initializer
0126: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0127: * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0128: * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0129: * @param vntWidth either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0130: * @param vntHeight either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0131: */
0132: public BlockX(String strName, int vntLeft, int vntTop,
0133: int vntWidth, String vntHeight) {
0134: super ((Context) null, (String) null, (ScriptProxy) null);
0135: ScriptBuffer script = new ScriptBuffer();
0136: script.appendCall("new BlockX", strName, vntLeft, vntTop,
0137: vntWidth, vntHeight);
0138: setInitScript(script);
0139: }
0140:
0141: /**
0142: * instance initializer
0143: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0144: * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0145: * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0146: * @param vntWidth either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0147: * @param vntHeight either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0148: */
0149: public BlockX(String strName, String vntLeft, String vntTop,
0150: int vntWidth, String vntHeight) {
0151: super ((Context) null, (String) null, (ScriptProxy) null);
0152: ScriptBuffer script = new ScriptBuffer();
0153: script.appendCall("new BlockX", strName, vntLeft, vntTop,
0154: vntWidth, vntHeight);
0155: setInitScript(script);
0156: }
0157:
0158: /**
0159: * instance initializer
0160: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0161: * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0162: * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0163: * @param vntWidth either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0164: * @param vntHeight either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0165: */
0166: public BlockX(String strName, String vntLeft, String vntTop,
0167: String vntWidth, int vntHeight) {
0168: super ((Context) null, (String) null, (ScriptProxy) null);
0169: ScriptBuffer script = new ScriptBuffer();
0170: script.appendCall("new BlockX", strName, vntLeft, vntTop,
0171: vntWidth, vntHeight);
0172: setInitScript(script);
0173: }
0174:
0175: /**
0176: * instance initializer
0177: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0178: * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0179: * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0180: * @param vntWidth either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0181: * @param vntHeight either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0182: */
0183: public BlockX(String strName, int vntLeft, int vntTop,
0184: String vntWidth, String vntHeight) {
0185: super ((Context) null, (String) null, (ScriptProxy) null);
0186: ScriptBuffer script = new ScriptBuffer();
0187: script.appendCall("new BlockX", strName, vntLeft, vntTop,
0188: vntWidth, vntHeight);
0189: setInitScript(script);
0190: }
0191:
0192: /**
0193: * instance initializer
0194: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0195: * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0196: * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0197: * @param vntWidth either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0198: * @param vntHeight either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0199: */
0200: public BlockX(String strName, int vntLeft, String vntTop,
0201: int vntWidth, int vntHeight) {
0202: super ((Context) null, (String) null, (ScriptProxy) null);
0203: ScriptBuffer script = new ScriptBuffer();
0204: script.appendCall("new BlockX", strName, vntLeft, vntTop,
0205: vntWidth, vntHeight);
0206: setInitScript(script);
0207: }
0208:
0209: /**
0210: * instance initializer
0211: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0212: * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0213: * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0214: * @param vntWidth either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0215: * @param vntHeight either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0216: */
0217: public BlockX(String strName, String vntLeft, int vntTop,
0218: String vntWidth, int vntHeight) {
0219: super ((Context) null, (String) null, (ScriptProxy) null);
0220: ScriptBuffer script = new ScriptBuffer();
0221: script.appendCall("new BlockX", strName, vntLeft, vntTop,
0222: vntWidth, vntHeight);
0223: setInitScript(script);
0224: }
0225:
0226: /**
0227: * instance initializer
0228: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0229: * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0230: * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0231: * @param vntWidth either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0232: * @param vntHeight either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0233: */
0234: public BlockX(String strName, String vntLeft, String vntTop,
0235: String vntWidth, String vntHeight) {
0236: super ((Context) null, (String) null, (ScriptProxy) null);
0237: ScriptBuffer script = new ScriptBuffer();
0238: script.appendCall("new BlockX", strName, vntLeft, vntTop,
0239: vntWidth, vntHeight);
0240: setInitScript(script);
0241: }
0242:
0243: /**
0244: * instance initializer
0245: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0246: * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0247: * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0248: * @param vntWidth either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0249: * @param vntHeight either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0250: */
0251: public BlockX(String strName, int vntLeft, int vntTop,
0252: int vntWidth, int vntHeight) {
0253: super ((Context) null, (String) null, (ScriptProxy) null);
0254: ScriptBuffer script = new ScriptBuffer();
0255: script.appendCall("new BlockX", strName, vntLeft, vntTop,
0256: vntWidth, vntHeight);
0257: setInitScript(script);
0258: }
0259:
0260: /**
0261: * instance initializer
0262: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0263: * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0264: * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0265: * @param vntWidth either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0266: * @param vntHeight either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0267: */
0268: public BlockX(String strName, int vntLeft, String vntTop,
0269: String vntWidth, String vntHeight) {
0270: super ((Context) null, (String) null, (ScriptProxy) null);
0271: ScriptBuffer script = new ScriptBuffer();
0272: script.appendCall("new BlockX", strName, vntLeft, vntTop,
0273: vntWidth, vntHeight);
0274: setInitScript(script);
0275: }
0276:
0277: /**
0278: * instance initializer
0279: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0280: * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0281: * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0282: * @param vntWidth either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0283: * @param vntHeight either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0284: */
0285: public BlockX(String strName, int vntLeft, String vntTop,
0286: int vntWidth, String vntHeight) {
0287: super ((Context) null, (String) null, (ScriptProxy) null);
0288: ScriptBuffer script = new ScriptBuffer();
0289: script.appendCall("new BlockX", strName, vntLeft, vntTop,
0290: vntWidth, vntHeight);
0291: setInitScript(script);
0292: }
0293:
0294: /**
0295: * instance initializer
0296: * @param strName unique name distinguishing this object from all other JSX GUI objects in the JSX application
0297: * @param vntLeft either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0298: * @param vntTop either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0299: * @param vntWidth either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0300: * @param vntHeight either a number (i.e, 12, 30, etc) or a number and a unit value (i.e., "25%", "36pt", etc); if a number is passed, pixels will be the assumed unit when painted to screen
0301: */
0302: public BlockX(String strName, String vntLeft, int vntTop,
0303: int vntWidth, int vntHeight) {
0304: super ((Context) null, (String) null, (ScriptProxy) null);
0305: ScriptBuffer script = new ScriptBuffer();
0306: script.appendCall("new BlockX", strName, vntLeft, vntTop,
0307: vntWidth, vntHeight);
0308: setInitScript(script);
0309: }
0310:
0311: /**
0312: * Returns the XSL string of this object.
0313: */
0314: @SuppressWarnings("unchecked")
0315: public void getXSLString(
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: + "getXSLString");
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 XSL string of this object.
0340: * @param strXSL
0341: * @return this object.
0342: */
0343: @SuppressWarnings("unchecked")
0344: public jsx3.xml.Cacheable setXSLString(String strXSL) {
0345: String extension = "setXSLString(\"" + strXSL + "\").";
0346: try {
0347: java.lang.reflect.Constructor<jsx3.xml.Cacheable> ctor = jsx3.xml.Cacheable.class
0348: .getConstructor(Context.class, String.class,
0349: ScriptProxy.class);
0350: return ctor.newInstance(this , extension, getScriptProxy());
0351: } catch (Exception ex) {
0352: throw new IllegalArgumentException("Unsupported type: "
0353: + jsx3.xml.Cacheable.class.getName());
0354: }
0355: }
0356:
0357: /**
0358: * Sets the XSL string of this object.
0359: * @param strXSL
0360: * @param returnType The expected return type
0361: * @return this object.
0362: */
0363: @SuppressWarnings("unchecked")
0364: public <T> T setXSLString(String strXSL, Class<T> returnType) {
0365: String extension = "setXSLString(\"" + strXSL + "\").";
0366: try {
0367: java.lang.reflect.Constructor<T> ctor = returnType
0368: .getConstructor(Context.class, String.class,
0369: ScriptProxy.class);
0370: return ctor.newInstance(this , extension, getScriptProxy());
0371: } catch (Exception ex) {
0372: throw new IllegalArgumentException(
0373: "Unsupported return type: " + returnType.getName());
0374: }
0375: }
0376:
0377: /**
0378: * Returns the XSL URL of this object.
0379: */
0380: @SuppressWarnings("unchecked")
0381: public void getXSLURL(
0382: org.directwebremoting.proxy.Callback<String> callback) {
0383: ScriptBuffer script = new ScriptBuffer();
0384: String callbackPrefix = "";
0385:
0386: if (callback != null) {
0387: callbackPrefix = "var reply = ";
0388: }
0389:
0390: script.appendCall(callbackPrefix + getContextPath()
0391: + "getXSLURL");
0392:
0393: if (callback != null) {
0394: String key = org.directwebremoting.extend.CallbackHelper
0395: .saveCallback(callback, String.class);
0396: script
0397: .appendCall("__System.activateCallback", key,
0398: "reply");
0399: }
0400:
0401: getScriptProxy().addScript(script);
0402: }
0403:
0404: /**
0405: * Sets the XSL URL of this object.
0406: * @param strXSLURL
0407: * @return this object.
0408: */
0409: @SuppressWarnings("unchecked")
0410: public jsx3.xml.Cacheable setXSLURL(String strXSLURL) {
0411: String extension = "setXSLURL(\"" + strXSLURL + "\").";
0412: try {
0413: java.lang.reflect.Constructor<jsx3.xml.Cacheable> ctor = jsx3.xml.Cacheable.class
0414: .getConstructor(Context.class, String.class,
0415: ScriptProxy.class);
0416: return ctor.newInstance(this , extension, getScriptProxy());
0417: } catch (Exception ex) {
0418: throw new IllegalArgumentException("Unsupported type: "
0419: + jsx3.xml.Cacheable.class.getName());
0420: }
0421: }
0422:
0423: /**
0424: * Sets the XSL URL of this object.
0425: * @param strXSLURL
0426: * @param returnType The expected return type
0427: * @return this object.
0428: */
0429: @SuppressWarnings("unchecked")
0430: public <T> T setXSLURL(String strXSLURL, Class<T> returnType) {
0431: String extension = "setXSLURL(\"" + strXSLURL + "\").";
0432: try {
0433: java.lang.reflect.Constructor<T> ctor = returnType
0434: .getConstructor(Context.class, String.class,
0435: ScriptProxy.class);
0436: return ctor.newInstance(this , extension, getScriptProxy());
0437: } catch (Exception ex) {
0438: throw new IllegalArgumentException(
0439: "Unsupported return type: " + returnType.getName());
0440: }
0441: }
0442:
0443: /**
0444: * Resets the XML source document stored in the server cache under the XML ID of this object to an empty CDF
0445: document.
0446: */
0447: public void clearXmlData() {
0448: ScriptBuffer script = new ScriptBuffer();
0449: script.appendCall(getContextPath() + "clearXmlData");
0450: getScriptProxy().addScript(script);
0451: }
0452:
0453: /**
0454: * Returns whether this object removes its XML and XSL source documents from the cache of its server when it
0455: is destroyed.
0456: * @param callback <code>CLEANUPRESOURCES</code> or <code>SHARERESOURCES</code>.
0457: */
0458: @SuppressWarnings("unchecked")
0459: public void getShareResources(
0460: org.directwebremoting.proxy.Callback<Integer> callback) {
0461: ScriptBuffer script = new ScriptBuffer();
0462: String callbackPrefix = "";
0463:
0464: if (callback != null) {
0465: callbackPrefix = "var reply = ";
0466: }
0467:
0468: script.appendCall(callbackPrefix + getContextPath()
0469: + "getShareResources");
0470:
0471: if (callback != null) {
0472: String key = org.directwebremoting.extend.CallbackHelper
0473: .saveCallback(callback, Integer.class);
0474: script
0475: .appendCall("__System.activateCallback", key,
0476: "reply");
0477: }
0478:
0479: getScriptProxy().addScript(script);
0480: }
0481:
0482: /**
0483: * Returns the XML source document of this object. The XML document is determined by the following steps:
0484:
0485: If an XML document exists in the server cache under an ID equal to the XML ID of this object, that
0486: document is returned.
0487: If the XML string of this object is not empty, a new document is created by parsing this string.
0488: If the XML URL of this object is not empty, a new document is created by parsing the file at the location
0489: specified by the URL resolved against the server owning this object.
0490: Otherwise, an empty CDF document is returned.
0491:
0492: If a new document is created for this object (any of the steps listed above except for the first one), the
0493: following actions are also taken:
0494:
0495: If creating the document resulted in an error (XML parsing error, file not found error, etc) the offending
0496: document is returned immediately.
0497: Otherwise, setSourceXML is called on this object, passing in the created document.
0498: */
0499: @SuppressWarnings("unchecked")
0500: public jsx3.xml.CdfDocument getXML() {
0501: String extension = "getXML().";
0502: try {
0503: java.lang.reflect.Constructor<jsx3.xml.CdfDocument> ctor = jsx3.xml.CdfDocument.class
0504: .getConstructor(Context.class, String.class,
0505: ScriptProxy.class);
0506: return ctor.newInstance(this , extension, getScriptProxy());
0507: } catch (Exception ex) {
0508: throw new IllegalArgumentException("Unsupported type: "
0509: + jsx3.xml.CdfDocument.class.getName());
0510: }
0511: }
0512:
0513: /**
0514: * Returns the XML source document of this object. The XML document is determined by the following steps:
0515:
0516: If an XML document exists in the server cache under an ID equal to the XML ID of this object, that
0517: document is returned.
0518: If the XML string of this object is not empty, a new document is created by parsing this string.
0519: If the XML URL of this object is not empty, a new document is created by parsing the file at the location
0520: specified by the URL resolved against the server owning this object.
0521: Otherwise, an empty CDF document is returned.
0522:
0523: If a new document is created for this object (any of the steps listed above except for the first one), the
0524: following actions are also taken:
0525:
0526: If creating the document resulted in an error (XML parsing error, file not found error, etc) the offending
0527: document is returned immediately.
0528: Otherwise, setSourceXML is called on this object, passing in the created document.
0529: * @param returnType The expected return type
0530: */
0531: @SuppressWarnings("unchecked")
0532: public <T> T getXML(Class<T> returnType) {
0533: String extension = "getXML().";
0534: try {
0535: java.lang.reflect.Constructor<T> ctor = returnType
0536: .getConstructor(Context.class, String.class,
0537: ScriptProxy.class);
0538: return ctor.newInstance(this , extension, getScriptProxy());
0539: } catch (Exception ex) {
0540: throw new IllegalArgumentException(
0541: "Unsupported return type: " + returnType.getName());
0542: }
0543: }
0544:
0545: /**
0546: * Returns the XML ID of this object.
0547: * @param callback the XML ID.
0548: */
0549: @SuppressWarnings("unchecked")
0550: public void getXMLId(
0551: org.directwebremoting.proxy.Callback<String> callback) {
0552: ScriptBuffer script = new ScriptBuffer();
0553: String callbackPrefix = "";
0554:
0555: if (callback != null) {
0556: callbackPrefix = "var reply = ";
0557: }
0558:
0559: script.appendCall(callbackPrefix + getContextPath()
0560: + "getXMLId");
0561:
0562: if (callback != null) {
0563: String key = org.directwebremoting.extend.CallbackHelper
0564: .saveCallback(callback, String.class);
0565: script
0566: .appendCall("__System.activateCallback", key,
0567: "reply");
0568: }
0569:
0570: getScriptProxy().addScript(script);
0571: }
0572:
0573: /**
0574: * Returns the XML string of this object.
0575: */
0576: @SuppressWarnings("unchecked")
0577: public void getXMLString(
0578: org.directwebremoting.proxy.Callback<String> callback) {
0579: ScriptBuffer script = new ScriptBuffer();
0580: String callbackPrefix = "";
0581:
0582: if (callback != null) {
0583: callbackPrefix = "var reply = ";
0584: }
0585:
0586: script.appendCall(callbackPrefix + getContextPath()
0587: + "getXMLString");
0588:
0589: if (callback != null) {
0590: String key = org.directwebremoting.extend.CallbackHelper
0591: .saveCallback(callback, String.class);
0592: script
0593: .appendCall("__System.activateCallback", key,
0594: "reply");
0595: }
0596:
0597: getScriptProxy().addScript(script);
0598: }
0599:
0600: /**
0601: * Returns the list of XML transformers of this object.
0602: */
0603: @SuppressWarnings("unchecked")
0604: public void getXMLTransformers(
0605: org.directwebremoting.proxy.Callback<Object[]> callback) {
0606: ScriptBuffer script = new ScriptBuffer();
0607: String callbackPrefix = "";
0608:
0609: if (callback != null) {
0610: callbackPrefix = "var reply = ";
0611: }
0612:
0613: script.appendCall(callbackPrefix + getContextPath()
0614: + "getXMLTransformers");
0615:
0616: if (callback != null) {
0617: String key = org.directwebremoting.extend.CallbackHelper
0618: .saveCallback(callback, Object[].class);
0619: script
0620: .appendCall("__System.activateCallback", key,
0621: "reply");
0622: }
0623:
0624: getScriptProxy().addScript(script);
0625: }
0626:
0627: /**
0628: * Returns the XML URL of this object.
0629: */
0630: @SuppressWarnings("unchecked")
0631: public void getXMLURL(
0632: org.directwebremoting.proxy.Callback<String> callback) {
0633: ScriptBuffer script = new ScriptBuffer();
0634: String callbackPrefix = "";
0635:
0636: if (callback != null) {
0637: callbackPrefix = "var reply = ";
0638: }
0639:
0640: script.appendCall(callbackPrefix + getContextPath()
0641: + "getXMLURL");
0642:
0643: if (callback != null) {
0644: String key = org.directwebremoting.extend.CallbackHelper
0645: .saveCallback(callback, String.class);
0646: script
0647: .appendCall("__System.activateCallback", key,
0648: "reply");
0649: }
0650:
0651: getScriptProxy().addScript(script);
0652: }
0653:
0654: /**
0655: * Returns the XSL source document of this object. The XSL document is determined by the following steps:
0656:
0657: If an XSL document exists in the server cache under an ID equal to the XSL ID of this object, that
0658: document is returned.
0659: (Deprecated) If the XSL string of this object is not null, a new document is created by parsing this string.
0660: (Deprecated) If the XSL URL of this object is not null, a new document is created by parsing the file at the location
0661: specified by the URL resolved against the server owning this object.
0662: Otherwise, the default stylesheet (Cacheable.DEFAULTSTYLESHEET) is returned.
0663: * @return the XSL source document.
0664: */
0665: @SuppressWarnings("unchecked")
0666: public jsx3.xml.CdfDocument getXSL() {
0667: String extension = "getXSL().";
0668: try {
0669: java.lang.reflect.Constructor<jsx3.xml.CdfDocument> ctor = jsx3.xml.CdfDocument.class
0670: .getConstructor(Context.class, String.class,
0671: ScriptProxy.class);
0672: return ctor.newInstance(this , extension, getScriptProxy());
0673: } catch (Exception ex) {
0674: throw new IllegalArgumentException("Unsupported type: "
0675: + jsx3.xml.CdfDocument.class.getName());
0676: }
0677: }
0678:
0679: /**
0680: * Returns the XSL source document of this object. The XSL document is determined by the following steps:
0681:
0682: If an XSL document exists in the server cache under an ID equal to the XSL ID of this object, that
0683: document is returned.
0684: (Deprecated) If the XSL string of this object is not null, a new document is created by parsing this string.
0685: (Deprecated) If the XSL URL of this object is not null, a new document is created by parsing the file at the location
0686: specified by the URL resolved against the server owning this object.
0687: Otherwise, the default stylesheet (Cacheable.DEFAULTSTYLESHEET) is returned.
0688: * @param returnType The expected return type
0689: * @return the XSL source document.
0690: */
0691: @SuppressWarnings("unchecked")
0692: public <T> T getXSL(Class<T> returnType) {
0693: String extension = "getXSL().";
0694: try {
0695: java.lang.reflect.Constructor<T> ctor = returnType
0696: .getConstructor(Context.class, String.class,
0697: ScriptProxy.class);
0698: return ctor.newInstance(this , extension, getScriptProxy());
0699: } catch (Exception ex) {
0700: throw new IllegalArgumentException(
0701: "Unsupported return type: " + returnType.getName());
0702: }
0703: }
0704:
0705: /**
0706: * Returns the XSL ID of this object.
0707: */
0708: @SuppressWarnings("unchecked")
0709: public void getXSLId(
0710: org.directwebremoting.proxy.Callback<String> callback) {
0711: ScriptBuffer script = new ScriptBuffer();
0712: String callbackPrefix = "";
0713:
0714: if (callback != null) {
0715: callbackPrefix = "var reply = ";
0716: }
0717:
0718: script.appendCall(callbackPrefix + getContextPath()
0719: + "getXSLId");
0720:
0721: if (callback != null) {
0722: String key = org.directwebremoting.extend.CallbackHelper
0723: .saveCallback(callback, String.class);
0724: script
0725: .appendCall("__System.activateCallback", key,
0726: "reply");
0727: }
0728:
0729: getScriptProxy().addScript(script);
0730: }
0731:
0732: /**
0733: * Returns a map containing all the parameters to pass to the XSL stylesheet during transformation.
0734: */
0735: @SuppressWarnings("unchecked")
0736: public jsx3.lang.Object getXSLParams() {
0737: String extension = "getXSLParams().";
0738: try {
0739: java.lang.reflect.Constructor<jsx3.lang.Object> ctor = jsx3.lang.Object.class
0740: .getConstructor(Context.class, String.class,
0741: ScriptProxy.class);
0742: return ctor.newInstance(this , extension, getScriptProxy());
0743: } catch (Exception ex) {
0744: throw new IllegalArgumentException("Unsupported type: "
0745: + jsx3.lang.Object.class.getName());
0746: }
0747: }
0748:
0749: /**
0750: * Returns a map containing all the parameters to pass to the XSL stylesheet during transformation.
0751: * @param returnType The expected return type
0752: */
0753: @SuppressWarnings("unchecked")
0754: public <T> T getXSLParams(Class<T> returnType) {
0755: String extension = "getXSLParams().";
0756: try {
0757: java.lang.reflect.Constructor<T> ctor = returnType
0758: .getConstructor(Context.class, String.class,
0759: ScriptProxy.class);
0760: return ctor.newInstance(this , extension, getScriptProxy());
0761: } catch (Exception ex) {
0762: throw new IllegalArgumentException(
0763: "Unsupported return type: " + returnType.getName());
0764: }
0765: }
0766:
0767: /**
0768: * Returns whether the XML data source of this object is loaded asynchronously.
0769: * @param callback <code>0</code> or <code>1</code>.
0770: */
0771: @SuppressWarnings("unchecked")
0772: public void getXmlAsync(
0773: org.directwebremoting.proxy.Callback<Integer> callback) {
0774: ScriptBuffer script = new ScriptBuffer();
0775: String callbackPrefix = "";
0776:
0777: if (callback != null) {
0778: callbackPrefix = "var reply = ";
0779: }
0780:
0781: script.appendCall(callbackPrefix + getContextPath()
0782: + "getXmlAsync");
0783:
0784: if (callback != null) {
0785: String key = org.directwebremoting.extend.CallbackHelper
0786: .saveCallback(callback, Integer.class);
0787: script
0788: .appendCall("__System.activateCallback", key,
0789: "reply");
0790: }
0791:
0792: getScriptProxy().addScript(script);
0793: }
0794:
0795: /**
0796: * Returns whether this object is bound to the XML document stored in the data cache.
0797: * @param callback <code>0</code> or <code>1</code>.
0798: */
0799: @SuppressWarnings("unchecked")
0800: public void getXmlBind(
0801: org.directwebremoting.proxy.Callback<Integer> callback) {
0802: ScriptBuffer script = new ScriptBuffer();
0803: String callbackPrefix = "";
0804:
0805: if (callback != null) {
0806: callbackPrefix = "var reply = ";
0807: }
0808:
0809: script.appendCall(callbackPrefix + getContextPath()
0810: + "getXmlBind");
0811:
0812: if (callback != null) {
0813: String key = org.directwebremoting.extend.CallbackHelper
0814: .saveCallback(callback, Integer.class);
0815: script
0816: .appendCall("__System.activateCallback", key,
0817: "reply");
0818: }
0819:
0820: getScriptProxy().addScript(script);
0821: }
0822:
0823: /**
0824: * This method is called in two situations:
0825:
0826: When the datasource of this object finishes loading (success, error, or timeout), if the
0827: xmlAsync property of this object is true, its datasource is specified as an
0828: XML URL, and the first time doTransform() was called the datasource was still loading.
0829: Any time the value stored in the server XML cache under the key equal to the XML Id of this object
0830: changes, if the xmlBind property of this object is true.
0831:
0832: Any methods overriding this method should begin with a call to jsxsupermix().
0833: * @param objEvent the event published by the cache.
0834: */
0835: public void onXmlBinding(jsx3.lang.Object objEvent) {
0836: ScriptBuffer script = new ScriptBuffer();
0837: script.appendCall(getContextPath() + "onXmlBinding", objEvent);
0838: getScriptProxy().addScript(script);
0839: }
0840:
0841: /**
0842: * Removes a parameter from the list of parameters to pass to the XSL stylesheet during transformation.
0843: * @param strName the name of the XSL parameter to remove.
0844: * @return this object.
0845: */
0846: @SuppressWarnings("unchecked")
0847: public jsx3.xml.Cacheable removeXSLParam(String strName) {
0848: String extension = "removeXSLParam(\"" + strName + "\").";
0849: try {
0850: java.lang.reflect.Constructor<jsx3.xml.Cacheable> ctor = jsx3.xml.Cacheable.class
0851: .getConstructor(Context.class, String.class,
0852: ScriptProxy.class);
0853: return ctor.newInstance(this , extension, getScriptProxy());
0854: } catch (Exception ex) {
0855: throw new IllegalArgumentException("Unsupported type: "
0856: + jsx3.xml.Cacheable.class.getName());
0857: }
0858: }
0859:
0860: /**
0861: * Removes a parameter from the list of parameters to pass to the XSL stylesheet during transformation.
0862: * @param strName the name of the XSL parameter to remove.
0863: * @param returnType The expected return type
0864: * @return this object.
0865: */
0866: @SuppressWarnings("unchecked")
0867: public <T> T removeXSLParam(String strName, Class<T> returnType) {
0868: String extension = "removeXSLParam(\"" + strName + "\").";
0869: try {
0870: java.lang.reflect.Constructor<T> ctor = returnType
0871: .getConstructor(Context.class, String.class,
0872: ScriptProxy.class);
0873: return ctor.newInstance(this , extension, getScriptProxy());
0874: } catch (Exception ex) {
0875: throw new IllegalArgumentException(
0876: "Unsupported return type: " + returnType.getName());
0877: }
0878: }
0879:
0880: /**
0881: * Removes all parameters from the list of parameters to pass to the XSL stylesheet during transformation.
0882: * @return this object.
0883: */
0884: @SuppressWarnings("unchecked")
0885: public jsx3.xml.Cacheable removeXSLParams() {
0886: String extension = "removeXSLParams().";
0887: try {
0888: java.lang.reflect.Constructor<jsx3.xml.Cacheable> ctor = jsx3.xml.Cacheable.class
0889: .getConstructor(Context.class, String.class,
0890: ScriptProxy.class);
0891: return ctor.newInstance(this , extension, getScriptProxy());
0892: } catch (Exception ex) {
0893: throw new IllegalArgumentException("Unsupported type: "
0894: + jsx3.xml.Cacheable.class.getName());
0895: }
0896: }
0897:
0898: /**
0899: * Removes all parameters from the list of parameters to pass to the XSL stylesheet during transformation.
0900: * @param returnType The expected return type
0901: * @return this object.
0902: */
0903: @SuppressWarnings("unchecked")
0904: public <T> T removeXSLParams(Class<T> returnType) {
0905: String extension = "removeXSLParams().";
0906: try {
0907: java.lang.reflect.Constructor<T> ctor = returnType
0908: .getConstructor(Context.class, String.class,
0909: ScriptProxy.class);
0910: return ctor.newInstance(this , extension, getScriptProxy());
0911: } catch (Exception ex) {
0912: throw new IllegalArgumentException(
0913: "Unsupported return type: " + returnType.getName());
0914: }
0915: }
0916:
0917: /**
0918: * Removes the XML and XSL source documents from the server cache.
0919: * @param objServer the server owning the cache to modify. This is a required argument only if
0920: <code>this.getServer()</code> does not returns a server instance.
0921: */
0922: public void resetCacheData(jsx3.app.Server objServer) {
0923: ScriptBuffer script = new ScriptBuffer();
0924: script.appendCall(getContextPath() + "resetCacheData",
0925: objServer);
0926: getScriptProxy().addScript(script);
0927: }
0928:
0929: /**
0930: * Removes the XML source document stored under the XML ID of this object from the server cache.
0931: * @param objServer the server owning the cache to modify. This is a required argument only if
0932: <code>this.getServer()</code> does not returns a server instance.
0933: */
0934: public void resetXmlCacheData(jsx3.app.Server objServer) {
0935: ScriptBuffer script = new ScriptBuffer();
0936: script.appendCall(getContextPath() + "resetXmlCacheData",
0937: objServer);
0938: getScriptProxy().addScript(script);
0939: }
0940:
0941: /**
0942: * Sets whether this object removes its XML and XSL source documents from the cache of its server when it
0943: is destroyed.
0944: * @param intShare <code>CLEANUPRESOURCES</code> or <code>SHARERESOURCES</code>. <code>CLEANUPRESOURCES</code>
0945: is the default value if the property is <code>null</code>.
0946: * @return this object.
0947: */
0948: @SuppressWarnings("unchecked")
0949: public jsx3.xml.Cacheable setShareResources(int intShare) {
0950: String extension = "setShareResources(\"" + intShare + "\").";
0951: try {
0952: java.lang.reflect.Constructor<jsx3.xml.Cacheable> ctor = jsx3.xml.Cacheable.class
0953: .getConstructor(Context.class, String.class,
0954: ScriptProxy.class);
0955: return ctor.newInstance(this , extension, getScriptProxy());
0956: } catch (Exception ex) {
0957: throw new IllegalArgumentException("Unsupported type: "
0958: + jsx3.xml.Cacheable.class.getName());
0959: }
0960: }
0961:
0962: /**
0963: * Sets whether this object removes its XML and XSL source documents from the cache of its server when it
0964: is destroyed.
0965: * @param intShare <code>CLEANUPRESOURCES</code> or <code>SHARERESOURCES</code>. <code>CLEANUPRESOURCES</code>
0966: is the default value if the property is <code>null</code>.
0967: * @param returnType The expected return type
0968: * @return this object.
0969: */
0970: @SuppressWarnings("unchecked")
0971: public <T> T setShareResources(int intShare, Class<T> returnType) {
0972: String extension = "setShareResources(\"" + intShare + "\").";
0973: try {
0974: java.lang.reflect.Constructor<T> ctor = returnType
0975: .getConstructor(Context.class, String.class,
0976: ScriptProxy.class);
0977: return ctor.newInstance(this , extension, getScriptProxy());
0978: } catch (Exception ex) {
0979: throw new IllegalArgumentException(
0980: "Unsupported return type: " + returnType.getName());
0981: }
0982: }
0983:
0984: /**
0985: * Sets the source document of this object as though objDoc were retrieved from the XML URL or XML
0986: string of this object. This method executes the following steps:
0987:
0988: The document is transformed serially by each XML transformers of this object.
0989: The XML document is saved in the server cache under the XML ID of this object.
0990: If this object is an instance of jsx3.xml.CDF and the root node is a <data> element
0991: and its jsxassignids attribute is equal to 1, all <record> elements without a
0992: jsxid attribute are assigned a unique jsxid.
0993: If this object is an instance of jsx3.xml.CDF, convertProperties() is called
0994: on this object.
0995: * @param objDoc
0996: * @param objCache
0997: * @return the document stored in the server cache as the data source of this object. If
0998: transformers were run, this value will not be equal to the <code>objDoc</code> parameter.
0999: */
1000: @SuppressWarnings("unchecked")
1001: public jsx3.xml.CdfDocument setSourceXML(
1002: jsx3.xml.CdfDocument objDoc, jsx3.app.Cache objCache) {
1003: String extension = "setSourceXML(\"" + objDoc + "\", \""
1004: + objCache + "\").";
1005: try {
1006: java.lang.reflect.Constructor<jsx3.xml.CdfDocument> ctor = jsx3.xml.CdfDocument.class
1007: .getConstructor(Context.class, String.class,
1008: ScriptProxy.class);
1009: return ctor.newInstance(this , extension, getScriptProxy());
1010: } catch (Exception ex) {
1011: throw new IllegalArgumentException("Unsupported type: "
1012: + jsx3.xml.CdfDocument.class.getName());
1013: }
1014: }
1015:
1016: /**
1017: * Sets the source document of this object as though objDoc were retrieved from the XML URL or XML
1018: string of this object. This method executes the following steps:
1019:
1020: The document is transformed serially by each XML transformers of this object.
1021: The XML document is saved in the server cache under the XML ID of this object.
1022: If this object is an instance of jsx3.xml.CDF and the root node is a <data> element
1023: and its jsxassignids attribute is equal to 1, all <record> elements without a
1024: jsxid attribute are assigned a unique jsxid.
1025: If this object is an instance of jsx3.xml.CDF, convertProperties() is called
1026: on this object.
1027: * @param objDoc
1028: * @param objCache
1029: * @param returnType The expected return type
1030: * @return the document stored in the server cache as the data source of this object. If
1031: transformers were run, this value will not be equal to the <code>objDoc</code> parameter.
1032: */
1033: @SuppressWarnings("unchecked")
1034: public <T> T setSourceXML(jsx3.xml.CdfDocument objDoc,
1035: jsx3.app.Cache objCache, Class<T> returnType) {
1036: String extension = "setSourceXML(\"" + objDoc + "\", \""
1037: + objCache + "\").";
1038: try {
1039: java.lang.reflect.Constructor<T> ctor = returnType
1040: .getConstructor(Context.class, String.class,
1041: ScriptProxy.class);
1042: return ctor.newInstance(this , extension, getScriptProxy());
1043: } catch (Exception ex) {
1044: throw new IllegalArgumentException(
1045: "Unsupported return type: " + returnType.getName());
1046: }
1047: }
1048:
1049: /**
1050: * Sets the XML ID of this object. This value is the key under which the XML source document of this object is
1051: saved in the cache of the server owning this object. The developer may specify either a unique or shared value.
1052: If no value is specified, a unique id is generated.
1053: * @param strXMLId
1054: * @return this object.
1055: */
1056: @SuppressWarnings("unchecked")
1057: public jsx3.xml.Cacheable setXMLId(String strXMLId) {
1058: String extension = "setXMLId(\"" + strXMLId + "\").";
1059: try {
1060: java.lang.reflect.Constructor<jsx3.xml.Cacheable> ctor = jsx3.xml.Cacheable.class
1061: .getConstructor(Context.class, String.class,
1062: ScriptProxy.class);
1063: return ctor.newInstance(this , extension, getScriptProxy());
1064: } catch (Exception ex) {
1065: throw new IllegalArgumentException("Unsupported type: "
1066: + jsx3.xml.Cacheable.class.getName());
1067: }
1068: }
1069:
1070: /**
1071: * Sets the XML ID of this object. This value is the key under which the XML source document of this object is
1072: saved in the cache of the server owning this object. The developer may specify either a unique or shared value.
1073: If no value is specified, a unique id is generated.
1074: * @param strXMLId
1075: * @param returnType The expected return type
1076: * @return this object.
1077: */
1078: @SuppressWarnings("unchecked")
1079: public <T> T setXMLId(String strXMLId, Class<T> returnType) {
1080: String extension = "setXMLId(\"" + strXMLId + "\").";
1081: try {
1082: java.lang.reflect.Constructor<T> ctor = returnType
1083: .getConstructor(Context.class, String.class,
1084: ScriptProxy.class);
1085: return ctor.newInstance(this , extension, getScriptProxy());
1086: } catch (Exception ex) {
1087: throw new IllegalArgumentException(
1088: "Unsupported return type: " + returnType.getName());
1089: }
1090: }
1091:
1092: /**
1093: * Sets the XML string of this object. Setting this value to the string serialization of an XML document is one
1094: way of specifying the source XML document of this object.
1095: * @param strXML <code>null</code> or a well-formed serialized XML element.
1096: * @return this object.
1097: */
1098: @SuppressWarnings("unchecked")
1099: public jsx3.xml.Cacheable setXMLString(String strXML) {
1100: String extension = "setXMLString(\"" + strXML + "\").";
1101: try {
1102: java.lang.reflect.Constructor<jsx3.xml.Cacheable> ctor = jsx3.xml.Cacheable.class
1103: .getConstructor(Context.class, String.class,
1104: ScriptProxy.class);
1105: return ctor.newInstance(this , extension, getScriptProxy());
1106: } catch (Exception ex) {
1107: throw new IllegalArgumentException("Unsupported type: "
1108: + jsx3.xml.Cacheable.class.getName());
1109: }
1110: }
1111:
1112: /**
1113: * Sets the XML string of this object. Setting this value to the string serialization of an XML document is one
1114: way of specifying the source XML document of this object.
1115: * @param strXML <code>null</code> or a well-formed serialized XML element.
1116: * @param returnType The expected return type
1117: * @return this object.
1118: */
1119: @SuppressWarnings("unchecked")
1120: public <T> T setXMLString(String strXML, Class<T> returnType) {
1121: String extension = "setXMLString(\"" + strXML + "\").";
1122: try {
1123: java.lang.reflect.Constructor<T> ctor = returnType
1124: .getConstructor(Context.class, String.class,
1125: ScriptProxy.class);
1126: return ctor.newInstance(this , extension, getScriptProxy());
1127: } catch (Exception ex) {
1128: throw new IllegalArgumentException(
1129: "Unsupported return type: " + returnType.getName());
1130: }
1131: }
1132:
1133: /**
1134: * Sets the list of XML transformers of this object. The XML source document of this object is transformed
1135: serially by each of these transformers before it is placed in the XML cache.
1136:
1137: Each transformer is either the URI of an XSLT document (which will be resolved against the
1138: the server of this object) or the cache id of a XSLT document in the XML cache of the server
1139: of this object. When any transformer is loaded from a URI it is placed in the server cache under the id
1140: equal to its resolved URI. Any transformer that does not correspond to a valid XSLT document will be skipped
1141: without throwing an error.
1142: * @param arrTrans
1143: */
1144: public void setXMLTransformers(Object[] arrTrans) {
1145: ScriptBuffer script = new ScriptBuffer();
1146: script.appendCall(getContextPath() + "setXMLTransformers",
1147: arrTrans);
1148: getScriptProxy().addScript(script);
1149: }
1150:
1151: /**
1152: * Sets the XML URL of this object. Settings this value to the URI of an XML document is one way of specifying the
1153: source XML document of this object.
1154: * @param strXMLURL <code>null</code> or a URI that when resolved against the server owning this object
1155: specifies a valid XML document.
1156: * @return this object.
1157: */
1158: @SuppressWarnings("unchecked")
1159: public jsx3.xml.Cacheable setXMLURL(String strXMLURL) {
1160: String extension = "setXMLURL(\"" + strXMLURL + "\").";
1161: try {
1162: java.lang.reflect.Constructor<jsx3.xml.Cacheable> ctor = jsx3.xml.Cacheable.class
1163: .getConstructor(Context.class, String.class,
1164: ScriptProxy.class);
1165: return ctor.newInstance(this , extension, getScriptProxy());
1166: } catch (Exception ex) {
1167: throw new IllegalArgumentException("Unsupported type: "
1168: + jsx3.xml.Cacheable.class.getName());
1169: }
1170: }
1171:
1172: /**
1173: * Sets the XML URL of this object. Settings this value to the URI of an XML document is one way of specifying the
1174: source XML document of this object.
1175: * @param strXMLURL <code>null</code> or a URI that when resolved against the server owning this object
1176: specifies a valid XML document.
1177: * @param returnType The expected return type
1178: * @return this object.
1179: */
1180: @SuppressWarnings("unchecked")
1181: public <T> T setXMLURL(String strXMLURL, Class<T> returnType) {
1182: String extension = "setXMLURL(\"" + strXMLURL + "\").";
1183: try {
1184: java.lang.reflect.Constructor<T> ctor = returnType
1185: .getConstructor(Context.class, String.class,
1186: ScriptProxy.class);
1187: return ctor.newInstance(this , extension, getScriptProxy());
1188: } catch (Exception ex) {
1189: throw new IllegalArgumentException(
1190: "Unsupported return type: " + returnType.getName());
1191: }
1192: }
1193:
1194: /**
1195: * Adds a name/value pair to the list of parameters to pass to the XSL stylesheet during transformation. If
1196: strValue is null the parameter is removed.
1197: * @param strName the name of the XSL parameter to add.
1198: * @param strValue the value of the XSL parameter to add.
1199: * @return this object.
1200: */
1201: @SuppressWarnings("unchecked")
1202: public jsx3.xml.Cacheable setXSLParam(String strName,
1203: String strValue) {
1204: String extension = "setXSLParam(\"" + strName + "\", \""
1205: + strValue + "\").";
1206: try {
1207: java.lang.reflect.Constructor<jsx3.xml.Cacheable> ctor = jsx3.xml.Cacheable.class
1208: .getConstructor(Context.class, String.class,
1209: ScriptProxy.class);
1210: return ctor.newInstance(this , extension, getScriptProxy());
1211: } catch (Exception ex) {
1212: throw new IllegalArgumentException("Unsupported type: "
1213: + jsx3.xml.Cacheable.class.getName());
1214: }
1215: }
1216:
1217: /**
1218: * Adds a name/value pair to the list of parameters to pass to the XSL stylesheet during transformation. If
1219: strValue is null the parameter is removed.
1220: * @param strName the name of the XSL parameter to add.
1221: * @param strValue the value of the XSL parameter to add.
1222: * @param returnType The expected return type
1223: * @return this object.
1224: */
1225: @SuppressWarnings("unchecked")
1226: public <T> T setXSLParam(String strName, String strValue,
1227: Class<T> returnType) {
1228: String extension = "setXSLParam(\"" + strName + "\", \""
1229: + strValue + "\").";
1230: try {
1231: java.lang.reflect.Constructor<T> ctor = returnType
1232: .getConstructor(Context.class, String.class,
1233: ScriptProxy.class);
1234: return ctor.newInstance(this , extension, getScriptProxy());
1235: } catch (Exception ex) {
1236: throw new IllegalArgumentException(
1237: "Unsupported return type: " + returnType.getName());
1238: }
1239: }
1240:
1241: /**
1242: * Sets whether the XML data source of this object is loaded asynchronously. This setting only applies to
1243: data sources loaded from an XML URL.
1244: * @param bAsync
1245: * @return this object.
1246: */
1247: @SuppressWarnings("unchecked")
1248: public jsx3.xml.Cacheable setXmlAsync(boolean bAsync) {
1249: String extension = "setXmlAsync(\"" + bAsync + "\").";
1250: try {
1251: java.lang.reflect.Constructor<jsx3.xml.Cacheable> ctor = jsx3.xml.Cacheable.class
1252: .getConstructor(Context.class, String.class,
1253: ScriptProxy.class);
1254: return ctor.newInstance(this , extension, getScriptProxy());
1255: } catch (Exception ex) {
1256: throw new IllegalArgumentException("Unsupported type: "
1257: + jsx3.xml.Cacheable.class.getName());
1258: }
1259: }
1260:
1261: /**
1262: * Sets whether the XML data source of this object is loaded asynchronously. This setting only applies to
1263: data sources loaded from an XML URL.
1264: * @param bAsync
1265: * @param returnType The expected return type
1266: * @return this object.
1267: */
1268: @SuppressWarnings("unchecked")
1269: public <T> T setXmlAsync(boolean bAsync, Class<T> returnType) {
1270: String extension = "setXmlAsync(\"" + bAsync + "\").";
1271: try {
1272: java.lang.reflect.Constructor<T> ctor = returnType
1273: .getConstructor(Context.class, String.class,
1274: ScriptProxy.class);
1275: return ctor.newInstance(this , extension, getScriptProxy());
1276: } catch (Exception ex) {
1277: throw new IllegalArgumentException(
1278: "Unsupported return type: " + returnType.getName());
1279: }
1280: }
1281:
1282: /**
1283: * Sets whether this object is bound to the XML document stored in the data cache. If this object is bound to the
1284: cache, then the onXmlBinding() method of this object is called any time the document stored in
1285: the cache under the XML Id of this object changes.
1286: * @param bBind
1287: * @param callback <code>0</code> or <code>1</code>.
1288: */
1289: @SuppressWarnings("unchecked")
1290: public void setXmlBind(boolean bBind,
1291: org.directwebremoting.proxy.Callback<Integer> callback) {
1292: ScriptBuffer script = new ScriptBuffer();
1293: String callbackPrefix = "";
1294:
1295: if (callback != null) {
1296: callbackPrefix = "var reply = ";
1297: }
1298:
1299: script.appendCall(callbackPrefix + getContextPath()
1300: + "setXmlBind", bBind);
1301:
1302: if (callback != null) {
1303: String key = org.directwebremoting.extend.CallbackHelper
1304: .saveCallback(callback, Integer.class);
1305: script
1306: .appendCall("__System.activateCallback", key,
1307: "reply");
1308: }
1309:
1310: getScriptProxy().addScript(script);
1311: }
1312:
1313: }
|