incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtu...@apache.org
Subject svn commit: r483283 - in /incubator/xap/trunk/src/xap: bridges/ext/EffectsBridge.js bridges/ext/EffectsPane.js bridges/ext/HelloWorldBridge.js bridges/ext/HtmlPaneBridge.js taghandling/plugin.xml
Date Wed, 06 Dec 2006 23:06:57 GMT
Author: mturyn
Date: Wed Dec  6 15:06:56 2006
New Revision: 483283

URL: http://svn.apache.org/viewvc?view=rev&rev=483283
Log:
For Rob Gagne

Changed the file and class names to have proper case

Added:
    incubator/xap/trunk/src/xap/bridges/ext/EffectsBridge.js
    incubator/xap/trunk/src/xap/bridges/ext/EffectsPane.js
    incubator/xap/trunk/src/xap/bridges/ext/HelloWorldBridge.js
    incubator/xap/trunk/src/xap/bridges/ext/HtmlPaneBridge.js
Modified:
    incubator/xap/trunk/src/xap/taghandling/plugin.xml

Added: incubator/xap/trunk/src/xap/bridges/ext/EffectsBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/ext/EffectsBridge.js?view=auto&rev=483283
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/ext/EffectsBridge.js (added)
+++ incubator/xap/trunk/src/xap/bridges/ext/EffectsBridge.js Wed Dec  6 15:06:56 2006
@@ -0,0 +1,117 @@
+/*
+ * 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
+ *
+ * A bridge class that provides animations effects
+ */
+
+/*
+ * this library requires Scriptaculous to be loaded
+ *
+ */
+
+Xap.provide("xap.bridges.ext.EffectsBridge"); 
+
+Xap.require("xap.bridges.dojo.DojoWidgetBridge");
+Xap.require("xap.bridges.ext.EffectsPane"); 
+Xap.require("dojo.style"); 
+
+xap.bridges.ext.EffectsBridge.loaded = false;
+
+xap.bridges.ext.EffectsBridge= function() { 
+	this._duration = 1;	
+	xap.bridges.dojo.DojoWidgetBridge.call(this);
+}
+
+Xap.setupClassAsSubclassOf(
+	"xap.bridges.ext.EffectsBridge",
+	"xap.bridges.dojo.DojoWidgetBridge"						
+);
+
+xap.bridges.ext.EffectsBridge.prototype.getPeerString = function(){
+	/*
+	require does not work since the objects are not in a class; this also does not work
+	if ( !xap.bridges.ext.EffectsBridge.loaded ){
+		libPath = this.getSession().getApplication().getConfiguration().srcPath + "src/xap/bridges/ext/lib/";
+		document.write('<script type="text/javascript" src="'+libPath+'prototype.js"></script>');
+		document.write('<script type="text/javascript" src="'+libPath+'scriptaculous.js?load=effects"></script>');
+		xap.bridges.ext.EffectsBridge.loaded = true;
+	}
+	*/
+	return "EffectsPane" ;
+}
+ 
+/**
+ * Attribute definitions
+ */ 
+ 
+xap.bridges.ext.EffectsBridge.prototype.getNewAllowedAttributes = function(){
+	return ["toggle", "effect",  "duration", "visible"];
+}	
+
+/** XML attribute set method for "toggle" */
+xap.bridges.ext.EffectsBridge.prototype.setToggleAttribute = function(value){
+	var node = this.getPeer().domNode;
+	if ( !node ) return;
+	node.style.visibility = 'visible';
+	new Effect.toggle (node, value, {duration: this._duration});
+}
+
+xap.bridges.ext.EffectsBridge.prototype.setEffectAttribute = function(value){
+	var node = this.getPeer().domNode;
+	var dur = this._duration;
+	if ( !node ) return;
+	node.style.visibility = 'visible';
+	
+	if ( value == 'blinddown' ) new Effect.BlindDown (node, {duration: dur});
+	if ( value == 'appear' ) new Effect.Appear (node, {duration: dur});
+	if ( value == 'blindup' ) new Effect.BlindUp (node, {duration: dur});
+	if ( value == 'fade' ) new Effect.Fade (node, {duration: dur});
+	if ( value == 'highlight' ) new Effect.Highlight (node, {duration: dur} );
+	
+}
+
+/** XML attribute set method for "visible" */
+xap.bridges.ext.EffectsBridge.prototype.setVisibleAttribute = function(value){
+	var node = this.getPeer().domNode;
+	var duration = this._duration;
+	if ( !node ) return;
+	if ( value == 'true' ) {
+		node.style.display = 'block';
+		node.style.visibility = 'visible';
+	}
+	else if ( value == 'false' ) {
+		node.style.display = 'none';
+		new Effect.BlindUp (node, {duration: '0', fps: '0'});
+	}
+}
+
+/** XML attribute set method for "duration" */
+xap.bridges.ext.EffectsBridge.prototype.setDurationAttribute = function(value){
+	this._duration = value;
+} 
+
+xap.bridges.ext.EffectsBridge.prototype.addChild = function(childHandler, index) {
+	var childPeer = this.getDojoWidgetPeer(childHandler);
+	if (childPeer) {
+		this.getPeer().addChild(childPeer, null, 'insertAtIndex', null, index);
+	}
+}
+ 
\ No newline at end of file

Added: incubator/xap/trunk/src/xap/bridges/ext/EffectsPane.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/ext/EffectsPane.js?view=auto&rev=483283
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/ext/EffectsPane.js (added)
+++ incubator/xap/trunk/src/xap/bridges/ext/EffectsPane.js Wed Dec  6 15:06:56 2006
@@ -0,0 +1,55 @@
+/*
+ * 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
+ *
+ * A pane class that provides animations effects
+ */
+
+Xap.provide("xap.bridges.ext.EffectsPane");
+
+dojo.require("dojo.widget.*");
+dojo.require("dojo.widget.HtmlWidget");
+dojo.require("dojo.dom");
+dojo.require("dojo.html");
+dojo.require("dojo.style");
+dojo.require("dojo.event");
+
+dojo.widget.manager.registerWidgetPackage("xap.bridges.ext");
+dojo.widget.tags.addParseTreeHandler("dojo:EffectsPane");
+
+xap.bridges.ext.EffectsPane = function(){
+	dojo.widget.HtmlWidget.call(this);
+}
+dojo.inherits(xap.bridges.ext.EffectsPane, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(xap.bridges.ext.EffectsPane, {	
+	templateString: '<div style="overflow:hidden; visibility: hidden;">' 
+		+ '<div dojoAttachPoint="containerNode" style="width: 100%; height: 100%; position:relative;
overflow:hidden"/></div>',
+	templateCssPath: null ,
+	widgetType: "EffectsPane",
+	isContainer: true,
+	
+	addChild: function(child, overrideContainerNode, pos, ref, insertIndex){
+		xap.bridges.ext.EffectsPane.superclass.addChild.call(this,child, overrideContainerNode,
pos, ref, insertIndex);
+	}
+}
+);
+
+

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=483283
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/ext/HelloWorldBridge.js (added)
+++ incubator/xap/trunk/src/xap/bridges/ext/HelloWorldBridge.js Wed Dec  6 15:06:56 2006
@@ -0,0 +1,79 @@
+/*
+ * 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() {
+	/* format is: return ["an_attribute", "another_one"] */
+	return ["sample"];
+}
+
+/*
+ * Respond to attributes; the name should be set(AttributeName)
+ */
+xap.bridges.ext.HelloWorldBridge.prototype.setSampleAttribute = function(value) {
+	this.contentDiv.innerHTML = value;
+}
+
+/*
+ * Handle events: as defined in the connect call
+ */
+ 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=483283
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/ext/HtmlPaneBridge.js (added)
+++ incubator/xap/trunk/src/xap/bridges/ext/HtmlPaneBridge.js Wed Dec  6 15:06:56 2006
@@ -0,0 +1,79 @@
+/*
+ * 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");
+}
\ No newline at end of file

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=483283&r1=483282&r2=483283
==============================================================================
--- incubator/xap/trunk/src/xap/taghandling/plugin.xml (original)
+++ incubator/xap/trunk/src/xap/taghandling/plugin.xml Wed Dec  6 15:06:56 2006
@@ -214,8 +214,8 @@
 	</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"/>
-		<mapping class="xap.bridges.ext.effectsBridge" name="effectsPane"/>
+		<mapping class="xap.bridges.ext.HelloWorldBridge" name="helloWorld"/>
+		<mapping class="xap.bridges.ext.HtmlPaneBridge" name="htmlPane"/>
+		<mapping class="xap.bridges.ext.EffectsBridge" name="effectsPane"/>
 	</tag-mappings>	
 </plugin>



Mime
View raw message