You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by jm...@apache.org on 2007/05/08 22:54:01 UTC
svn commit: r536367 - in /incubator/xap/trunk: buildsystem/seed/xap/config/
codebase/src/xap/data/ codebase/src/xap/taghandling/ codebase/src/xap/xml/
samples/WebContent/ unittests/testsrc/
Author: jmargaris
Date: Tue May 8 15:54:00 2007
New Revision: 536367
URL: http://svn.apache.org/viewvc?view=rev&rev=536367
Log:
removed XalNamespaceHandler and replaced with a more
generic mechanism that will work for all UI namespaces
Added:
incubator/xap/trunk/codebase/src/xap/xml/UiNamespaceShortcutHandler.js
- copied, changed from r521423, incubator/xap/trunk/codebase/src/xap/xml/XalNamespaceHandler.js
Removed:
incubator/xap/trunk/codebase/src/xap/xml/XalNamespaceHandler.js
Modified:
incubator/xap/trunk/buildsystem/seed/xap/config/XapConfig.js
incubator/xap/trunk/codebase/src/xap/data/DataNamespaceHandler.js
incubator/xap/trunk/codebase/src/xap/taghandling/PluginRegistryImpl.js
incubator/xap/trunk/samples/WebContent/XapConfig.js
incubator/xap/trunk/unittests/testsrc/XapConfig-Min.js
Modified: incubator/xap/trunk/buildsystem/seed/xap/config/XapConfig.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/buildsystem/seed/xap/config/XapConfig.js?view=diff&rev=536367&r1=536366&r2=536367
==============================================================================
--- incubator/xap/trunk/buildsystem/seed/xap/config/XapConfig.js (original)
+++ incubator/xap/trunk/buildsystem/seed/xap/config/XapConfig.js Tue May 8 15:54:00 2007
@@ -81,7 +81,6 @@
"xap.mco.McoNamespaceHandler",
"xap.xml.xmodify.XmodifyNamespaceHandler",
"xap.macro.MacroNamespaceHandler",
- "xap.xml.XalNamespaceHandler",
"xap.data.DataNamespaceHandler"
],
/**
Modified: incubator/xap/trunk/codebase/src/xap/data/DataNamespaceHandler.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/data/DataNamespaceHandler.js?view=diff&rev=536367&r1=536366&r2=536367
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/data/DataNamespaceHandler.js (original)
+++ incubator/xap/trunk/codebase/src/xap/data/DataNamespaceHandler.js Tue May 8 15:54:00 2007
@@ -127,11 +127,23 @@
}
} // end iteration over document names
+
+ //this could be an iterator at the top level, which means it maps to the UI document
+ //and should do the normal shortcut behavior that UiNamespaceShortcutHandler
+ //normally does
+ var definition = clientSession.getPluginRegistry().getPluginDefinition(element.getLocalName(), element.getNamespaceUri(), "ui");
+ if (definition){
+ var uiDocument = this._session.getDocumentContainer().getUiDocument();
+ var rootElement = uiDocument.getRootElement();
+ rootElement.appendChild(element);
+ }
+ else{
+ //if we got here it means we didn't find any proper definition which is
+ //an error
+ //TODO: fix exception handling
+ var ex = new xap.util.Exception("Unhandled data tag in namespace: " + element.getNamespaceUri() + ", " + element.getLocalName()) ;
+ clientSession.handleException(ex);
+ }
- //if we got here it means we didn't find any proper definition which is
- //an error
- //TODO: fix exception handling
- var ex = new xap.util.Exception("Undhandled data tag in namespace: " + element.getNamespaceUri() + ", " + element.getLocalName()) ;
- clientSession.handleException(ex);
};
Modified: incubator/xap/trunk/codebase/src/xap/taghandling/PluginRegistryImpl.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/taghandling/PluginRegistryImpl.js?view=diff&rev=536367&r1=536366&r2=536367
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/taghandling/PluginRegistryImpl.js (original)
+++ incubator/xap/trunk/codebase/src/xap/taghandling/PluginRegistryImpl.js Tue May 8 15:54:00 2007
@@ -24,6 +24,7 @@
Xap.require("google.xpath");
Xap.require("xap.xml.ParserFactory");
Xap.require("xap.log.Logger");
+Xap.require("xap.xml.UiNamespaceShortcutHandler");
/**
* @fileoverview Work in progress.
@@ -55,6 +56,7 @@
this._tagDefinitions = new xap.util.Hashtable();
this._tagMappings = new xap.util.Hashtable();
this._session = session;
+ this._uiShortcutNamespaceHandler = new xap.xml.UiNamespaceShortcutHandler(session);
}
xap.taghandling.PluginRegistryImpl.s_log = xap.log.Logger.getLogger( "xap.taghandling.PluginRegistryImpl" );
@@ -203,6 +205,16 @@
//just continue, most likely there was extra whitespace that split
//turned into a blank string
continue;
+ }
+
+
+ //if this namespace applies to the UI document set up a shortcut
+ //mapping that namespace to the shortcut handler. Make sure not to override
+ //any existing handlers
+ if (documentName == xap.xml.DocumentContainer.UI_DOCUMENT_NAME){
+ if (!this._session.getNamespaceHandlerManager()._namespaceToHandlersMap.get(nameSpace)){
+ this._session.getNamespaceHandlerManager().addHandler(nameSpace, this._uiShortcutNamespaceHandler);
+ }
}
//for each child of that tag in the block
Copied: incubator/xap/trunk/codebase/src/xap/xml/UiNamespaceShortcutHandler.js (from r521423, incubator/xap/trunk/codebase/src/xap/xml/XalNamespaceHandler.js)
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/xml/UiNamespaceShortcutHandler.js?view=diff&rev=536367&p1=incubator/xap/trunk/codebase/src/xap/xml/XalNamespaceHandler.js&r1=521423&p2=incubator/xap/trunk/codebase/src/xap/xml/UiNamespaceShortcutHandler.js&r2=536367
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/xml/XalNamespaceHandler.js (original)
+++ incubator/xap/trunk/codebase/src/xap/xml/UiNamespaceShortcutHandler.js Tue May 8 15:54:00 2007
@@ -17,7 +17,7 @@
*
*/
-Xap.provide( "xap.xml.XalNamespaceHandler" ) ;
+Xap.provide( "xap.xml.UiNamespaceShortcutHandler" ) ;
Xap.require("xap.log.Logger");
@@ -31,10 +31,10 @@
/**
- * Creates a xap.xml.XalNamespaceHandler instance, typically there is no need
- * to contruct a xap.xml.XalNamespaceHandler directly.
+ * Creates a xap.xml.UiNamespaceShortcutHandler instance, typically there is no need
+ * to contruct a xap.xml.UiNamespaceShortcutHandler directly.
*
- * @class The xap.xml.XalNamespaceHandler handles elements with the xal namespace
+ * @class The xap.xml.UiNamespaceShortcutHandler handles elements with any UI namespace
* that are at the first level of a document being processed.
* Currently what this does it take the element being processed and append
* it to the root of the UI document.
@@ -46,26 +46,14 @@
*
*
*/
-xap.xml.XalNamespaceHandler = function(){
-
+xap.xml.UiNamespaceShortcutHandler = function(session){
+ this._session = session;
}
//-----------------------------------------------------------------------
// Class variables.
//-----------------------------------------------------------------------
-xap.xml.XalNamespaceHandler.s_log = xap.log.Logger.getLogger( "xap.xml.XalNamespaceHandler" );
-
-
-//-----------------------------------------------------------------------
-// xap.xml.NamespaceHandler Implementation.
-//-----------------------------------------------------------------------
-
-
-xap.xml.XalNamespaceHandler.prototype.pluginLoaded = function( session ){
- session.getNamespaceHandlerManager().addHandler("http://openxal.org/ui", this);
- session.getNamespaceHandlerManager().addHandler("http://openxal.org/ui/html", this);
- this._session = session;
-}
+xap.xml.UiNamespaceShortcutHandler.s_log = xap.log.Logger.getLogger( "xap.xml.UiNamespaceShortcutHandler" );
/**
* This method is called when an element with the xal namespace is
@@ -75,9 +63,9 @@
* children
* @throws UpdateException
*/
-xap.xml.XalNamespaceHandler.prototype.receiveDispatch = function( element ) {
- if (xap.xml.XalNamespaceHandler.s_log.isTrace()){
- xap.xml.XalNamespaceHandler.s_log.trace("receiveDispatch:" + element);
+xap.xml.UiNamespaceShortcutHandler.prototype.receiveDispatch = function( element ) {
+ if (xap.xml.UiNamespaceShortcutHandler.s_log.isTrace()){
+ xap.xml.UiNamespaceShortcutHandler.s_log.trace("receiveDispatch:" + element);
}
//get the root and just append to it
@@ -85,6 +73,3 @@
var rootElement = uiDocument.getRootElement();
rootElement.appendChild(element);
}
-
-
-
Modified: incubator/xap/trunk/samples/WebContent/XapConfig.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/samples/WebContent/XapConfig.js?view=diff&rev=536367&r1=536366&r2=536367
==============================================================================
--- incubator/xap/trunk/samples/WebContent/XapConfig.js (original)
+++ incubator/xap/trunk/samples/WebContent/XapConfig.js Tue May 8 15:54:00 2007
@@ -81,7 +81,6 @@
"xap.mco.McoNamespaceHandler",
"xap.xml.xmodify.XmodifyNamespaceHandler",
"xap.macro.MacroNamespaceHandler",
- "xap.xml.XalNamespaceHandler",
"xap.data.DataNamespaceHandler"
],
/**
Modified: incubator/xap/trunk/unittests/testsrc/XapConfig-Min.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/unittests/testsrc/XapConfig-Min.js?view=diff&rev=536367&r1=536366&r2=536367
==============================================================================
--- incubator/xap/trunk/unittests/testsrc/XapConfig-Min.js (original)
+++ incubator/xap/trunk/unittests/testsrc/XapConfig-Min.js Tue May 8 15:54:00 2007
@@ -62,7 +62,6 @@
//"xap.mco.McoNamespaceHandler",
"xap.xml.xmodify.XmodifyNamespaceHandler",
//"xap.macro.MacroNamespaceHandler",
- "xap.xml.XalNamespaceHandler"
//"xap.data.DataNamespaceHandler",
//"xap.datarequest.DataRequestPlugin",
//"xap.protocol.CspPlugin"