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.app;
0017:
0018: import org.directwebremoting.ScriptBuffer;
0019: import org.directwebremoting.proxy.ScriptProxy;
0020: import org.directwebremoting.proxy.io.Context;
0021:
0022: /**
0023: * The controller of the JSX architecture.
0024: * @author Joe Walker [joe at getahead dot org]
0025: * @author DRAPGEN - Dwr Reverse Ajax Proxy GENerator
0026: */
0027: public class Server extends jsx3.lang.Object {
0028: /**
0029: * All reverse ajax proxies need context to work from
0030: * @param scriptProxy The place we are writing scripts to
0031: * @param context The script that got us to where we are now
0032: */
0033: public Server(Context context, String extension,
0034: ScriptProxy scriptProxy) {
0035: super (context, extension, scriptProxy);
0036: }
0037:
0038: /**
0039: * Sets environment variables used by this class (the controller for the JSX architecture)
0040: * @param strAppPath URL (either relative or absolute) for the application to load
0041: * @param objGUI the browser element (body, div, span, td, etc) into which the GI application should load
0042: * @param bPaint false if null; if true, the application VIEW will immediately be generated.
0043: * @param objEnv
0044: */
0045: public Server(String strAppPath, String objGUI, boolean bPaint,
0046: jsx3.lang.Object objEnv) {
0047: super ((Context) null, (String) null, (ScriptProxy) null);
0048: ScriptBuffer script = new ScriptBuffer();
0049: script.appendCall("new Server", strAppPath, objGUI, bPaint,
0050: objEnv);
0051: setInitScript(script);
0052: }
0053:
0054: /**
0055: * The subject of an event that jsx3.app.Server publishes when an instance of this class
0056: is created. The target of the event object is the initialized server.
0057: */
0058: public static final String INITED = "inited";
0059:
0060: /**
0061: * The subject of an event that instances of this class publish when a context help hot key is pressed
0062: in the context of a DOM node that has a help ID. The event has the following fields:
0063:
0064:
0065: target - the server publishing the event.
0066:
0067: model - the DOM node that received the key event.
0068:
0069: helpid - the help ID of the nearest ancestor of model that defines a help ID.
0070: */
0071: public static final String HELP = "help";
0072:
0073: /**
0074: * Returns the value of an environment setting of this server. Valid keys correspond to deployment options and are
0075: (case-insensitive):
0076:
0077: VERSION
0078: APPPATH
0079: ABSPATH
0080: CAPTION
0081: MODE
0082: SYSTEM
0083: NAMESPACE
0084: CANCELERROR
0085: CANCELRIGHTCLICK
0086: BODYHOTKEYS
0087: WIDTH
0088: HEIGHT
0089: LEFT
0090: TOP
0091: POSITION
0092: OVERFLOW
0093: UNICODE
0094: EVENTSVERS
0095: * @param strEnvKey the key of the environment value to return
0096: */
0097: @SuppressWarnings("unchecked")
0098: public void getEnv(String strEnvKey,
0099: org.directwebremoting.proxy.Callback<String> callback) {
0100: ScriptBuffer script = new ScriptBuffer();
0101: String callbackPrefix = "";
0102:
0103: if (callback != null) {
0104: callbackPrefix = "var reply = ";
0105: }
0106:
0107: script.appendCall(callbackPrefix + getContextPath() + "getEnv",
0108: strEnvKey);
0109:
0110: if (callback != null) {
0111: String key = org.directwebremoting.extend.CallbackHelper
0112: .saveCallback(callback, String.class);
0113: script
0114: .appendCall("__System.activateCallback", key,
0115: "reply");
0116: }
0117:
0118: getScriptProxy().addScript(script);
0119: }
0120:
0121: /**
0122: * Returns the settings of this server/project per config.xml
0123: */
0124: @SuppressWarnings("unchecked")
0125: public jsx3.app.Settings getSettings() {
0126: String extension = "getSettings().";
0127: try {
0128: java.lang.reflect.Constructor<jsx3.app.Settings> ctor = jsx3.app.Settings.class
0129: .getConstructor(Context.class, String.class,
0130: ScriptProxy.class);
0131: return ctor.newInstance(this , extension, getScriptProxy());
0132: } catch (Exception ex) {
0133: throw new IllegalArgumentException("Unsupported type: "
0134: + jsx3.app.Settings.class.getName());
0135: }
0136: }
0137:
0138: /**
0139: * Returns handle to a descendant taskbar belonging to this server instance (this is where JSXDialog instances will try to minimize to if it exists); returns null if none found;
0140: if no taskbar is found, dialogs are not minimized, but are 'window shaded'Ñlike a Mac used to do
0141: * @param objJSX if null, this.JSXROOT is assumed; otherwise the object in the DOM from which to start looking for a descendant taskbar (a jsx3.gui.WindowBar instance)
0142: */
0143: @SuppressWarnings("unchecked")
0144: public jsx3.gui.WindowBar getTaskBar(jsx3.app.Model objJSX) {
0145: String extension = "getTaskBar(\"" + objJSX + "\").";
0146: try {
0147: java.lang.reflect.Constructor<jsx3.gui.WindowBar> ctor = jsx3.gui.WindowBar.class
0148: .getConstructor(Context.class, String.class,
0149: ScriptProxy.class);
0150: return ctor.newInstance(this , extension, getScriptProxy());
0151: } catch (Exception ex) {
0152: throw new IllegalArgumentException("Unsupported type: "
0153: + jsx3.gui.WindowBar.class.getName());
0154: }
0155: }
0156:
0157: /**
0158: * call to shut down a server instance and free up resources used by the server (cache,dom,etc)
0159: */
0160: public void destroy() {
0161: ScriptBuffer script = new ScriptBuffer();
0162: script.appendCall(getContextPath() + "destroy");
0163: getScriptProxy().addScript(script);
0164: }
0165:
0166: /**
0167: * Paints this application and its default component into the application view port on the host HTML page. The
0168: system class loader calls this method once all the required resources of the application have loaded. The
0169: order of actions taken by this method is:
0170:
0171: Load the default component file
0172: Execute the onload script for the application
0173: Paint the default component in the view port
0174: * @param objXML the pre-loaded default component document.
0175: */
0176: public void paint(jsx3.xml.CdfDocument objXML) {
0177: ScriptBuffer script = new ScriptBuffer();
0178: script.appendCall(getContextPath() + "paint", objXML);
0179: getScriptProxy().addScript(script);
0180: }
0181:
0182: /**
0183: * set all four dimensions for a jsx3.Server instance, allowing the developer to adjust the width/height/left/width for the server. Must be called during/after the onload event for the server instance as it affects the VIEW for the server. Updates the absolutely positioned element that contains JSXROOT.
0184: * @param left the new left value or a JavaScript array containing all four new values (in pixels)
0185: * @param top the new top value (in pixels)
0186: * @param width the new width value (in pixels)
0187: * @param height the new height value (in pixels)
0188: */
0189: public void setDimensions(int left, int top, int width, int height) {
0190: ScriptBuffer script = new ScriptBuffer();
0191: script.appendCall(getContextPath() + "setDimensions", left,
0192: top, width, height);
0193: getScriptProxy().addScript(script);
0194: }
0195:
0196: /**
0197: * set all four dimensions for a jsx3.Server instance, allowing the developer to adjust the width/height/left/width for the server. Must be called during/after the onload event for the server instance as it affects the VIEW for the server. Updates the absolutely positioned element that contains JSXROOT.
0198: * @param left the new left value or a JavaScript array containing all four new values (in pixels)
0199: * @param top the new top value (in pixels)
0200: * @param width the new width value (in pixels)
0201: * @param height the new height value (in pixels)
0202: */
0203: public void setDimensions(Object[] left, int top, int width,
0204: int height) {
0205: ScriptBuffer script = new ScriptBuffer();
0206: script.appendCall(getContextPath() + "setDimensions", left,
0207: top, width, height);
0208: getScriptProxy().addScript(script);
0209: }
0210:
0211: /**
0212: * Loads an external resource into this server instance. What this method does depends on the strType
0213: parameter.
0214:
0215:
0216: script - Loads a JavaScript file asynchronously into the memory space of the page hosting this
0217: application; returns null.
0218:
0219: css - Loads a CSS file asynchronously into the memory space of the page hosting this
0220: application; returns null.
0221:
0222: xml or xsl - Loads an XML file synchronously into the XML cache of this
0223: application; returns the loaded jsx3.xml.Document instance.
0224:
0225: jss or ljss - Loads a dynamic properties file or localized properties bundle
0226: synchronously into this application; returns null.
0227:
0228: services - Loads and parses a mapping rules file synchronously; returns a new instance of
0229: jsx3.net.Service.
0230: * @param strSrc the path to the resource.
0231: * @param strId the unique identifier of the resource. A resource loaded by this method may clobber
0232: a previously loaded resource of the same type and id.
0233: * @param strType the type of include, one of: <code>css</code>, <code>jss</code>, <code>xml</code>,
0234: <code>xsl</code>, <code>script</code> (for JavaScript), <code>services</code> (for mapping rules),
0235: or <code>ljss</code>.
0236: * @param bReload if <code>true</code>, a JavaScript or CSS file is reloaded from the remote server
0237: without checking the local browser cache. Other types of resources are not affected by this parameter.
0238: * @return the return type depends on the <code>strType</code>
0239: parameter. See the method description.
0240: */
0241: @SuppressWarnings("unchecked")
0242: public jsx3.xml.CdfDocument loadInclude(java.net.URI strSrc,
0243: String strId, String strType, String bReload) {
0244: String extension = "loadInclude(\"" + strSrc + "\", \"" + strId
0245: + "\", \"" + strType + "\", \"" + bReload + "\").";
0246: try {
0247: java.lang.reflect.Constructor<jsx3.xml.CdfDocument> ctor = jsx3.xml.CdfDocument.class
0248: .getConstructor(Context.class, String.class,
0249: ScriptProxy.class);
0250: return ctor.newInstance(this , extension, getScriptProxy());
0251: } catch (Exception ex) {
0252: throw new IllegalArgumentException("Unsupported type: "
0253: + jsx3.xml.CdfDocument.class.getName());
0254: }
0255: }
0256:
0257: /**
0258: * Loads an external resource into this server instance. What this method does depends on the strType
0259: parameter.
0260:
0261:
0262: script - Loads a JavaScript file asynchronously into the memory space of the page hosting this
0263: application; returns null.
0264:
0265: css - Loads a CSS file asynchronously into the memory space of the page hosting this
0266: application; returns null.
0267:
0268: xml or xsl - Loads an XML file synchronously into the XML cache of this
0269: application; returns the loaded jsx3.xml.Document instance.
0270:
0271: jss or ljss - Loads a dynamic properties file or localized properties bundle
0272: synchronously into this application; returns null.
0273:
0274: services - Loads and parses a mapping rules file synchronously; returns a new instance of
0275: jsx3.net.Service.
0276: * @param strSrc the path to the resource.
0277: * @param strId the unique identifier of the resource. A resource loaded by this method may clobber
0278: a previously loaded resource of the same type and id.
0279: * @param strType the type of include, one of: <code>css</code>, <code>jss</code>, <code>xml</code>,
0280: <code>xsl</code>, <code>script</code> (for JavaScript), <code>services</code> (for mapping rules),
0281: or <code>ljss</code>.
0282: * @param bReload if <code>true</code>, a JavaScript or CSS file is reloaded from the remote server
0283: without checking the local browser cache. Other types of resources are not affected by this parameter.
0284: * @param returnType The expected return type
0285: * @return the return type depends on the <code>strType</code>
0286: parameter. See the method description.
0287: */
0288: @SuppressWarnings("unchecked")
0289: public <T> T loadInclude(java.net.URI strSrc, String strId,
0290: String strType, String bReload, Class<T> returnType) {
0291: String extension = "loadInclude(\"" + strSrc + "\", \"" + strId
0292: + "\", \"" + strType + "\", \"" + bReload + "\").";
0293: try {
0294: java.lang.reflect.Constructor<T> ctor = returnType
0295: .getConstructor(Context.class, String.class,
0296: ScriptProxy.class);
0297: return ctor.newInstance(this , extension, getScriptProxy());
0298: } catch (Exception ex) {
0299: throw new IllegalArgumentException(
0300: "Unsupported return type: " + returnType.getName());
0301: }
0302: }
0303:
0304: /**
0305: * Loads an external resource into this server instance. What this method does depends on the strType
0306: parameter.
0307:
0308:
0309: script - Loads a JavaScript file asynchronously into the memory space of the page hosting this
0310: application; returns null.
0311:
0312: css - Loads a CSS file asynchronously into the memory space of the page hosting this
0313: application; returns null.
0314:
0315: xml or xsl - Loads an XML file synchronously into the XML cache of this
0316: application; returns the loaded jsx3.xml.Document instance.
0317:
0318: jss or ljss - Loads a dynamic properties file or localized properties bundle
0319: synchronously into this application; returns null.
0320:
0321: services - Loads and parses a mapping rules file synchronously; returns a new instance of
0322: jsx3.net.Service.
0323: * @param strSrc the path to the resource.
0324: * @param strId the unique identifier of the resource. A resource loaded by this method may clobber
0325: a previously loaded resource of the same type and id.
0326: * @param strType the type of include, one of: <code>css</code>, <code>jss</code>, <code>xml</code>,
0327: <code>xsl</code>, <code>script</code> (for JavaScript), <code>services</code> (for mapping rules),
0328: or <code>ljss</code>.
0329: * @param bReload if <code>true</code>, a JavaScript or CSS file is reloaded from the remote server
0330: without checking the local browser cache. Other types of resources are not affected by this parameter.
0331: * @return the return type depends on the <code>strType</code>
0332: parameter. See the method description.
0333: */
0334: @SuppressWarnings("unchecked")
0335: public jsx3.xml.CdfDocument loadInclude(String strSrc,
0336: String strId, String strType, String bReload) {
0337: String extension = "loadInclude(\"" + strSrc + "\", \"" + strId
0338: + "\", \"" + strType + "\", \"" + bReload + "\").";
0339: try {
0340: java.lang.reflect.Constructor<jsx3.xml.CdfDocument> ctor = jsx3.xml.CdfDocument.class
0341: .getConstructor(Context.class, String.class,
0342: ScriptProxy.class);
0343: return ctor.newInstance(this , extension, getScriptProxy());
0344: } catch (Exception ex) {
0345: throw new IllegalArgumentException("Unsupported type: "
0346: + jsx3.xml.CdfDocument.class.getName());
0347: }
0348: }
0349:
0350: /**
0351: * Loads an external resource into this server instance. What this method does depends on the strType
0352: parameter.
0353:
0354:
0355: script - Loads a JavaScript file asynchronously into the memory space of the page hosting this
0356: application; returns null.
0357:
0358: css - Loads a CSS file asynchronously into the memory space of the page hosting this
0359: application; returns null.
0360:
0361: xml or xsl - Loads an XML file synchronously into the XML cache of this
0362: application; returns the loaded jsx3.xml.Document instance.
0363:
0364: jss or ljss - Loads a dynamic properties file or localized properties bundle
0365: synchronously into this application; returns null.
0366:
0367: services - Loads and parses a mapping rules file synchronously; returns a new instance of
0368: jsx3.net.Service.
0369: * @param strSrc the path to the resource.
0370: * @param strId the unique identifier of the resource. A resource loaded by this method may clobber
0371: a previously loaded resource of the same type and id.
0372: * @param strType the type of include, one of: <code>css</code>, <code>jss</code>, <code>xml</code>,
0373: <code>xsl</code>, <code>script</code> (for JavaScript), <code>services</code> (for mapping rules),
0374: or <code>ljss</code>.
0375: * @param bReload if <code>true</code>, a JavaScript or CSS file is reloaded from the remote server
0376: without checking the local browser cache. Other types of resources are not affected by this parameter.
0377: * @param returnType The expected return type
0378: * @return the return type depends on the <code>strType</code>
0379: parameter. See the method description.
0380: */
0381: @SuppressWarnings("unchecked")
0382: public <T> T loadInclude(String strSrc, String strId,
0383: String strType, String bReload, Class<T> returnType) {
0384: String extension = "loadInclude(\"" + strSrc + "\", \"" + strId
0385: + "\", \"" + strType + "\", \"" + bReload + "\").";
0386: try {
0387: java.lang.reflect.Constructor<T> ctor = returnType
0388: .getConstructor(Context.class, String.class,
0389: ScriptProxy.class);
0390: return ctor.newInstance(this , extension, getScriptProxy());
0391: } catch (Exception ex) {
0392: throw new IllegalArgumentException(
0393: "Unsupported return type: " + returnType.getName());
0394: }
0395: }
0396:
0397: /**
0398: * Removes a loaded JavaScript or CSS resource from the browser DOM.
0399: * @param strId the id used when loading the resource.
0400: */
0401: public void unloadInclude(String strId) {
0402: ScriptBuffer script = new ScriptBuffer();
0403: script.appendCall(getContextPath() + "unloadInclude", strId);
0404: getScriptProxy().addScript(script);
0405: }
0406:
0407: /**
0408: * Loads an application resource. This method looks up a resource registered with this application by its id.
0409: The resource must be registered in the config.xml file of this application.
0410: * @param strId unique identifier for the resource (its unique id as an application resource file).
0411: * @return the return type depends on the type of resource.
0412: See the documentation for <code>loadInclude()</code> for more information.
0413: */
0414: @SuppressWarnings("unchecked")
0415: public jsx3.xml.CdfDocument loadResource(String strId) {
0416: String extension = "loadResource(\"" + strId + "\").";
0417: try {
0418: java.lang.reflect.Constructor<jsx3.xml.CdfDocument> ctor = jsx3.xml.CdfDocument.class
0419: .getConstructor(Context.class, String.class,
0420: ScriptProxy.class);
0421: return ctor.newInstance(this , extension, getScriptProxy());
0422: } catch (Exception ex) {
0423: throw new IllegalArgumentException("Unsupported type: "
0424: + jsx3.xml.CdfDocument.class.getName());
0425: }
0426: }
0427:
0428: /**
0429: * Loads an application resource. This method looks up a resource registered with this application by its id.
0430: The resource must be registered in the config.xml file of this application.
0431: * @param strId unique identifier for the resource (its unique id as an application resource file).
0432: * @param returnType The expected return type
0433: * @return the return type depends on the type of resource.
0434: See the documentation for <code>loadInclude()</code> for more information.
0435: */
0436: @SuppressWarnings("unchecked")
0437: public <T> T loadResource(String strId, Class<T> returnType) {
0438: String extension = "loadResource(\"" + strId + "\").";
0439: try {
0440: java.lang.reflect.Constructor<T> ctor = returnType
0441: .getConstructor(Context.class, String.class,
0442: ScriptProxy.class);
0443: return ctor.newInstance(this , extension, getScriptProxy());
0444: } catch (Exception ex) {
0445: throw new IllegalArgumentException(
0446: "Unsupported return type: " + returnType.getName());
0447: }
0448: }
0449:
0450: /**
0451: * updates a single dynamic style property; dynamic properties are used by jsx3.gui.Block objects that extend the astract class, jsx3.gui.Block;
0452: * @param strPropName id for this dynamic property among all properties
0453: * @param vntValue value of the property; if null, the property with the name, @strPropName will be removed
0454: */
0455: public void setDynamicProperty(String strPropName, String vntValue) {
0456: ScriptBuffer script = new ScriptBuffer();
0457: script.appendCall(getContextPath() + "setDynamicProperty",
0458: strPropName, vntValue);
0459: getScriptProxy().addScript(script);
0460: }
0461:
0462: /**
0463: * Returns the value of the dynamic property @strPropName
0464: * @param strPropName id for this dynamic property among all properties
0465: * @param strToken if present tokens such as {0}, {1}, {n} will be replaced with the nth element of this vararg array
0466: * @param callback value of the property
0467: */
0468: @SuppressWarnings("unchecked")
0469: public void getDynamicProperty(String strPropName, String strToken,
0470: org.directwebremoting.proxy.Callback<String> callback) {
0471: ScriptBuffer script = new ScriptBuffer();
0472: String callbackPrefix = "";
0473:
0474: if (callback != null) {
0475: callbackPrefix = "var reply = ";
0476: }
0477:
0478: script.appendCall(callbackPrefix + getContextPath()
0479: + "getDynamicProperty", strPropName, strToken);
0480:
0481: if (callback != null) {
0482: String key = org.directwebremoting.extend.CallbackHelper
0483: .saveCallback(callback, String.class);
0484: script
0485: .appendCall("__System.activateCallback", key,
0486: "reply");
0487: }
0488:
0489: getScriptProxy().addScript(script);
0490: }
0491:
0492: /**
0493: * Sets a Cookie with the given name and value
0494: * @param name name of the cookie
0495: * @param value value of the cookie
0496: * @param expires valid jscript date object. for example: new Date("11:59:59 12-31-2004")
0497: * @param path path where the cookie is valid (default: path of calling document)
0498: * @param domain domain where the cookie is valid (default: domain of calling document)
0499: * @param secure valid jscript date object. for example: new Date("11:59:59 12-31-2004")
0500: * @param bRaw
0501: */
0502: public void setCookie(String name, String value,
0503: java.util.Date expires, String path, String domain,
0504: boolean secure, boolean bRaw) {
0505: ScriptBuffer script = new ScriptBuffer();
0506: script.appendCall(getContextPath() + "setCookie", name, value,
0507: expires, path, domain, secure, bRaw);
0508: getScriptProxy().addScript(script);
0509: }
0510:
0511: /**
0512: * Returns the value for the Cookie with the given @name
0513: * @param name name of the cookie
0514: * @param bRaw
0515: */
0516: @SuppressWarnings("unchecked")
0517: public void getCookie(String name, boolean bRaw,
0518: org.directwebremoting.proxy.Callback<String> callback) {
0519: ScriptBuffer script = new ScriptBuffer();
0520: String callbackPrefix = "";
0521:
0522: if (callback != null) {
0523: callbackPrefix = "var reply = ";
0524: }
0525:
0526: script.appendCall(callbackPrefix + getContextPath()
0527: + "getCookie", name, bRaw);
0528:
0529: if (callback != null) {
0530: String key = org.directwebremoting.extend.CallbackHelper
0531: .saveCallback(callback, String.class);
0532: script
0533: .appendCall("__System.activateCallback", key,
0534: "reply");
0535: }
0536:
0537: getScriptProxy().addScript(script);
0538: }
0539:
0540: /**
0541: * delete a cookie
0542: * @param name name of the cookie
0543: * @param path path where the cookie is valid (default: path of calling document)
0544: * @param domain domain where the cookie is valid (default: domain of calling document)
0545: */
0546: public void deleteCookie(String name, String path, String domain) {
0547: ScriptBuffer script = new ScriptBuffer();
0548: script.appendCall(getContextPath() + "deleteCookie", name,
0549: path, domain);
0550: getScriptProxy().addScript(script);
0551: }
0552:
0553: /**
0554: * Returns the root block for this server (JSXROOT)
0555: */
0556: @SuppressWarnings("unchecked")
0557: public jsx3.gui.Block getRootBlock() {
0558: String extension = "getRootBlock().";
0559: try {
0560: java.lang.reflect.Constructor<jsx3.gui.Block> ctor = jsx3.gui.Block.class
0561: .getConstructor(Context.class, String.class,
0562: ScriptProxy.class);
0563: return ctor.newInstance(this , extension, getScriptProxy());
0564: } catch (Exception ex) {
0565: throw new IllegalArgumentException("Unsupported type: "
0566: + jsx3.gui.Block.class.getName());
0567: }
0568: }
0569:
0570: /**
0571: * Returns the root block for this server (JSXROOT)
0572: * @param returnType The expected return type
0573: */
0574: @SuppressWarnings("unchecked")
0575: public <T> T getRootBlock(Class<T> returnType) {
0576: String extension = "getRootBlock().";
0577: try {
0578: java.lang.reflect.Constructor<T> ctor = returnType
0579: .getConstructor(Context.class, String.class,
0580: ScriptProxy.class);
0581: return ctor.newInstance(this , extension, getScriptProxy());
0582: } catch (Exception ex) {
0583: throw new IllegalArgumentException(
0584: "Unsupported return type: " + returnType.getName());
0585: }
0586: }
0587:
0588: /**
0589: * To implement jsx3.gui.Alerts interface.
0590: * @return the root block.
0591: */
0592: @SuppressWarnings("unchecked")
0593: public jsx3.app.Model getAlertsParent() {
0594: String extension = "getAlertsParent().";
0595: try {
0596: java.lang.reflect.Constructor<jsx3.app.Model> ctor = jsx3.app.Model.class
0597: .getConstructor(Context.class, String.class,
0598: ScriptProxy.class);
0599: return ctor.newInstance(this , extension, getScriptProxy());
0600: } catch (Exception ex) {
0601: throw new IllegalArgumentException("Unsupported type: "
0602: + jsx3.app.Model.class.getName());
0603: }
0604: }
0605:
0606: /**
0607: * To implement jsx3.gui.Alerts interface.
0608: * @param returnType The expected return type
0609: * @return the root block.
0610: */
0611: @SuppressWarnings("unchecked")
0612: public <T> T getAlertsParent(Class<T> returnType) {
0613: String extension = "getAlertsParent().";
0614: try {
0615: java.lang.reflect.Constructor<T> ctor = returnType
0616: .getConstructor(Context.class, String.class,
0617: ScriptProxy.class);
0618: return ctor.newInstance(this , extension, getScriptProxy());
0619: } catch (Exception ex) {
0620: throw new IllegalArgumentException(
0621: "Unsupported return type: " + returnType.getName());
0622: }
0623: }
0624:
0625: /**
0626: * Returns the body block for this server (JSXBODY)
0627: */
0628: @SuppressWarnings("unchecked")
0629: public jsx3.gui.Block getBodyBlock() {
0630: String extension = "getBodyBlock().";
0631: try {
0632: java.lang.reflect.Constructor<jsx3.gui.Block> ctor = jsx3.gui.Block.class
0633: .getConstructor(Context.class, String.class,
0634: ScriptProxy.class);
0635: return ctor.newInstance(this , extension, getScriptProxy());
0636: } catch (Exception ex) {
0637: throw new IllegalArgumentException("Unsupported type: "
0638: + jsx3.gui.Block.class.getName());
0639: }
0640: }
0641:
0642: /**
0643: * Returns the body block for this server (JSXBODY)
0644: * @param returnType The expected return type
0645: */
0646: @SuppressWarnings("unchecked")
0647: public <T> T getBodyBlock(Class<T> returnType) {
0648: String extension = "getBodyBlock().";
0649: try {
0650: java.lang.reflect.Constructor<T> ctor = returnType
0651: .getConstructor(Context.class, String.class,
0652: ScriptProxy.class);
0653: return ctor.newInstance(this , extension, getScriptProxy());
0654: } catch (Exception ex) {
0655: throw new IllegalArgumentException(
0656: "Unsupported return type: " + returnType.getName());
0657: }
0658: }
0659:
0660: /**
0661: * Returns the list of objects that are children of the body object. These are the root objects
0662: in a serialization file and the root nodes in the Component Hierarchy palette.
0663: */
0664: @SuppressWarnings("unchecked")
0665: public void getRootObjects(
0666: org.directwebremoting.proxy.Callback<Object[]> callback) {
0667: ScriptBuffer script = new ScriptBuffer();
0668: String callbackPrefix = "";
0669:
0670: if (callback != null) {
0671: callbackPrefix = "var reply = ";
0672: }
0673:
0674: script.appendCall(callbackPrefix + getContextPath()
0675: + "getRootObjects");
0676:
0677: if (callback != null) {
0678: String key = org.directwebremoting.extend.CallbackHelper
0679: .saveCallback(callback, Object[].class);
0680: script
0681: .appendCall("__System.activateCallback", key,
0682: "reply");
0683: }
0684:
0685: getScriptProxy().addScript(script);
0686: }
0687:
0688: /**
0689: * Returns the XML/XSL cache for this server
0690: */
0691: @SuppressWarnings("unchecked")
0692: public jsx3.app.Cache getCache() {
0693: String extension = "getCache().";
0694: try {
0695: java.lang.reflect.Constructor<jsx3.app.Cache> ctor = jsx3.app.Cache.class
0696: .getConstructor(Context.class, String.class,
0697: ScriptProxy.class);
0698: return ctor.newInstance(this , extension, getScriptProxy());
0699: } catch (Exception ex) {
0700: throw new IllegalArgumentException("Unsupported type: "
0701: + jsx3.app.Cache.class.getName());
0702: }
0703: }
0704:
0705: /**
0706: * Returns the DOM for this server
0707: */
0708: @SuppressWarnings("unchecked")
0709: public jsx3.app.DOM getDOM() {
0710: String extension = "getDOM().";
0711: try {
0712: java.lang.reflect.Constructor<jsx3.app.DOM> ctor = jsx3.app.DOM.class
0713: .getConstructor(Context.class, String.class,
0714: ScriptProxy.class);
0715: return ctor.newInstance(this , extension, getScriptProxy());
0716: } catch (Exception ex) {
0717: throw new IllegalArgumentException("Unsupported type: "
0718: + jsx3.app.DOM.class.getName());
0719: }
0720: }
0721:
0722: /**
0723: * Looks up a DOM node owned by this server by id or by name.
0724: * @param strId either the id (_jsxid) of the object or its name (jsxname)
0725: * @return the JSX object or null if none found
0726: */
0727: @SuppressWarnings("unchecked")
0728: public jsx3.app.Model getJSX(String strId) {
0729: String extension = "getJSX(\"" + strId + "\").";
0730: try {
0731: java.lang.reflect.Constructor<jsx3.app.Model> ctor = jsx3.app.Model.class
0732: .getConstructor(Context.class, String.class,
0733: ScriptProxy.class);
0734: return ctor.newInstance(this , extension, getScriptProxy());
0735: } catch (Exception ex) {
0736: throw new IllegalArgumentException("Unsupported type: "
0737: + jsx3.app.Model.class.getName());
0738: }
0739: }
0740:
0741: /**
0742: * Looks up a DOM node owned by this server by id or by name.
0743: * @param strId either the id (_jsxid) of the object or its name (jsxname)
0744: * @param returnType The expected return type
0745: * @return the JSX object or null if none found
0746: */
0747: @SuppressWarnings("unchecked")
0748: public <T> T getJSX(String strId, Class<T> returnType) {
0749: String extension = "getJSX(\"" + strId + "\").";
0750: try {
0751: java.lang.reflect.Constructor<T> ctor = returnType
0752: .getConstructor(Context.class, String.class,
0753: ScriptProxy.class);
0754: return ctor.newInstance(this , extension, getScriptProxy());
0755: } catch (Exception ex) {
0756: throw new IllegalArgumentException(
0757: "Unsupported return type: " + returnType.getName());
0758: }
0759: }
0760:
0761: /**
0762: * Looks up a DOM node owned by this server by name. If more than one such objects exist, only one is returned.
0763: * @param strId the name (jsxname) of the object
0764: * @return the JSX object or null if none found
0765: */
0766: @SuppressWarnings("unchecked")
0767: public jsx3.app.Model getJSXByName(String strId) {
0768: String extension = "getJSXByName(\"" + strId + "\").";
0769: try {
0770: java.lang.reflect.Constructor<jsx3.app.Model> ctor = jsx3.app.Model.class
0771: .getConstructor(Context.class, String.class,
0772: ScriptProxy.class);
0773: return ctor.newInstance(this , extension, getScriptProxy());
0774: } catch (Exception ex) {
0775: throw new IllegalArgumentException("Unsupported type: "
0776: + jsx3.app.Model.class.getName());
0777: }
0778: }
0779:
0780: /**
0781: * Looks up a DOM node owned by this server by name. If more than one such objects exist, only one is returned.
0782: * @param strId the name (jsxname) of the object
0783: * @param returnType The expected return type
0784: * @return the JSX object or null if none found
0785: */
0786: @SuppressWarnings("unchecked")
0787: public <T> T getJSXByName(String strId, Class<T> returnType) {
0788: String extension = "getJSXByName(\"" + strId + "\").";
0789: try {
0790: java.lang.reflect.Constructor<T> ctor = returnType
0791: .getConstructor(Context.class, String.class,
0792: ScriptProxy.class);
0793: return ctor.newInstance(this , extension, getScriptProxy());
0794: } catch (Exception ex) {
0795: throw new IllegalArgumentException(
0796: "Unsupported return type: " + returnType.getName());
0797: }
0798: }
0799:
0800: /**
0801: * Looks up a DOM node owned by this server by id.
0802: * @param strId the id (_jsxid) of the object
0803: * @return the JSX object or null if none found
0804: */
0805: @SuppressWarnings("unchecked")
0806: public jsx3.app.Model getJSXById(String strId) {
0807: String extension = "getJSXById(\"" + strId + "\").";
0808: try {
0809: java.lang.reflect.Constructor<jsx3.app.Model> ctor = jsx3.app.Model.class
0810: .getConstructor(Context.class, String.class,
0811: ScriptProxy.class);
0812: return ctor.newInstance(this , extension, getScriptProxy());
0813: } catch (Exception ex) {
0814: throw new IllegalArgumentException("Unsupported type: "
0815: + jsx3.app.Model.class.getName());
0816: }
0817: }
0818:
0819: /**
0820: * Looks up a DOM node owned by this server by id.
0821: * @param strId the id (_jsxid) of the object
0822: * @param returnType The expected return type
0823: * @return the JSX object or null if none found
0824: */
0825: @SuppressWarnings("unchecked")
0826: public <T> T getJSXById(String strId, Class<T> returnType) {
0827: String extension = "getJSXById(\"" + strId + "\").";
0828: try {
0829: java.lang.reflect.Constructor<T> ctor = returnType
0830: .getConstructor(Context.class, String.class,
0831: ScriptProxy.class);
0832: return ctor.newInstance(this , extension, getScriptProxy());
0833: } catch (Exception ex) {
0834: throw new IllegalArgumentException(
0835: "Unsupported return type: " + returnType.getName());
0836: }
0837: }
0838:
0839: /**
0840: * Creates a new jsx3.gui.Window instance for this server. A branch of the DOM of this application can be placed
0841: in this window in order to distribute the application across multiple browser windows.
0842: * @param strName the unique name of the window to create
0843: */
0844: @SuppressWarnings("unchecked")
0845: public jsx3.gui.Window createAppWindow(String strName) {
0846: String extension = "createAppWindow(\"" + strName + "\").";
0847: try {
0848: java.lang.reflect.Constructor<jsx3.gui.Window> ctor = jsx3.gui.Window.class
0849: .getConstructor(Context.class, String.class,
0850: ScriptProxy.class);
0851: return ctor.newInstance(this , extension, getScriptProxy());
0852: } catch (Exception ex) {
0853: throw new IllegalArgumentException("Unsupported type: "
0854: + jsx3.gui.Window.class.getName());
0855: }
0856: }
0857:
0858: /**
0859: * Loads a new jsx3.gui.Window instance from a component file.
0860: * @param strSource either an XML document containing the window to load or the URL of the
0861: component to load.
0862: */
0863: @SuppressWarnings("unchecked")
0864: public jsx3.gui.Window loadAppWindow(String strSource) {
0865: String extension = "loadAppWindow(\"" + strSource + "\").";
0866: try {
0867: java.lang.reflect.Constructor<jsx3.gui.Window> ctor = jsx3.gui.Window.class
0868: .getConstructor(Context.class, String.class,
0869: ScriptProxy.class);
0870: return ctor.newInstance(this , extension, getScriptProxy());
0871: } catch (Exception ex) {
0872: throw new IllegalArgumentException("Unsupported type: "
0873: + jsx3.gui.Window.class.getName());
0874: }
0875: }
0876:
0877: /**
0878: * Loads a new jsx3.gui.Window instance from a component file.
0879: * @param strSource either an XML document containing the window to load or the URL of the
0880: component to load.
0881: */
0882: @SuppressWarnings("unchecked")
0883: public jsx3.gui.Window loadAppWindow(jsx3.xml.Node strSource) {
0884: String extension = "loadAppWindow(\"" + strSource + "\").";
0885: try {
0886: java.lang.reflect.Constructor<jsx3.gui.Window> ctor = jsx3.gui.Window.class
0887: .getConstructor(Context.class, String.class,
0888: ScriptProxy.class);
0889: return ctor.newInstance(this , extension, getScriptProxy());
0890: } catch (Exception ex) {
0891: throw new IllegalArgumentException("Unsupported type: "
0892: + jsx3.gui.Window.class.getName());
0893: }
0894: }
0895:
0896: /**
0897: * Retrieves a previously created jsx3.gui.Window instance.
0898: * @param strName the unique name of the window to retrieve
0899: * @return the window instance or <code>null</code> if no such window exists.
0900: */
0901: @SuppressWarnings("unchecked")
0902: public jsx3.gui.Window getAppWindow(String strName) {
0903: String extension = "getAppWindow(\"" + strName + "\").";
0904: try {
0905: java.lang.reflect.Constructor<jsx3.gui.Window> ctor = jsx3.gui.Window.class
0906: .getConstructor(Context.class, String.class,
0907: ScriptProxy.class);
0908: return ctor.newInstance(this , extension, getScriptProxy());
0909: } catch (Exception ex) {
0910: throw new IllegalArgumentException("Unsupported type: "
0911: + jsx3.gui.Window.class.getName());
0912: }
0913: }
0914:
0915: /**
0916: * Returns the browser document object containing a particular JSX object. This method inspects whether the
0917: JSX object is a descendent of the root block of this server or one of its jsx3.gui.Window roots.
0918: * @param objJSX
0919: * @param callback document object
0920: */
0921: @SuppressWarnings("unchecked")
0922: public void getDocumentOf(jsx3.app.Model objJSX,
0923: org.directwebremoting.proxy.Callback<String> callback) {
0924: ScriptBuffer script = new ScriptBuffer();
0925: String callbackPrefix = "";
0926:
0927: if (callback != null) {
0928: callbackPrefix = "var reply = ";
0929: }
0930:
0931: script.appendCall(callbackPrefix + getContextPath()
0932: + "getDocumentOf", objJSX);
0933:
0934: if (callback != null) {
0935: String key = org.directwebremoting.extend.CallbackHelper
0936: .saveCallback(callback, String.class);
0937: script
0938: .appendCall("__System.activateCallback", key,
0939: "reply");
0940: }
0941:
0942: getScriptProxy().addScript(script);
0943: }
0944:
0945: /**
0946: * Returns the browser DOM object where a particulat JSX object renders. This method inspects the main root of
0947: this server as well as all of its jsx3.gui.Window roots.
0948: * @param objJSX
0949: * @param callback DOM object
0950: */
0951: @SuppressWarnings("unchecked")
0952: public void getRenderedOf(jsx3.app.Model objJSX,
0953: org.directwebremoting.proxy.Callback<String> callback) {
0954: ScriptBuffer script = new ScriptBuffer();
0955: String callbackPrefix = "";
0956:
0957: if (callback != null) {
0958: callbackPrefix = "var reply = ";
0959: }
0960:
0961: script.appendCall(callbackPrefix + getContextPath()
0962: + "getRenderedOf", objJSX);
0963:
0964: if (callback != null) {
0965: String key = org.directwebremoting.extend.CallbackHelper
0966: .saveCallback(callback, String.class);
0967: script
0968: .appendCall("__System.activateCallback", key,
0969: "reply");
0970: }
0971:
0972: getScriptProxy().addScript(script);
0973: }
0974:
0975: /**
0976: * Resolves a URI that is referenced from a file in this server. This method takes into account the changes in
0977: resource addressing between 3.1 and 3.2. For version 3.1, the URI is resolved as any URI in the system, using
0978: jsx3.resolveURI(). In version 3.2, the URI is taken as relative to the application folder. In
0979: particular, a relative URI will be resolved to a base of the application folder, an absolute URI will be
0980: unaffected.
0981: * @param strURI the URI to resolve.
0982: * @param callback the resolved URI.
0983: */
0984: @SuppressWarnings("unchecked")
0985: public void resolveURI(String strURI,
0986: org.directwebremoting.proxy.Callback<java.net.URI> callback) {
0987: ScriptBuffer script = new ScriptBuffer();
0988: String callbackPrefix = "";
0989:
0990: if (callback != null) {
0991: callbackPrefix = "var reply = ";
0992: }
0993:
0994: script.appendCall(callbackPrefix + getContextPath()
0995: + "resolveURI", strURI);
0996:
0997: if (callback != null) {
0998: String key = org.directwebremoting.extend.CallbackHelper
0999: .saveCallback(callback, java.net.URI.class);
1000: script
1001: .appendCall("__System.activateCallback", key,
1002: "reply");
1003: }
1004:
1005: getScriptProxy().addScript(script);
1006: }
1007:
1008: /**
1009: * Resolves a URI that is referenced from a file in this server. This method takes into account the changes in
1010: resource addressing between 3.1 and 3.2. For version 3.1, the URI is resolved as any URI in the system, using
1011: jsx3.resolveURI(). In version 3.2, the URI is taken as relative to the application folder. In
1012: particular, a relative URI will be resolved to a base of the application folder, an absolute URI will be
1013: unaffected.
1014: * @param strURI the URI to resolve.
1015: * @param callback the resolved URI.
1016: */
1017: @SuppressWarnings("unchecked")
1018: public void resolveURI(java.net.URI strURI,
1019: org.directwebremoting.proxy.Callback<java.net.URI> callback) {
1020: ScriptBuffer script = new ScriptBuffer();
1021: String callbackPrefix = "";
1022:
1023: if (callback != null) {
1024: callbackPrefix = "var reply = ";
1025: }
1026:
1027: script.appendCall(callbackPrefix + getContextPath()
1028: + "resolveURI", strURI);
1029:
1030: if (callback != null) {
1031: String key = org.directwebremoting.extend.CallbackHelper
1032: .saveCallback(callback, java.net.URI.class);
1033: script
1034: .appendCall("__System.activateCallback", key,
1035: "reply");
1036: }
1037:
1038: getScriptProxy().addScript(script);
1039: }
1040:
1041: /**
1042: *
1043: */
1044: @SuppressWarnings("unchecked")
1045: public void getUriPrefix(
1046: org.directwebremoting.proxy.Callback<String> callback) {
1047: ScriptBuffer script = new ScriptBuffer();
1048: String callbackPrefix = "";
1049:
1050: if (callback != null) {
1051: callbackPrefix = "var reply = ";
1052: }
1053:
1054: script.appendCall(callbackPrefix + getContextPath()
1055: + "getUriPrefix");
1056:
1057: if (callback != null) {
1058: String key = org.directwebremoting.extend.CallbackHelper
1059: .saveCallback(callback, String.class);
1060: script
1061: .appendCall("__System.activateCallback", key,
1062: "reply");
1063: }
1064:
1065: getScriptProxy().addScript(script);
1066: }
1067:
1068: /**
1069: *
1070: * @param strURI the URI to relativize.
1071: * @param bRel
1072: * @param callback the relativized URI.
1073: */
1074: @SuppressWarnings("unchecked")
1075: public void relativizeURI(java.net.URI strURI, boolean bRel,
1076: org.directwebremoting.proxy.Callback<java.net.URI> callback) {
1077: ScriptBuffer script = new ScriptBuffer();
1078: String callbackPrefix = "";
1079:
1080: if (callback != null) {
1081: callbackPrefix = "var reply = ";
1082: }
1083:
1084: script.appendCall(callbackPrefix + getContextPath()
1085: + "relativizeURI", strURI, bRel);
1086:
1087: if (callback != null) {
1088: String key = org.directwebremoting.extend.CallbackHelper
1089: .saveCallback(callback, java.net.URI.class);
1090: script
1091: .appendCall("__System.activateCallback", key,
1092: "reply");
1093: }
1094:
1095: getScriptProxy().addScript(script);
1096: }
1097:
1098: /**
1099: *
1100: * @param strURI the URI to relativize.
1101: * @param bRel
1102: * @param callback the relativized URI.
1103: */
1104: @SuppressWarnings("unchecked")
1105: public void relativizeURI(String strURI, boolean bRel,
1106: org.directwebremoting.proxy.Callback<java.net.URI> callback) {
1107: ScriptBuffer script = new ScriptBuffer();
1108: String callbackPrefix = "";
1109:
1110: if (callback != null) {
1111: callbackPrefix = "var reply = ";
1112: }
1113:
1114: script.appendCall(callbackPrefix + getContextPath()
1115: + "relativizeURI", strURI, bRel);
1116:
1117: if (callback != null) {
1118: String key = org.directwebremoting.extend.CallbackHelper
1119: .saveCallback(callback, java.net.URI.class);
1120: script
1121: .appendCall("__System.activateCallback", key,
1122: "reply");
1123: }
1124:
1125: getScriptProxy().addScript(script);
1126: }
1127:
1128: /**
1129: * Returns the current locale of this server. If the locale has been set explicitly with setLocale(),
1130: that locale is returned. Otherwise, getDefaultLocale() is consulted, and finally the system-wide
1131: locale.
1132: */
1133: @SuppressWarnings("unchecked")
1134: public void getLocale(
1135: org.directwebremoting.proxy.Callback<java.util.Locale> callback) {
1136: ScriptBuffer script = new ScriptBuffer();
1137: String callbackPrefix = "";
1138:
1139: if (callback != null) {
1140: callbackPrefix = "var reply = ";
1141: }
1142:
1143: script.appendCall(callbackPrefix + getContextPath()
1144: + "getLocale");
1145:
1146: if (callback != null) {
1147: String key = org.directwebremoting.extend.CallbackHelper
1148: .saveCallback(callback, java.util.Locale.class);
1149: script
1150: .appendCall("__System.activateCallback", key,
1151: "reply");
1152: }
1153:
1154: getScriptProxy().addScript(script);
1155: }
1156:
1157: /**
1158: * Sets the locale of this server.
1159: * @param objLocale
1160: */
1161: public void setLocale(java.util.Locale objLocale) {
1162: ScriptBuffer script = new ScriptBuffer();
1163: script.appendCall(getContextPath() + "setLocale", objLocale);
1164: getScriptProxy().addScript(script);
1165: }
1166:
1167: /**
1168: * Returns the default locale of this server. This is configured with the default_locale configuration
1169: setting.
1170: */
1171: @SuppressWarnings("unchecked")
1172: public void getDefaultLocale(
1173: org.directwebremoting.proxy.Callback<java.util.Locale> callback) {
1174: ScriptBuffer script = new ScriptBuffer();
1175: String callbackPrefix = "";
1176:
1177: if (callback != null) {
1178: callbackPrefix = "var reply = ";
1179: }
1180:
1181: script.appendCall(callbackPrefix + getContextPath()
1182: + "getDefaultLocale");
1183:
1184: if (callback != null) {
1185: String key = org.directwebremoting.extend.CallbackHelper
1186: .saveCallback(callback, java.util.Locale.class);
1187: script
1188: .appendCall("__System.activateCallback", key,
1189: "reply");
1190: }
1191:
1192: getScriptProxy().addScript(script);
1193: }
1194:
1195: /**
1196: * Reloads all resource files that are localized. This method should be called after calling
1197: setLocale() for the server to render properly in the new locale.
1198: */
1199: public void reloadLocalizedResources() {
1200: ScriptBuffer script = new ScriptBuffer();
1201: script
1202: .appendCall(getContextPath()
1203: + "reloadLocalizedResources");
1204: getScriptProxy().addScript(script);
1205: }
1206:
1207: /**
1208: * Invokes context-sensitive help as though the user had pressed the help hot key in the context of the DOM node
1209: objJSX.
1210: * @param objJSX
1211: */
1212: public void invokeHelp(jsx3.app.Model objJSX) {
1213: ScriptBuffer script = new ScriptBuffer();
1214: script.appendCall(getContextPath() + "invokeHelp", objJSX);
1215: getScriptProxy().addScript(script);
1216: }
1217:
1218: /**
1219: * Publishes an event to all subscribed objects.
1220: * @param objEvent the event, should have at least a field 'subject' that is the event id, another common field is 'target' (target will default to this instance)
1221: * @param callback the number of listeners to which the event was broadcast
1222: */
1223: @SuppressWarnings("unchecked")
1224: public void publish(jsx3.lang.Object objEvent,
1225: org.directwebremoting.proxy.Callback<Integer> callback) {
1226: ScriptBuffer script = new ScriptBuffer();
1227: String callbackPrefix = "";
1228:
1229: if (callback != null) {
1230: callbackPrefix = "var reply = ";
1231: }
1232:
1233: script
1234: .appendCall(callbackPrefix + getContextPath()
1235: + "publish", objEvent);
1236:
1237: if (callback != null) {
1238: String key = org.directwebremoting.extend.CallbackHelper
1239: .saveCallback(callback, Integer.class);
1240: script
1241: .appendCall("__System.activateCallback", key,
1242: "reply");
1243: }
1244:
1245: getScriptProxy().addScript(script);
1246: }
1247:
1248: /**
1249: * Subscribes an object or function to a type of event published by this object.
1250:
1251: As of version 3.4 a string value for objHandler is deprecated.
1252: * @param strEventId the event type(s).
1253: * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
1254: * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
1255: */
1256: public void subscribe(Object[] strEventId,
1257: org.directwebremoting.proxy.CodeBlock objHandler,
1258: String objFunction) {
1259: ScriptBuffer script = new ScriptBuffer();
1260: script.appendCall(getContextPath() + "subscribe", strEventId,
1261: objHandler, objFunction);
1262: getScriptProxy().addScript(script);
1263: }
1264:
1265: /**
1266: * Subscribes an object or function to a type of event published by this object.
1267:
1268: As of version 3.4 a string value for objHandler is deprecated.
1269: * @param strEventId the event type(s).
1270: * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
1271: * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
1272: */
1273: public void subscribe(String strEventId,
1274: org.directwebremoting.proxy.CodeBlock objHandler,
1275: org.directwebremoting.proxy.CodeBlock objFunction) {
1276: ScriptBuffer script = new ScriptBuffer();
1277: script.appendCall(getContextPath() + "subscribe", strEventId,
1278: objHandler, objFunction);
1279: getScriptProxy().addScript(script);
1280: }
1281:
1282: /**
1283: * Subscribes an object or function to a type of event published by this object.
1284:
1285: As of version 3.4 a string value for objHandler is deprecated.
1286: * @param strEventId the event type(s).
1287: * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
1288: * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
1289: */
1290: public void subscribe(String strEventId,
1291: org.directwebremoting.proxy.CodeBlock objHandler,
1292: String objFunction) {
1293: ScriptBuffer script = new ScriptBuffer();
1294: script.appendCall(getContextPath() + "subscribe", strEventId,
1295: objHandler, objFunction);
1296: getScriptProxy().addScript(script);
1297: }
1298:
1299: /**
1300: * Subscribes an object or function to a type of event published by this object.
1301:
1302: As of version 3.4 a string value for objHandler is deprecated.
1303: * @param strEventId the event type(s).
1304: * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
1305: * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
1306: */
1307: public void subscribe(String strEventId,
1308: jsx3.lang.Object objHandler, String objFunction) {
1309: ScriptBuffer script = new ScriptBuffer();
1310: script.appendCall(getContextPath() + "subscribe", strEventId,
1311: objHandler, objFunction);
1312: getScriptProxy().addScript(script);
1313: }
1314:
1315: /**
1316: * Subscribes an object or function to a type of event published by this object.
1317:
1318: As of version 3.4 a string value for objHandler is deprecated.
1319: * @param strEventId the event type(s).
1320: * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
1321: * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
1322: */
1323: public void subscribe(Object[] strEventId,
1324: jsx3.lang.Object objHandler, String objFunction) {
1325: ScriptBuffer script = new ScriptBuffer();
1326: script.appendCall(getContextPath() + "subscribe", strEventId,
1327: objHandler, objFunction);
1328: getScriptProxy().addScript(script);
1329: }
1330:
1331: /**
1332: * Subscribes an object or function to a type of event published by this object.
1333:
1334: As of version 3.4 a string value for objHandler is deprecated.
1335: * @param strEventId the event type(s).
1336: * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
1337: * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
1338: */
1339: public void subscribe(Object[] strEventId,
1340: jsx3.lang.Object objHandler,
1341: org.directwebremoting.proxy.CodeBlock objFunction) {
1342: ScriptBuffer script = new ScriptBuffer();
1343: script.appendCall(getContextPath() + "subscribe", strEventId,
1344: objHandler, objFunction);
1345: getScriptProxy().addScript(script);
1346: }
1347:
1348: /**
1349: * Subscribes an object or function to a type of event published by this object.
1350:
1351: As of version 3.4 a string value for objHandler is deprecated.
1352: * @param strEventId the event type(s).
1353: * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
1354: * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
1355: */
1356: public void subscribe(Object[] strEventId, String objHandler,
1357: String objFunction) {
1358: ScriptBuffer script = new ScriptBuffer();
1359: script.appendCall(getContextPath() + "subscribe", strEventId,
1360: objHandler, objFunction);
1361: getScriptProxy().addScript(script);
1362: }
1363:
1364: /**
1365: * Subscribes an object or function to a type of event published by this object.
1366:
1367: As of version 3.4 a string value for objHandler is deprecated.
1368: * @param strEventId the event type(s).
1369: * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
1370: * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
1371: */
1372: public void subscribe(String strEventId, String objHandler,
1373: org.directwebremoting.proxy.CodeBlock objFunction) {
1374: ScriptBuffer script = new ScriptBuffer();
1375: script.appendCall(getContextPath() + "subscribe", strEventId,
1376: objHandler, objFunction);
1377: getScriptProxy().addScript(script);
1378: }
1379:
1380: /**
1381: * Subscribes an object or function to a type of event published by this object.
1382:
1383: As of version 3.4 a string value for objHandler is deprecated.
1384: * @param strEventId the event type(s).
1385: * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
1386: * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
1387: */
1388: public void subscribe(Object[] strEventId, String objHandler,
1389: org.directwebremoting.proxy.CodeBlock objFunction) {
1390: ScriptBuffer script = new ScriptBuffer();
1391: script.appendCall(getContextPath() + "subscribe", strEventId,
1392: objHandler, objFunction);
1393: getScriptProxy().addScript(script);
1394: }
1395:
1396: /**
1397: * Subscribes an object or function to a type of event published by this object.
1398:
1399: As of version 3.4 a string value for objHandler is deprecated.
1400: * @param strEventId the event type(s).
1401: * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
1402: * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
1403: */
1404: public void subscribe(Object[] strEventId,
1405: org.directwebremoting.proxy.CodeBlock objHandler,
1406: org.directwebremoting.proxy.CodeBlock objFunction) {
1407: ScriptBuffer script = new ScriptBuffer();
1408: script.appendCall(getContextPath() + "subscribe", strEventId,
1409: objHandler, objFunction);
1410: getScriptProxy().addScript(script);
1411: }
1412:
1413: /**
1414: * Subscribes an object or function to a type of event published by this object.
1415:
1416: As of version 3.4 a string value for objHandler is deprecated.
1417: * @param strEventId the event type(s).
1418: * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
1419: * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
1420: */
1421: public void subscribe(String strEventId, String objHandler,
1422: String objFunction) {
1423: ScriptBuffer script = new ScriptBuffer();
1424: script.appendCall(getContextPath() + "subscribe", strEventId,
1425: objHandler, objFunction);
1426: getScriptProxy().addScript(script);
1427: }
1428:
1429: /**
1430: * Subscribes an object or function to a type of event published by this object.
1431:
1432: As of version 3.4 a string value for objHandler is deprecated.
1433: * @param strEventId the event type(s).
1434: * @param objHandler if an object, the instance to notify of events (objFunction is required); if a string, the JSX id of the instance to notify of events (objFunction is required), must exist in the same Server; if a function, the function to call to notify of events (objFunction ignored)
1435: * @param objFunction if objHandler is a string or object then the function to call on that instance. either a function or a string that is the name of a method of the instance
1436: */
1437: public void subscribe(String strEventId,
1438: jsx3.lang.Object objHandler,
1439: org.directwebremoting.proxy.CodeBlock objFunction) {
1440: ScriptBuffer script = new ScriptBuffer();
1441: script.appendCall(getContextPath() + "subscribe", strEventId,
1442: objHandler, objFunction);
1443: getScriptProxy().addScript(script);
1444: }
1445:
1446: /**
1447: * Unsubscribe an object or function from an event published by this object.
1448:
1449: As of version 3.4 a string value for objHandler is deprecated.
1450: * @param strEventId the event type(s).
1451: * @param objHandler the value of objHandler passed to subscribe
1452: */
1453: public void unsubscribe(Object[] strEventId,
1454: jsx3.lang.Object objHandler) {
1455: ScriptBuffer script = new ScriptBuffer();
1456: script.appendCall(getContextPath() + "unsubscribe", strEventId,
1457: objHandler);
1458: getScriptProxy().addScript(script);
1459: }
1460:
1461: /**
1462: * Unsubscribe an object or function from an event published by this object.
1463:
1464: As of version 3.4 a string value for objHandler is deprecated.
1465: * @param strEventId the event type(s).
1466: * @param objHandler the value of objHandler passed to subscribe
1467: */
1468: public void unsubscribe(Object[] strEventId, String objHandler) {
1469: ScriptBuffer script = new ScriptBuffer();
1470: script.appendCall(getContextPath() + "unsubscribe", strEventId,
1471: objHandler);
1472: getScriptProxy().addScript(script);
1473: }
1474:
1475: /**
1476: * Unsubscribe an object or function from an event published by this object.
1477:
1478: As of version 3.4 a string value for objHandler is deprecated.
1479: * @param strEventId the event type(s).
1480: * @param objHandler the value of objHandler passed to subscribe
1481: */
1482: public void unsubscribe(Object[] strEventId,
1483: org.directwebremoting.proxy.CodeBlock objHandler) {
1484: ScriptBuffer script = new ScriptBuffer();
1485: script.appendCall(getContextPath() + "unsubscribe", strEventId,
1486: objHandler);
1487: getScriptProxy().addScript(script);
1488: }
1489:
1490: /**
1491: * Unsubscribe an object or function from an event published by this object.
1492:
1493: As of version 3.4 a string value for objHandler is deprecated.
1494: * @param strEventId the event type(s).
1495: * @param objHandler the value of objHandler passed to subscribe
1496: */
1497: public void unsubscribe(String strEventId, String objHandler) {
1498: ScriptBuffer script = new ScriptBuffer();
1499: script.appendCall(getContextPath() + "unsubscribe", strEventId,
1500: objHandler);
1501: getScriptProxy().addScript(script);
1502: }
1503:
1504: /**
1505: * Unsubscribe an object or function from an event published by this object.
1506:
1507: As of version 3.4 a string value for objHandler is deprecated.
1508: * @param strEventId the event type(s).
1509: * @param objHandler the value of objHandler passed to subscribe
1510: */
1511: public void unsubscribe(String strEventId,
1512: org.directwebremoting.proxy.CodeBlock objHandler) {
1513: ScriptBuffer script = new ScriptBuffer();
1514: script.appendCall(getContextPath() + "unsubscribe", strEventId,
1515: objHandler);
1516: getScriptProxy().addScript(script);
1517: }
1518:
1519: /**
1520: * Unsubscribe an object or function from an event published by this object.
1521:
1522: As of version 3.4 a string value for objHandler is deprecated.
1523: * @param strEventId the event type(s).
1524: * @param objHandler the value of objHandler passed to subscribe
1525: */
1526: public void unsubscribe(String strEventId,
1527: jsx3.lang.Object objHandler) {
1528: ScriptBuffer script = new ScriptBuffer();
1529: script.appendCall(getContextPath() + "unsubscribe", strEventId,
1530: objHandler);
1531: getScriptProxy().addScript(script);
1532: }
1533:
1534: /**
1535: * Unsubscribes all subscribed objects to a type of event published by this object.
1536: * @param strEventId the event type
1537: */
1538: public void unsubscribeAll(String strEventId) {
1539: ScriptBuffer script = new ScriptBuffer();
1540: script.appendCall(getContextPath() + "unsubscribeAll",
1541: strEventId);
1542: getScriptProxy().addScript(script);
1543: }
1544:
1545: /**
1546: * show an alert dialog
1547: * @param strTitle the title of the dialog
1548: * @param strMessage the message to display
1549: * @param fctOnOk callback function on pressing ok button, receives the dialog as an argument; if null the dialog will close itself; if defined must explicitly close the dialog
1550: * @param strOk the text of the ok button, can be false to remove button from display
1551: * @param objParams argument to configureAlert()
1552: */
1553: public void alert(String strTitle, String strMessage,
1554: org.directwebremoting.proxy.CodeBlock fctOnOk,
1555: String strOk, String objParams) {
1556: ScriptBuffer script = new ScriptBuffer();
1557: script.appendCall(getContextPath() + "alert", strTitle,
1558: strMessage, fctOnOk, strOk, objParams);
1559: getScriptProxy().addScript(script);
1560: }
1561:
1562: /**
1563: * configure the dialog
1564: * @param objDialog the dialog
1565: * @param objParams may include fields 'width', 'height', 'noTitle', and 'nonModal'.
1566: */
1567: public void configureAlert(java.lang.Object objDialog,
1568: jsx3.lang.Object objParams) {
1569: ScriptBuffer script = new ScriptBuffer();
1570: script.appendCall(getContextPath() + "configureAlert",
1571: objDialog, objParams);
1572: getScriptProxy().addScript(script);
1573: }
1574:
1575: /**
1576: * show a confirm alert
1577: * @param strTitle the title of the dialog
1578: * @param strMessage the message to display
1579: * @param fctOnOk callback function on pressing ok button, receives the dialog as an argument; if null the dialog will close itself; if defined must explicitly close the dialog
1580: * @param fctOnCancel callback function on pressing cancel button, receives the dialog as an argument; if null the dialog will close itself; if defined must explicitly close the dialog
1581: * @param strOk the text of the ok button
1582: * @param strCancel the text of the cancel button
1583: * @param intBtnDefault the bold button that receives return key, 1:ok, 2:cancel, 3:no
1584: * @param fctOnNo callback function on pressing no button, receives the dialog as an argument; if null the dialog will close itself; if defined must explicitly close the dialog
1585: * @param strNo the text of the no button
1586: * @param objParams argument to configureAlert()
1587: */
1588: public void confirm(String strTitle, String strMessage,
1589: org.directwebremoting.proxy.CodeBlock fctOnOk,
1590: org.directwebremoting.proxy.CodeBlock fctOnCancel,
1591: String strOk, String strCancel, int intBtnDefault,
1592: org.directwebremoting.proxy.CodeBlock fctOnNo,
1593: String strNo, String objParams) {
1594: ScriptBuffer script = new ScriptBuffer();
1595: script.appendCall(getContextPath() + "confirm", strTitle,
1596: strMessage, fctOnOk, fctOnCancel, strOk, strCancel,
1597: intBtnDefault, fctOnNo, strNo, objParams);
1598: getScriptProxy().addScript(script);
1599: }
1600:
1601: /**
1602: * show a text box input prompt
1603: * @param strTitle the title of the dialog
1604: * @param strMessage the message to display
1605: * @param fctOnOk callback function on pressing ok button, receives the dialog as an argument, and the value of the text input as a second argument; if null the dialog will close itself; if defined must explicitly close the dialog
1606: * @param fctOnCancel callback function on pressing cancel button, receives the dialog as an argument; if null the dialog will close itself; if defined must explicitly close the dialog
1607: * @param strOk the text of the ok button
1608: * @param strCancel the text of the cancel button
1609: * @param objParams argument to configureAlert()
1610: */
1611: public void prompt(String strTitle, String strMessage,
1612: org.directwebremoting.proxy.CodeBlock fctOnOk,
1613: org.directwebremoting.proxy.CodeBlock fctOnCancel,
1614: String strOk, String strCancel, String objParams) {
1615: ScriptBuffer script = new ScriptBuffer();
1616: script.appendCall(getContextPath() + "prompt", strTitle,
1617: strMessage, fctOnOk, fctOnCancel, strOk, strCancel,
1618: objParams);
1619: getScriptProxy().addScript(script);
1620: }
1621:
1622: }
|