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 mt...@apache.org on 2006/11/06 18:23:09 UTC

svn commit: r471807 - in /incubator/xap/trunk: WebContent/examples/widgets/ src/xap/bridges/dojo/ src/xap/widgets/

Author: mturyn
Date: Mon Nov  6 10:23:08 2006
New Revision: 471807

URL: http://svn.apache.org/viewvc?view=rev&rev=471807
Log:
(For Y.Wang:)

Bug fixes.

Modified:
    incubator/xap/trunk/WebContent/examples/widgets/menu.xal
    incubator/xap/trunk/src/xap/bridges/dojo/MenuBarBridge.js
    incubator/xap/trunk/src/xap/bridges/dojo/MenuBarItemBridge.js
    incubator/xap/trunk/src/xap/bridges/dojo/MenuBridge.js
    incubator/xap/trunk/src/xap/widgets/Button.js
    incubator/xap/trunk/src/xap/widgets/Label.js
    incubator/xap/trunk/src/xap/widgets/RadioButton.js

Modified: incubator/xap/trunk/WebContent/examples/widgets/menu.xal
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/widgets/menu.xal?view=diff&rev=471807&r1=471806&r2=471807
==============================================================================
--- incubator/xap/trunk/WebContent/examples/widgets/menu.xal (original)
+++ incubator/xap/trunk/WebContent/examples/widgets/menu.xal Mon Nov  6 10:23:08 2006
@@ -52,7 +52,8 @@
 				</xal:menu>
 			</xal:menuBarItem>
 			
-		</xal:menuBar>	
+		</xal:menuBar>			
+		
 	
 		<horizontalFlowPane width="825px" xmlns="http://www.openxal.org/xal">
 			<label width="825px" height="25px" 
@@ -101,15 +102,19 @@
 			<button width="200px" height="25px" 
 				text="font style -> 'italic'"
 				onCommand="mco:attributeSetter.setAttribute(testComponent,
-					'fontStyle' ,'italic')"/>		
+					'fontStyle' ,'italic')"/>	
+			<button width="200px" height="25px" 
+				text="enabled -> 'false'"
+				onCommand="mco:attributeSetter.setAttribute(testComponent,
+					'enabled' ,'false')"/>						
 			<button width="200px" height="25px" 
 				text="enabled -> 'true'"
 				onCommand="mco:attributeSetter.setAttribute(testComponent,
 					'enabled' ,'true')"/>		
 			<button width="200px" height="25px" 
-				text="enabled -> 'false'"
+				text="pack -> 'true'"
 				onCommand="mco:attributeSetter.setAttribute(testComponent,
-					'enabled' ,'false')"/>	 																																														
+					'pack' ,'true')"/>	 																																														
 		</horizontalFlowPane>		
 		<horizontalFlowPane width="825px" xmlns="http://www.openxal.org/xal">
 			<label width="825px" height="25px" 

Modified: incubator/xap/trunk/src/xap/bridges/dojo/MenuBarBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/MenuBarBridge.js?view=diff&rev=471807&r1=471806&r2=471807
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/dojo/MenuBarBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/dojo/MenuBarBridge.js Mon Nov  6 10:23:08 2006
@@ -34,9 +34,6 @@
  
 xap.bridges.dojo.MenuBarBridge= function() {
 	xap.bridges.dojo.DojoWidgetBridge.call(this);
-	
-	//IMPORTANT should't this property be set on 'this' rather than prototype
-	dojo.widget.MenuBar2.prototype.disabled = false;
 }
 
 Xap.setupClassAsSubclassOf(
@@ -44,20 +41,10 @@
 				"xap.bridges.dojo.DojoWidgetBridge"						
 );
 
-//IMPORTANT remove this? Just a pass through
-xap.bridges.dojo.MenuBarBridge.prototype.init = function() {
-	xap.bridges.dojo.DojoWidgetBridge.prototype.init.call(this);
-}
-
 xap.bridges.dojo.MenuBarBridge.prototype.getPeerString = function(){
     return "MenuBar2" ;
 }
 
-//IMPORTANT should't these property be set on 'this' rather than prototype?
-//won't these get shared among all menubars in application?
-dojo.widget.MenuBar2.prototype.enabled = true;
-dojo.widget.MenuBar2.prototype.height = null;
-
 dojo.widget.MenuBar2.prototype.itemHover = function(item) {
 	if (!this.enabled) {
 		return;
@@ -187,11 +174,6 @@
 		this.getPeer().postCreate();
 	}
 } 
-
-xap.bridges.dojo.MenuBarBridge.prototype.setHeightAttribute = function(value) {
-	this.getPeer().height = value;
-	this.getRootDomNode().style.height = value;
-}
 
 /**
  * Layout menu without changing the height of the menubar.

Modified: incubator/xap/trunk/src/xap/bridges/dojo/MenuBarItemBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/MenuBarItemBridge.js?view=diff&rev=471807&r1=471806&r2=471807
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/dojo/MenuBarItemBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/dojo/MenuBarItemBridge.js Mon Nov  6 10:23:08 2006
@@ -44,11 +44,6 @@
 				"xap.bridges.dojo.DojoWidgetBridge"						
 );
 
-//IMPORTANT these on the prototype is a bad idea?
-dojo.widget.MenuBarItem2.prototype.enabled = true;
-dojo.widget.MenuBarItem2.prototype.visible = true;
-
-//IMPORTANT DOJO workaround menu item sizing is bad in .31 dojo
 dojo.widget.MenuBarItem2.prototype.layoutItem = function(item_h){
 	var label_w = dojo.style.getOuterWidth(this.labelNode.childNodes[0]);
 	label_w += 20;
@@ -68,17 +63,13 @@
 	dojo.style.setOuterWidth(this.targetNode, label_w);
 	dojo.style.setOuterHeight(this.targetNode, item_h); 
  
-	if (!this.parent.enabled){
+ 	if (this.parent.enabled == null) {
+ 		this.parent.enabled = true;
+ 	} else if (!this.parent.enabled){
 		this.setDisabled(true);
 	}	
 }
 
-
-//IMPORTANT remove this? simple pass through
-xap.bridges.dojo.MenuBarItemBridge.prototype.init = function() {
-	xap.bridges.dojo.DojoWidgetBridge.prototype.init.call(this);
-}
-
 xap.bridges.dojo.MenuBarItemBridge.prototype.getPeerString = function(){
     return "MenuBarItem2" ;
 }
@@ -160,11 +151,18 @@
 }
 
 xap.bridges.dojo.MenuBarItemBridge.prototype._enable = function() {
-	var peer = this.getPeer();
- 
+	var peer = this.getPeer(); 
+ 	
+ 	if (peer.parent && peer.parent.enabled == null) {
+ 		peer.parent.enabled = true;
+ 	} 
+	if (peer.enabled == null) {
+ 		peer.enabled = true;
+ 	}
+ 	
 	if (peer.parent && peer.parent.enabled && peer.enabled) {
 		peer.setDisabled(false);
-	} else {
+	} else {  
 		peer.setDisabled(true);
 	}
 }
@@ -201,10 +199,14 @@
 	this._getRootSpan().style.fontWeight = value; 
 }
 
-/** XML attribute set method for "fontWeight" */
+/** XML attribute set method for "visible" */
 xap.bridges.dojo.MenuBarItemBridge.prototype.setVisibleAttribute = function(value) {
 	var booleanValue = value == "true";
 	var peer = this.getPeer();
+
+	if (peer.visible == null) {
+		peer.visible = true;
+	}
 
 	if (peer.visible != booleanValue) {
 		peer.visible = booleanValue;

Modified: incubator/xap/trunk/src/xap/bridges/dojo/MenuBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/dojo/MenuBridge.js?view=diff&rev=471807&r1=471806&r2=471807
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/dojo/MenuBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/dojo/MenuBridge.js Mon Nov  6 10:23:08 2006
@@ -42,13 +42,7 @@
 				"xap.bridges.dojo.MenuBridge",
 				"xap.bridges.dojo.DojoWidgetBridge"						
 );
-
-
-//IMPORTANT remove this? simple pass through
-xap.bridges.dojo.MenuBridge.prototype.init = function() {
-	xap.bridges.dojo.DojoWidgetBridge.prototype.init.call(this);
-}
-
+ 
 xap.bridges.dojo.MenuBridge.prototype.getPeerString = function(){
     return "PopupMenu2" ;
 }

Modified: incubator/xap/trunk/src/xap/widgets/Button.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/widgets/Button.js?view=diff&rev=471807&r1=471806&r2=471807
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/Button.js (original)
+++ incubator/xap/trunk/src/xap/widgets/Button.js Mon Nov  6 10:23:08 2006
@@ -105,7 +105,7 @@
  * Get proper img URL for display.
  */
 xap.widgets.Button.prototype._getProperImgURL = function() {
-	imgURL = "";
+	var imgURL = "";
 
 	if (this.enabled) {
 		if (this.mousePressed && this.imgPressedURL != "") {

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=471807&r1=471806&r2=471807
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/Label.js (original)
+++ incubator/xap/trunk/src/xap/widgets/Label.js Mon Nov  6 10:23:08 2006
@@ -245,7 +245,7 @@
  * Show proper img for the label based on its state of enabled/disabled.
  */
 xap.widgets.Label.prototype._showImg = function() {
-	imgURL = this._getProperImgURL();
+	var imgURL = this._getProperImgURL();
 
 	if (imgURL != this.img.src) {
 		if (imgURL != "") {
@@ -263,7 +263,7 @@
  * Get proper img URL for display.
  */
 xap.widgets.Label.prototype._getProperImgURL = function() {
-	imgURL = "";
+	var imgURL = "";
 
 	if (!this.enabled && this.imgDisabledURL != "") {
 		imgURL = this.imgDisabledURL;

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=471807&r1=471806&r2=471807
==============================================================================
--- incubator/xap/trunk/src/xap/widgets/RadioButton.js (original)
+++ incubator/xap/trunk/src/xap/widgets/RadioButton.js Mon Nov  6 10:23:08 2006
@@ -86,7 +86,7 @@
 }
 
 xap.widgets.RadioButton.prototype._getProperImgURL = function () {
-	imgURL = "";
+	var imgURL = "";
 	if (this.enabled) {
 		if (this.selected) {
 			if (this.mousePressed && this.imgPressedSelectedURL != "") {