incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtu...@apache.org
Subject svn commit: r485538 - in /incubator/xap/trunk/src/xap: bridges/xap/ListBoxBridge.js bridges/xap/XapComboBoxBridge.js widgets/ListBox.js widgets/XapComboBox.js
Date Mon, 11 Dec 2006 07:32:10 GMT
Author: mturyn
Date: Sun Dec 10 23:32:08 2006
New Revision: 485538

URL: http://svn.apache.org/viewvc?view=rev&rev=485538
Log:
XAP-50
Fixed disabled["true"|"false"], visible["true"|"false"] attributes' setting.

Modified:
    incubator/xap/trunk/src/xap/bridges/xap/ListBoxBridge.js
    incubator/xap/trunk/src/xap/bridges/xap/XapComboBoxBridge.js
    incubator/xap/trunk/src/xap/widgets/ListBox.js
    incubator/xap/trunk/src/xap/widgets/XapComboBox.js

Modified: incubator/xap/trunk/src/xap/bridges/xap/ListBoxBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/xap/ListBoxBridge.js?view=diff&rev=485538&r1=485537&r2=485538
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/xap/ListBoxBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/xap/ListBoxBridge.js Sun Dec 10 23:32:08 2006
@@ -161,7 +161,7 @@
 		this.writeBackAttribute("selectionMode","multiRow") ;
 	} else {
 		this.getPeer().setSelectMultiple(false);
-		this.writeBackAttribute("selectionMode","single") ;		
+		this.writeBackAttribute("selectionMode","singleRow") ;		
 		// We might have trimmed nodes at this point, so set an onChange
 		this.onChange( this.fakeDomEvent() );
 	}
@@ -201,6 +201,34 @@
 	this.getPeer().setY( value ) ;
 }
 
+xap.bridges.xap.ListBoxBridge.prototype.setDisabledAttribute = function(pszDisabled) {
+	xap.bridges.basic.AbstractWidgetBridge.prototype.setDisabledAttribute.call(this,pszDisabled);
+	// Default is "enabled":
+	var bDisabled = false ;
+	if( pszDisabled == "true" ){
+		bDisabled = true ;
+	}
+	this.getPeer().setDisabled(bDisabled);
+}
+
+
+xap.bridges.xap.ListBoxBridge.prototype.addStyleState = function( stateName ){
+	if (this.getPeer().select && this.getCssStyleName()){
+		dojo.html.addClass(this.getPeer().select,this.getCssStyleName() + stateName);		
+	}
+	if (this.getPeer().domNode && this.getCssStyleName()){
+		dojo.html.addClass(this.getPeer().domNode,this.getCssStyleName() + stateName);		
+	}	
+}
+
+xap.bridges.xap.ListBoxBridge.prototype.removeStyleState = function( stateName ){
+	if (this.getPeer().select && this.getCssStyleName()){
+		dojo.html.removeClass(this.getPeer().select,this.getCssStyleName() + stateName);
+	}
+	if (this.getPeer().domNode && this.getCssStyleName()){
+		dojo.html.removeClass(this.getPeer().domNode,this.getCssStyleName() + stateName);
+	}	
+}
 
 
 

Modified: incubator/xap/trunk/src/xap/bridges/xap/XapComboBoxBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/xap/XapComboBoxBridge.js?view=diff&rev=485538&r1=485537&r2=485538
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/xap/XapComboBoxBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/xap/XapComboBoxBridge.js Sun Dec 10 23:32:08 2006
@@ -49,53 +49,6 @@
 	this.getPeer().setWidth(value) ;
 }
 
-/**
- * Doesn't really work for dropdown boxes....<b> 
-**/
-xap.bridges.xap.XapComboBoxBridge.prototype.setHeightAttribute = function(value) {
-	
-	if( !window.netscape ){
-		// nothing more can be done:	
-		if( this.getRootDomNode() ){
-			this.getRootDomNode().style.height = value ;
-		}
-		return ;
-	}
-
-	this.getPeer().domNode.style.height 
-		= value ;
-	if( this.getPeer().domNode.firstChild ){
-		this.getPeer().domNode.firstChild.style.height 
-			= (this.getPeer().domNode.clientHeight - 1)+"px" ;		
-	}
-
-	// Need to remove select box and then replace it
-	// in order to get height change to show up:
-	var holder = this._peer.domNode.firstChild ;
-	if(holder){
-	var select = holder.firstChild ;
-	if(holder && select){
-//		try {
-			holder.removeChild(select) ;
-//		} catch(e){}
-
-		holder.appendChild(select) ;
-		}		
-	}
-
-	// This doesn't work under ie yet....	
-//	if( !isMozish && hasSelectBox ){
-//		// ...so resynch outer divs to the unchanged select:
-//		var sel = this._peer.children[0].select ;
-//		this.getPeer().domNode.style.height 
-//			= sel.clientHeight+"px" ;
-//		if( this.getPeer().domNode.firstChild ){
-//			this.getPeer().domNode.firstChild.style.height 
-//				= this.getPeer().domNode.style.height ;		
-//		}	
-//	}
-	var bkpt = -1 ;
-}
 
 xap.bridges.xap.XapComboBoxBridge.prototype.addChild = function(childHandler) {
 
@@ -112,18 +65,20 @@
 	this._childListbox = childHandler.getPeer();
 	this._childHandler = childHandler ;
 
-
+	// make this a dropdown:
 	this._childListbox.select.multiple = null;
 	this._childListbox.select.removeAttribute('multiple');
 	this._childListbox.select.size = 1 ;
 	
-	this._childListbox.select.style.height = "100%" ;
+	this._childListbox.trimSuperUnarySelectedOptions()	
 
 	this.getPeer().addChild(this._childListbox);
 
 	// Includes evil code to make height show up: element must be
 	// dropped and then re-added:
-	this.setHeightAttribute(this.getElement().getAttribute("height")) ;
+	this.setHeightAttribute("1px") ;
+	this.setHeightAttribute(this.getElement().getAttribute("height")) ;	
+	this._childListbox.select.style.height = "100%" ;	
 	
 
 	// Notice a change event in the child:
@@ -182,6 +137,48 @@
 }
 
 
+xap.bridges.xap.XapComboBoxBridge.prototype.setDisabledAttribute = function(pszValue){
+	xap.bridges.basic.AbstractWidgetBridge.prototype.setDisabledAttribute(this,pszValue) ;
+	if (this._childHandler){
+		this._childHandler.setDisabledAttribute(pszValue) ;
+	}	
+}
 
+/**
+ * Doesn't really work for dropdown boxes....<b> 
+**/
+xap.bridges.xap.XapComboBoxBridge.prototype.setHeightAttribute = function(value) {
+	
+	if( !window.netscape ){
+		// nothing more can be done:	
+		if( this._childListbox && this._childListbox.domNode ){
+			this._childListbox.domNode.style.height = value ;
+			
+		}	
+		if( this._childListbox && this._childListbox.select ){
+			this._childListbox.select.style.height = "100%" ;
+			this._childListbox.select.size = 1 ;
+		}			
 
+		return ;
+	}
 
+	this.getPeer().domNode.style.height = value ;
+	if( this.getPeer().domNode.firstChild ){
+		this.getPeer().domNode.firstChild.style.height 
+			= (this.getPeer().domNode.clientHeight)+"px" ;		
+	}
+
+	// Need to remove select box and then replace it
+	// in order to get height change to show up:
+	var holder = this._peer.domNode.firstChild ;
+	if(holder){
+		var select = holder.firstChild ;
+		if(holder && select){
+			holder.removeChild(select) ;
+			holder.appendChild(select) ;
+		}
+	}
+
+	var bkpt = -1 ;
+}

Modified: incubator/xap/trunk/src/xap/widgets/ListBox.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/ListBox.js?view=diff&rev=485538&r1=485537&r2=485538
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/ListBox.js (original)
+++ incubator/xap/trunk/src/xap/widgets/ListBox.js Sun Dec 10 23:32:08 2006
@@ -18,10 +18,10 @@
 // If size==1, get a combo box, which we don't want, so
 // start with size 2, increment if necessary as we add children:
 //(Note:onkeydown, onblur so far is only needed if this is a combobox interior.)
-		templateString: '<div style="border: 1px solid black;margin:0px;align:center;">'
+		templateString: '<div style="zIndex:500;border: 1px solid black;margin:0px;align:center;">'
 						+'<select dojoAttachPoint="select" '
 							+ 'dojoAttachEvent="onkeyup;onchange;onmouseout;onkeydown;onblur;onselect"' 
-							+ 'style="border: 1px ridge darkgray;padding:0px;"'
+							+ 'style="zIndex:501;border: 4px ridge darkgray;padding:0px;margin:0px"'
 							+ 'size="2"></select></div>',
 		templateCssPath: null,
 		widgetType: "ListBox",
@@ -32,7 +32,7 @@
 			if(tf){
 				this.select.multiple = true ;
 			} else {
-				this.select.multiple= false ;
+				this.select.removeAttribute('multiple');				
 				// If more than one is selected at this point,
 				// keep the first (faute de mieux) and deselect
 				// the rest:
@@ -179,6 +179,10 @@
 	this.domNode.style.top = value  ;
 }
 
+xap.widgets.ListBox.prototype.setVisible = function(value){
+	this.domNode.style.visibility = (value=="false")?"hidden":"visible"  ;
+}
+
 xap.widgets.ListBox.prototype.setHeight = function(value) {
 	this.select.style.height = "100%";	
 	this.domNode.style.height = value;
@@ -207,6 +211,20 @@
 xap.widgets.ListBox.prototype.setFontWeight = function(value){
 	this.select.style.fontWeight = value ;
 }
+
+
+/**
+ * @param bValue{boolean}---note that the string 
+ * "false" evaluates to the truth boolean
+**/ 
+xap.widgets.ListBox.prototype.setDisabled = function(bValue){
+	this.domNode.disabled = bValue ;
+	this.select.disabled = bValue ;			
+}
+
+
+
+
 
 
 

Modified: incubator/xap/trunk/src/xap/widgets/XapComboBox.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/XapComboBox.js?view=diff&rev=485538&r1=485537&r2=485538
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/XapComboBox.js (original)
+++ incubator/xap/trunk/src/xap/widgets/XapComboBox.js Sun Dec 10 23:32:08 2006
@@ -21,7 +21,7 @@
 dojo.inherits(xap.widgets.XapComboBox, dojo.widget.HtmlWidget);
 
 dojo.lang.extend(xap.widgets.XapComboBox, {
-	templateString: '<div></div>',
+	templateString: '<div style="padding:0px;margin:0px;border:0px solid black"></div>',
 	templateCssPath: null,
 	widgetType: 'XapComboBox',
 	isContainer: true,
@@ -29,6 +29,13 @@
 	addChild: function(child) {
     	xap.widgets.XapComboBox.superclass.addChild.call(this, child); /* add dojo widget to
dojo widget */
     	this.child = child ;
+		// IE seems to balk at becoming a drop-down; clicking anywhere
+		// on the page will induce the transition, but so will this:
+		if( !window.netscape){
+			var oT = this.child.domNode.clientTop ;   	
+		   	this.child.domNode.style.height = (oT+1)+"px";
+		  	this.child.domNode.style.height = (oT)+"px";    		
+		}
 	},
 	
     
@@ -40,11 +47,12 @@
 dojo.widget.tags.addParseTreeHandler("dojo:XapComboBox");
 
 xap.widgets.XapComboBox.prototype.setVisible = function(value){
+	this.domNode.style.visibility = (value=="true")?"visible":"hidden"   ;
 	if( this.child ){
-		this.child.setVisible( value ) ;
+		this.child.setVisible(value) ;
 	}
-	this.domNode.style.visible = value  ;
 }
+
 xap.widgets.XapComboBox.prototype.setBackgroundColor = function(value){
 	if( this.child ){
 		this.child.setBackgroundColor( value ) ;
@@ -70,7 +78,7 @@
 xap.widgets.XapComboBox.prototype.setHeight = function(value) {
 	this.domNode.style.height = value;
 	if(this.child){
-		this.child.setHeight( "100%" ) ;
+		this.child.setHeight( value ) ;
 	}		
 }
 



Mime
View raw message