Anonymous avatar Anonymous committed 47b0af7

* added support for style & class UI attributes
* added form parameter when ww:form is used as a parent of a UI tag
* listkey and listvalue are no longer needed if the collection is a Map

git-svn-id: http://svn.opensymphony.com/svn/webwork/trunk@364 573baa09-0c28-0410-bef9-dab3c582ae83

Comments (0)

Files changed (15)

src/etc/taglib.tld

             <rtexprvalue>true</rtexprvalue>
         </attribute>
         <attribute>
+            <name>class</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>style</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
             <name>theme</name>
             <required>false</required>
             <rtexprvalue>true</rtexprvalue>
             <rtexprvalue>false</rtexprvalue>
         </attribute>
         <attribute>
+            <name>class</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>style</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
             <name>theme</name>
             <required>false</required>
             <rtexprvalue>true</rtexprvalue>
             <rtexprvalue>false</rtexprvalue>
         </attribute>
         <attribute>
+            <name>class</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>style</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
             <name>theme</name>
             <required>false</required>
             <rtexprvalue>true</rtexprvalue>
             <rtexprvalue>false</rtexprvalue>
         </attribute>
         <attribute>
+            <name>class</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>style</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
             <name>theme</name>
             <required>false</required>
             <rtexprvalue>true</rtexprvalue>
             <rtexprvalue>false</rtexprvalue>
         </attribute>
         <attribute>
+            <name>class</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>style</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
             <name>theme</name>
             <required>false</required>
             <rtexprvalue>true</rtexprvalue>
             <rtexprvalue>false</rtexprvalue>
         </attribute>
         <attribute>
+            <name>class</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>style</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
             <name>theme</name>
             <required>false</required>
             <rtexprvalue>true</rtexprvalue>
             <rtexprvalue>false</rtexprvalue>
         </attribute>
         <attribute>
+            <name>class</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>style</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
             <name>label</name>
             <required>false</required>
             <rtexprvalue>true</rtexprvalue>
             <rtexprvalue>false</rtexprvalue>
         </attribute>
         <attribute>
+            <name>class</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>style</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
             <name>theme</name>
             <required>false</required>
             <rtexprvalue>true</rtexprvalue>
             <rtexprvalue>false</rtexprvalue>
         </attribute>
         <attribute>
+            <name>class</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>style</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
             <name>size</name>
             <required>false</required>
             <rtexprvalue>false</rtexprvalue>
             <rtexprvalue>false</rtexprvalue>
         </attribute>
         <attribute>
+            <name>class</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>style</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
             <name>theme</name>
             <required>false</required>
             <rtexprvalue>true</rtexprvalue>
         <bodycontent>JSP</bodycontent>
         <info>An HTML Textarea UI widget</info>
         <attribute>
+            <name>id</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>class</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>style</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
             <name>theme</name>
             <required>false</required>
             <rtexprvalue>true</rtexprvalue>
         <bodycontent>JSP</bodycontent>
         <info>An HTML TextField UI widget</info>
         <attribute>
+            <name>id</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>class</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>style</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
             <name>theme</name>
             <required>false</required>
             <rtexprvalue>true</rtexprvalue>
         <bodycontent>JSP</bodycontent>
         <info>An HTML File UI widget</info>
         <attribute>
+            <name>id</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>class</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
+            <name>style</name>
+            <required>false</required>
+            <rtexprvalue>true</rtexprvalue>
+        </attribute>
+        <attribute>
             <name>theme</name>
             <required>false</required>
             <rtexprvalue>true</rtexprvalue>
             <rtexprvalue>false</rtexprvalue>
         </attribute>
         <attribute>
-            <name>id</name>
-            <required>false</required>
-            <rtexprvalue>false</rtexprvalue>
-        </attribute>
-        <attribute>
             <name>contentName</name>
             <required>true</required>
             <rtexprvalue>false</rtexprvalue>

src/example/com/opensymphony/webwork/example/ui/SimpleAction.java

 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.HashMap;
 
 
 /**
         this.multiValues = new String[2];
         this.multiValues[0] = "bar";
         this.multiValues[1] = "biz";
+
+        this.map = new HashMap();
+        this.map.put("ABC", "123");
+        this.map.put("XYZ", "789");
     }
 
     //~ Inner Classes //////////////////////////////////////////////////////////

src/java/com/opensymphony/webwork/views/jsp/ui/AbstractListTag.java

     }
 
     public void evaluateExtraParams(OgnlValueStack stack) {
+        Object value = findValue(listAttr);
         if (listAttr != null) {
-            Object value = findValue(listAttr);
             if (value instanceof Collection) {
                 addParam("list", value);
                 addParam("listSize", new Integer(((Collection) value).size()));
 
         if (listKeyAttr != null) {
             addParam("listKey", listKeyAttr);
+        } else if (value instanceof Map) {
+            addParam("listKey", "key");
         }
 
         if (listValueAttr != null) {
             addParam("listValue", listValueAttr);
+        } else if (value instanceof Map) {
+            addParam("listValue", "value");
         }
     }
 

src/java/com/opensymphony/webwork/views/jsp/ui/AbstractUITag.java

     protected String templateAttr;
     protected String themeAttr;
     protected String valueAttr;
+    protected String classAttr;
 
     //~ Methods ////////////////////////////////////////////////////////////////
 
         valueAttr = aValue;
     }
 
+    public void setClass(String aClass) {
+        classAttr = aClass;
+    }
+
     public int doEndTag() throws JspException {
         try {
             OgnlValueStack stack = getStack();
             addParam("onchange", findValue(onchangeAttr, String.class));
         }
 
+        if (classAttr != null) {
+            addParam("class", findValue(classAttr, String.class));
+        }
+
+        FormTag tag = (FormTag) findAncestorWithClass(this, FormTag.class);
+        if (tag != null)
+        {
+            addParam("form", tag.getParams());
+        }
+
         Class valueClazz = getValueClassType();
 
         if (valueClazz != null) {

src/java/template/xhtml/checkbox.vm

                 #if ($parameters.tabindex)         tabindex="$!webwork.htmlEncode($parameters.tabindex)"    #end
                 #if ($parameters.onchange)         onchange="$!webwork.htmlEncode($parameters.onchange)"    #end
                 #if ($parameters.id)               id="$!webwork.htmlEncode($parameters.id)"                #end
+                #if ($parameters.get('class'))     class="$!webwork.htmlEncode($parameters.get('class'))"   #end
+                #if ($parameters.style)            style="$!webwork.htmlEncode($parameters.style)"          #end
                 />
             </td>
             <td width="100%" valign="top">

src/java/template/xhtml/combobox.vm

 #if ($parameters.tabindex)         tabindex="$!webwork.htmlEncode($parameters.tabindex)"    #end
 #if ($parameters.onchange)         onchange="$!webwork.htmlEncode($parameters.onchange)"    #end
 #if ($parameters.id)               id="$!webwork.htmlEncode($parameters.id)"                #end
+#if ($parameters.get('class'))     class="$!webwork.htmlEncode($parameters.get('class'))"   #end
+#if ($parameters.style)            style="$!webwork.htmlEncode($parameters.style)"          #end
 /><br/>
 
 #if ($parameters.list)

src/java/template/xhtml/file.vm

 #if ($parameters.id)               id="$!webwork.htmlEncode($parameters.id)"                #end
 #if ($parameters.accept)           accept="$!webwork.htmlEncode($parameters.accept)"        #end
 #if ($parameters.onchange)         onchange="$!parameters.onchange"                         #end
+#if ($parameters.get('class'))     class="$!webwork.htmlEncode($parameters.get('class'))"   #end
+#if ($parameters.style)            style="$!webwork.htmlEncode($parameters.style)"          #end
 />
 
 #parse("/template/xhtml/controlfooter.vm")

src/java/template/xhtml/form.vm

 <table>
 <form
+    #if ($parameters.id)        id="$!webwork.htmlEncode($parameters.id)"           #end
     #if ($parameters.name)      name="$!webwork.htmlEncode($parameters.name)"       #end
     #if ($parameters.action)    action="$!webwork.htmlEncode($parameters.action)"   #end
     #if ($parameters.method)    method="$!webwork.htmlEncode($parameters.method)"   #end

src/java/template/xhtml/hidden.vm

     type="hidden"
     #if ($parameters.name)      name="$!webwork.htmlEncode($parameters.name)"       #end
     #if ($parameters.nameValue) value="$!webwork.htmlEncode($parameters.nameValue)" #end
+    #if ($parameters.get('class'))     class="$!webwork.htmlEncode($parameters.get('class'))"   #end
+    #if ($parameters.style)            style="$!webwork.htmlEncode($parameters.style)"          #end
 />

src/java/template/xhtml/label.vm

   --                       to the control.  Default is to the left of the control.
   *#
 #parse("/template/xhtml/controlheader.vm")
-<label> $!webwork.htmlEncode($parameters.nameValue) </label>
+<label
+#if ($parameters.id)               id="$!webwork.htmlEncode($parameters.id)"                #end
+#if ($parameters.get('class'))     class="$!webwork.htmlEncode($parameters.get('class'))"   #end
+#if ($parameters.style)            style="$!webwork.htmlEncode($parameters.style)"          #end
+> $!webwork.htmlEncode($parameters.nameValue) </label>
 #parse("/template/xhtml/controlfooter.vm")

src/java/template/xhtml/radiomap.vm

             #if ($parameters.disabled)  disabled="disabled"             #end
             #if ($parameters.tabindex)  tabindex="$!webwork.htmlEncode($parameters.tabindex)" #end
             #if ($parameters.onchange)  onchange="$!webwork.htmlEncode($parameters.onchange)" #end
+            #if ($parameters.get('class'))     class="$!webwork.htmlEncode($parameters.get('class'))"   #end
+            #if ($parameters.style)            style="$!webwork.htmlEncode($parameters.style)"          #end
         />
         <label for="$!webwork.htmlEncode($parameters.name)$!webwork.htmlEncode($itemKey)">$!itemValue</label>
 

src/java/template/xhtml/select.vm

     #if ($parameters.onchange)         onchange="$parameters.onchange"    #end
     #if ($parameters.id)               id="$parameters.id"                #end
     #if ($parameters.multiple)         multiple="multiple"                #end
+    #if ($parameters.get('class'))     class="$!webwork.htmlEncode($parameters.get('class'))"   #end
+    #if ($parameters.style)            style="$!webwork.htmlEncode($parameters.style)"          #end
 >
 
 #if ($parameters.headerKey && $parameters.headerValue)

src/java/template/xhtml/submit.vm

             type="submit"
             #if ($parameters.name)       name="$!webwork.htmlEncode($parameters.name)"           #end
             #if ($parameters.nameValue)  value="$!webwork.htmlEncode($parameters.nameValue)"     #end
+            #if ($parameters.get('class'))     class="$!webwork.htmlEncode($parameters.get('class'))"   #end
+            #if ($parameters.style)            style="$!webwork.htmlEncode($parameters.style)"          #end
         /></div>
 #parse( "/template/xhtml/controlfooter.vm" )

src/java/template/xhtml/text.vm

 #if ($parameters.size)             size="$!webwork.htmlEncode($parameters.size)"            #end
 #if ($parameters.maxlength)        maxlength="$!webwork.htmlEncode($parameters.maxlength)"  #end
 #if ($parameters.nameValue)        value="$!webwork.htmlEncode($parameters.nameValue)"      #end
-#if ($parameters.disabled == true) disabled="disabled"                #end
-#if ($parameters.readonly)         readonly="readonly"                #end
+#if ($parameters.disabled == true) disabled="disabled"                                      #end
+#if ($parameters.readonly)         readonly="readonly"                                      #end
 #if ($parameters.onkeyup)          onkeyup="$!webwork.htmlEncode($parameters.onkeyup)"      #end
 #if ($parameters.tabindex)         tabindex="$!webwork.htmlEncode($parameters.tabindex)"    #end
 #if ($parameters.onchange)         onchange="$!webwork.htmlEncode($parameters.onchange)"    #end
 #if ($parameters.id)               id="$!webwork.htmlEncode($parameters.id)"                #end
+#if ($parameters.get('class'))     class="$!webwork.htmlEncode($parameters.get('class'))"   #end
+#if ($parameters.style)            style="$!webwork.htmlEncode($parameters.style)"          #end
 />
 
 #parse("/template/xhtml/controlfooter.vm")

src/java/template/xhtml/textarea.vm

 #if ($parameters.tabindex)         tabindex="$!webwork.htmlEncode($parameters.tabindex)"    #end
 #if ($parameters.onchange)         onchange="$!webwork.htmlEncode($parameters.onchange)"    #end
 #if ($parameters.id)               id="$!webwork.htmlEncode($parameters.id)"                #end
+#if ($parameters.get('class'))     class="$!webwork.htmlEncode($parameters.get('class'))"   #end
+#if ($parameters.style)            style="$!webwork.htmlEncode($parameters.style)"          #end
 >$!webwork.htmlEncode($parameters.nameValue)</textarea>
 
 #parse("/template/xhtml/controlfooter.vm")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.