click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sa...@apache.org
Subject svn commit: r788391 - in /incubator/click/trunk/click/extras/src/org/apache/click/extras/control: PickList.htm PickList.java
Date Thu, 25 Jun 2009 15:24:13 GMT
Author: sabob
Date: Thu Jun 25 15:24:13 2009
New Revision: 788391

URL: http://svn.apache.org/viewvc?rev=788391&view=rev
Log:
allow attributes to be set on the picklist rendered table

Modified:
    incubator/click/trunk/click/extras/src/org/apache/click/extras/control/PickList.htm
    incubator/click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java

Modified: incubator/click/trunk/click/extras/src/org/apache/click/extras/control/PickList.htm
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/extras/src/org/apache/click/extras/control/PickList.htm?rev=788391&r1=788390&r2=788391&view=diff
==============================================================================
--- incubator/click/trunk/click/extras/src/org/apache/click/extras/control/PickList.htm (original)
+++ incubator/click/trunk/click/extras/src/org/apache/click/extras/control/PickList.htm Thu
Jun 25 15:24:13 2009
@@ -17,7 +17,7 @@
    under the License.*#
 -->
 
-<table width="$size" class="picklist">
+<table width="$size" $!{attributes}>
 #if($unselectedLabel || $selectedLabel)
 <thead>
   <tr>
@@ -43,26 +43,26 @@
   </select>
 </td>
 <td valign="middle">
-  <input type="button" value="&gt;" style="width:60px;" 
-         onclick="pickListMove(${id}_unselected, $id, ${id}_hidden, true)"
+  <input type="button" value="&gt;" style="width:60px;"
+         onclick="pickListMove(document.getElementById('${id}_unselected'), document.getElementById('$id'),
document.getElementById('${id}_hidden'), true)"
     #if($readOnly || $disabled)
       disabled="disabled"
     #end
   /><br/>
-  <input type="button" value="&lt;" style="width:60px;" 
-         onclick="pickListMove($id, ${id}_unselected, ${id}_hidden, false)"
+  <input type="button" value="&lt;" style="width:60px;"
+         onclick="pickListMove(document.getElementById('$id'), document.getElementById('${id}_unselected'),
document.getElementById('${id}_hidden'), false)"
     #if($readOnly || $disabled)
       disabled="disabled"
     #end
   /><br/>
-  <input type="button" value="&gt;&gt;" style="width:60px;" 
-         onclick="pickListMoveAll(${id}_unselected, $id, ${id}_hidden, true)"
+  <input type="button" value="&gt;&gt;" style="width:60px;"
+         onclick="pickListMoveAll(document.getElementById('${id}_unselected'), document.getElementById('$id'),
document.getElementById('${id}_hidden'), true)"
     #if($readOnly || $disabled)
       disabled="disabled"
     #end
   /><br/>
-  <input type="button" value="&lt;&lt;" style="width:60px;" 
-         onclick="pickListMoveAll($id, ${id}_unselected, ${id}_hidden, false)"
+  <input type="button" value="&lt;&lt;" style="width:60px;"
+         onclick="pickListMoveAll(document.getElementById('$id'), document.getElementById('${id}_unselected'),
document.getElementById('${id}_hidden'), false)"
     #if($readOnly || $disabled)
       disabled="disabled"
     #end

Modified: incubator/click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java
URL: http://svn.apache.org/viewvc/incubator/click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java?rev=788391&r1=788390&r2=788391&view=diff
==============================================================================
--- incubator/click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java (original)
+++ incubator/click/trunk/click/extras/src/org/apache/click/extras/control/PickList.java Thu
Jun 25 15:24:13 2009
@@ -645,9 +645,38 @@
             options.add(map);
         }
 
+        // Add all attributes to buffer
+        HtmlStringBuffer attributesBuffer = new HtmlStringBuffer();
+
+        // Add the CSS class 'picklist' to buffer
+        String cssClass = null;
+        if (hasAttribute("class")) {
+            cssClass = getAttribute("class");
+            attributesBuffer.append("class=\"");
+            if (cssClass != null) {
+                // If class attribute exists, temporarily remove it
+                setAttribute("class", null);
+
+                attributesBuffer.append(cssClass).append(" ");
+            }
+            attributesBuffer.append("picklist\"");
+        } else {
+            attributesBuffer.appendAttribute("class", "picklist");
+        }
+
+        if (hasAttributes()) {
+            attributesBuffer.appendAttributes(getAttributes());
+        }
+
+        // Restore class attribute
+        if (cssClass != null) {
+            setAttribute("class", cssClass);
+        }
+
         Map model = new HashMap();
 
         model.put("id", getId());
+        model.put("attributes", attributesBuffer.toString());
         model.put("name", getName());
         model.put("options", options);
         model.put("selectedLabel", selectedLabel);



Mime
View raw message