incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmarga...@apache.org
Subject svn commit: r439865 - in /incubator/xap/trunk/src/xap/widgets/dojo: ./ BorderPanel.js FreePanel.js HorizontalPanel.js PasswordField.js TextArea.js TextField.js VerticalPanel.js
Date Sun, 03 Sep 2006 22:46:26 GMT
Author: jmargaris
Date: Sun Sep  3 15:46:26 2006
New Revision: 439865

URL: http://svn.apache.org/viewvc?view=rev&rev=439865
Log:
dojo widgets moved from components to widget folder

Added:
    incubator/xap/trunk/src/xap/widgets/dojo/
    incubator/xap/trunk/src/xap/widgets/dojo/BorderPanel.js   (with props)
    incubator/xap/trunk/src/xap/widgets/dojo/FreePanel.js   (with props)
    incubator/xap/trunk/src/xap/widgets/dojo/HorizontalPanel.js   (with props)
    incubator/xap/trunk/src/xap/widgets/dojo/PasswordField.js   (with props)
    incubator/xap/trunk/src/xap/widgets/dojo/TextArea.js   (with props)
    incubator/xap/trunk/src/xap/widgets/dojo/TextField.js   (with props)
    incubator/xap/trunk/src/xap/widgets/dojo/VerticalPanel.js   (with props)

Added: incubator/xap/trunk/src/xap/widgets/dojo/BorderPanel.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/dojo/BorderPanel.js?view=auto&rev=439865
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/dojo/BorderPanel.js (added)
+++ incubator/xap/trunk/src/xap/widgets/dojo/BorderPanel.js Sun Sep  3 15:46:26 2006
@@ -0,0 +1,97 @@
+//IMPORTANT move this to some shared area
+dojo.widget.manager.registerWidgetPackage("xap.widgets.dojo");
+
+Xap.provide("xap.widgets.dojo.VerticalPanel");
+
+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.tags.addParseTreeHandler("dojo:BorderPanel");
+
+xap.widgets.dojo.BorderPanel = function(){
+	dojo.widget.HtmlWidget.call(this);
+}
+
+dojo.inherits(xap.widgets.dojo.BorderPanel,dojo.widget.HtmlWidget);
+
+dojo.lang.extend(xap.widgets.dojo.BorderPanel, {
+	templateString: '<table><tr align="center" valign="center">'+
+	'<td colspan="3" dojoAttachPoint="north" style="height:1px"></td></tr>'
+
+	'<tr align="center" valign="center"">'+
+	'<td dojoAttachPoint="west" style="width:1px"></td><td dojoAttachPoint="center"
style="height:99%;width:99%"></td><td style="width:1px" dojoAttachPoint="east"></td></tr>'
+
+	'<tr align="center" valign="center"><td colspan="3" style="height:1px" dojoAttachPoint="south"></tr></td></table>',
+	
+	templateCssPath: null ,
+	widgetType: "BorderPanel",
+	isContainer: true,
+	
+	addChild: function(child, position){
+		
+		var adjustWidth = false;
+		var adjustHeight = false;
+		if (position=="north"){
+			this.containerNode = this.north;
+			adjustWidth = true;
+		}
+		else if (position=="south"){
+			this.containerNode = this.south;
+			adjustWidth = true;
+		}
+		else if (position=="east"){
+			this.containerNode = this.east;
+			adjustHeight = true;
+		}
+		else if (position=="west"){
+			this.containerNode = this.west;
+			adjustHeight = true;
+		}
+		else{
+			this.containerNode = this.center;
+			adjustWidth = true;
+			adjustHeight = true;
+		}
+		
+		//if we already have child nodes that's bad!
+		if (this.containerNode.childNodes.length!=0){
+			return;
+		}
+		
+		
+		//IMPORTANT should we do this in a setTimeout() after 
+		//we give the table a chance to layout first? probably
+		if (adjustWidth){
+			child.domNode.style.width="100%";
+		}
+		if (adjustHeight){
+			child.domNode.style.height="100%";
+		}
+		xap.widgets.dojo.BorderPanel.superclass.addChild.call(this,child);
+	},
+	
+	removeChild: function(child) {
+	 	var containerNode = child.domNode.parentNode;		 	
+		xap.widgets.dojo.BorderPanel.superclass.removeChild.call(this,child);
+		resetNode(containerNode);
+    },
+    
+    resetNode : function(containerNode){
+    	var nodeStyle = containerNode.style;
+    	if (containerNode==this.north || containerNode==this.south){
+			nodeStyle.width="";
+			nodeStyle.height="1px";
+		}
+		else if (containerNode==this.east || containerNode==this.west){
+			nodeStyle.width="1px";
+			nodeStyle.height="";
+		}
+		else{
+			nodeStyle.width= "99%";
+			nodeStyle.height = "99%";
+		}
+    }
+}
+);
\ No newline at end of file

Propchange: incubator/xap/trunk/src/xap/widgets/dojo/BorderPanel.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/xap/trunk/src/xap/widgets/dojo/FreePanel.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/dojo/FreePanel.js?view=auto&rev=439865
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/dojo/FreePanel.js (added)
+++ incubator/xap/trunk/src/xap/widgets/dojo/FreePanel.js Sun Sep  3 15:46:26 2006
@@ -0,0 +1,38 @@
+//IMPORTANT move this to some shared area
+dojo.widget.manager.registerWidgetPackage("xap.widgets.dojo");
+
+Xap.provide("xap.widgets.dojo.FreePanel");
+
+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.tags.addParseTreeHandler("dojo:FreePanel");
+
+xap.widgets.dojo.FreePanel = function(){
+	dojo.widget.HtmlWidget.call(this);
+}
+dojo.inherits(xap.widgets.dojo.FreePanel, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(xap.widgets.dojo.FreePanel, {
+
+	//setting display:block on a div should work but doesn't.
+	//If you set absolute position on a div then it creates a block in the box
+	//model but then the div is absolute which we don't want.
+	//so we put stuff in a table which DOES define a block in the box model
+	templateString: '<table cellPadding="0" cellSpacing="0"><tr><td><div
dojoAttachPoint="containerNode" style="width: 100%; height: 100%; position:relative"></td></tr></table>',
+	templateCssPath: null ,
+	widgetType: "FreePanel",
+	isContainer: true,
+	
+	addChild: function(child, overrideContainerNode, pos, ref, insertIndex){
+		child.domNode.style.position = "absolute";
+		xap.widgets.dojo.FreePanel.superclass.addChild.call(this,child, overrideContainerNode,
pos, ref, insertIndex);
+	}
+}
+);
+
+

Propchange: incubator/xap/trunk/src/xap/widgets/dojo/FreePanel.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/xap/trunk/src/xap/widgets/dojo/HorizontalPanel.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/dojo/HorizontalPanel.js?view=auto&rev=439865
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/dojo/HorizontalPanel.js (added)
+++ incubator/xap/trunk/src/xap/widgets/dojo/HorizontalPanel.js Sun Sep  3 15:46:26 2006
@@ -0,0 +1,88 @@
+//IMPORTANT move this to some shared area
+dojo.widget.manager.registerWidgetPackage("xap.widgets.dojo");
+
+Xap.provide("xap.widgets.dojo.HorizontalPanel");
+
+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.tags.addParseTreeHandler("dojo:HorizontalPanel");
+
+xap.widgets.dojo.HorizontalPanel = function(){
+	dojo.widget.HtmlWidget.call(this);
+}
+dojo.inherits(xap.widgets.dojo.HorizontalPanel, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(xap.widgets.dojo.HorizontalPanel, {
+	templateString: '<table cellPadding="0" cellSpacing="0"><tbody><tr><td
dojoAttachPoint="startCell"></td>'
+	+'<td dojoAttachPoint="endCell" style="width:99%"></td></tr></tbody></table>',
+	templateCssPath: null ,
+	widgetType: "HorizontalPanel",
+	isContainer: true,
+	align : "start",
+	
+	addChild: function(child, overrideContainerNode, pos, ref, insertIndex){
+		var row = this.endCell.parentNode;
+		var cell = document.createElement("td");
+		
+		
+		if (this.align=="center"){
+			cell.setAttribute("valign", "center");
+		}
+		else if (this.align=="start"){
+			cell.setAttribute("valign", "top");
+		}
+		else if (this.align=="end"){
+			cell.setAttribute("valign", "bottom");
+		}
+		else if (this.align=="stretch"){
+			child.domNode.style.height="100%";
+		}
+		
+		//if we are inserting in the middle, insert before some row
+		//bumped up one to account for the start spacer row
+		if (insertIndex && insertIndex>=0 && insertIndex<row.childNodes.length-2){
+			row.insertBefore(cell,row.childNodes[insertIndex+1]);
+		}
+		else{
+			row.insertBefore(cell, this.endCell);
+		}
+		this.containerNode = cell;
+		xap.widgets.dojo.HorizontalPanel.superclass.addChild.call(this,child, overrideContainerNode,
pos, ref, insertIndex);
+	},
+	
+	 removeChild: function(child) {
+	 	
+	 	//when we remove the child we also have to remove the entire
+	 	//cell it was in
+	 	var containerCell= child.domNode.parentNode;
+		xap.widgets.dojo.HorizontalPanel.superclass.removeChild.call(this,child);
+		containerCell.parentNode.removeChild(containerCell);
+    },
+    
+	setAlign: function(align){
+    	this.align = align;
+    },
+    
+    setPack: function(pack){
+    	if (pack=="start"){
+    		this.startCell.style.width="0%";
+    		this.endCell.style.width="99%";
+    	}
+    	else if (pack=="end"){
+    		this.startCell.style.width="99%";
+    		this.endCell.style.width="0%";
+    	}
+   	else if (pack=="center"){
+   		this.startCell.style.width="50%";
+    		this.endCell.style.width="50%";
+   	}
+    }
+}
+);
+
+

Propchange: incubator/xap/trunk/src/xap/widgets/dojo/HorizontalPanel.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/xap/trunk/src/xap/widgets/dojo/PasswordField.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/dojo/PasswordField.js?view=auto&rev=439865
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/dojo/PasswordField.js (added)
+++ incubator/xap/trunk/src/xap/widgets/dojo/PasswordField.js Sun Sep  3 15:46:26 2006
@@ -0,0 +1,39 @@
+//IMPORTANT move this to some shared area
+dojo.widget.manager.registerWidgetPackage("xap.widgets.dojo");
+
+Xap.provide("xap.widgets.dojo.PasswordField");
+
+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.tags.addParseTreeHandler("dojo:PasswordField");
+
+xap.widgets.dojo.PasswordField = function(){
+	dojo.widget.HtmlWidget.call(this);
+}
+dojo.inherits(xap.widgets.dojo.PasswordField, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(xap.widgets.dojo.PasswordField, {
+
+	templateString: '<input type="password" dojoAttachEvent="onblur"></input>',
+	templateCssPath: null ,
+	widgetType: "PasswordField",
+	isContainer: false,
+	
+	//hook for attach event
+	onblur: function(){
+	},
+	
+	setText: function( text ){
+		this.domNode.value = text;
+	},
+	
+	getText: function(){
+		return this.domNode.value;
+	}
+}
+);
\ No newline at end of file

Propchange: incubator/xap/trunk/src/xap/widgets/dojo/PasswordField.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/xap/trunk/src/xap/widgets/dojo/TextArea.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/dojo/TextArea.js?view=auto&rev=439865
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/dojo/TextArea.js (added)
+++ incubator/xap/trunk/src/xap/widgets/dojo/TextArea.js Sun Sep  3 15:46:26 2006
@@ -0,0 +1,39 @@
+//IMPORTANT move this to some shared area
+dojo.widget.manager.registerWidgetPackage("xap.widgets.dojo");
+
+Xap.provide("xap.widgets.dojo.TextArea");
+
+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.tags.addParseTreeHandler("dojo:TextArea");
+
+xap.widgets.dojo.TextArea = function(){
+	dojo.widget.HtmlWidget.call(this);
+}
+dojo.inherits(xap.widgets.dojo.TextArea, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(xap.widgets.dojo.TextArea, {
+
+	templateString: '<textarea dojoAttachEvent="onblur"></textarea>',
+	templateCssPath: null ,
+	widgetType: "TextArea",
+	isContainer: false,
+	
+	//hook for attach event
+	onblur: function(){
+	},
+	
+	setText: function( text ){
+		this.domNode.value = text;
+	},
+	
+	getText: function(){
+		return this.domNode.value;
+	}
+}
+);
\ No newline at end of file

Propchange: incubator/xap/trunk/src/xap/widgets/dojo/TextArea.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/xap/trunk/src/xap/widgets/dojo/TextField.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/dojo/TextField.js?view=auto&rev=439865
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/dojo/TextField.js (added)
+++ incubator/xap/trunk/src/xap/widgets/dojo/TextField.js Sun Sep  3 15:46:26 2006
@@ -0,0 +1,39 @@
+//IMPORTANT move this to some shared area
+dojo.widget.manager.registerWidgetPackage("xap.widgets.dojo");
+
+Xap.provide("xap.widgets.dojo.TextField");
+
+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.tags.addParseTreeHandler("dojo:TextField");
+
+xap.widgets.dojo.TextField = function(){
+	dojo.widget.HtmlWidget.call(this);
+}
+dojo.inherits(xap.widgets.dojo.TextField, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(xap.widgets.dojo.TextField, {
+
+	templateString: '<input type="text" dojoAttachEvent="onblur"></input>',
+	templateCssPath: null ,
+	widgetType: "TextField",
+	isContainer: false,
+	
+	//hook for attach event
+	onblur: function(){
+	},
+	
+	setText: function( text ){
+		this.domNode.value = text;
+	},
+	
+	getText: function(){
+		return this.domNode.value;
+	}
+}
+);
\ No newline at end of file

Propchange: incubator/xap/trunk/src/xap/widgets/dojo/TextField.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/xap/trunk/src/xap/widgets/dojo/VerticalPanel.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/dojo/VerticalPanel.js?view=auto&rev=439865
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/dojo/VerticalPanel.js (added)
+++ incubator/xap/trunk/src/xap/widgets/dojo/VerticalPanel.js Sun Sep  3 15:46:26 2006
@@ -0,0 +1,97 @@
+//IMPORTANT move this to some shared area
+dojo.widget.manager.registerWidgetPackage("xap.widgets.dojo");
+
+Xap.provide("xap.widgets.dojo.VerticalPanel");
+
+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.tags.addParseTreeHandler("dojo:VerticalPanel");
+
+xap.widgets.dojo.VerticalPanel = function(){
+	dojo.widget.HtmlWidget.call(this);
+}
+dojo.inherits(xap.widgets.dojo.VerticalPanel, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(xap.widgets.dojo.VerticalPanel, {
+	templateString: '<table cellPadding="0" cellSpacing="0"><tbody dojoAttachPoint="tbody">'
+
+	'<tr dojoAttachPoint="startRow"><td></td></tr>'
+	+'<tr dojoAttachPoint="endRow" style="height:99%"><td></td></tr></tbody></table>',
+	templateCssPath: null ,
+	widgetType: "VerticalPanel",
+	isContainer: true,
+	align: "center", //start, center, end, stretch
+	
+	addChild: function(child, overrideContainerNode, pos, ref, insertIndex){
+		//TODO if they have something like height=50%
+		//we should set that on the table cell?
+		var row = document.createElement("tr");
+		var cell = document.createElement("td");
+		if (this.align=="center"){
+			cell.setAttribute("align", "center");
+		}
+		else if (this.align=="start"){
+			cell.setAttribute("align", "left");
+		}
+		else if (this.align=="end"){
+			cell.setAttribute("align", "right");
+		}
+		
+		//if they set the width again after this it won't really work
+		//TODO this can happen now when they have width=x because
+		//of the order of operations we add the child to the parent
+		//BEFORE we go through the initial attributes
+		else if (this.align=="stretch"){
+			child.domNode.style.width="100%";
+		}
+		row.appendChild(cell);
+		
+		var tBody = this.tbody;
+		
+		//if we are inserting in the middle, insert before some row
+		//bumped up one to account for the start spacer row
+		if (insertIndex && insertIndex>=0 && insertIndex<tBody.childNodes.length-2){
+			tBody.insertBefore(row,tBody.childNodes[insertIndex+1]);
+		}
+		else{
+			tBody.insertBefore(row, this.endRow);
+		}
+		this.containerNode = cell;
+		xap.widgets.dojo.VerticalPanel.superclass.addChild.call(this,child, overrideContainerNode,
pos, ref, 0);
+	},
+	
+	 removeChild: function(child) {
+	 	
+	 	//when we remove the child we also have to remove the entire
+	 	//row it was in
+	 	var containerRow = child.domNode.parentNode.parentNode;	
+		xap.widgets.dojo.VerticalPanel.superclass.removeChild.call(this,child);
+		containerRow.parentNode.removeChild(containerRow);
+    },
+    
+    setAlign: function(align){
+    	this.align = align;
+    },
+    
+    setPack: function(pack){
+    	if (pack=="start"){
+    		this.startRow.style.height="0%";
+    		this.endRow.style.height="99%";
+    	}
+    	else if (pack=="end"){
+    		this.startRow.style.height="99%";
+    		this.endRow.style.height="0%";
+    	}
+   	else if (pack=="center"){
+   		this.startRow.style.height="50%";
+    		this.endRow.style.height="50%";
+   	}
+    }
+}
+);
+
+

Propchange: incubator/xap/trunk/src/xap/widgets/dojo/VerticalPanel.js
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message