incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtu...@apache.org
Subject svn commit: r448294 [2/2] - in /incubator/xap/trunk: WebContent/examples/dataBinding/ WebContent/examples/helloWorld/ WebContent/examples/xapwidgets/ src/xap/bridges/xap/ src/xap/taghandling/ src/xap/widgets/
Date Wed, 20 Sep 2006 18:32:52 GMT
Modified: incubator/xap/trunk/src/xap/widgets/Checkbox.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/Checkbox.js?view=diff&rev=448294&r1=448293&r2=448294
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/Checkbox.js (original)
+++ incubator/xap/trunk/src/xap/widgets/Checkbox.js Wed Sep 20 11:32:51 2006
@@ -21,37 +21,56 @@
 
 
 
-xap.widgets.Checkbox = function(text) {
+xap.widgets.Checkbox = function(appContext) {
 	
 	xap.widgets.Label.call(this);
 	
-	this.img.srcON = '../../css/tree_folderopen.gif'; /* should change to xapContext */
-	this.img.srcOFF = '../../css/tree_folderclosed.gif'; /* should change to xapContext */
+	this.img.srcON = appContext + 'src/xap/widgets/images/checkbox_on.gif';
+	this.img.srcOFF = appContext + 'src/xap/widgets/images/checkbox_off.gif';
 	this.img.srcToggle = this.img.srcOFF;	
 	this.img.style.display = '';
 	
 	this.setTextPlacementHorizontal('right');
 	this.setAlignVertical('center');
 	this.setAlignHorizontal('center');
+	this.setOff();
+	
+	var parent = this;
   
-	this.setImage(this.img.srcOFF);
-
 	this.img.onclick = function() {
-		this.srcToggle = (this.srcToggle == this.srcOFF) ? this.srcON : this.srcOFF;
-		this.src = this.srcToggle;
+		(this.srcToggle == this.srcOFF) ? parent.setOn() : parent.setOff();
 		this.clickobj && this.clickobj[this.clickfn] && this.clickobj[this.clickfn](this.clickparam);
-
 	}
 	
-
 }
 
 xap.widgets.Checkbox.prototype = new xap.widgets.Label();
 
 
+
+
 xap.widgets.Checkbox.prototype.setOnClick = function(obj, fn, param) {
 	this.img.clickobj = obj;
 	this.img.clickfn = fn;
 	this.img.clickparam = param;
 }
+
+
+xap.widgets.Checkbox.prototype.setOn = function() {
+  this.setImage(this.img.srcON);
+	this.img.srcToggle = this.img.srcON;
+	this.selected = 'true';
+}
+
+xap.widgets.Checkbox.prototype.setOff = function() {
+  this.setImage(this.img.srcOFF);
+	this.img.srcToggle = this.img.srcOFF;
+	this.selected = 'false';
+}
+
+xap.widgets.Checkbox.prototype.getSelected = function() {
+  return this.selected;
+}
+
+
 

Modified: incubator/xap/trunk/src/xap/widgets/Label.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/Label.js?view=diff&rev=448294&r1=448293&r2=448294
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/Label.js (original)
+++ incubator/xap/trunk/src/xap/widgets/Label.js Wed Sep 20 11:32:51 2006
@@ -57,10 +57,10 @@
 	
 	this._rootDomNode.appendChild(this.table);
 	
-	xap.widgets.styleSet(this.table, {backgroundColor: '#eee', width:'100%', height: '100%'});
/* to remove */
-	xap.widgets.styleSet(this.td, {backgroundColor: '#eef', width:'100%', height: '100%'});
/* to remove */	
+	xap.widgets.styleSet(this.table, {width:'100%', height: '100%'});
+	xap.widgets.styleSet(this.td, {width:'100%', height: '100%'});
 	
-	xap.widgets.styleSet(this._rootDomNode, {overflow:'hidden', position:'relative', backgroundColor:'gray'});
/* to remove */
+	xap.widgets.styleSet(this._rootDomNode, {overflow:'hidden', position:'relative'});
 
 }
 
@@ -132,7 +132,6 @@
 			var node = children[i];
 			if (node.nodeType == 1 && node.nodeName == 'br') this.td.removeChild(node);
 		}
-	
 	
 		if (direction == 'left') {
 			this.td.insertBefore(this.span, this.img);

Added: incubator/xap/trunk/src/xap/widgets/ListBox.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/ListBox.js?view=auto&rev=448294
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/ListBox.js (added)
+++ incubator/xap/trunk/src/xap/widgets/ListBox.js Wed Sep 20 11:32:51 2006
@@ -0,0 +1,48 @@
+//IMPORTANT move this to some shared area
+dojo.widget.manager.registerWidgetPackage("xap.widgets");
+
+Xap.provide("xap.widgets.ListBox");
+
+Xap.require("dojo.widget.HtmlWidget");
+
+dojo.widget.tags.addParseTreeHandler("dojo:ListBox");
+
+xap.widgets.ListBox = function(){
+	dojo.widget.HtmlWidget.call(this);
+}
+
+dojo.inherits(xap.widgets.ListBox, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(xap.widgets.ListBox, {
+		templateString: '<div><form><select dojoAttachPoint="select"></select></form></div>',
+		templateCssPath: null,
+		widgetType: "ListBox",
+		isContainer: true,
+		addChild: function(child) { /* elementListItem */
+			
+			this.select.appendChild(child.domNode);
+			
+				//alert('adding an option');
+			
+		},
+		removeChild: function(child) {
+			
+			//this.select.removeChild(child.domNode);
+
+
+			var options = this.select.options
+			
+			for (var i = 0; i < options.length; i++) {
+				if (options[i] == child.domNode) options[i] = null;
+				/* IE doesn't update the page with dom node removal so we have to do this*/
+			}
+			
+		},
+		setOnStateChange: function(obj, fn, param) {
+			this.select.onchange = function() {
+				obj && obj[fn] && obj[fn](param);
+			}
+		}
+		
+	}
+);
\ No newline at end of file

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

Added: incubator/xap/trunk/src/xap/widgets/ListItem.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/ListItem.js?view=auto&rev=448294
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/ListItem.js (added)
+++ incubator/xap/trunk/src/xap/widgets/ListItem.js Wed Sep 20 11:32:51 2006
@@ -0,0 +1,31 @@
+//IMPORTANT move this to some shared area
+dojo.widget.manager.registerWidgetPackage("xap.widgets");
+
+Xap.provide("xap.widgets.ListItem");
+Xap.require("dojo.widget.HtmlWidget");
+
+dojo.widget.tags.addParseTreeHandler("dojo:ListItem");
+
+xap.widgets.ListItem = function(){
+	dojo.widget.HtmlWidget.call(this);
+}
+
+dojo.inherits(xap.widgets.ListItem, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(xap.widgets.ListItem, {
+		templateString: null,
+		templateCssPath: null,
+		widgetType: "ListItem",
+		isContainer: true,
+		fillInTemplate: function(){
+			this.domNode = document.createElement("option");
+		},		
+		setDetail: function(text, value) {
+			this.domNode.text = text;
+			this.domNode.value = value;
+		},
+		setSelected: function() {
+			this.domNode.selected = true;
+		}
+	}
+);
\ No newline at end of file

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

Modified: incubator/xap/trunk/src/xap/widgets/RadioButton.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/RadioButton.js?view=diff&rev=448294&r1=448293&r2=448294
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/RadioButton.js (original)
+++ incubator/xap/trunk/src/xap/widgets/RadioButton.js Wed Sep 20 11:32:51 2006
@@ -19,14 +19,12 @@
 Xap.provide("xap.widgets.RadioButton");
 Xap.require("xap.widgets.Label");
 
-
-
-xap.widgets.RadioButton = function(text) {
+xap.widgets.RadioButton = function(appContext) {
 	
 	xap.widgets.Label.call(this);
 	
-	this.img.srcON = '../../css/tree_folderopen.gif'; /* should change to xapContext */
-	this.img.srcOFF = '../../css/tree_folderclosed.gif'; /* should change to xapContext */
+	this.img.srcON = appContext + 'src/xap/widgets/images/radio_on.gif';
+	this.img.srcOFF = appContext + 'src/xap/widgets/images/radio_off.gif';
 	this.img.srcToggle = this.img.srcOFF;	
 	this.img.style.display = '';
 	
@@ -34,28 +32,34 @@
 	this.setAlignVertical('center');
 	this.setAlignHorizontal('center');
   
-	this.setImage(this.img.srcOFF);
+	this.setOff();
 
 	this.img.onclick = function() {
-		this.srcToggle = (this.srcToggle == this.srcOFF) ? this.srcON : this.srcOFF;
-		this.src = this.srcToggle;
 		this.clickobj && this.clickobj[this.clickfn] && this.clickobj[this.clickfn](this.clickparam);
-
 	}
 	
-
 }
 
 xap.widgets.RadioButton.prototype = new xap.widgets.Label();
 
-
 xap.widgets.RadioButton.prototype.setOnClick = function(obj, fn, param) {
 	this.img.clickobj = obj;
 	this.img.clickfn = fn;
 	this.img.clickparam = param;
 }
 
-xap.widgets.RadioButton.prototype.reset = function() {
-	this.img.srcToggle = this.img.srcOFF;
+xap.widgets.RadioButton.prototype.setOn = function() {
+  this.setImage(this.img.srcON);
+	this.img.srcToggle = this.img.srcON;
+	this.selected = 'true';
+}
+
+xap.widgets.RadioButton.prototype.setOff = function() {
   this.setImage(this.img.srcOFF);
+	this.img.srcToggle = this.img.srcOFF;
+	this.selected = 'false';
+}
+
+xap.widgets.RadioButton.prototype.getSelected = function() {
+  return this.selected;
 }

Added: incubator/xap/trunk/src/xap/widgets/XapComboBox.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/XapComboBox.js?view=auto&rev=448294
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/XapComboBox.js (added)
+++ incubator/xap/trunk/src/xap/widgets/XapComboBox.js Wed Sep 20 11:32:51 2006
@@ -0,0 +1,36 @@
+//IMPORTANT move this to some shared area
+dojo.widget.manager.registerWidgetPackage("xap.widgets");
+Xap.provide("xap.widgets.XapComboBox");
+
+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");
+
+xap.widgets.XapComboBox = function(){
+
+	dojo.widget.Widget.call(this);
+	
+}
+
+dojo.inherits(xap.widgets.XapComboBox, dojo.widget.HtmlWidget);
+
+dojo.lang.extend(xap.widgets.XapComboBox, {
+	templateString: '<div></div>',
+	templateCssPath: null,
+	widgetType: 'XapComboBox',
+	isContainer: true,
+
+	addChild: function(child) {
+    xap.widgets.XapComboBox.superclass.addChild.call(this, child); /* add dojo widget to
dojo widget */
+	},
+	
+    
+	resetNode: function(containerNode){
+	}
+}
+);
+
+dojo.widget.tags.addParseTreeHandler("dojo:XapComboBox");
\ No newline at end of file

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



Mime
View raw message