You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by jm...@apache.org on 2007/10/11 07:34:15 UTC

svn commit: r583714 - in /incubator/xap/trunk/codebase/src/xap/bridges/xap: ListBoxBridge.js ListItemBridge.js XapComboBoxBridge.js

Author: jmargaris
Date: Thu Oct 11 00:34:14 2007
New Revision: 583714

URL: http://svn.apache.org/viewvc?rev=583714&view=rev
Log:
more effieciency changes

Modified:
    incubator/xap/trunk/codebase/src/xap/bridges/xap/ListBoxBridge.js
    incubator/xap/trunk/codebase/src/xap/bridges/xap/ListItemBridge.js
    incubator/xap/trunk/codebase/src/xap/bridges/xap/XapComboBoxBridge.js

Modified: incubator/xap/trunk/codebase/src/xap/bridges/xap/ListBoxBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/xap/ListBoxBridge.js?rev=583714&r1=583713&r2=583714&view=diff
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/xap/ListBoxBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/xap/ListBoxBridge.js Thu Oct 11 00:34:14 2007
@@ -142,10 +142,14 @@
 
 // Adjust world to changes from adding a new option list item:
 xap.bridges.xap.ListBoxBridge.prototype.childAdded  = function(anEvent){
-
 	xap.bridges.xap.ListBoxBridge.superclass.childAdded.call(this,anEvent) ;
-
-	this.revalue() ;
+	if (this._peer.isCombobox){
+		var select = this._peer.select;
+		if (select.selectedIndex == -1){
+			select.selectedIndex = 0 ;
+			this.revalue() ;
+		}
+	}
 }
 
 xap.bridges.xap.ListBoxBridge.prototype.setIsChildOfComboBox = function( b ){

Modified: incubator/xap/trunk/codebase/src/xap/bridges/xap/ListItemBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/xap/ListItemBridge.js?rev=583714&r1=583713&r2=583714&view=diff
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/xap/ListItemBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/xap/ListItemBridge.js Thu Oct 11 00:34:14 2007
@@ -42,6 +42,8 @@
 
 
 xap.bridges.xap.ListItemBridge.prototype.setSelectedAttribute = function(value) {
+	//if they select/deselect something on the fly we need to 
+	//revalue the comboBox/listBox
 	this.getPeer().setSelected(value=='true'?true:false);
 }
 

Modified: incubator/xap/trunk/codebase/src/xap/bridges/xap/XapComboBoxBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/xap/XapComboBoxBridge.js?rev=583714&r1=583713&r2=583714&view=diff
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/xap/XapComboBoxBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/xap/XapComboBoxBridge.js Thu Oct 11 00:34:14 2007
@@ -77,7 +77,6 @@
 		dojo.event.disconnect(this._childHandler,"onChange",this,"onChange") ;
 		dojo.event.disconnect(this._childHandler,"onKeyDown",this,"onKeyDown") ;
 		dojo.event.disconnect(this._childHandler,"onMouseUp",this,"onMouseUp") ;
-		dojo.event.disconnect(this._childHandler,"childAdded",this,"listboxAddedOrRemovedChild") ;
 		dojo.event.disconnect(this._childHandler,"revalue",this,"revalue") ;
 	}
 
@@ -96,23 +95,9 @@
 	dojo.event.connect(this._childHandler,"onChange",this,"onChange") ;
 	dojo.event.connect(this._childHandler,"onKeyDown",this,"onKeyDown") ;
 	dojo.event.connect(this._childHandler,"onMouseUp",this,"onMouseUp") ;
-	dojo.event.connect(childHandler,"childAdded",this,"listboxAddedOrRemovedChild") ;
-	dojo.event.connect(childHandler,"revalue",this,"revalue") ;
 
-}
+	dojo.event.connect(childHandler,"revalue",this,"revalue") ;
 
-xap.bridges.xap.XapComboBoxBridge.prototype.listboxAddedOrRemovedChild  = function(anEvent){
-	// These should be two strings, since the child 
-	// should be a single-valued list box.
-	// The getPeer() should be fine, since we've
-	// just added a child and not thrown an error:
-	var select = this._childListbox.select ;
-	// Also:  there must be a selected value for a combobox; if
-	// there is none such yet, choose the first one by default:
-	if( select.selectedIndex == -1 && select.options.length > 0 ){
-		select.selectedIndex = 0 ;
-		this.revalue() ;
-	}
 }
 
 xap.bridges.xap.XapComboBoxBridge.prototype.revalue = function(){