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 mt...@apache.org on 2006/09/22 03:02:56 UTC

svn commit: r448782 - in /incubator/xap/trunk/src/xap: data/bridge/BindingBridge.js data/controller/Binding.js data/controller/BindingType.js taghandling/plugin.xml

Author: mturyn
Date: Thu Sep 21 20:02:56 2006
New Revision: 448782

URL: http://svn.apache.org/viewvc?view=rev&rev=448782
Log:
Binding class and bridge, with mapping added to plugin.xml.

Binding not fully functional yet, but getting there....

Added:
    incubator/xap/trunk/src/xap/data/bridge/BindingBridge.js
    incubator/xap/trunk/src/xap/data/controller/Binding.js
    incubator/xap/trunk/src/xap/data/controller/BindingType.js
Modified:
    incubator/xap/trunk/src/xap/taghandling/plugin.xml

Added: incubator/xap/trunk/src/xap/data/bridge/BindingBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/data/bridge/BindingBridge.js?view=auto&rev=448782
==============================================================================
--- incubator/xap/trunk/src/xap/data/bridge/BindingBridge.js (added)
+++ incubator/xap/trunk/src/xap/data/bridge/BindingBridge.js Thu Sep 21 20:02:56 2006
@@ -0,0 +1,123 @@
+/*
+ * Copyright  2006 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *	  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+//Xap.require("xap.tags.AttributeConversionException");
+Xap.require("xap.data.DataFramework");
+Xap.require("xap.data.controller.Binding");
+Xap.require("xap.data.controller.BindingType");
+Xap.require("xap.data.datasource.DataSourceImpl");
+//Xap.require("xap.data.formatter.Formatter");
+Xap.require("xap.xml.dom.XapElement");
+Xap.provide("xap.data.bridge.BindingBridge");
+
+/**
+ * @class The handler for a binding to a data-source:
+**/ 
+xap.data.bridge.BindingBridge = function () {
+	xap.data.DataFrameworkBridge.call(this);
+};
+Xap.setupClassAsSubclassOf("xap.data.bridge.BindingBridge", "xap.data.bridge.DataFrameworkBridge");
+/**
+ * @public
+ * @return {void}
+ **/
+xap.data.bridge.BindingBridge.prototype.init = function () {
+	this.superclass.init(this);
+	/*XapElement*/
+	var me = this.getElement();
+
+	//get all the relevant strings
+	/*String*/
+	var select = me.getAttribute(XmlDataTokens.SELECT);
+	/*String*/
+	var id = me.getAttribute(XmlDataTokens.ID);
+	/*String*/
+	var dataSourceId = me.getAttribute(XmlDataTokens.DATA_SOURCE);
+	/*String*/
+	var formatter = me.getAttribute(XmlDataTokens.FORMATTER);
+	/*String*/
+	var bindingTypeString = me.getAttribute(XmlDataTokens.BINDING_TYPE);
+	/*String*/
+	var defaultValue = me.getAttribute(XmlDataTokens.DEFAULT_VALUE);
+	if (defaultValue == null) {
+		defaultValue = "";
+	}
+
+	//try to convert the "type" attribute to a binding type
+	//no binding is ok
+	/*BindingType*/
+	var bindingType = BindingType.ONE_TIME;
+	if (bindingTypeString != null) {
+		try {
+			bindingType = DataAttributeConverter.toBindingType(bindingTypeString);
+		}
+		catch (e) {//AttributeConversionException //XmlDataTokens.BINDING_TYPE
+			reportInvalidXmlException("BINDING_TYPE:", bindingTypeString, me, e);
+//			throw new xap.util.Exception("Problem:: binding type string: "
+//											+ bindingTypeString
+//											+ "ndocument element: "
+//											+ me
+//											+ "nexception: "
+//											+ e
+//										);
+		}
+	}
+	/*Binding*/
+	var binding = null;
+
+	//try to convert the "dataSource" to a data source, can't be null
+	//if we fail don't bother to create the binding itself
+	try {
+		/*DataSource*/
+		var ds = DataAttributeConverter.toDataSource(dataSourceId, getDataService());
+		var sess = this.getSession();
+		binding = new xap.data.controller.Binding(ds, select, sess, bindingType, defaultValue);
+		(this.getDataService()).getBindingContainer().addBinding(id, binding);
+	}
+	catch (e) { //AttributeConversionException 
+		this.reportInvalidXmlException(XmlDataTokens.DATA_SOURCE, dataSourceId, me, e);
+	}
+
+	//if we got to this point OK, add the formatter
+//TODO  IMPORTANT  turn formatter on when we have one.
+//	if (binding!=null){
+//		this.addFormatters(formatter,binding);
+//	}
+};
+/**
+ * @private
+ * @return {void}
+ *
+ * @param formatter{String}
+  *@param binding{Binding}
+ **/
+xap.data.bridge.BindingBridge.prototype.addFormatters = function (formatter, binding) {
+	if (formatter == null) {
+		return;
+	}
+
+	//try to convert "formatter" to a formatter
+	//and add it to the binding
+	try {
+		/*Formatter*/
+		var f = DataAttributeConverter.toFormatter(formatter, getDataService());
+		binding.setFormatter(f);
+	}
+	catch (e) { //AttributeConversionException
+		reportInvalidXmlException(XmlDataTokens.FORMATTER, formatter, getElement(), e);
+	}
+};
+

Added: incubator/xap/trunk/src/xap/data/controller/Binding.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/data/controller/Binding.js?view=auto&rev=448782
==============================================================================
--- incubator/xap/trunk/src/xap/data/controller/Binding.js (added)
+++ incubator/xap/trunk/src/xap/data/controller/Binding.js Thu Sep 21 20:02:56 2006
@@ -0,0 +1,423 @@
+
+/*
+ * Copyright  2006 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *	  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required  by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+Xap.provide("xap.data.controller.Binding");
+Xap.require("xap.util.Vector");
+Xap.require("xap.client.ClientSession");
+Xap.require("xap.UiUpdateQueue");
+Xap.require("xap.data.DataException");
+Xap.require("xap.data.DataService");
+Xap.require("xap.data.DataServiceFactory");
+//Xap.require("xap.data.datasource.DataAccessException") ;
+//Xap.require("xap.data.datasource.DataRetrievalListener") ;
+Xap.require("xap.data.datasource.DataSourceImpl");
+//Xap.require("xap.data.datasource.MalformedQueryException") ;
+//Xap.require("xap.data.datasource.UnsupportedBindingTypeException") ;
+//Xap.require("xap.data.formatter.FormatException") ;
+//Xap.require("xap.data.formatter.Formatter") ;
+//Xap.require("xap.util.TypeConversionException") ;
+Xap.require("xap.xml.dom.XapElement");
+Xap.require("xap.data.controller.BindingType");
+/**
+ * It's a binding. It must be based on EITHER a DataSource or an iterator.
+ * 
+ * Maybe two separate subclasses should handle those cases? Depending on how
+ * complicated it is I guess.
+ * 
+ * @author JMargaris
+ *
+ */
+ 
+ /**
+ * Construct a binding to the given data source with the
+ * given select string.
+ * <br/>
+ * OR
+ * <br/>
+ * Construct a binding relative to a parent iterator.
+ * When we resolve we query the iterator to get the 
+ * proper parameters.
+ * 
+ * @param contextStack{ContextStack}
+ * @param select{String}
+ * @param name{String}
+ * @param session{ClientSession}
+ * @param bindingType{BindingType}
+ * @param defaultValue{String}
+ *
+ * @param source{DataSource}
+ * @param select{String}
+ * @param session{ClientSession}
+ * @param bindingType{BindingType}
+ * @param defaultValue{String}
+ * 
+ * @throws DataControllerException
+ */
+xap.data.controller.Binding = function () {
+	// Crude way to fold in two Java constructors into one JS...
+	if (arguments.length == 5) {
+		var source = arguments[0];
+		var select = arguments[1];
+		var session = arguments[2];
+		var bindingType = arguments[3];
+		var defaultValue = arguments[4];
+		this._source = source;
+		this._select = select;
+		this._session = session;
+		this._bindingType = bindingType;
+		if (defaultValue != null) {
+			this._defaultValue = defaultValue;
+		}
+		this._currentValue = this._defaultValue;
+	} else if (arguments.length == 6) {
+		var contextStack = arguments[0];
+		var select = arguments[1];
+		var name = arguments[2];
+		var session = arguments[3];
+		var bindingType = arguments[4];
+		var defaultValue = arguments[5];
+		this._select = select;
+		this._session = session;
+		this._bindingType = bindingType;
+		if (name != null && name.length() > 0) {
+			this._source = DataServiceFactory.getDataService(session).getDataSourceContainer().getDataSource(name);
+			if (this._source == null) {
+				// Find the ancestor iterator context with the
+				// specified name, since there was not data source with
+				// that name
+				this._context = contextStack.getContext(name);
+				if (this._context == null) {
+					//					throw new DataControllerException(DataControllerException.QUICK_BINDING_NAMED_CONTEXT_NOT_FOUND,
+					//							name);
+					throw new xap.util.Exception("Named context for quick binding not found for '" + name + "'.");
+				}
+				this._source = this._context.getDataSource();
+			}
+		} else {
+			// No name specified, use the current context, this is relative to parent
+			this._context = contextStack.getCurrentContext();
+			if (this._context == null) {
+				//			throw new DataControllerException(DataControllerException.RELATIVE_BINDING_WITHOUT_PARENT, select);
+				throw new xap.util.Exception("Attempted a relative binding without a parent: '" + select + "'.");
+			}
+			this._source = this._context.getDataSource();
+		}
+			
+		if (defaultValue != null) {
+			this._defaultValue = defaultValue;
+		}
+			
+		this._currentValue = this._defaultValue;
+	} //6-argument (contextStack) version
+	else {
+		throw new xap.util.Exception(
+						 "Binding must be created using either"
+						 + "five or six parameters; "
+						 + arguments.length
+						 + " were supplied: ["
+						 + arguments.join(",") 
+						 + "] ."
+						 ) ;
+	}
+};
+ 
+ 
+
+
+Xap.setupClassAsSubclassOf("xap.data.controller.Binding", "Object");
+/*private*/
+xap.data.controller.Binding.prototype._select = null;
+/*private*/
+xap.data.controller.Binding.prototype._source = null;
+/*private*/
+xap.data.controller.Binding.prototype._context = null;
+/*private*/
+xap.data.controller.Binding.prototype._targets = new xap.util.Vector();
+/*private*/
+xap.data.controller.Binding.prototype._formatter = null;
+/*private*/
+xap.data.controller.Binding.prototype._session;
+/*private*/
+xap.data.controller.Binding.prototype._bindingType = BindingType.ONE_TIME;
+/*private*/
+xap.data.controller.Binding.prototype._defaultValue = "";
+/*private*/
+xap.data.controller.Binding.prototype._currentValue = null;
+/**
+	 * Get the client session for this binding.
+	 * @public
+	 * @return {ClientSession} The session.
+	 */
+xap.data.controller.Binding.prototype.getSession = function () {
+	return this._session;
+};
+/**
+	 * Set the binding type for this binding.
+	 * 
+	 * @param type{xap.data.controller.BindingType} The binding type.
+	 */
+/*public*/
+xap.data.controller.Binding.prototype.setBindingType = function (type) {
+	this._bindingType = type;
+};
+/**
+	 * Resolve the specified attribute.  This will return the current value associated
+	 * with this binding and potentially update the value when it becomes available or is
+	 * modified in the configured data source.
+	 * 
+	 * @param e{XapElement} the element being parsed
+	 * 
+	 * @param attributeName{String} the name of the attribute which needs resolution
+	 * 
+	 * @return the resolved attribute value.
+	 * 
+	 * @throws DataAccessException
+	 * @throws MalformedQueryException
+	 * @throws UnsupportedBindingTypeException
+	 */
+/*public*/
+xap.data.controller.Binding.prototype.resolve = function (e, attributeName) {
+		//if we are based on a data source, just get the data off that source
+		
+		//if we are based on an iterator, this resolve must be in the context
+		//of a current iteration. So rather than saving it we just look it up
+		//each time. The timing here is important: this must be called
+		//DURING iteration
+	if (this._bindingType == xap.data.controller.BindingType.ONE_TIME) {
+			// Reset the current data value to the default value.
+			// Since we are a one time binding, we want the current
+			// data value from the datasource to be retrieved once,
+			// and only the default value should be able to show up
+			// prior to that retrieval.
+		this._currentValue = this._defaultValue;
+	}
+	this.requestData();
+		
+		// If the binding type is not ONE_TIME or
+		// the binding type -is- ONE_TIME and the data was not
+		// returned by the request for data immediately
+		// (indicated by the current value being the default value,
+		// we need to add a bind target so that the data can be set
+		// at a later time 
+	if ((_bindingType != BindingType.ONE_TIME) || ((_bindingType == BindingType.ONE_TIME) && (_currentValue == this._defaultValue))) {
+		this.addBindTarget(new AttributeValueLocation(e, attributeName));
+	}
+	return this._currentValue;
+};
+/**
+	 * Resolve the specified text node.  This will return the current value associated
+	 * with this binding and potentially update the value when it becomes available or is
+	 * modified in the configured data source.
+	 * 
+	 * @param e{XapElement} the element being parsed
+	 * 
+	 * @param value{String} the current value of the text node
+	 * 
+	 * @param index{integer} the text node's index
+	 * 
+	 * @return the resolved attribute value.
+	 * 
+	 * @throws DataAccessException
+	 * @throws MalformedQueryException
+	 * @throws UnsupportedBindingTypeException
+	 */
+/*public*/
+xap.data.controller.Binding.prototype.resolve = function (e, value, index) {
+	/*boolean*/
+	var calledInParseInitialChildren = false;
+	if (index == -1) {
+		index = e.indexOfChild(value);
+		calledInParseInitialChildren = true;
+	}
+	if (this._bindingType == xap.data.controller.Binding.BindingType.ONE_TIME) {
+			// Reset the current data value to the default value.
+			// Since we are a one time binding, we want the current
+			// data value from the datasource to be retrieved once,
+			// and only the default value should be able to show up
+			// prior to that retrieval.
+		this._currentValue = this._defaultValue;
+	}
+	this.requestData();
+
+		// If the binding type is not ONE_TIME or
+		// the binding type -is- ONE_TIME and the data was not
+		// returned by the request for data immediately
+		// (indicated by the current value being the default value,
+		// we need to add a bind target so that the data can be set
+		// at a later time 
+	if ((_bindingType != BindingType.ONE_TIME) || ((_bindingType == BindingType.ONE_TIME) && (_currentValue == this._defaultValue))) {
+		this.addBindTarget(new TextNodeLocation(e, index, calledInParseInitialChildren));
+	}
+	return this._currentValue;
+};
+/**
+ * Generic resolve.  This will return the current value from the data source if it
+ * is available, otherwise it will return the default value.
+ * 
+ * @return the value
+ * 
+ * @throws DataAccessException
+ * @throws MalformedQueryException
+ * @throws UnsupportedBindingTypeException
+ * @throws DataAccessException, MalformedQueryException, UnsupportedBindingTypeException 
+ */
+xap.data.controller.Binding.prototype.resolve = function () {
+		// This non-location based resolution can only do its best to do an immediate
+		// query for the data to get the most current value and return it.
+	this.requestData();
+	return this._currentValue;
+};
+/**
+ * Call this method to cause the current value from the data source (or default value) to be
+ * set on all registered targets.  This method is public due to the fact that it may need to
+ * be called back in the UI event thread.
+ */
+/*public*/
+xap.data.controller.Binding.prototype.setData = function () {
+//		synchronized (
+//		this._session.getDocumentRegistry().getUiDocument().getDomSynchronizationObject()) {
+	for (var i = 0; i < this._targets.size(); i++) {
+		/* TargetLocation */
+		var target = this._targets.elementAt(i);
+		target.setData(_currentValue, this._session);
+		if (this._bindingType == xap.data.controller.BindingType.ONE_TIME) {
+				// Dangerous...will we have to recast?---add method
+				// to whatever it actually is, as opposed to
+				// what (in Java) it was to be recast-to?
+				//	((XmlLocation)target).invalidate();
+			target.invalidate();
+		}
+	}
+//		} // end synchronization block
+};
+/**
+	 * Adds a formatter to the end of the formatter chain.
+	 * 
+	 * @param f{Formatter} The formatter.
+	 */
+/*public*/
+xap.data.controller.Binding.prototype.setFormatter = function (f) {
+	this._formatter = f;
+};
+/*
+ * Runs an object through the configured formatter.
+ * @param data{Object}
+ * @throws FormatException
+ */
+/*private*/
+xap.data.controller.Binding.prototype.formatObject = function (data) {
+	if (this._formatter != null) {
+		data = this._formatter.format(data);
+	}
+	return data;
+};
+/**
+ * @param target{Location}
+**/
+xap.data.controller.Binding.prototype.addBindTarget = function (target) {
+	this._targets.addElement(target);
+	target.setLocationListener(this);
+};
+/**
+ * @param target{Location}
+**/
+xap.data.controller.Binding.prototype.removeBindTarget = function (target) {
+	this._targets.removeElement(target);
+		// if there are no targets left deregister from the data source associated
+		// with this binding.
+		// The data source is responsible for cleaning up one time bindings when
+		// the asynchronous call terminates, so never do that here.
+	if (this._bindingType != xap.data.controller.BindingType.ONE_TIME && this._targets.size() == 0) {
+			// IMPORTANT REVISIT revisit this.the source should probably handle listeners removing themselves while
+			// it is looping through !!!
+		this._source.removeListener(this);
+	}
+};
+/**
+ * @public
+ * @param location{Location} Binding target's location.<b>
+**/
+xap.data.controller.Binding.prototype.locationInvalidated = function (location) {
+	this.removeBindTarget(location);
+};
+/*
+ * @public
+ * @param query{String}
+ * @param data{Object}
+ * @param context{Context}
+ * QueryCompletionListener INTERFACE METHODS 
+ */
+xap.data.controller.Binding.prototype.dataRetrieved = function (query, data, context) {
+	this._currentValue = this._defaultValue;
+	if (data != null) {
+		try {
+			this._currentValue = this.getSession().getTypeConversionService().convertToString(formatObject(data));
+		}
+		catch (dataException) { //DataException
+			this._session.handleException(DataService.DATA_FRAMEWORK_EXCEPTION_TYPE, dataException);
+//			}catch ( conversionException ) { //TypeConversionException
+//				this._session.handleException(DataService.DATA_FRAMEWORK_EXCEPTION_TYPE, conversionException);
+		}
+	}
+	this.setDataOnUiUpdateThread();
+};
+/*public*/
+xap.data.controller.Binding.prototype.getBindingType = function () {
+	return this._bindingType;
+};
+/*
+	 * END - QueryCompletionListener INTERFACE METHODS 
+	 */
+/**
+ * @private
+ * @throws UnsupportedBindingTypeException,MalformedQueryException, DataAccessException 
+**/
+xap.data.controller.Binding.prototype.requestData = function () {
+
+		// Make a request to the data source if necessary
+		// If we are in ONE_TIME mode, always call to make sure the
+		// latest data is reflected in this object
+		// otherwise, check to see if there are no targets set, which
+		// indicates we have not yet initiated ourselves as a ONE_WAY
+		// listener with the data source
+	if (this._targets.size() == 0 || this._bindingType == xap.data.controller.BindingType.ONE_TIME) {
+			// If there are already targets, then we're already waiting on some
+			// data, if we are in one-time mode, we should use this opportunity to
+			// make sure the latest data is the current data.
+		this._source.getData(this._select, this, this._context);
+	}
+};
+/*private*/
+xap.data.controller.Binding.prototype.setDataOnUiUpdateThread = function () {
+	try {
+		/*UiUpdateQueue*/
+		var updateQueue = this.getSession().getUiUpdateQueue();
+		if (this.updateQueue.isUiUpdateThread()) {
+			this.setData();
+		} else {
+			this.updateQueue.invokeLater(this.setData, null), null);
+		}
+	}
+	catch (e) { //Exception
+		this._session.handleException(xap.data.DataServiceImpl.DATA_FRAMEWORK_EXCEPTION_TYPE, new xap.util.Exception(e));
+// TODO:  better exception
+//					new DataControllerException(
+//						DataControllerException.BINDING_SET_SCHEDULE_EXCEPTION,
+//							e));
+	}
+};
+

Added: incubator/xap/trunk/src/xap/data/controller/BindingType.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/data/controller/BindingType.js?view=auto&rev=448782
==============================================================================
--- incubator/xap/trunk/src/xap/data/controller/BindingType.js (added)
+++ incubator/xap/trunk/src/xap/data/controller/BindingType.js Thu Sep 21 20:02:56 2006
@@ -0,0 +1,120 @@
+/*
+ * Copyright  2006 The Apache Software Foundation.
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *	  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required  by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+/**
+ * Represents the different types of bindings for data.
+ *
+ * @author jconstantine, mturyn
+ */
+/**
+ * @private
+ * @return {BindingType}
+ *
+ * @param typeName{String}
+ * @param typeId{String}
+**/
+xap.data.controller.BindingType = function (typeName, typeId) {
+	this._typeName = typeName;
+	this._typeId = typeId;
+};
+
+//-----------------------------------------------------------------------
+// Constants.
+//-----------------------------------------------------------------------
+/**
+ * Defines one time binding.  The data will be resolved once and all 
+ * binding information will be discarded.
+ */
+/*public static final BindingType*/
+xap.data.controller.BindingType.ONE_TIME 
+	= new xap.data.controller.BindingType("One Time", "ONE_TIME");
+/**
+	 * Defines one way binding.  The data will be resolved any time the
+	 * source data changes.
+	 */
+/*public static final BindingType*/
+xap.data.controller.BindingType.ONE_WAY 
+	= new xap.data.controller.BindingType("One Way", "ONE_WAY");
+
+//-----------------------------------------------------------------------
+// Instance Variables.
+//-----------------------------------------------------------------------
+/**
+ * @private String
+**/
+xap.data.controller.BindingType.prototype._typeName = null;
+	
+// the type identifier used in attributes and parameters
+/**
+ * @private String
+**/
+xap.data.controller.BindingType.prototype._typeId = null; 
+	
+//-----------------------------------------------------------------------
+// Constructors.
+//-----------------------------------------------------------------------
+
+
+//-----------------------------------------------------------------------
+// Public Methods.
+//-----------------------------------------------------------------------
+
+/**
+ * Returns a human readable representation of the binding type.
+ * 
+ * @return {String} A String indicating the binding type.
+ * @public
+**/
+xap.data.controller.BindingType.prototype.getTypeName = function () {
+	return this._typeName;
+};
+
+/**
+ * Returns the type identifier, the string representation used in control 
+ * declarations and definitions to indicate the binding type to use.
+ * 
+ * @return A String indicating the type identifier.
+ * @public
+ * @return {String}
+**/
+xap.data.controller.BindingType.prototype.getTypeId = function () {
+	return this._typeId;
+};
+
+
+/**
+ * Get the binding type for the associated type identifier string, 
+ * for instance, ONE_WAY.
+ * 
+ * @param type{String} The type identifier.
+ * @return {BindingType} The type.
+ * 
+ * @public
+ *
+**/
+xap.data.controller.BindingType.getBindingType = function (type) {
+// As this is a method on the class, "this"
+// should scope these well:
+	if (this.ONE_WAY._typeId == type) {
+		return this.ONE_WAY;
+	}
+	if (this.ONE_TIME._typeId == type) {
+		return this.ONE_TIME;
+	}
+	return null;
+};
+

Modified: incubator/xap/trunk/src/xap/taghandling/plugin.xml
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/taghandling/plugin.xml?view=diff&rev=448782&r1=448781&r2=448782
==============================================================================
--- incubator/xap/trunk/src/xap/taghandling/plugin.xml (original)
+++ incubator/xap/trunk/src/xap/taghandling/plugin.xml Thu Sep 21 20:02:56 2006
@@ -5,11 +5,17 @@
 	</tag-mappings>
 	
 	
-	<!-- Data-binding mappings: -->
+	<!-- Data-source mappings: -->
 	<tag-mappings namespace="http://www.openxal.org/data" document="dataSources">
 		<mapping class="xap.data.bridge.ObjectDataSourceBridge" name="objectDataSource"/>	
 		<mapping class="xap.data.bridge.JavascriptDataSourceBridge" name="javascriptDataSource"/>	
 	</tag-mappings>		
+	
+	<!-- binding -->
+	<tag-mappings namespace="http://nexaweb.com/data" document="bindings">
+		<mapping class="xap.data.bridge.BindingBridge"
+			name="binding"/>
+	</tag-mappings>	
 	
 
 	<!-- default mappings -->