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 2006/11/30 02:23:57 UTC

svn commit: r480808 - in /incubator/xap/trunk: WebContent/examples/widgets/standardButtons.xal src/xap/bridges/basic/AbstractWidgetBridge.js

Author: jmargaris
Date: Wed Nov 29 18:23:56 2006
New Revision: 480808

URL: http://svn.apache.org/viewvc?view=rev&rev=480808
Log:
visible true/false working

Modified:
    incubator/xap/trunk/WebContent/examples/widgets/standardButtons.xal
    incubator/xap/trunk/src/xap/bridges/basic/AbstractWidgetBridge.js

Modified: incubator/xap/trunk/WebContent/examples/widgets/standardButtons.xal
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/WebContent/examples/widgets/standardButtons.xal?view=diff&rev=480808&r1=480807&r2=480808
==============================================================================
--- incubator/xap/trunk/WebContent/examples/widgets/standardButtons.xal (original)
+++ incubator/xap/trunk/WebContent/examples/widgets/standardButtons.xal Wed Nov 29 18:23:56 2006
@@ -76,6 +76,14 @@
 	<button width="200px" height="25px" text="fontSize-> '8'"
 		onCommand="mco:attributeSetter.setAttribute(testComponent,
 				'fontSize' ,'8px')"/>
+				
+	<button width="200px" height="25px" text="visible-> 'false'"
+		onCommand="mco:attributeSetter.setAttribute(testComponent,
+				'visible' ,'false')"/>
+				
+	<button width="200px" height="25px" text="visible-> 'true'"
+		onCommand="mco:attributeSetter.setAttribute(testComponent,
+				'visible' ,'true')"/>
 
 </horizontalFlowPane>
 	<horizontalBoxPane>

Modified: incubator/xap/trunk/src/xap/bridges/basic/AbstractWidgetBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/bridges/basic/AbstractWidgetBridge.js?view=diff&rev=480808&r1=480807&r2=480808
==============================================================================
--- incubator/xap/trunk/src/xap/bridges/basic/AbstractWidgetBridge.js (original)
+++ incubator/xap/trunk/src/xap/bridges/basic/AbstractWidgetBridge.js Wed Nov 29 18:23:56 2006
@@ -505,7 +505,7 @@
 		"borderWidth","borderColor","borderStyle","margin",
 		"padding","color","textDecoration","fontFamily",
 		"fontStyle","fontWeight", "fontSize", "textAlign",
-		"popup","tooltip", "focused", "disabled"];
+		"popup","tooltip", "focused", "disabled","visible"];
 }
 
 
@@ -516,6 +516,31 @@
 **/ 
 xap.bridges.basic.AbstractWidgetBridge.prototype._getNameToSetterMap = function(){
 	return this.constructor._nameToSetterMap ;
+}
+
+/** XML attribute set method for "x" */
+xap.bridges.basic.AbstractWidgetBridge.prototype.setVisibleAttribute = function(value){
+	var rootNode = this.getRootDomNode();
+	if (!rootNode) return;
+	
+	if (value=="false"){
+		rootNode.style.visibility = "hidden";
+		
+		//save the old display if it was set
+		this._oldDisplay = rootNode.style.display;
+		rootNode.style.display = "none";
+	}
+	else if (value=="true"){
+		rootNode.style.visibility = "visible";
+		
+		//if old display is saved roll back to it
+		if (this._oldDisplay){
+			rootNode.style.display = this._oldDisplay;
+			delete this.oldDisplay;
+		}
+		//otherwise just do the best we can
+		else rootNode.style.display = "";
+	}
 }
 
 /** XML attribute set method for "x" */