Anonymous avatar Anonymous committed fcfa958

Updated to work with new way of writing UI tags.

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

Comments (0)

Files changed (2)

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

  */
 package com.opensymphony.webwork.views.jsp.ui;
 
+import com.opensymphony.webwork.util.MakeIterator;
+
+import com.opensymphony.xwork.util.OgnlValueStack;
+
+import java.util.Collection;
 
 /**
  *
 public abstract class AbstractDoubleListTag extends AbstractListTag {
     //~ Instance fields ////////////////////////////////////////////////////////
 
-    private Object doubleListValue;
-    private Object doubleName;
-    private String doubleList;
-    private String doubleListKey;
+    protected String doubleListAttr;
+    protected String doubleListKeyAttr;
+    protected String doubleListValueAttr;
 
     //~ Methods ////////////////////////////////////////////////////////////////
 
-    public void setDoubleList(String doubleList) {
-        this.doubleList = doubleList;
+    
+    public void setDoubleList(String list) {
+        this.doubleListAttr = list;
     }
 
-    public String getDoubleList() {
-        return doubleList;
+    public void setDoubleListKey(String listKey) {
+        this.doubleListKeyAttr = listKey;
     }
 
-    public void setDoubleListKey(String doubleListKey) {
-        this.doubleListKey = doubleListKey;
+    public void setDoubleListValue(String listValue) {
+        this.doubleListValueAttr = listValue;
     }
+    
+    public void evaluateExtraParams(OgnlValueStack stack) {
+        super.evaluateExtraParams(stack);
+        
+        if (doubleListAttr != null) {
+            Object value = findValue(doubleListAttr);
+            addParam("doubleList", MakeIterator.convert(value));
+            if (value instanceof Collection) {
+                addParam("doubleListSize", new Integer(((Collection) value).size()));
+            }
+        }
 
-    public String getDoubleListKey() {
-        return doubleListKey;
-    }
-
-    public void setDoubleListValue(Object doubleListValue) {
-        this.doubleListValue = doubleListValue;
-    }
-
-    public Object getDoubleListValue() {
-        return doubleListValue;
-    }
-
-    public void setDoubleName(Object doubleName) {
-        this.doubleName = doubleName;
-    }
+        if (doubleListKeyAttr != null) {
+            addParam("doubleListKey", doubleListKeyAttr);
+        }
 
-    public Object getDoubleName() {
-        return doubleName;
+        if (doubleListValueAttr != null) {
+            addParam("doubleListValue", doubleListValueAttr);
+        }
     }
 }

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

  */
 package com.opensymphony.webwork.views.jsp.ui;
 
+import com.opensymphony.xwork.util.OgnlValueStack;
 
 /**
  * @version $Id$
     //~ Static fields/initializers /////////////////////////////////////////////
 
     /**
-     * The name of the default template for the SelectTag
+     * The name of the default template for the DoubleSelectTag.
      */
     final public static String TEMPLATE = "doubleselect.vm";
 
     //~ Instance fields ////////////////////////////////////////////////////////
 
-    private boolean multiple;
-    private int size;
+    protected String emptyOptionAttr;
+    protected String headerKeyAttr;
+    protected String headerValueAttr;
+    protected String multipleAttr;
+    protected String sizeAttr;
 
     //~ Methods ////////////////////////////////////////////////////////////////
 
-    public void setMultiple(boolean multiple) {
-        this.multiple = multiple;
+    public void setEmptyOption(String emptyOption) {
+        this.emptyOptionAttr = emptyOption;
     }
 
-    public boolean isMultiple() {
-        return multiple;
+    public void setHeaderKey(String headerKey) {
+        this.headerKeyAttr = headerKey;
     }
 
-    public void setSize(int size) {
-        this.size = size;
+    public void setHeaderValue(String headerValue) {
+        this.headerValueAttr = headerValue;
     }
 
-    public int getSize() {
-        return size;
+    public void setMultiple(String multiple) {
+        this.multipleAttr = multiple;
+    }
+
+    public void setSize(String size) {
+        this.sizeAttr = size;
+    }
+
+    public void evaluateExtraParams(OgnlValueStack stack) {
+        super.evaluateExtraParams(stack);
+
+        if (emptyOptionAttr != null) {
+            addParam("emptyOption", findValue(emptyOptionAttr, Boolean.class));
+        }
+
+        if (multipleAttr != null) {
+            addParam("multiple", findValue(multipleAttr, Boolean.class));
+        }
+
+        if (sizeAttr != null) {
+            addParam("size", findValue(sizeAttr, String.class));
+        }
+
+        if ((headerKeyAttr != null) && (headerValueAttr != null)) {
+            addParam("headerKey", findValue(headerKeyAttr, String.class));
+            addParam("headerValue", findValue(headerValueAttr, String.class));
+        }
     }
 
     protected String getDefaultTemplate() {
         return TEMPLATE;
     }
-}
+}
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.