incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtu...@apache.org
Subject svn commit: r482493 - in /incubator/xap/trunk/src/xap: bridges/ext/ bridges/ext/helloWorldBridge.js bridges/ext/htmlPaneBridge.js bridges/xap/LinkBridge.js taghandling/plugin.xml widgets/Link.js xml/dom/XapElement.js
Date Tue, 05 Dec 2006 05:19:36 GMT
Author: mturyn
Date: Mon Dec  4 21:19:33 2006
New Revision: 482493

URL: http://svn.apache.org/viewvc?view=rev&rev=482493
Log:
>From Rob Gagne

Submitted patches

Added:
    incubator/xap/trunk/src/xap/bridges/ext/
    incubator/xap/trunk/src/xap/bridges/ext/helloWorldBridge.js
    incubator/xap/trunk/src/xap/bridges/ext/htmlPaneBridge.js
    incubator/xap/trunk/src/xap/bridges/xap/LinkBridge.js
    incubator/xap/trunk/src/xap/widgets/Link.js
Modified:
    incubator/xap/trunk/src/xap/taghandling/plugin.xml
    incubator/xap/trunk/src/xap/xml/dom/XapElement.js

Added: incubator/xap/trunk/src/xap/bridges/ext/helloWorldBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/ext/helloWorldBridge.js?view=auto&rev=482493
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/ext/helloWorldBridge.js (added)
+++ incubator/xap/trunk/src/xap/bridges/ext/helloWorldBridge.js Mon Dec  4 21:19:33 2006
@@ -0,0 +1,78 @@
+/*
+ * 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.
+ *
+ */
+
+/**
+ * @fileoverview
+ * @author Rob Gagne
+ * @version 0.1 
+ *  A class intended to demonstrate basic widget support
+**/
+
+Xap.provide("xap.bridges.ext.helloWorldBridge");
+Xap.require("xap.bridges.basic.AbstractWidgetBridge");
+
+xap.bridges.ext.helloWorldBridge = function() {
+	xap.bridges.basic.AbstractWidgetBridge.call(this);
+}
+
+Xap.setupClassAsSubclassOf("xap.bridges.ext.helloWorldBridge", "xap.bridges.basic.AbstractWidgetBridge");
+
+/*
+ * Set up the widget object
+ */
+xap.bridges.ext.helloWorldBridge.prototype.obtainPeer = function() {
+
+	/* construct the widget */
+	contentDiv = document.createElement("div");
+	this._rootDomNode  = contentDiv;
+	contentDiv.style.overflow = "hidden";
+	this.contentDiv = contentDiv;
+	this.contentDiv.innerHTML = 'Hello, World';
+	this.setPeer (this);
+	
+	/* hook up any events we're interested in */
+	dojo.event.connect(this.getRootDomNode(), "onclick", this, "onclick");	
+}
+
+/*
+ * Provide the DOM root of this widget
+ */
+xap.bridges.ext.helloWorldBridge.prototype.getRootDomNode = function() {
+	return this.getPeer()._rootDomNode;
+}
+
+/*
+ * Identify the supported attributes
+ */
+xap.bridges.ext.helloWorldBridge.prototype.getNewAllowedAttributes = function() {
+	return ["sample"];
+}
+
+/*
+ * Respond to attributes
+ */
+xap.bridges.ext.helloWorldBridge.prototype.setSampleAttribute = function(value) {
+	this.contentDiv.innerHTML = value;
+}
+
+/*
+ * Handle events
+ */
+ xap.bridges.ext.helloWorldBridge.prototype.onclick = function() {
+	alert ("event");
+}
+

Added: incubator/xap/trunk/src/xap/bridges/ext/htmlPaneBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/ext/htmlPaneBridge.js?view=auto&rev=482493
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/ext/htmlPaneBridge.js (added)
+++ incubator/xap/trunk/src/xap/bridges/ext/htmlPaneBridge.js Mon Dec  4 21:19:33 2006
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ *
+ */
+
+/**
+ * @fileoverview
+ * @author Rob Gagne
+ * @version 0.1 
+ *  A class intended to demonstrate basic widget support
+**/
+
+Xap.provide("xap.bridges.ext.htmlPaneBridge");
+Xap.require("xap.bridges.basic.AbstractWidgetBridge");
+
+xap.bridges.ext.htmlPaneBridge = function() {
+	xap.bridges.basic.AbstractWidgetBridge.call(this);
+}
+
+Xap.setupClassAsSubclassOf("xap.bridges.ext.htmlPaneBridge", "xap.bridges.basic.AbstractWidgetBridge");
+
+/*
+ * Set up the widget object
+ */
+xap.bridges.ext.htmlPaneBridge.prototype.obtainPeer = function() {
+
+	/* construct the widget */
+	contentDiv = document.createElement("div");
+	this._rootDomNode  = contentDiv;
+	contentDiv.style.overflow = "hidden";
+	this.contentDiv = contentDiv;
+	this.setPeer (this);
+}
+
+/*
+ * Provide the DOM root of this widget
+ */
+xap.bridges.ext.htmlPaneBridge.prototype.getRootDomNode = function() {
+	return this.getPeer()._rootDomNode;
+}
+
+/*
+ * Identify the supported attributes
+ */
+xap.bridges.ext.htmlPaneBridge.prototype.getNewAllowedAttributes = function() {
+	return ["src"];
+}
+
+/*
+ * Respond to attributes
+ */
+xap.bridges.ext.htmlPaneBridge.prototype.setSrcAttribute = function(value) {
+	var requestService = this.getSession().getRequestService();
+	var response = requestService.retrieveAsynchronously(value, this);
+}
+
+/**
+ * Handle the asynchronous request
+ */
+xap.bridges.ext.htmlPaneBridge.prototype.requestCompleted = function(url, response) {
+	var thisElement = this.getElement();
+	this.contentDiv.innerHTML = response.responseText;
+}
+
+xap.bridges.ext.htmlPaneBridge.requestFailed = function(url, response) {
+	alert("htmlPane request for " + url + " failed");
+}
+
+/**
+ * Returns the node that represents this widget at the top level
+ */
+xap.bridges.basic.TextViewBridge.prototype.getRootDomNode =  function(){
+	return this.getPeer();
+}

Added: incubator/xap/trunk/src/xap/bridges/xap/LinkBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/xap/LinkBridge.js?view=auto&rev=482493
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/xap/LinkBridge.js (added)
+++ incubator/xap/trunk/src/xap/bridges/xap/LinkBridge.js Mon Dec  4 21:19:33 2006
@@ -0,0 +1,45 @@
+/*
+ * 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.bridges.xap.LinkBridge");
+Xap.require("xap.bridges.xap.ButtonBridge");
+Xap.require("xap.widgets.Link");
+Xap.require("dojo.event.*");
+
+xap.bridges.xap.LinkBridge = function() {
+	xap.bridges.xap.LabelBridge.call(this);
+}
+
+Xap.setupClassAsSubclassOf("xap.bridges.xap.LinkBridge", "xap.bridges.xap.ButtonBridge");
+
+xap.bridges.xap.LinkBridge.prototype.obtainPeer = function() {
+	this.setPeer(new xap.widgets.Link());
+	this.getPeer().init();
+	dojo.event.connect(this.getRootDomNode(), "onclick", this, "onclick");
+	dojo.event.connectBefore(this.getPeer(), "_onmouseup", this, "onMouseUp");			
+}
+
+xap.bridges.xap.LinkBridge.prototype.onclick = function() {
+	if (this.getPeer().enabled) {
+		this.fireEvent("onCommand");
+	}
+}
+
+
+xap.bridges.xap.LinkBridge.prototype.getNewAllowedAttributes = function() {
+	return ["mouseOverImage", "pressedImage"];
+}

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=482493&r1=482492&r2=482493
==============================================================================
--- incubator/xap/trunk/src/xap/taghandling/plugin.xml (original)
+++ incubator/xap/trunk/src/xap/taghandling/plugin.xml Mon Dec  4 21:19:33 2006
@@ -53,6 +53,7 @@
 		<mapping class="xap.bridges.basic.TextViewBridge" name="textView"/>
 		
 		<mapping class="xap.bridges.xap.LabelBridge" name="label"/>
+		<mapping class="xap.bridges.xap.LinkBridge" name="link"/>		
 		<mapping class="xap.bridges.xap.ButtonBridge" name="button"/>
 		<mapping class="xap.bridges.xap.CheckboxBridge" name="checkBox"/>
 		<mapping class="xap.bridges.xap.RadioButtonBridge" name="radioButton"/>
@@ -116,6 +117,7 @@
 		<mapping class="xap.bridges.basic.TextViewBridge" name="textView"/>
 		
 		<mapping class="xap.bridges.xap.LabelBridge" name="label"/>
+		<mapping class="xap.bridges.xap.LinkBridge" name="link"/>
 		<mapping class="xap.bridges.xap.ButtonBridge" name="button"/>
 		<mapping class="xap.bridges.xap.CheckboxBridge" name="checkBox"/>
 		<mapping class="xap.bridges.xap.RadioButtonBridge" name="radioButton"/>
@@ -209,4 +211,8 @@
 		<mapping class="xap.bridges.microsoft.VEIconBridge" name="icon"/>
 	</tag-mappings>	
 	
+	<tag-mappings namespace="http://openxal.org/ext" document="ui">	
+		<mapping class="xap.bridges.ext.helloWorldBridge" name="helloWorld"/>
+		<mapping class="xap.bridges.ext.htmlPaneBridge" name="htmlPane"/>
+	</tag-mappings>	
 </plugin>

Added: incubator/xap/trunk/src/xap/widgets/Link.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/Link.js?view=auto&rev=482493
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/Link.js (added)
+++ incubator/xap/trunk/src/xap/widgets/Link.js Mon Dec  4 21:19:33 2006
@@ -0,0 +1,39 @@
+/*
+ * 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.widgets.Link");
+Xap.require("xap.widgets.Button");
+Xap.require("dojo.event.*");
+
+xap.widgets.Link = function() {
+	xap.widgets.Label.call(this);
+
+	this.imgOverURL = "";
+	this.imgPressedURL = "";
+
+	this.mouseOver = false;
+	this.mousePressed = false;
+	this.setAlignHorizontal("left");
+	this.setSelectable("true");
+}
+ 
+Xap.setupClassAsSubclassOf("xap.widgets.Link", "xap.widgets.Button");
+
+xap.widgets.Link.prototype.init = function() {
+	dojo.event.connect(this._rootDomNode, "onmousedown", this, "_onmousedown");
+	dojo.event.connect(this._rootDomNode, "onmousedown", this, "_styleMousedown");
+}

Modified: incubator/xap/trunk/src/xap/xml/dom/XapElement.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/xml/dom/XapElement.js?view=diff&rev=482493&r1=482492&r2=482493
==============================================================================
--- incubator/xap/trunk/src/xap/xml/dom/XapElement.js (original)
+++ incubator/xap/trunk/src/xap/xml/dom/XapElement.js Mon Dec  4 21:19:33 2006
@@ -238,18 +238,18 @@
     
 	var event = null;
 	var attributeChangeListenersExist = 
-    	this._doAnyAttributeChangeListenersExist( doc );
-    if ( attributeChangeListenersExist ) {
-	    event = new xap.xml.dom.events.AttributeChangeEvent( this, name, value );
-	    this._fireAttributeChangeEvent( doc, event, xap.xml.dom.XapElement.BEFORE_ATTRIBUTE_SET);
-	    // Listeners have the opportunity to modify the value.
-	    // Make sure we get the latest value out of the event.
-	    value = event.getNewValue();
-	    if ( value == null ) {
-	    	 throw new xap.xml.dom.events.ChangeRejectedException
-                ( xap.xml.dom.events.ChangeRejectedException.CHANGE_ATTRIBUTE_TO_NULL_MSGID,

-                  null, null, event );
-	    }
+	this._doAnyAttributeChangeListenersExist( doc );
+	if ( attributeChangeListenersExist ) {
+		event = new xap.xml.dom.events.AttributeChangeEvent( this, name, value );
+		this._fireAttributeChangeEvent( doc, event, xap.xml.dom.XapElement.BEFORE_ATTRIBUTE_SET);
+		// Listeners have the opportunity to modify the value.
+		// Make sure we get the latest value out of the event.
+		value = event.getNewValue();
+		if ( value == null ) {
+		throw new xap.xml.dom.events.ChangeRejectedException
+			( xap.xml.dom.events.ChangeRejectedException.CHANGE_ATTRIBUTE_TO_NULL_MSGID, 
+			null, null, event );
+		}
     }
     
     if ( attributeChangeListenersExist ) {



Mime
View raw message