[richfaces-svn-commits] JBoss Rich Faces SVN: r5355 - in trunk/sandbox/ui/combobox/src/main: resources/org/richfaces/renderkit/html/scripts and 1 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Mon Jan 14 11:32:51 EST 2008


Author: abelevich
Date: 2008-01-14 11:32:51 -0500 (Mon, 14 Jan 2008)
New Revision: 5355

Modified:
   trunk/sandbox/ui/combobox/src/main/config/component/combobox.xml
   trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
   trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
Log:
add support for buttonIcon, buttonDisabledIcon, buttonNormalIcon

Modified: trunk/sandbox/ui/combobox/src/main/config/component/combobox.xml
===================================================================
--- trunk/sandbox/ui/combobox/src/main/config/component/combobox.xml	2008-01-14 15:51:30 UTC (rev 5354)
+++ trunk/sandbox/ui/combobox/src/main/config/component/combobox.xml	2008-01-14 16:32:51 UTC (rev 5355)
@@ -134,6 +134,12 @@
 		    	<defaultvalue><![CDATA[""]]></defaultvalue>
 		    </property>
 		    <property>
+		    	<name>buttonIconNormal</name>
+		    	<classname>java.lang.String</classname>
+		        <description>URI</description>
+		    	<defaultvalue><![CDATA[""]]></defaultvalue>
+		    </property>
+		    <property>
 		    	<name>defaultLabel</name>
 		    	<classname>java.lang.String</classname>
 		        <description></description>

Modified: trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js
===================================================================
--- trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js	2008-01-14 15:51:30 UTC (rev 5354)
+++ trunk/sandbox/ui/combobox/src/main/resources/org/richfaces/renderkit/html/scripts/combobox.js	2008-01-14 16:32:51 UTC (rev 5355)
@@ -85,19 +85,28 @@
 	
 	buttonMouseOverHandler : function(e) {
 		var classCss = this.classes.BUTTON.CLASSES;
+		var iconStyles = this.classes.BUTTONICON.STYLE;
+		
 		if (this.isActive()) { 
 			this.button.className= classCss.ACTIVE + " " + classCss.HOVERED;
+			this.button.style.backgroundImage = iconStyles.ACTIVE
 		} else {
 			this.button.className = classCss.NORMAL + " " + classCss.HOVERED;
-		}	
+			this.button.style.backgroundImage = iconStyles.NORMAL; 
+		}
 	},
 	
 	buttonMouseOutHandler : function(e) {
+		var classCss = this.classes.BUTTON.CLASSES;
+		var iconStyles = this.classes.BUTTONICON.STYLE;
+		
 		if (this.isActive()) { 
-			this.button.className= this.classes.BUTTON.CLASSES.ACTIVE;
+			this.button.className= classCss.ACTIVE;
+			this.button.style.backgroundImage = iconStyles.ACTIVE
 		} else {
-			this.button.className = this.classes.BUTTON.CLASSES.NORMAL;
-		}	
+			this.button.className = classCss.NORMAL;
+			this.button.style.backgroundImage = iconStyles.NORMAL
+		}
 	},
 	
 	listMouseMoveHandler : function(event) {
@@ -251,8 +260,12 @@
 			this.button.className = this.classes.BUTTON.CLASSES.ACTIVE + " " + this.classes.BUTTON.CLASSES.HOVERED;
 		} else {
 			this.button.className = this.classes.BUTTON.CLASSES.ACTIVE ;
-		}	
- 		this.field.className = this.classes.FIELD.CLASSES.ACTIVE;
+		}
+		
+		var iconStyles = this.classes.BUTTONICON.STYLE;
+		this.button.style.backgroundImage = iconStyles.ACTIVE;
+		
+		this.field.className = this.classes.FIELD.CLASSES.ACTIVE;
  		this.buttonBG.className = this.classes.BUTTONBG.CLASSES.ACTIVE;
  		this.isDisabled = false;
 	},
@@ -262,6 +275,9 @@
 		this.buttonBG.className = this.classes.BUTTONBG.CLASSES.DISABLED;
 		this.field.className = this.classes.FIELD.CLASSES.DISABLED;
 		
+		var iconStyles = this.classes.BUTTONICON.STYLE;
+		this.button.style.backgroundImage = iconStyles.DISABLE
+			
 		this.button.disabled = true;
 		this.field.disabled = true;
 		
@@ -273,6 +289,9 @@
 		this.buttonBG.className = this.classes.BUTTONBG.CLASSES.NORMAL;
 		this.field.className = this.classes.FIELD.CLASSES.NORMAL;
 		
+		var iconStyles = this.classes.BUTTONICON.STYLE;
+		this.button.style.backgroundImage = iconStyles.NORMAL
+				
 		this.button.disabled = false;
 		this.field.disabled = false;
 		this.isDisabled = false;

Modified: trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx
===================================================================
--- trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx	2008-01-14 15:51:30 UTC (rev 5354)
+++ trunk/sandbox/ui/combobox/src/main/templates/combobox.jspx	2008-01-14 16:32:51 UTC (rev 5355)
@@ -67,9 +67,6 @@
 	    	variables.setVariable("value", value);
 
 	    	Object inputStyle = component.getAttributes().get("inputStyle");
-	    	if(inputStyle==null || inputStyle.equals("")) {
-	    		inputStyle = "\"\"";
-	    	}
 	    	variables.setVariable("inputStyle", inputStyle);
 	    	
 	    	Object inputClass = component.getAttributes().get("inputClass");
@@ -79,9 +76,6 @@
 	    	variables.setVariable("inputClass", inputClass);
 	    	
 	    	Object inputDisabledStyle = component.getAttributes().get("inputDisabledStyle");
-	    	if(inputDisabledStyle==null || inputDisabledStyle.equals("")) {
-	    		inputDisabledStyle = "\"\"";
-	    	}
 	    	variables.setVariable("inputDisabledStyle", inputDisabledStyle);
 	    	
 	    	Object inputDisabledClass = component.getAttributes().get("inputDisabledClass");
@@ -97,9 +91,6 @@
 	    	variables.setVariable("buttonDisabledClass", buttonDisabledClass);
 	    	
 	    	Object buttonDisabledStyle = component.getAttributes().get("buttonDisabledStyle");
-	    	if(buttonDisabledStyle==null || buttonDisabledStyle.equals("")) {
-	    		buttonDisabledStyle = "\"\"";
-	    	}
 	    	variables.setVariable("buttonDisabledStyle", buttonDisabledStyle);
 	    	
 	    	Object buttonClass = component.getAttributes().get("buttonClass");
@@ -109,15 +100,9 @@
 	    	variables.setVariable("buttonClass", buttonClass);
 	    	
 	    	Object buttonStyle = component.getAttributes().get("buttonStyle");
-	    	if(buttonStyle==null || buttonStyle.equals("")) {
-	    		buttonStyle = "\"\"";
-	    	}
 	    	variables.setVariable("buttonStyle", buttonStyle);
 	    	
 	    	Object listStyle = component.getAttributes().get("listStyle");
-	    	if(listStyle==null || listStyle.equals("")) {
-	    		listStyle = "\"\"";
-	    	}
 	    	variables.setVariable("listStyle", listStyle);
 	    	
 	    	Object listClass = component.getAttributes().get("listClass");
@@ -127,9 +112,6 @@
 	    	variables.setVariable("listClass", listClass);
 	    	
 	    	Object listDisabledStyle = component.getAttributes().get("listDisabledStyle");
-	    	if(listDisabledStyle==null || listDisabledStyle.equals("")) {
-	    		listDisabledStyle = "\"\"";
-	    	}
 	    	variables.setVariable("listDisabledStyle", listDisabledStyle);
 	    	
 	    	Object listDisabledClass = component.getAttributes().get("listDisabledClass");
@@ -168,6 +150,27 @@
     			curWidth = width;
     		}
     		variables.setVariable("curWidth", curWidth);
+    		
+    		String buttonIcon = (String)component.getAttributes().get("buttonIcon");
+    		if (buttonIcon != null && !buttonIcon.equals("")) {
+    			buttonIcon = "url('" + buttonIcon + "')";
+    		}
+    		variables.setVariable("buttonIcon", buttonIcon);
+    		
+    		String buttonIconDisabled = (String)component.getAttributes().get("buttonIconDisabled");
+    		if (buttonIconDisabled != null && !buttonIconDisabled.equals("")) {
+    			buttonIconDisabled = "url('" + buttonIconDisabled + "')";
+    		}
+    		variables.setVariable("buttonIconDisabled", buttonIconDisabled);
+    		
+    		String buttonIconNormal = (String)component.getAttributes().get("buttonIconNormal");
+    		if (buttonIconNormal != null && !buttonIconNormal.equals("")) {
+    			buttonIconNormal = "url('" + buttonIconNormal + "')";
+    		}
+       		variables.setVariable("buttonIconNormal", buttonIconNormal);
+ 
+    		
+    		
 		]]>
     </jsp:scriptlet>
 	<jsp:scriptlet>
@@ -202,7 +205,7 @@
 				   style="width:#{width}; #{inputStyle}"
 				   />
 			<input id="comboBoxButtonBG#{clientId}" readonly="true" type="text" value="" class="rich-combobox-font rich-combobox-button-background rich-combobox-button"/>
-			<input id="comboboxButton#{clientId}" readonly="true" disabled="#{disabled}" type="text" value="" style="#{buttonStyle}" 
+			<input id="comboboxButton#{clientId}" readonly="true" disabled="#{disabled}" type="text" value="" style="#{buttonStyle}; background-image: #{buttonIconNormal};" 
 				   class="rich-combobox-font-disabled rich-combobox-button-icon-disabled rich-combobox-button #{buttonDisabledClass}" 
 				   onmousedown="document.getElementById('comboBoxButtonBG#{clientId}').className='rich-combobox-font rich-combobox-button-pressed-background rich-combobox-button';"
 				   onmouseup="document.getElementById('comboBoxButtonBG#{clientId}').className='rich-combobox-font rich-combobox-button-background rich-combobox-button';"/>
@@ -231,30 +234,35 @@
 						  DISABLED : "rich-combobox-font-disabled rich-combobox-button-icon-disabled rich-combobox-button-disabled #{buttonDisabledClass}",
 						  HOVERED : "rich-combobox-button-hovered"},
 					  STYLE : 
-					  	 {NORMAL: #{buttonDisabledStyle},
-					  	  ACTIVE: #{buttonStyle},
-					  	  DISABLED:	#{buttonDisabledStyle}}
+					  	 {NORMAL: "#{buttonDisabledStyle}",
+					  	  ACTIVE: "#{buttonStyle}",
+					  	  DISABLED:	"#{buttonDisabledStyle}"}
 					  },	 
 			BUTTONBG : {CLASSES :
 			           	 {NORMAL:"rich-combobox-font-disabled rich-combobox-button-background-disabled rich-combobox-button-disabled", 
                           ACTIVE: "rich-combobox-font rich-combobox-button-background rich-combobox-button",
 			           	  DISABLED : "rich-combobox-font-disabled rich-combobox-button-background-disabled rich-combobox-button-disabled"}
-			         },           	 	   		   	  
+			         },    
+			BUTTONICON : {STYLE : 
+							{NORMAL: "#{buttonIconNormal}",
+							 ACTIVE: "#{buttonIcon}",
+							 DISABLED: "#{buttonIconDisabled}"}
+					  },	 	                 	 	   		   	  
 			FIELD : {CLASSES: 
 						{NORMAL : "rich-combobox-font-disabled rich-combobox-input-default-disabled rich-combobox-input-disabled #{inputDisabledClass}", 
 			 		 	ACTIVE : "rich-combobox-font rich-combobox-input-default rich-combobox-input #{inputClass}", 
 			 		 	DISABLED : "rich-combobox-font-disabled rich-combobox-input-default-disabled rich-combobox-input-disabled #{inputDisabledClass}"},
 			 		 STYLE : 	
-			 		 	{NORMAL : #{inputDisabledStyle},
-					  	  ACTIVE : #{inputStyle},
-					  	  DISABLED : #{inputDisabledStyle}}
+			 		 	{NORMAL : "#{inputDisabledStyle}",
+					  	  ACTIVE : "#{inputStyle}",
+					  	  DISABLED : "#{inputDisabledStyle}"}
 			 		 },	
 			COMBO_LIST : {
 				LIST : {CLASSES :
 						 {ACTIVE : "rich-combobox-list-cord rich-combobox-list-scroll rich-combobox-list-decoration rich-combobox-list-position #{listClass}",
 						  DISABLED : "rich-combobox-list-cord rich-combobox-list-scroll rich-combobox-list-decoration rich-combobox-list-position #{listDisabledClass}"},
-					    STYLE : {ACTIVE: #{listStyle},
-					  	  		 DISABLED:	#{listDisabledStyle}}
+					    STYLE : {ACTIVE: "#{listStyle}",
+					  	  		 DISABLED:	"#{listDisabledStyle}"}
 					   },  	  		 	  
 				ITEM : {NORMAL : "rich-combobox-item rich-combobox-item-normal #{itemClass}", 
 						SELECTED : "rich-combobox-item rich-combobox-item-selected #{itemSelectedClass}",




More information about the richfaces-svn-commits mailing list