incubator-xap-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmarga...@apache.org
Subject svn commit: r614058 - /incubator/xap/trunk/codebase/src/xap/bridges/dojo/TabBridge.js
Date Mon, 21 Jan 2008 23:46:32 GMT
Author: jmargaris
Date: Mon Jan 21 15:46:30 2008
New Revision: 614058

URL: http://svn.apache.org/viewvc?rev=614058&view=rev
Log:
https://issues.apache.org/jira/browse/XAP-558

Modified:
    incubator/xap/trunk/codebase/src/xap/bridges/dojo/TabBridge.js

Modified: incubator/xap/trunk/codebase/src/xap/bridges/dojo/TabBridge.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/codebase/src/xap/bridges/dojo/TabBridge.js?rev=614058&r1=614057&r2=614058&view=diff
==============================================================================
--- incubator/xap/trunk/codebase/src/xap/bridges/dojo/TabBridge.js (original)
+++ incubator/xap/trunk/codebase/src/xap/bridges/dojo/TabBridge.js Mon Jan 21 15:46:30 2008
@@ -58,13 +58,44 @@
 	var parentHandler = this.getUiContentHandler().getHandlerForElement( parentElement );
 	this._tabContainer =  parentHandler.getPeer();
 	
-	this._wasSelected = 
-			(this._tabContainer.selectedChildWidget == this.getPeer()) ;
+	this._wasSelected = (this._tabContainer.selectedChildWidget == this.getPeer()) ;
 	
 	//add listener last so we don't fire for the initial set
-	dojo.event.connect(this._tabContainer, "selectChild",this,"onSelect");		
+	dojo.event.connect(this._tabContainer, "selectChild",this,"onSelect");	
+	
+	
+	// get/make tab button elements
+	this._titleNode = this.getPeer().controlButton.titleNode;
+	this._imageNode = document.createElement("img");
+	
+	this._imageNode.style.verticalAlign = 'bottom';
+	
+	//	We set image attributes here because it is not in the original Dojo template
+	//	so we have to create the image on-the-fly and then add attributes to it
+	if(this.getPeer().imageSrc) {
+		this._imageNode.src = this.getPeer().imageSrc;
+	} else {
+		this._imageNode.style.visibility = "hidden";
+	}
+	
+	if(this.getPeer().imageWidth) {
+		this._imageNode.style.width = this.getPeer().imageWidth;
+	} else {
+		this._imageNode.style.width  = "1px"
+	}
+	
+	if(this.getPeer().imageHeight) {
+		this._imageNode.style.height = this.getPeer().imageHeight;
+	} else {
+		this._imageNode.style.height = "1px"
+	}
+
+	// add the image to the tab	
+	this.getPeer().controlButton.innerDiv.insertBefore(this._imageNode, this._titleNode);
+		
 }
 
+
 xap.bridges.dojo.TabBridge.prototype.unload = function(){
 	dojo.event.disconnect(this._tabContainer, "selectChild",this,"onSelect");
 }
@@ -90,9 +121,6 @@
 }
 
 
-
-
-
 xap.bridges.dojo.TabBridge.prototype.getPeerString = function(){
     return "SoloPanel" ;
 }
@@ -107,13 +135,43 @@
  
  
 xap.bridges.dojo.TabBridge.prototype.getNewAllowedAttributes = function(){
-	return ["text", "selected"];
+	return ["text", "selected", "image", "imageWidth", "imageHeight"];
 }
 
-//TODO make dynamic
+
 xap.bridges.dojo.TabBridge.prototype.setTextAttribute = function(value){
-	this.getPeer().label = value;
-}	
+	if(this._titleNode) {
+		this._titleNode.innerHTML = value;
+	} else {
+		this.getPeer().label = value;
+	}
+}
+
+xap.bridges.dojo.TabBridge.prototype.setImageAttribute = function(value) {
+	if(this._imageNode) {
+		this._imageNode.src = value;
+	} else {
+		this.getPeer().imageSrc = value;
+	}
+}
+
+xap.bridges.dojo.TabBridge.prototype.setImageHeightAttribute = function(value) {
+	if(this._imageNode) {
+		this._imageNode.style.height = value;
+	} else {
+		this.getPeer().imageHeight = value;
+	}
+}
+
+xap.bridges.dojo.TabBridge.prototype.setImageWidthAttribute = function(value) {
+	if(this._imageNode) {
+		this._imageNode.style.width = value;
+	} else {
+		this.getPeer().imageWidth = value;
+	}
+}
+
+
 
 xap.bridges.dojo.TabBridge.prototype.setSelectedAttribute = function(value){
 	



Mime
View raw message