[richfaces-svn-commits] JBoss Rich Faces SVN: r5111 - in trunk/sandbox/ui/pickList/src/main: java/org/richfaces/renderkit and 1 other directory.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Sat Dec 29 11:40:57 EST 2007


Author: abelevich
Date: 2007-12-29 11:40:57 -0500 (Sat, 29 Dec 2007)
New Revision: 5111

Modified:
   trunk/sandbox/ui/pickList/src/main/config/component/picklist.xml
   trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
Log:
add width attribute

Modified: trunk/sandbox/ui/pickList/src/main/config/component/picklist.xml
===================================================================
--- trunk/sandbox/ui/pickList/src/main/config/component/picklist.xml	2007-12-29 15:44:14 UTC (rev 5110)
+++ trunk/sandbox/ui/pickList/src/main/config/component/picklist.xml	2007-12-29 16:40:57 UTC (rev 5111)
@@ -109,8 +109,13 @@
        			<classname>java.lang.String</classname>
        		</property>
        		
+       		<property>
+       			<name>width</name>
+       			<classname>java.lang.String</classname>
+       			<defaultvalue>"70px"</defaultvalue>
+       		</property>
+       	  		
        		
-       		
        	</properties>
        
     </component>

Modified: trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java
===================================================================
--- trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java	2007-12-29 15:44:14 UTC (rev 5110)
+++ trunk/sandbox/ui/pickList/src/main/java/org/richfaces/renderkit/PickListRenderer.java	2007-12-29 16:40:57 UTC (rev 5111)
@@ -174,13 +174,17 @@
 		 writer.endElement("table");
 	 }
 	 
-	 private void encodeSelect(FacesContext facesContext, UIComponent uiComponent, String clientId, boolean disabled,
+	 private void encodeSelect(FacesContext context, UIComponent component, String clientId, boolean disabled,
       		int size, List selectItemsToDisplay, Converter converter, ResponseWriter writer) throws IOException {
 
-		writer.startElement("select", uiComponent);
+		writer.startElement("select", component);
 		writer.writeAttribute("id", clientId, "id");
 		writer.writeAttribute("name", clientId, null);
 		writer.writeAttribute("multiple", "true", null);
+		String width = (String) component.getAttributes().get("width");
+		if(width != null) {
+			writer.writeAttribute("style", "width: " + width + ";", null);
+		}	
 		
 		if (size == 0) {
 			writer.writeAttribute("size", Integer.toString(selectItemsToDisplay.size()), null);
@@ -191,7 +195,7 @@
 			writer.writeAttribute(HTML.DISABLED_ATTR, Boolean.TRUE, null);
 		}
 		
-		renderSelectOptions(facesContext, uiComponent, converter, Collections.EMPTY_SET, selectItemsToDisplay);
+		renderSelectOptions(context, component, converter, Collections.EMPTY_SET, selectItemsToDisplay);
 		writer.writeText("", null);
 		writer.endElement("select");
 	 }




More information about the richfaces-svn-commits mailing list