From xap-commits-return-143-apmail-incubator-xap-commits-archive=incubator.apache.org@incubator.apache.org Sat Jul 15 17:23:25 2006 Return-Path: Delivered-To: apmail-incubator-xap-commits-archive@locus.apache.org Received: (qmail 46559 invoked from network); 15 Jul 2006 17:23:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 15 Jul 2006 17:23:24 -0000 Received: (qmail 97060 invoked by uid 500); 15 Jul 2006 17:23:24 -0000 Delivered-To: apmail-incubator-xap-commits-archive@incubator.apache.org Received: (qmail 97032 invoked by uid 500); 15 Jul 2006 17:23:24 -0000 Mailing-List: contact xap-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: xap-dev@incubator.apache.org Delivered-To: mailing list xap-commits@incubator.apache.org Received: (qmail 96976 invoked by uid 99); 15 Jul 2006 17:23:23 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 15 Jul 2006 10:23:23 -0700 X-ASF-Spam-Status: No, hits=-8.6 required=10.0 tests=ALL_TRUSTED,INFO_TLD,NO_REAL_NAME X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [140.211.166.113] (HELO eris.apache.org) (140.211.166.113) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 15 Jul 2006 10:23:17 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 288531A981D; Sat, 15 Jul 2006 10:22:57 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r422273 [2/5] - in /incubator/xap/trunk: WebContent/examples/dojo/ src/xap/ src/xap/bridges/basic/ src/xap/bridges/dojo/ src/xap/bridges/google/ src/xap/bridges/zimbra/ src/xap/components/zimbra/ src/xap/macro/ src/xap/mco/ src/xap/requests... Date: Sat, 15 Jul 2006 17:22:44 -0000 To: xap-commits@incubator.apache.org From: mturyn@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20060715172257.288531A981D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Modified: incubator/xap/trunk/src/xap/macro/MacroNamespaceHandler.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/macro/MacroNamespaceHandler.js?rev=422273&r1=422272&r2=422273&view=diff ============================================================================== --- incubator/xap/trunk/src/xap/macro/MacroNamespaceHandler.js (original) +++ incubator/xap/trunk/src/xap/macro/MacroNamespaceHandler.js Sat Jul 15 10:22:41 2006 @@ -18,33 +18,33 @@ /** - * @fileoverview The MacroNamespaceHandler is responsible for reading the xml under a - * macro and saving it for later by creating a Macro object and storing it in + * @fileoverview The xap.macro.MacroNamespaceHandler is responsible for reading the xml under a + * macro and saving it for later by creating a xap.macro.Macro object and storing it in * the macro container. * * @author jmargaris */ /** - * Creates a MacroNamespaceHandler instance. - * @class The MacroNamespaceHandler is responsible for reading the xml under a - * macro and saving it for later by creating a Macro object and storing it in + * Creates a xap.macro.MacroNamespaceHandler instance. + * @class The xap.macro.MacroNamespaceHandler is responsible for reading the xml under a + * macro and saving it for later by creating a xap.macro.Macro object and storing it in * the macro container. */ -MacroNamespaceHandler = function( session ){ - NamespaceHandler.call(this, session); +xap.macro.MacroNamespaceHandler = function( session ){ + xap.xml.NamespaceHandler.call(this, session); } -MacroNamespaceHandler.prototype = new NamespaceHandler; +xap.macro.MacroNamespaceHandler.prototype = new xap.xml.NamespaceHandler; //----------------------------------------------------------------------- // Class variables. //----------------------------------------------------------------------- -MacroNamespaceHandler.s_log = xap.util.LogFactory.getLog( "MacroNamespaceHandler" ); +xap.macro.MacroNamespaceHandler.s_log = xap.util.LogFactory.getLog( "xap.macro.MacroNamespaceHandler" ); //----------------------------------------------------------------------- -// NamespaceHandler Implementation. +// xap.xml.NamespaceHandler Implementation. //----------------------------------------------------------------------- /** @@ -53,33 +53,33 @@ * * @param element the element that is namespaced, including all of its * children - * @param container The DocumentContainer to be used for processing. + * @param container The xap.xml.DocumentContainer to be used for processing. * @throws UpdateException */ -MacroNamespaceHandler.prototype.receiveDispatch = function( element ) { +xap.macro.MacroNamespaceHandler.prototype.receiveDispatch = function( element ) { var id = element.getAttribute("id"); if ( id == null || id == "" || - XapElement.isGeneratedId( id )) { + xap.xml.dom.XapElement.isGeneratedId( id )) { session.handleException( - new InvalidXmlException( - InvalidXmlException.MISSING_ATTRIBUTE_MSGID, + new xap.xml.InvalidXmlException( + xap.xml.InvalidXmlException.MISSING_ATTRIBUTE_MSGID, new Array( "id", element.toXml( true )))); } - MacroNamespaceHandler.s_log.debug( "Create macro id: ["+ id + + xap.macro.MacroNamespaceHandler.s_log.debug( "Create macro id: ["+ id + "] from element: [" + element.toXml() + "]"); //TODO we really need to clarify whether or not XAP is a generic wrapping //tag or something with more meaning //TODO what if the original macro is malformed? - var macro = new Macro( "" + element.childNodes[0].toXmlWithoutAutoAssignedIds() + "", this.getSession() ); + var macro = new xap.macro.Macro( "" + element.childNodes[0].toXmlWithoutAutoAssignedIds() + "", this.getSession() ); //TODO if we are replacing and existing one should probably //output that to info at least. var macroContainer = this.getSession().getMacroContainer(); if ( macroContainer.get( id ) != null ){ - MacroNamespaceHandler.s_log.info( "Replacing an existing macro registered" + + xap.macro.MacroNamespaceHandler.s_log.info( "Replacing an existing macro registered" + " with id:" + id + ". Element:" + element.toXml() ); } macroContainer.put( id, macro ); Modified: incubator/xap/trunk/src/xap/mco/McoInvocationException.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/mco/McoInvocationException.js?rev=422273&r1=422272&r2=422273&view=diff ============================================================================== --- incubator/xap/trunk/src/xap/mco/McoInvocationException.js (original) +++ incubator/xap/trunk/src/xap/mco/McoInvocationException.js Sat Jul 15 10:22:41 2006 @@ -29,30 +29,30 @@ // Constructors. //----------------------------------------------------------------------- -McoInvocationException = function( msgId, args, cause ) { - XapException.call( this, msgId, args, cause ); +xap.mco.McoInvocationException = function( msgId, args, cause ) { + xap.util.XapException.call( this, msgId, args, cause ); } -McoInvocationException.prototype = new XapException; +xap.mco.McoInvocationException.prototype = new xap.util.XapException; -McoInvocationException.CLASSNAME = "McoInvocationException"; +xap.mco.McoInvocationException.CLASSNAME = "xap.mco.McoInvocationException"; // {0} mco id -McoInvocationException.MCO_NOT_FOUND = "mcoNotFound"; +xap.mco.McoInvocationException.MCO_NOT_FOUND = "mcoNotFound"; // {0} mco id // {1} method name -McoInvocationException.MCO_METHOD_NOT_FOUND = "mcoMethodNotFound"; +xap.mco.McoInvocationException.MCO_METHOD_NOT_FOUND = "mcoMethodNotFound"; //----------------------------------------------------------------------- // PublicMethods. //----------------------------------------------------------------------- -McoInvocationException.prototype.toString = function() { +xap.mco.McoInvocationException.prototype.toString = function() { var buf = "[McoInvocationException:\t" + - XapException.prototype.toString.call( this ) + "]"; + xap.util.XapException.prototype.toString.call( this ) + "]"; return buf; } -McoInvocationException.prototype.getClassName = function() { - return McoInvocationException.CLASSNAME; +xap.mco.McoInvocationException.prototype.getClassName = function() { + return xap.mco.McoInvocationException.CLASSNAME; } Modified: incubator/xap/trunk/src/xap/mco/McoInvocationExceptionRes.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/mco/McoInvocationExceptionRes.js?rev=422273&r1=422272&r2=422273&view=diff ============================================================================== --- incubator/xap/trunk/src/xap/mco/McoInvocationExceptionRes.js (original) +++ incubator/xap/trunk/src/xap/mco/McoInvocationExceptionRes.js Sat Jul 15 10:22:41 2006 @@ -18,9 +18,9 @@ //Let Dojo know what to expect from this file: Xap.provide('xap.mco.McoInvocationExceptionRes'); -McoInvocationExceptionRes = function() { +xap.mco.McoInvocationExceptionRes = function() { this.messages = new Object(); - this.messages[McoInvocationException.MCO_NOT_FOUND] = "MCO not found:{0}"; - this.messages[McoInvocationException.MCO_METHOD_NOT_FOUND] = "MCO method not found: mco id={0}, method={1}"; + this.messages[xap.mco.McoInvocationException.MCO_NOT_FOUND] = "MCO not found:{0}"; + this.messages[xap.mco.McoInvocationException.MCO_METHOD_NOT_FOUND] = "MCO method not found: mco id={0}, method={1}"; } Modified: incubator/xap/trunk/src/xap/mco/McoNamespaceHandler.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/mco/McoNamespaceHandler.js?rev=422273&r1=422272&r2=422273&view=diff ============================================================================== --- incubator/xap/trunk/src/xap/mco/McoNamespaceHandler.js (original) +++ incubator/xap/trunk/src/xap/mco/McoNamespaceHandler.js Sat Jul 15 10:22:41 2006 @@ -30,28 +30,28 @@ * * @constructor */ -McoNamespaceHandler = function( session){ - NamespaceHandler.call(this, session); +xap.mco.McoNamespaceHandler = function( session){ + xap.xml.NamespaceHandler.call(this, session); } -McoNamespaceHandler.prototype = new NamespaceHandler; +xap.mco.McoNamespaceHandler.prototype = new xap.xml.NamespaceHandler; //----------------------------------------------------------------------- // Constants. //----------------------------------------------------------------------- -McoNamespaceHandler.EXECUTE = "execute"; -McoNamespaceHandler.ID = "id"; -McoNamespaceHandler.SOURCE = "src"; -McoNamespaceHandler.ON_LOAD = "onLoad"; -McoNamespaceHandler.MCO = "mco"; +xap.mco.McoNamespaceHandler.EXECUTE = "execute"; +xap.mco.McoNamespaceHandler.ID = "id"; +xap.mco.McoNamespaceHandler.SOURCE = "src"; +xap.mco.McoNamespaceHandler.ON_LOAD = "onLoad"; +xap.mco.McoNamespaceHandler.MCO = "mco"; //----------------------------------------------------------------------- // Class Variables. //----------------------------------------------------------------------- -McoNamespaceHandler.s_log = xap.util.LogFactory.getLog( "McoNamespaceHandler" ); +xap.mco.McoNamespaceHandler.s_log = xap.util.LogFactory.getLog( "xap.mco.McoNamespaceHandler" ); //----------------------------------------------------------------------- -// NamespaceHandler Implementation. +// xap.xml.NamespaceHandler Implementation. //----------------------------------------------------------------------- /** @@ -60,47 +60,47 @@ * * @param element the element that is namespaced, including all of its * children - * @param container The DocumentContainer to be used for processing. + * @param container The xap.xml.DocumentContainer to be used for processing. * @throws UpdateException */ -McoNamespaceHandler.prototype.receiveDispatch = function( element ) { - McoNamespaceHandler.s_log.debug( "receiveDispatch:" + element ); +xap.mco.McoNamespaceHandler.prototype.receiveDispatch = function( element ) { + xap.mco.McoNamespaceHandler.s_log.debug( "receiveDispatch:" + element ); var name = element.getLocalName(); - if ( name == McoNamespaceHandler.EXECUTE ) { + if ( name == xap.mco.McoNamespaceHandler.EXECUTE ) { //this.handleExecute( element, clientSession ); - } else if ( name == McoNamespaceHandler.MCO ) { + } else if ( name == xap.mco.McoNamespaceHandler.MCO ) { this._handleMcoDeclaration( element ); } } -McoNamespaceHandler.prototype._handleMcoDeclaration = function( element ) { +xap.mco.McoNamespaceHandler.prototype._handleMcoDeclaration = function( element ) { var session = this.getSession(); var id = element.getAttribute( "id" ); if ( id == null || id == "" || - XapElement.isGeneratedId( id )) { + xap.xml.dom.XapElement.isGeneratedId( id )) { session.handleException( - new InvalidXmlException( - InvalidXmlException.MISSING_ATTRIBUTE_MSGID, - new Array( McoNamespaceHandler.ID, + new xap.xml.InvalidXmlException( + xap.xml.InvalidXmlException.MISSING_ATTRIBUTE_MSGID, + new Array( xap.mco.McoNamespaceHandler.ID, element.toXml( true )))); } var src = element.getAttribute( "src" ); if ( src == null || src == "" ) { session.handleException( - new InvalidXmlException( - InvalidXmlException.MISSING_ATTRIBUTE_MSGID, - new Array( McoNamespaceHandler.SOURCE, + new xap.xml.InvalidXmlException( + xap.xml.InvalidXmlException.MISSING_ATTRIBUTE_MSGID, + new Array( xap.mco.McoNamespaceHandler.SOURCE, element.toXml( true )))); } - McoNamespaceHandler.s_log.debug( "Creating mco id: ["+ id + "] from source: [" + xap.mco.McoNamespaceHandler.s_log.debug( "Creating mco id: ["+ id + "] from source: [" + src + "]"); try { var mco = eval("new " + src + "()"); - McoNamespaceHandler.s_log.debug("Created mco: " + mco); + xap.mco.McoNamespaceHandler.s_log.debug("Created mco: " + mco); //TODO info if replacing existing macro? session.getMcoContainer().put( id, mco ); } catch ( e ) { Modified: incubator/xap/trunk/src/xap/requestservice/NetServiceListener.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/requestservice/NetServiceListener.js?rev=422273&r1=422272&r2=422273&view=diff ============================================================================== --- incubator/xap/trunk/src/xap/requestservice/NetServiceListener.js (original) +++ incubator/xap/trunk/src/xap/requestservice/NetServiceListener.js Sat Jul 15 10:22:41 2006 @@ -20,8 +20,8 @@ /** - * NetServiceListener is used as a callback for asynchronous - * NetService operations. The NetServiceListener is called back + * xap.requestservice.NetServiceListener is used as a callback for asynchronous + * NetService operations. The xap.requestservice.NetServiceListener is called back * when an asynchronous call either completes successfully or fails * due to an error. * @@ -33,27 +33,27 @@ //----------------------------------------------------------------------- // Constructors. //----------------------------------------------------------------------- -NetServiceListener = function() {} +xap.requestservice.NetServiceListener = function() {} //----------------------------------------------------------------------- // Public Methods. //----------------------------------------------------------------------- /** - * Called when the RequestService operation completes successfully. + * Called when the xap.requestservice.RequestService operation completes successfully. * For a retrieveAndProcess, this is called after the processing * of the returned XML has taken place. * * @param requestUrl The request URL * @param responseContent The response content (String) */ -NetServiceListener.prototype.requestCompleted = function( url, responseContent ) {} +xap.requestservice.NetServiceListener.prototype.requestCompleted = function( url, responseContent ) {} /** * Called when the NetService operation fails. * * @param url The original request URL - * @param exception The RequestServiceException detailing the failure cause. + * @param exception The xap.requestservice.RequestServiceException detailing the failure cause. */ -NetServiceListener.prototype.requestFailed = function( url, exception ) {} +xap.requestservice.NetServiceListener.prototype.requestFailed = function( url, exception ) {} Modified: incubator/xap/trunk/src/xap/requestservice/RequestService.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/requestservice/RequestService.js?rev=422273&r1=422272&r2=422273&view=diff ============================================================================== --- incubator/xap/trunk/src/xap/requestservice/RequestService.js (original) +++ incubator/xap/trunk/src/xap/requestservice/RequestService.js Sat Jul 15 10:22:41 2006 @@ -17,17 +17,18 @@ //Let Dojo know what to expect from this file: Xap.provide('xap.requestservice.RequestService'); - +Xap.require("xap.xml.sax.SaxContentHandler") ; +Xap.require("xap.xml.sax.SaxParser") ; /** - * RequestService provides methods for sending and receiving + * xap.requestservice.RequestService provides methods for sending and receiving * HTTP messages, and other request based functions. */ //----------------------------------------------------------------------- // Constructors. //----------------------------------------------------------------------- -RequestService = function( clientSession ) { +xap.requestservice.RequestService = function( clientSession ) { this._clientSession = clientSession; } @@ -41,18 +42,18 @@ * * @param url, the url will be relative to the application context path always. * @return The retrieved content (String) - * @throws RequestServiceException, a wrapper exception of either a failed + * @throws xap.requestservice.RequestServiceException, a wrapper exception of either a failed * network call or a failed response processing. Check the * getCausalThrowable() and printStackTrace() * method to find out details. *

- * The process cause could be ParserException etc. - *

ParserException: when the data contains a + * The process cause could be xap.xml.sax.ParserException etc. + *

xap.xml.sax.ParserException: when the data contains a * malformed XML; however, any XML up to the point of malformed data will be * processed and executed. Also note that a well-formed but non-relevant XML, * will be ignored during the processing and will not trigger an exception. */ -RequestService.prototype.retrieveAndProcess = function( url ) { +xap.requestservice.RequestService.prototype.retrieveAndProcess = function( url ) { var content = this.retrieve( url ); this._processXmlString( content.responseText ); return content; @@ -71,12 +72,12 @@ * is finished or an error occurs. * */ -RequestService.prototype.retrieveAndProcessAsynchronously = function( url, listener ) { +xap.requestservice.RequestService.prototype.retrieveAndProcessAsynchronously = function( url, listener ) { var callback = function( response ) { this._processXmlString( request.responseText ); listener.requestCompleted( url, request.responseText ); }; - HttpUtils.get( url, callback ); + xap.util.HttpUtils.get( url, callback ); } /** @@ -87,11 +88,11 @@ * a full url. * * @return The content of the response (String) - * @throws RequestServiceException, a wrapper exception. Check the + * @throws xap.requestservice.RequestServiceException, a wrapper exception. Check the * getCause() method to find out details. */ -RequestService.prototype.retrieve = function( url ) { - return HttpUtils.get( url ); +xap.requestservice.RequestService.prototype.retrieve = function( url ) { + return xap.util.HttpUtils.get( url ); } @@ -101,19 +102,19 @@ * @param url, if there is no leading slash, it's relative to current context path; if * there is a leading slash, it's relative to server; or it needs to be a full url. * - * @param listener The NetServiceListener to asynchronously call back when the retrieve + * @param listener The xap.requestservice.NetServiceListener to asynchronously call back when the retrieve * is finished or an error occurs. */ -RequestService.prototype.retrieveAsynchronously = function( url, listener ) { +xap.requestservice.RequestService.prototype.retrieveAsynchronously = function( url, listener ) { var callback = function(response){ listener.requestCompleted(url, response.responseText)}; - HttpUtils.get( url, callback ); + xap.util.HttpUtils.get( url, callback ); } /** - * Parses the xml string into a Document and then walks the resulting Document - * dispatching elements to appropriate NamespaceHandlers. + * Parses the xml string into a xap.xml.dom.Document and then walks the resulting xap.xml.dom.Document + * dispatching elements to appropriate xap.xml.NamespaceHandlers. */ -RequestService.prototype._processXmlString = function( xmlString ) { - var parser = new SaxParser( new SaxContentHandler() ); +xap.requestservice.RequestService.prototype._processXmlString = function( xmlString ) { + var parser = new xap.xml.sax.SaxParser( new xap.xml.sax.SaxContentHandler() ); this._clientSession.processDocument( parser.parse( xmlString ) ); } Modified: incubator/xap/trunk/src/xap/session/ClientEvent.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/session/ClientEvent.js?rev=422273&r1=422272&r2=422273&view=diff ============================================================================== --- incubator/xap/trunk/src/xap/session/ClientEvent.js (original) +++ incubator/xap/trunk/src/xap/session/ClientEvent.js Sat Jul 15 10:22:41 2006 @@ -24,13 +24,13 @@ * Placeholder functionality only for now. We just set/get properties * on this object for each event */ -ClientEvent = function( source, session ) { +xap.session.ClientEvent = function( source, session ) { this.source = source; this.session = session; } -ClientEvent.prototype.toString = function(){ - var returnValue = "ClientEvent:" +xap.session.ClientEvent.prototype.toString = function(){ + var returnValue = "xap.session.ClientEvent:" for (var i in this){ if (typeof( this[i]) != 'function'){ returnValue += "\n" + i + " : " + this[i]; Modified: incubator/xap/trunk/src/xap/session/ClientSession.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/session/ClientSession.js?rev=422273&r1=422272&r2=422273&view=diff ============================================================================== --- incubator/xap/trunk/src/xap/session/ClientSession.js (original) +++ incubator/xap/trunk/src/xap/session/ClientSession.js Sat Jul 15 10:22:41 2006 @@ -14,13 +14,14 @@ * limitations under the License. * */ - Xap.provide( "xap.session.ClientSession" ) ; - +Xap.require("xap.xml.sax.SaxContentHandler") ; +Xap.require("xap.xml.sax.SaxParser") ; +Xap.provide( "xap.session.ClientSession" ) ; /** - * ClientSession is the entry point for most client-side functionality. - * ClientSession exposes various services that can be used programatically + * xap.session.ClientSession is the entry point for most client-side functionality. + * xap.session.ClientSession exposes various services that can be used programatically * or declaratively using XML. * * @author ikaplansky @@ -30,54 +31,54 @@ //----------------------------------------------------------------------- // Constructors. //----------------------------------------------------------------------- -ClientSession = function( webappContext,toolkitType, parentElement ) { +xap.session.ClientSession = function( webappContext,toolkitType, parentElement ) { - this._namesToContainers = new Hashtable(); + this._namesToContainers = new xap.util.Hashtable(); this._webappContext = webappContext; - this._mcoContainer = new Container(this); + this._mcoContainer = new xap.session.Container(this); this.addContainer("mco", this._mcoContainer); - this._macroContainer = new Container(this); + this._macroContainer = new xap.session.Container(this); this.addContainer("macro", this._macroContainer); - this._documentContainer = new DocumentContainer(this); + this._documentContainer = new xap.xml.DocumentContainer(this); this.addContainer("document", this._documentContainer); - this._systemContainer = new Container(this); + this._systemContainer = new xap.session.Container(this); - this._requestService = new RequestService( this ); - this._eventHandler = new EventHandler(this); - this._declarativeArgumentParser = new DeclarativeArgumentParser(this); + this._requestService = new xap.requestservice.RequestService( this ); + this._eventHandler = new xap.session.EventHandler(this); + this._declarativeArgumentParser = new xap.session.DeclarativeArgumentParser(this); - this._pluginRegistry = new PluginRegistryImpl( this ); + this._pluginRegistry = new xap.taghandling.PluginRegistryImpl( this ); - this._namespaceHandlerManager = new NamespaceHandlerManager( this ); + this._namespaceHandlerManager = new xap.xml.NamespaceHandlerManager( this ); //set up a plugin document handler for the UI document var uiDocument = this._documentContainer.getUiDocument(); - this._uiDocumentHandler = new PluginDocumentHandler( this, - uiDocument, DocumentContainer.UI_DOCUMENT_NAME ); + this._uiDocumentHandler = new xap.taghandling.PluginDocumentHandler( this, + uiDocument, xap.xml.DocumentContainer.UI_DOCUMENT_NAME ); //TODO handle this in a better way this._createInitialDocument(toolkitType, parentElement); } -ClientSession.s_log = xap.util.LogFactory.getLog( "ClientSession" ); +xap.session.ClientSession.s_log = xap.util.LogFactory.getLog( "xap.session.ClientSession" ); //----------------------------------------------------------------------- // Public Methods. //----------------------------------------------------------------------- -ClientSession.prototype.getPluginRegistry = function() { +xap.session.ClientSession.prototype.getPluginRegistry = function() { return this._pluginRegistry; } -ClientSession.prototype.getNamespaceHandlerManager = function() { +xap.session.ClientSession.prototype.getNamespaceHandlerManager = function() { return this._namespaceHandlerManager; } @@ -85,7 +86,7 @@ * Returns the container used to house user-defined MCOs. * */ -ClientSession.prototype.getMcoContainer = function() { +xap.session.ClientSession.prototype.getMcoContainer = function() { return this._mcoContainer; } @@ -93,7 +94,7 @@ * Returns the container used to house XML documents. * */ -ClientSession.prototype.getDocumentContainer = function() { +xap.session.ClientSession.prototype.getDocumentContainer = function() { return this._documentContainer; } @@ -101,22 +102,22 @@ * Returns the container used to house system-defined services * that can be called from XML. */ -ClientSession.prototype.getSystemContainer = function() { +xap.session.ClientSession.prototype.getSystemContainer = function() { return this._systemContainer; } /** - * Returns the MacroContainer which houses all the declared + * Returns the xap.macro.MacroContainer which houses all the declared * macros in the application. */ -ClientSession.prototype.getMacroContainer = function() { +xap.session.ClientSession.prototype.getMacroContainer = function() { return this._macroContainer; } /** * Returns the request service for server requests. */ -ClientSession.prototype.getRequestService = function() { +xap.session.ClientSession.prototype.getRequestService = function() { return this._requestService; } @@ -124,14 +125,14 @@ /** * Returns a service that allows users to look up the current - * ClientEvent as well as to fire events programatically to mimic the behavior + * xap.session.ClientEvent as well as to fire events programatically to mimic the behavior * of XML-defined event-handling strings. */ -ClientSession.prototype.getEventHandler = function() { +xap.session.ClientSession.prototype.getEventHandler = function() { return this._eventHandler; } -ClientSession.prototype.getDeclarativeArgumentParser = function() { +xap.session.ClientSession.prototype.getDeclarativeArgumentParser = function() { return this._declarativeArgumentParser } @@ -143,7 +144,7 @@ * if no container with that name exists. Objects in a container * can be accessed via XML by using the container:// convention. */ -ClientSession.prototype.getContainer = function( name ) { +xap.session.ClientSession.prototype.getContainer = function( name ) { return this._namesToContainers.get(name); } @@ -152,12 +153,12 @@ * Objects from the container can be referenced using the * CONTAINER_NAME://OBJECT_NAME syntax. */ -ClientSession.prototype.addContainer = function( name, container ) { +xap.session.ClientSession.prototype.addContainer = function( name, container ) { this._namesToContainers.put(name, container); } -ClientSession.prototype.handleException = function( exception ) { - alert(XapException.exceptionToString(exception)); +xap.session.ClientSession.prototype.handleException = function( exception ) { + alert(xap.util.XapException.exceptionToString(exception)); } @@ -165,9 +166,9 @@ * Processes an XDocument by calling all the namespace handlers associated * with each namespace and running them. * - * @param {Document} doc + * @param {xap.xml.dom.Document} doc */ -ClientSession.prototype.processDocument = function( doc ) { +xap.session.ClientSession.prototype.processDocument = function( doc ) { //TODO make sure it is a doc and not an element, common mistake? var namespaceHandlerManager = this.getNamespaceHandlerManager(); var root = doc.getRootElement(); @@ -189,14 +190,14 @@ //----------------------------------------------------------------------- // Private Methods. //----------------------------------------------------------------------- -ClientSession.prototype._start = function( startPage ) { +xap.session.ClientSession.prototype._start = function( startPage ) { this._processConfiguration(); var requestService = this.getRequestService(); try{ - Profiler.start("Parse plugin.xml"); + xap.util.Profiler.start("Parse plugin.xml"); var response = requestService.retrieve(this._webappContext + "src/xap/taghandling/plugin.xml"); this._pluginRegistry.addPluginDescription(response.responseText); - Profiler.end("Parse plugin.xml"); + xap.util.Profiler.end("Parse plugin.xml"); } catch( exception ){ this.handleException( exception); @@ -210,12 +211,12 @@ } } -ClientSession.prototype._processConfiguration = function() { +xap.session.ClientSession.prototype._processConfiguration = function() { var configFilePath = this._webappContext + "XapConfig.xml"; var configString = this.getRequestService().retrieve( configFilePath ).responseText; if( configString && configString != null ) { try { - var parser = new SaxParser( new SaxContentHandler() ); + var parser = new xap.xml.sax.SaxParser( new xap.xml.sax.SaxContentHandler() ); var doc = parser.parse( configString ); var root = doc.getRootElement(); var children = root.childNodes; @@ -234,16 +235,16 @@ } } } catch ( e ) { - ClientSession.s_log.error( "Exception parsing config:" + configString ); + xap.session.ClientSession.s_log.error( "Exception parsing config:" + configString ); } } } -ClientSession.prototype.getUiDocumentHandler = function() { +xap.session.ClientSession.prototype.getUiDocumentHandler = function() { return this._uiDocumentHandler; } -ClientSession.prototype._createInitialDocument = function(toolkitType, parentElement) { +xap.session.ClientSession.prototype._createInitialDocument = function(toolkitType, parentElement) { var shell = null ; if( toolkitType && toolkitType=="dojo"){ shell = parentElement!=null? parentElement : document.body ; @@ -252,7 +253,7 @@ } //create a zimbra shell object //create an abstractTagImpl - var handler = new AbstractTagImpl(); + var handler = new xap.taghandling.AbstractTagImpl(); var uiDocument = this.getDocumentContainer().getUiDocument(); handler.setElement( uiDocument.getRootElement() ); @@ -262,7 +263,7 @@ handler.getElement(), handler ); handler.init(); - //have the shell be the peer of the AbstractTagImpl + //have the shell be the peer of the xap.taghandling.AbstractTagImpl handler.setPeer( shell ); } Modified: incubator/xap/trunk/src/xap/session/Container.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/session/Container.js?rev=422273&r1=422272&r2=422273&view=diff ============================================================================== --- incubator/xap/trunk/src/xap/session/Container.js (original) +++ incubator/xap/trunk/src/xap/session/Container.js Sat Jul 15 10:22:41 2006 @@ -31,28 +31,28 @@ */ /** - * Creates a new Container instance. + * Creates a new xap.session.Container instance. * - * @class Container is a repository that stores objects by name and provides + * @class xap.session.Container is a repository that stores objects by name and provides * notification events when objects are added and removed. * */ -Container = function( clientSession ){ +xap.session.Container = function( clientSession ){ this._clientSession = clientSession; - this._namesToObjects = new Hashtable(); - this._objectsToNames = new Hashtable(); + this._namesToObjects = new xap.util.Hashtable(); + this._objectsToNames = new xap.util.Hashtable(); } /** @private */ -Container.UNNAMED = new Object(); +xap.session.Container.UNNAMED = new Object(); /** * Returns the session this container belongs to. * - * @type ClientSession + * @type xap.session.ClientSession */ -Container.prototype.getSession = function(){ +xap.session.Container.prototype.getSession = function(){ return this._clientSession; } @@ -63,7 +63,7 @@ * @return The object with the given name, or null if no object * with that name exists. */ -Container.prototype.get = function( name ){ +xap.session.Container.prototype.get = function( name ){ return this._namesToObjects.get(name); } @@ -83,7 +83,7 @@ * @return The previous object stored under this name, null * if there was no prior object. */ -Container.prototype.put = function(name, obj){ +xap.session.Container.prototype.put = function(name, obj){ var previousObject = null; //if there is a name get the old object with that name, remove it, @@ -96,7 +96,7 @@ //else there was no name else { - this._objectsToNames.put(obj, Container.UNNAMED); + this._objectsToNames.put(obj, xap.session.Container.UNNAMED); } //if it implements the addedToContainer method then @@ -115,9 +115,9 @@ * @param obj The object to look up the name for. * @return The object name. */ -Container.prototype.getName = function(obj) { +xap.session.Container.prototype.getName = function(obj) { var name = this._objectsToNames.get(obj); - if (name == Container.UNNAMED) { + if (name == xap.session.Container.UNNAMED) { name = null; } return name; @@ -129,7 +129,7 @@ * * @type Array */ -Container.prototype.getNames = function(){ +xap.session.Container.prototype.getNames = function(){ return this._namesToObjects.keys(); } @@ -138,7 +138,7 @@ * * @type boolean */ -Container.prototype.containsValue = function(obj) { +xap.session.Container.prototype.containsValue = function(obj) { return this._objectsToNames.containsKey(obj); } @@ -151,14 +151,14 @@ * @type boolean * @return true if the object was removed. */ -Container.prototype.removeValue = function(obj){ +xap.session.Container.prototype.removeValue = function(obj){ var name = this._objectsToNames.remove(obj); if (name != null) { - if (name != Container.UNNAMED) { + if (name != xap.session.Container.UNNAMED) { this._namesToObjects.remove(name); } if (obj.removedFromContainer){ - obj.removedFromContainer(this, name==Container.UNNAMED?null:name); + obj.removedFromContainer(this, name==xap.session.Container.UNNAMED?null:name); } } @@ -179,7 +179,7 @@ * @param {String} name The name of the object to remove * @return the object that was removed. */ -Container.prototype.remove = function(name) { +xap.session.Container.prototype.remove = function(name) { var obj = null; if (name != null) { obj = this._namesToObjects.get(name); @@ -199,7 +199,7 @@ * * @type Array */ -Container.prototype.getObjects = function(){ +xap.session.Container.prototype.getObjects = function(){ return this._objectsToNames.keys(); } @@ -208,7 +208,7 @@ * * @type integer */ -Container.prototype.size = function(){ +xap.session.Container.prototype.size = function(){ return this._objectsToNames.size(); } @@ -216,7 +216,7 @@ * Removes every object from the container and calls * the proper lifecycle methods with each removal. */ -Container.prototype.destroy = function(){ +xap.session.Container.prototype.destroy = function(){ var mcos = getObjects(); for (var i = 0; i
* * onCommand=mco:myMco.doSomething( this.text, someOtherElement, true, 5) @@ -76,12 +76,12 @@ * * */ -DeclarativeArgumentParser = function( session ) { +xap.session.DeclarativeArgumentParser = function( session ) { this._session = session; } /** @private */ -DeclarativeArgumentParser.s_log = xap.util.LogFactory.getLog("Argument Parser"); +xap.session.DeclarativeArgumentParser.s_log = xap.util.LogFactory.getLog("Argument Parser"); //----------------------------------------------------------------------- // Public Methods. //----------------------------------------------------------------------- @@ -123,18 +123,18 @@ * * @param {String} args A string that we are looking for the next arg in * @param {Number} startIndex the index in the string to start looking at - * @param {XapElement} sourceElement The current element that 'this' should refer to - * @param {ClientEvent} clientEvent The current event that 'event' should refer to. + * @param {xap.xml.dom.XapElement} sourceElement The current element that 'this' should refer to + * @param {xap.session.ClientEvent} clientEvent The current event that 'event' should refer to. * @return {ParseResult} A ParseResult object that wraps the argument we resolved. * @throws xap.util.Exception if something goes wrong.. */ -DeclarativeArgumentParser.prototype.parseArgument = function( args, startIndex, +xap.session.DeclarativeArgumentParser.prototype.parseArgument = function( args, startIndex, sourceElement, clientEvent) { - DeclarativeArgumentParser.s_log.debug("Parse argument [ " + args + "] at start index:" + startIndex); + xap.session.DeclarativeArgumentParser.s_log.debug("Parse argument [ " + args + "] at start index:" + startIndex); var arg = new String(); var parseResult = null; @@ -145,13 +145,13 @@ //we had better hit a ',' or a ')' next if (parseResult!=null){ if (c==','){ - DeclarativeArgumentParser.s_log.debug("HIt a comma, returning arg" + arg); + xap.session.DeclarativeArgumentParser.s_log.debug("HIt a comma, returning arg" + arg); parseResult._terminatingIndex = nextChar; parseResult._parseStatus = ParseResult.COMMA_ENCOUNTERED; return parseResult; } else if (c==')'){ - DeclarativeArgumentParser.s_log.debug("HIt a close paren, returning arg" + arg); + xap.session.DeclarativeArgumentParser.s_log.debug("HIt a close paren, returning arg" + arg); parseResult._terminatingIndex = nextChar; parseResult._parseStatus = ParseResult.CLOSING_PAREN; return parseResult; @@ -160,7 +160,7 @@ ; //trailing whitespace is ok } else{ - DeclarativeArgumentParser.s_log.debug("Hit a character after the full arg:" + arg); + xap.session.DeclarativeArgumentParser.s_log.debug("Hit a character after the full arg:" + arg); throw new xap.util.Exception("Bad parameter trailing characters"); //TODO } @@ -173,14 +173,14 @@ //if we hit a ' or " with only whitespace before it that's //a string if ( (c=='\"' || c=='\'') && arg.trim().length==0){ - DeclarativeArgumentParser.s_log.debug("Hit an open string char, parsing string"); + xap.session.DeclarativeArgumentParser.s_log.debug("Hit an open string char, parsing string"); parseResult = this._parseString(args,nextChar, c); nextChar = parseResult._terminatingIndex; } //if we get an '(' anywhere it means this must be an 'mco' call of some sort else if (c=='('){ - DeclarativeArgumentParser.s_log.debug("Hit an open paren, parsing args"); + xap.session.DeclarativeArgumentParser.s_log.debug("Hit an open paren, parsing args"); var mcoCallResult = this._parseArguments(args,sourceElement,nextChar+1, clientEvent); //TODO trim is needed here @@ -216,11 +216,11 @@ var mcoName = mco.substring(0,periodIndex); var methodName = mco.substring(periodIndex+1); - DeclarativeArgumentParser.s_log.debug("Firing an object event"); + xap.session.DeclarativeArgumentParser.s_log.debug("Firing an object event"); var callResult = this._fireObjectEvent(containerName,mcoName,methodName,mcoCallResult._resultObject); - DeclarativeArgumentParser.s_log.debug("Object event returned : " + callResult); + xap.session.DeclarativeArgumentParser.s_log.debug("Object event returned : " + callResult); parseResult = new ParseResult(callResult,mcoCallResult._terminatingIndex); @@ -230,7 +230,7 @@ //if we hit a comma we must have had a plain old literal //if the literal is all whitespace this will throw an exception else if (c==','){ - DeclarativeArgumentParser.s_log.debug("Hit comma after arg:" + arg); + xap.session.DeclarativeArgumentParser.s_log.debug("Hit comma after arg:" + arg); return new ParseResult(this._stringToMcoArgument(arg, sourceElement, clientEvent), nextChar,ParseResult.COMMA_ENCOUNTERED); //TODO check for all whitespace here or someplace else? @@ -241,7 +241,7 @@ //if we hit a ) we are also done else if (c==')'){ - DeclarativeArgumentParser.s_log.debug("Hit a close paren"); + xap.session.DeclarativeArgumentParser.s_log.debug("Hit a close paren"); //an empty thing is fine if for example we got //myMco.doSomething() @@ -276,14 +276,14 @@ //so you can't do something like //text="{ }" if (parseResult==null){ - DeclarativeArgumentParser.s_log.debug("Exited loop without a parse result at all"); + xap.session.DeclarativeArgumentParser.s_log.debug("Exited loop without a parse result at all"); return new ParseResult(this._stringToMcoArgument(arg,sourceElement, clientEvent), args.length-1,ParseResult.END_OF_STRING); } //if there was a parse result just set the terminating index up properly else{ - DeclarativeArgumentParser.s_log.debug("Exited loop with a parse result"); + xap.session.DeclarativeArgumentParser.s_log.debug("Exited loop with a parse result"); parseResult._terminatingIndex = args.length-1; parseResult._parseStatus = ParseResult.END_OF_STRING; return parseResult; @@ -297,8 +297,8 @@ * returning a ParseResult that wraps an array of resolved values. * @private */ -DeclarativeArgumentParser.prototype._parseArguments = function( argumentsString, sourceElement, index, clientEvent){ - DeclarativeArgumentParser.s_log.debug("Parse arguments: " + argumentsString + " at index " + index); +xap.session.DeclarativeArgumentParser.prototype._parseArguments = function( argumentsString, sourceElement, index, clientEvent){ + xap.session.DeclarativeArgumentParser.s_log.debug("Parse arguments: " + argumentsString + " at index " + index); var args = new Array(); //keep calling parseAgument until we are done, //then stick all the results in an object[] @@ -308,10 +308,10 @@ //why do we do +1 here? because if the last terminating character //was , we need to start our search one AFTER the comma! var result = this.parseArgument(argumentsString,argumentStart+1,sourceElement, clientEvent); - DeclarativeArgumentParser.s_log.debug("Got back result " + result._resultObject); + xap.session.DeclarativeArgumentParser.s_log.debug("Got back result " + result._resultObject); if (result._resultObject!=null){ args.push(result._resultObject); - DeclarativeArgumentParser.s_log.debug("Push result: " + result._resultObject); + xap.session.DeclarativeArgumentParser.s_log.debug("Push result: " + result._resultObject); argumentStart = result._terminatingIndex; if (result._parseStatus==ParseResult.CLOSING_PAREN){ break; @@ -329,7 +329,7 @@ } } - DeclarativeArgumentParser.s_log.debug("Return parse result: " + args); + xap.session.DeclarativeArgumentParser.s_log.debug("Return parse result: " + args); return new ParseResult(args,argumentStart); } @@ -359,13 +359,13 @@ * * @private */ -DeclarativeArgumentParser.prototype._stringToMcoArgument = +xap.session.DeclarativeArgumentParser.prototype._stringToMcoArgument = function(arg, thisElement, clientEvent){ - DeclarativeArgumentParser.s_log.debug("Convert string [" + arg + "] to argument"); + xap.session.DeclarativeArgumentParser.s_log.debug("Convert string [" + arg + "] to argument"); arg = arg.trim(); if (arg.indexOf(":")!=-1){ - DeclarativeArgumentParser.s_log.debug("Found a colon, convert to object reference"); + xap.session.DeclarativeArgumentParser.s_log.debug("Found a colon, convert to object reference"); var index = arg.indexOf(":"); var containerName = arg.substring(0,index); var mcoName = arg.substring(index+1); @@ -384,17 +384,17 @@ //note that this RETURNS a macro and does not RUN it! } else if (arg=="true") { - DeclarativeArgumentParser.s_log.debug("Found true"); + xap.session.DeclarativeArgumentParser.s_log.debug("Found true"); //TODO do we have to do this sort of thing, can we rely on JS type conversion stuff? return new Boolean(true); } else if (arg=="false"){ - DeclarativeArgumentParser.s_log.debug("Found false"); + xap.session.DeclarativeArgumentParser.s_log.debug("Found false"); return new Boolean(false); } else{ var num = parseFloat(arg); - DeclarativeArgumentParser.s_log.debug("Converted to float: " + num); + xap.session.DeclarativeArgumentParser.s_log.debug("Converted to float: " + num); if (!isNaN(num)){ return num; } @@ -402,7 +402,7 @@ //TODO do we really want to do this? if (arg=="event"){ - DeclarativeArgumentParser.s_log.debug("Found event string"); + xap.session.DeclarativeArgumentParser.s_log.debug("Found event string"); return clientEvent; } @@ -421,14 +421,14 @@ element = thisElement; } - DeclarativeArgumentParser.s_log.debug("FOund element: " + element); + xap.session.DeclarativeArgumentParser.s_log.debug("FOund element: " + element); if (element!=null){ if (elementAttribute==null) return element; var attributeValue = element.getAttribute(elementAttribute); - DeclarativeArgumentParser.s_log.debug("FOund attribute: " + attributeValue); + xap.session.DeclarativeArgumentParser.s_log.debug("FOund attribute: " + attributeValue); if (attributeValue==null) attributeValue = ""; return attributeValue; @@ -455,7 +455,7 @@ * * @private */ -DeclarativeArgumentParser.prototype._fireObjectEvent = function(containerName, mcoName, +xap.session.DeclarativeArgumentParser.prototype._fireObjectEvent = function(containerName, mcoName, methodName, args){ var container = this._session.getContainer(containerName); @@ -481,7 +481,7 @@ } - DeclarativeArgumentParser.s_log.debug("Fire object event [" + methodName +"] on the object " + mcoName + + xap.session.DeclarativeArgumentParser.s_log.debug("Fire object event [" + methodName +"] on the object " + mcoName + " with arguments " + args); try{ return o[methodName].apply(o,args); @@ -504,9 +504,9 @@ * @private */ -DeclarativeArgumentParser.prototype._parseString = function(args, startIndex, terminatingCharacter){ +xap.session.DeclarativeArgumentParser.prototype._parseString = function(args, startIndex, terminatingCharacter){ - DeclarativeArgumentParser.s_log.debug("Parse string :" + args + " at start index " + startIndex); + xap.session.DeclarativeArgumentParser.s_log.debug("Parse string :" + args + " at start index " + startIndex); var result = new ParseResult(null,startIndex); var arg = new String(); startIndex++; //first must be a " or ' @@ -522,7 +522,7 @@ //if we got the terminating char we are done if (c==terminatingCharacter){ - DeclarativeArgumentParser.s_log.debug("Hit terminating char " + c + " result string=" + arg); + xap.session.DeclarativeArgumentParser.s_log.debug("Hit terminating char " + c + " result string=" + arg); result._resultObject = arg; result._terminatingIndex = nextChar; break; Modified: incubator/xap/trunk/src/xap/session/EventHandler.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/session/EventHandler.js?rev=422273&r1=422272&r2=422273&view=diff ============================================================================== --- incubator/xap/trunk/src/xap/session/EventHandler.js (original) +++ incubator/xap/trunk/src/xap/session/EventHandler.js Sat Jul 15 10:22:41 2006 @@ -25,7 +25,7 @@ * Placeholder functionality only for now. Event handler is used * to fire/handle events specified in the XML. For example if they have * onSelect="myPage.jsp" event handler takes care of calling myPage.jsp. - * EventHandler handles mco calls, macro calls, and more generically + * xap.session.EventHandler handles mco calls, macro calls, and more generically * it should handle anything in the form container://id.method() * although we may want to rethink that syntax a bit. * @@ -36,14 +36,14 @@ //----------------------------------------------------------------------- // Constructors. //----------------------------------------------------------------------- -EventHandler = function( session ) { +xap.session.EventHandler = function( session ) { this._session = session; } //----------------------------------------------------------------------- // Public Methods. //----------------------------------------------------------------------- -EventHandler.prototype.fireEvent = function( eventName, eventValue, +xap.session.EventHandler.prototype.fireEvent = function( eventName, eventValue, eventElement, clientEvent ) { @@ -96,7 +96,7 @@ return null; } -EventHandler.prototype._handleObjectEvent = function( eventValue, eventElement, clientEvent){ +xap.session.EventHandler.prototype._handleObjectEvent = function( eventValue, eventElement, clientEvent){ var openParenPos = eventValue.indexOf("("); var closeParenPos = eventValue.indexOf(")"); var periodPos = eventValue.indexOf("."); @@ -105,7 +105,7 @@ !(periodPoshandler mapping. * * @param e The element being removed from the document. */ -PluginDocumentHandler.prototype.deregister = function( el ) { +xap.taghandling.PluginDocumentHandler.prototype.deregister = function( el ) { var handler = this.getHandlerForElement( el ); if ( handler != null ) { this._elementsToBridges.remove( el ); @@ -133,13 +133,13 @@ * Parses an XML Element and returns a new instance of the tag-handling * bridge class that the tag name was mapped to. This is called whenever a * new document fragment is added to the UI document, and from - * parseInitialChildren() in AbstractTagImpl. + * parseInitialChildren() in xap.taghandling.AbstractTagImpl. * * @param childElement The element to parse and create the tag<->tag-handler * mapping for. * @return A new instance of the tag-handling class or null if no mapping exists. */ -PluginDocumentHandler.prototype.parseChild = function( childElement ) { +xap.taghandling.PluginDocumentHandler.prototype.parseChild = function( childElement ) { var handler = null; var pluginRegistry = this._clientSession.getPluginRegistry(); @@ -154,10 +154,10 @@ //if the implementing class name is null do what we used to do //and print out an error if ( bridgeClass == null ) { - PluginDocumentHandler.s_log.debug( "No mapping for tag name [" + + xap.taghandling.PluginDocumentHandler.s_log.debug( "No mapping for tag name [" + tagName + "] with namespace [" + namespace + "] on document [" + this._documentName + "]"); - PluginDocumentHandler.s_log.error( "No mapping found for tag " + + xap.taghandling.PluginDocumentHandler.s_log.error( "No mapping found for tag " + tagName + ", namespace=" + namespace ); return null; } @@ -176,7 +176,7 @@ handler = eval( "new " + bridgeClass + "()" ); } catch( ex ) { - PluginDocumentHandler.s_log.exception( "Exception during eval:" + + xap.taghandling.PluginDocumentHandler.s_log.exception( "Exception during eval:" + ex.toString() ); //if that fails, try again with just the stuff after the @@ -194,12 +194,12 @@ handler = eval( "new " + bridgeClass + "()" ); } catch(ex2){ - PluginDocumentHandler.s_log.exception( "Exception during eval:" + + xap.taghandling.PluginDocumentHandler.s_log.exception( "Exception during eval:" + ex.toString() ); // If we didn't create a new handler just now, // handler==null, so this.setHandlerForElement below - // will bomb on the Hashtable.put(aKey,handler) that + // will bomb on the xap.util.Hashtable.put(aKey,handler) that // it calls, and handler.setSession() below will also // fail, so we might as well end it here: throw ex ; @@ -234,7 +234,7 @@ handler.fireEvent( "onCreate" ); } catch( ex ) { - this._clientSession.handleException( new XapException("blah",null, ex,"PluginDocumentHandler.parseChild" )); + this._clientSession.handleException( new xap.util.XapException("blah",null, ex,"xap.taghandling.PluginDocumentHandler.parseChild" )); } return handler; } @@ -246,14 +246,14 @@ * @param e The Element to look up the tag-handler for. * @return The tag-handling class. */ -PluginDocumentHandler.prototype.getHandlerForElement = function( el ){ +xap.taghandling.PluginDocumentHandler.prototype.getHandlerForElement = function( el ){ return this._elementsToBridges.get( el ); } /** * For internal use only. */ -PluginDocumentHandler.prototype.setHandlerForElement = function( el, tagImpl ){ +xap.taghandling.PluginDocumentHandler.prototype.setHandlerForElement = function( el, tagImpl ){ this._elementsToBridges.put( el, tagImpl ); } @@ -263,23 +263,23 @@ * the bridge from the peer. For example, given a JButton * to look up the subclass of SwingBridge that controls that JButton * instance.

- * This is called automatically by ContainerBridge + * This is called automatically by xap.session.ContainerBridge * in setUiComponent(). * * @param peer The controlled object. * @param bridge The bridge class that controls that object. */ -PluginDocumentHandler.prototype.setHandlerForPeer = function( peer, tagImpl ) { +xap.taghandling.PluginDocumentHandler.prototype.setHandlerForPeer = function( peer, tagImpl ) { this._peersToBridges.put( peer, tagImpl ); } /** * Removes the mpping between the peer and the handler. - * This should be called in in the AbstractTagImpl + * This should be called in in the xap.taghandling.AbstractTagImpl * deregister() to clean up any references. * @param peer The peer object to remove the mapping for. */ -PluginDocumentHandler.prototype.removeHandlerForPeer = function( peer ) { +xap.taghandling.PluginDocumentHandler.prototype.removeHandlerForPeer = function( peer ) { this._peersToBridges.remove( peer ); } @@ -297,7 +297,7 @@ * itself control the same table peer object. * @param peer The controlled object to look up the bridge for. */ -PluginDocumentHandler.prototype.getHandlerForPeer = function( peer ) { +xap.taghandling.PluginDocumentHandler.prototype.getHandlerForPeer = function( peer ) { return this._peersToBridges.get( peer ); } //Let Dojo know what to expect from this file: Modified: incubator/xap/trunk/src/xap/taghandling/PluginRegistry.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/taghandling/PluginRegistry.js?rev=422273&r1=422272&r2=422273&view=diff ============================================================================== --- incubator/xap/trunk/src/xap/taghandling/PluginRegistry.js (original) +++ incubator/xap/trunk/src/xap/taghandling/PluginRegistry.js Sat Jul 15 10:22:41 2006 @@ -16,7 +16,7 @@ */ /** - * @fileoverview PluginRegistry keeps track of all the tags + * @fileoverview xap.taghandling.PluginRegistry keeps track of all the tags * for various documents and namespaces and what they map to. * * @author ikaplansky @@ -24,9 +24,9 @@ */ /** - * Creates a new PluginRegistry. + * Creates a new xap.taghandling.PluginRegistry. * - * @class PluginRegistry keeps track of all the tags + * @class xap.taghandling.PluginRegistry keeps track of all the tags * for various documents and namespaces and what they map to. Currently * this class maps tags to bridge class names without any regard for * namespace or document name. In the future it needs to allow the same @@ -34,9 +34,9 @@ * the tag appears in. TODO * */ -PluginRegistry = function() { +xap.taghandling.PluginRegistry = function() { - this._tagToBridgeClassName = new Hashtable(); + this._tagToBridgeClassName = new xap.util.Hashtable(); //zimbra components this._tagToBridgeClassName.put( "panel", "DwtCompositeBridge" ); @@ -44,27 +44,27 @@ this._tagToBridgeClassName.put( "button", "DwtButtonBridge" ); this._tagToBridgeClassName.put( "tabPane", "DwtTabViewBridge" ); this._tagToBridgeClassName.put( "tab", "DwtTabBridge" ); - this._tagToBridgeClassName.put( "splitPane", "DwtSplitterBridge" ); - this._tagToBridgeClassName.put( "left", "DwtSplitChildBridge" ); - this._tagToBridgeClassName.put( "right", "DwtSplitChildBridge" ); - this._tagToBridgeClassName.put( "top", "DwtSplitChildBridge" ); - this._tagToBridgeClassName.put( "bottom", "DwtSplitChildBridge" ); + this._tagToBridgeClassName.put( "splitPane", "xap.components.zimbra.DwtSplitterBridge" ); + this._tagToBridgeClassName.put( "left", "xap.components.zimbra.DwtSplitChildBridge" ); + this._tagToBridgeClassName.put( "right", "xap.components.zimbra.DwtSplitChildBridge" ); + this._tagToBridgeClassName.put( "top", "xap.components.zimbra.DwtSplitChildBridge" ); + this._tagToBridgeClassName.put( "bottom", "xap.components.zimbra.DwtSplitChildBridge" ); this._tagToBridgeClassName.put( "tree", "DwtTreeBridge" ); this._tagToBridgeClassName.put( "treeItem", "DwtTreeItemBridge" ); this._tagToBridgeClassName.put( "textField", "DwtTextFieldBridge" ); - this._tagToBridgeClassName.put( "verticalLayoutPanel", "DwtVerticalLayoutPanelBridge" ); - this._tagToBridgeClassName.put( "horizontalLayoutPanel", "DwtHorizontalLayoutPanelBridge" ); + this._tagToBridgeClassName.put( "verticalLayoutPanel", "xap.components.zimbra.DwtVerticalLayoutPanelBridge" ); + this._tagToBridgeClassName.put( "horizontalLayoutPanel", "xap.components.zimbra.DwtHorizontalLayoutPanelBridge" ); //basic components - this._tagToBridgeClassName.put( "textView", "TextViewBridge" ); + this._tagToBridgeClassName.put( "textView", "xap.bridges.basic.TextViewBridge" ); //add custom tags here - this._tagToBridgeClassName.put( "gMap", "GoogleMapBridge" ); - this._tagToBridgeClassName.put( "infoWindow", "GoogleInfoWindowBridge" ); - this._tagToBridgeClassName.put( "marker", "GoogleMarkerBridge" ); - this._tagToBridgeClassName.put( "markers", "GoogleMarkersBridge" ); - this._tagToBridgeClassName.put( "icons", "GoogleIconsBridge" ); - this._tagToBridgeClassName.put( "icon", "GoogleIconBridge" ); + this._tagToBridgeClassName.put( "gMap", "xap.bridges.google.GoogleMapBridge" ); + this._tagToBridgeClassName.put( "infoWindow", "xap.bridges.google.GoogleInfoWindowBridge" ); + this._tagToBridgeClassName.put( "marker", "xap.bridges.google.GoogleMarkerBridge" ); + this._tagToBridgeClassName.put( "markers", "xap.bridges.google.GoogleMarkersBridge" ); + this._tagToBridgeClassName.put( "icons", "xap.bridges.google.GoogleIconsBridge" ); + this._tagToBridgeClassName.put( "icon", "xap.bridges.google.GoogleIconBridge" ); } /** @@ -72,6 +72,6 @@ * return the bridge class name that the tag/namespace/document maps to, * if any. */ -PluginRegistry.prototype.getTagMapping = function( tagName, nameSpace, documentName ) { +xap.taghandling.PluginRegistry.prototype.getTagMapping = function( tagName, nameSpace, documentName ) { return this._tagToBridgeClassName.get( tagName ); } Modified: incubator/xap/trunk/src/xap/taghandling/PluginRegistryImpl.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/taghandling/PluginRegistryImpl.js?rev=422273&r1=422272&r2=422273&view=diff ============================================================================== --- incubator/xap/trunk/src/xap/taghandling/PluginRegistryImpl.js (original) +++ incubator/xap/trunk/src/xap/taghandling/PluginRegistryImpl.js Sat Jul 15 10:22:41 2006 @@ -17,6 +17,8 @@ Xap.provide( "xap.taghandling.PluginRegistryImpl" ) ; Xap.require("google.xpath"); +Xap.require("xap.xml.sax.SaxContentHandler") ; +Xap.require("xap.xml.sax.SaxParser") ; /** * @fileoverview Work in progress. * @@ -28,7 +30,7 @@ /** * A constructor. * - * @class This is going to replace the functionality in PluginRegistry (perhaps + * @class This is going to replace the functionality in xap.taghandling.PluginRegistry (perhaps * with a rename). This class is responsible for parsing a plugin mapping file * and setting up the proper mappings. A plugin mapping file defines * tags that map to classes. Each entry applies to a single namespace @@ -42,22 +44,22 @@ -PluginRegistryImpl = function( session ){ +xap.taghandling.PluginRegistryImpl = function( session ){ this._pluginLifecycleObjects = new Array(); - this._tagDefinitions = new Hashtable(); - this._tagMappings = new Hashtable(); + this._tagDefinitions = new xap.util.Hashtable(); + this._tagMappings = new xap.util.Hashtable(); this._session = session; } -PluginRegistryImpl.s_log = xap.util.LogFactory.getLog( "PluginRegistryImpl" ); +xap.taghandling.PluginRegistryImpl.s_log = xap.util.LogFactory.getLog( "xap.taghandling.PluginRegistryImpl" ); -PluginRegistryImpl.TAG_MAPPINGS_PATH = "/plugin/tag-mappings"; +xap.taghandling.PluginRegistryImpl.TAG_MAPPINGS_PATH = "/plugin/tag-mappings"; -PluginRegistryImpl.UNMAPPED_TAGS_PATH = "/plugin/unmapped-tags" +xap.taghandling.PluginRegistryImpl.UNMAPPED_TAGS_PATH = "/plugin/unmapped-tags" -PluginRegistryImpl.PLUGIN_LIFECYCLE_CLASS_PATH = "/plugin/@class"; +xap.taghandling.PluginRegistryImpl.PLUGIN_LIFECYCLE_CLASS_PATH = "/plugin/@class"; -PluginRegistryImpl.NO_MAPPED_CLASS = new Object(); +xap.taghandling.PluginRegistryImpl.NO_MAPPED_CLASS = new Object(); //TODO would this whole thing make more sense as a generic namespace @@ -70,10 +72,10 @@ * @param fileContents a String representing the actual content (NOT path) * of the description file */ -PluginRegistryImpl.prototype.addPluginDescription = function( fileContents ){ +xap.taghandling.PluginRegistryImpl.prototype.addPluginDescription = function( fileContents ){ - PluginRegistryImpl.s_log.debug("Add plugin description"); - var parser = new SaxParser( new SaxContentHandler() ); + xap.taghandling.PluginRegistryImpl.s_log.debug("Add plugin description"); + var parser = new xap.xml.sax.SaxParser( new xap.xml.sax.SaxContentHandler() ); var pluginDocument = null; try{ @@ -87,21 +89,21 @@ //TODO this returs what an array of nodes? var tagMappingSections = - google.xpathDomEval(PluginRegistryImpl.TAG_MAPPINGS_PATH , pluginDocument); - PluginRegistryImpl.s_log.debug(tagMappingSections.value.length + " mapped tags"); + google.xpathDomEval(xap.taghandling.PluginRegistryImpl.TAG_MAPPINGS_PATH , pluginDocument); + xap.taghandling.PluginRegistryImpl.s_log.debug(tagMappingSections.value.length + " mapped tags"); this._parseTagMappingElements(tagMappingSections.value,true); - PluginRegistryImpl.s_log.debug("Parse unmapped tags"); + xap.taghandling.PluginRegistryImpl.s_log.debug("Parse unmapped tags"); tagMappingSections = - google.xpathDomEval(PluginRegistryImpl.UNMAPPED_TAGS_PATH , pluginDocument); - PluginRegistryImpl.s_log.debug(tagMappingSections.value.length + " unmapped tags"); + google.xpathDomEval(xap.taghandling.PluginRegistryImpl.UNMAPPED_TAGS_PATH , pluginDocument); + xap.taghandling.PluginRegistryImpl.s_log.debug(tagMappingSections.value.length + " unmapped tags"); this._parseTagMappingElements(tagMappingSections.value,false); //TODO this returns an array but we want a string, get the first element node value? var lifecycleClassName = - google.xpathDomEval(PluginRegistryImpl.PLUGIN_LIFECYCLE_CLASS_PATH , pluginDocument).value[0]; + google.xpathDomEval(xap.taghandling.PluginRegistryImpl.PLUGIN_LIFECYCLE_CLASS_PATH , pluginDocument).value[0]; - PluginRegistryImpl.s_log.debug("lifecycle class = " + lifecycleClassName); + xap.taghandling.PluginRegistryImpl.s_log.debug("lifecycle class = " + lifecycleClassName); if (lifecycleClassName && lifecycleClassName.length >0){ try{ @@ -128,8 +130,8 @@ * Returns the original definition element that came from the tag-mapping/ * plugin file representing this tag/namespace combo */ -PluginRegistryImpl.prototype.getPluginDefinition = function( tagName, nameSpace, documentName){ - this._tagDefinitions.get(PluginRegistryImpl._createHashtableKey(tagName,nameSpace,documentName)); +xap.taghandling.PluginRegistryImpl.prototype.getPluginDefinition = function( tagName, nameSpace, documentName){ + this._tagDefinitions.get(xap.taghandling.PluginRegistryImpl._createHashtableKey(tagName,nameSpace,documentName)); } @@ -139,8 +141,8 @@ * 2: null, indicating unmapped * 3: A non-string object, indicating unmapped purposely */ -PluginRegistryImpl.prototype.getTagMapping = function(tagName, nameSpace, documentName){ - return this._tagMappings.get(PluginRegistryImpl._createHashtableKey(tagName,nameSpace,documentName)); +xap.taghandling.PluginRegistryImpl.prototype.getTagMapping = function(tagName, nameSpace, documentName){ + return this._tagMappings.get(xap.taghandling.PluginRegistryImpl._createHashtableKey(tagName,nameSpace,documentName)); } @@ -151,7 +153,7 @@ * tag-mapping and unmapped-tags roots * @param isMappedTag if true, each item should map to a class */ -PluginRegistryImpl.prototype._parseTagMappingElements = function(tagMappingSections, isMappedTag){ +xap.taghandling.PluginRegistryImpl.prototype._parseTagMappingElements = function(tagMappingSections, isMappedTag){ //for each tag in the block for (var section =0; section/gm, ">"); - + //then write to log window var consoleDoc = xap.util.LogFactory.ConsoleLog.s_logWindow.document; var log = consoleDoc.getElementById('log'); Modified: incubator/xap/trunk/src/xap/util/Profiler.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/util/Profiler.js?rev=422273&r1=422272&r2=422273&view=diff ============================================================================== --- incubator/xap/trunk/src/xap/util/Profiler.js (original) +++ incubator/xap/trunk/src/xap/util/Profiler.js Sat Jul 15 10:22:41 2006 @@ -16,33 +16,33 @@ */ Xap.provide( "xap.util.Profiler" ) ; -Profiler = function (){} +xap.util.Profiler = function (){} -Profiler._hashtable = new Hashtable(); +xap.util.Profiler._hashtable = new xap.util.Hashtable(); -Profiler.s_log = xap.util.LogFactory.getLog("Profiler"); +xap.util.Profiler.s_log = xap.util.LogFactory.getLog("xap.util.Profiler"); -Profiler.start = function( message ){ - var x = Profiler._hashtable.get(message); +xap.util.Profiler.start = function( message ){ + var x = xap.util.Profiler._hashtable.get(message); if (!x){ x = new Array(); } x.push(new Date()); - Profiler._hashtable.put(message, x); + xap.util.Profiler._hashtable.put(message, x); } -Profiler.end = function( message ){ +xap.util.Profiler.end = function( message ){ var now = new Date(); - var x = Profiler._hashtable.get(message); + var x = xap.util.Profiler._hashtable.get(message); if (!x || x.length==0) return; var startTime = x.pop(); var message = message + "[" + x.length + "] took " + (now.getTime()-startTime.getTime()) + "ms"; - Profiler.s_log.debug(message); + xap.util.Profiler.s_log.debug(message); } Modified: incubator/xap/trunk/src/xap/util/ResourceDictionary.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/util/ResourceDictionary.js?rev=422273&r1=422272&r2=422273&view=diff ============================================================================== --- incubator/xap/trunk/src/xap/util/ResourceDictionary.js (original) +++ incubator/xap/trunk/src/xap/util/ResourceDictionary.js Sat Jul 15 10:22:41 2006 @@ -19,7 +19,7 @@ /** - * ResourceDictionary's purpose is to look up messages (i.e. debug, info) by + * xap.util.ResourceDictionary's purpose is to look up messages (i.e. debug, info) by * ids. The messages should be defined in property files that are specific to * given locales. * @@ -28,26 +28,26 @@ Xap.require("xap.util.MessageFormat"); -ResourceDictionary = function() {} +xap.util.ResourceDictionary = function() {} //------------------------------------------------------------------- // Class Variables. //------------------------------------------------------------------- -ResourceDictionary.s_classnameToResourceObject = new Hashtable(); -ResourceDictionary.s_log = xap.util.LogFactory.getLog( "ResourceDictionary" ); +xap.util.ResourceDictionary.s_classnameToResourceObject = new xap.util.Hashtable(); +xap.util.ResourceDictionary.s_log = xap.util.LogFactory.getLog( "xap.util.ResourceDictionary" ); //------------------------------------------------------------------- // Public Class Methods. //------------------------------------------------------------------- -ResourceDictionary.getMessage = function( msgId, className, args ) { - var resourceObject = ResourceDictionary.s_classnameToResourceObject.get +xap.util.ResourceDictionary.getMessage = function( msgId, className, args ) { + var resourceObject = xap.util.ResourceDictionary.s_classnameToResourceObject.get ( className ); if( resourceObject == null ) { try { var resourceObject = eval ( "new " + className + "Res();" ); - ResourceDictionary.s_classnameToResourceObject.put( className, resourceObject ); + xap.util.ResourceDictionary.s_classnameToResourceObject.put( className, resourceObject ); } catch ( e ){ - ResourceDictionary.s_log.exception( "Exception getting message:" + + xap.util.ResourceDictionary.s_log.exception( "Exception getting message:" + "id=" + msgId + ",classname=" + className + ", args:" + args + ", exception:" + e ); } Modified: incubator/xap/trunk/src/xap/util/UidProvider.js URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/util/UidProvider.js?rev=422273&r1=422272&r2=422273&view=diff ============================================================================== --- incubator/xap/trunk/src/xap/util/UidProvider.js (original) +++ incubator/xap/trunk/src/xap/util/UidProvider.js Sat Jul 15 10:22:41 2006 @@ -19,25 +19,25 @@ Xap.provide('xap.util.UidProvider'); /** - * @fileoverview UidProvider generates a sequences of unique ids. + * @fileoverview xap.util.UidProvider generates a sequences of unique ids. * * @author ikaplansky */ /** - * Creates a UidProvider with the given seed. + * Creates a xap.util.UidProvider with the given seed. * - * @class UidProvider generates a sequences of unique ids. You can use it - * by instantiating an instance of a UidProvider or through the static + * @class xap.util.UidProvider generates a sequences of unique ids. You can use it + * by instantiating an instance of a xap.util.UidProvider or through the static * createId method. * * @param {String} seed A unique-ish string. */ -UidProvider = function( seed ) { +xap.util.UidProvider = function( seed ) { this._count = 0; if ( seed == null ) { - this._seed = UidProvider._createSeed(); + this._seed = xap.util.UidProvider._createSeed(); } else { this._seed = seed; } @@ -49,18 +49,18 @@ /** @private */ -UidProvider.XAP_ID_PREFIX = "xap:"; +xap.util.UidProvider.XAP_ID_PREFIX = "xap:"; /** @private */ -UidProvider.s_count = 0; +xap.util.UidProvider.s_count = 0; /** @private */ -UidProvider._createSeed = function () { +xap.util.UidProvider._createSeed = function () { return new Date().getTime(); } /** @private */ -UidProvider.s_seed = UidProvider._createSeed(); +xap.util.UidProvider.s_seed = xap.util.UidProvider._createSeed(); //----------------------------------------------------------------------- // Public Class Methods. @@ -71,9 +71,9 @@ * * @type String */ -UidProvider.createId = function() { - return new String( UidProvider.XAP_ID_PREFIX + - UidProvider.s_seed + UidProvider.s_count++ ); +xap.util.UidProvider.createId = function() { + return new String( xap.util.UidProvider.XAP_ID_PREFIX + + xap.util.UidProvider.s_seed + xap.util.UidProvider.s_count++ ); } @@ -88,7 +88,7 @@ * * @type String */ -UidProvider.prototype.nextId = function () { - return UidProvider.XAP_ID_PREFIX + this._seed + this._count++; +xap.util.UidProvider.prototype.nextId = function () { + return xap.util.UidProvider.XAP_ID_PREFIX + this._seed + this._count++; }