[seam-commits] Seam SVN: r10303 - in trunk: ui/src/main/config/component and 2 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Sun Apr 5 22:40:33 EDT 2009


Author: smendenh at redhat.com
Date: 2009-04-05 22:40:32 -0400 (Sun, 05 Apr 2009)
New Revision: 10303

Modified:
   trunk/doc/Seam_Reference_Guide/en-US/Controls.xml
   trunk/ui/src/main/config/component/decorate.xml
   trunk/ui/src/main/java/org/jboss/seam/ui/component/UIDecorate.java
   trunk/ui/src/main/java/org/jboss/seam/ui/renderkit/DecorateRendererBase.java
Log:
Added enclose and element attributes in response to https://jira.jboss.org/jira/browse/JBSEAM-3339

Modified: trunk/doc/Seam_Reference_Guide/en-US/Controls.xml
===================================================================
--- trunk/doc/Seam_Reference_Guide/en-US/Controls.xml	2009-04-06 01:36:22 UTC (rev 10302)
+++ trunk/doc/Seam_Reference_Guide/en-US/Controls.xml	2009-04-06 02:40:32 UTC (rev 10303)
@@ -634,6 +634,21 @@
                      to use to decorate the component
                 </para>
               </listitem>
+              <listitem>
+                  <para>
+                     <literal>enclose</literal> &#8212; if true, the template 
+                     	 used to decorate the input field is enclosed by the 
+                     	 element specified with the "element" attribute. By 
+                     	 default this is a div element.
+                </para>
+              </listitem>
+              <listitem>
+                  <para>
+                     <literal>element</literal> &#8212; the element to enclose 
+                         the template used to decorate the input field.  By default, 
+                         the template is enclosed with a div element.
+                </para>
+              </listitem>
             </itemizedlist>
             <para>
                <literal>#{invalid}</literal> and <literal>#{required}</literal> 

Modified: trunk/ui/src/main/config/component/decorate.xml
===================================================================
--- trunk/ui/src/main/config/component/decorate.xml	2009-04-06 01:36:22 UTC (rev 10302)
+++ trunk/ui/src/main/config/component/decorate.xml	2009-04-06 02:40:32 UTC (rev 10303)
@@ -41,6 +41,24 @@
 	        <description>XHTML template to use to decorate the input field</description>
 	    </property>
 	    
+	    <property el="false">
+			<name>enclose</name>
+			<classname>boolean</classname>
+			<description>if true, the template used to decorate the input field is
+			             enclosed by the element specified with the "element"
+			             attribute. By default this is a div element.
+			</description>
+			<defaultvalue>true</defaultvalue>
+		</property>
+		
+		<property el="false">
+			<name>element</name>
+			<classname>java.lang.String</classname>
+			<description>the element to enclose the template used to decorate the input field.
+			             By default, the template is enclosed with a div element.</description>
+			<defaultvalue>"div"</defaultvalue>
+		</property>
+	    
 	</component>
     
 </components>

Modified: trunk/ui/src/main/java/org/jboss/seam/ui/component/UIDecorate.java
===================================================================
--- trunk/ui/src/main/java/org/jboss/seam/ui/component/UIDecorate.java	2009-04-06 01:36:22 UTC (rev 10302)
+++ trunk/ui/src/main/java/org/jboss/seam/ui/component/UIDecorate.java	2009-04-06 02:40:32 UTC (rev 10303)
@@ -73,6 +73,13 @@
    
    public abstract void setStyle(String style);
    
+   public abstract boolean isEnclose();
+      
+   public abstract void setEnclose(boolean enclose);
+      
+   public abstract String getElement();
+     
+   public abstract void setElement(String element);  
 
    public UIComponent getDecoration(String name)
    {

Modified: trunk/ui/src/main/java/org/jboss/seam/ui/renderkit/DecorateRendererBase.java
===================================================================
--- trunk/ui/src/main/java/org/jboss/seam/ui/renderkit/DecorateRendererBase.java	2009-04-06 01:36:22 UTC (rev 10302)
+++ trunk/ui/src/main/java/org/jboss/seam/ui/renderkit/DecorateRendererBase.java	2009-04-06 02:40:32 UTC (rev 10303)
@@ -75,16 +75,19 @@
 
       boolean hasMessage = decorate.hasMessage();
 
-      writer.startElement("div", decorate);
-      if (decorate.getStyleClass() != null)
+      if (decorate.isEnclose())
       {
-         writer.writeAttribute(HTML.CLASS_ATTR, decorate.getStyleClass(), HTML.CLASS_ATTR);
+          writer.startElement(decorate.getElement(), decorate);
+          if (decorate.getStyleClass() != null)
+          {
+             writer.writeAttribute(HTML.CLASS_ATTR, decorate.getStyleClass(), HTML.CLASS_ATTR);
+          }
+          if (decorate.getStyle() != null)
+          {
+             writer.writeAttribute(HTML.STYLE_ATTR, decorate.getStyle(), HTML.STYLE_ATTR);
+          }
+          writer.writeAttribute("id", decorate.getClientId(context), "id");
       }
-      if (decorate.getStyle() != null)
-      {
-         writer.writeAttribute(HTML.STYLE_ATTR, decorate.getStyle(), HTML.STYLE_ATTR);
-      }
-      writer.writeAttribute("id", decorate.getClientId(context), "id");
 
       UIComponent aroundDecoration = decorate.getDecoration("aroundField");
       UIComponent aroundInvalidDecoration = decorate.getDecoration("aroundInvalidField");
@@ -118,7 +121,10 @@
          aroundInvalidDecoration.setParent(decorate);
          aroundInvalidDecoration.encodeEnd(context);
       }
-      context.getResponseWriter().endElement("div");
+      if (decorate.isEnclose())
+      {
+          context.getResponseWriter().endElement(decorate.getElement());
+      }
 
       restoreOriginalValues(storeOriginals, Contexts.getEventContext());
    }




More information about the seam-commits mailing list