You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lo...@apache.org on 2015/06/05 08:34:06 UTC

svn commit: r1683664 - in /myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main: java/org/apache/myfaces/tobago/example/test/SelectManyListboxBean.java webapp/test/selectManyListbox/selectManyListbox-value.xhtml

Author: lofwyr
Date: Fri Jun  5 06:34:05 2015
New Revision: 1683664

URL: http://svn.apache.org/r1683664
Log:
TOBAGO-1453: SelectManyRendererBase should support Collection
- test

Modified:
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/SelectManyListboxBean.java
    myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/selectManyListbox/selectManyListbox-value.xhtml

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/SelectManyListboxBean.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/SelectManyListboxBean.java?rev=1683664&r1=1683663&r2=1683664&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/SelectManyListboxBean.java (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/SelectManyListboxBean.java Fri Jun  5 06:34:05 2015
@@ -20,49 +20,100 @@
 package org.apache.myfaces.tobago.example.test;
 
 import java.util.Collection;
+import java.util.Currency;
+import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Set;
 
 public class SelectManyListboxBean {
 
-  private List<String> list;
+  private List<String> stringList;
+  private String[] stringArray;
+  private Set<String> stringSet = new HashSet<String>();
+  private Collection<String> stringCollection = new LinkedList<String>();
 
-  private Set<String> set;
+  private List<Currency> currencyList;
+  private Currency[] currencyArray;
+  private Set<Currency> currencySet = new HashSet<Currency>();
+  private Collection<Currency> currencyCollection = new LinkedList<Currency>();
 
-  private Collection<String> collection = new LinkedList<String>();
+  private Currency[] currencyItems;
 
-  private String[] array;
+  public SelectManyListboxBean() {
+    currencyItems = new Currency[]{
+        Currency.getInstance("JPY"),
+        Currency.getInstance("TTD"),
+        Currency.getInstance("USD"),
+        Currency.getInstance("EUR")
+    };
+  }
+
+  public List<String> getStringList() {
+    return stringList;
+  }
+
+  public void setStringList(final List<String> stringList) {
+    this.stringList = stringList;
+  }
+
+  public String[] getStringArray() {
+    return stringArray;
+  }
+
+  public void setStringArray(final String[] stringArray) {
+    this.stringArray = stringArray;
+  }
+
+  public Set<String> getStringSet() {
+    return stringSet;
+  }
+
+  public void setStringSet(final Set<String> stringSet) {
+    this.stringSet = stringSet;
+  }
+
+  public Collection<String> getStringCollection() {
+    return stringCollection;
+  }
+
+  public void setStringCollection(final Collection<String> stringCollection) {
+    this.stringCollection = stringCollection;
+  }
+
+  public List<Currency> getCurrencyList() {
+    return currencyList;
+  }
 
-  public List<String> getList() {
-    return list;
+  public void setCurrencyList(final List<Currency> currencyList) {
+    this.currencyList = currencyList;
   }
 
-  public void setList(final List<String> list) {
-    this.list = list;
+  public Currency[] getCurrencyArray() {
+    return currencyArray;
   }
 
-  public String[] getArray() {
-    return array;
+  public void setCurrencyArray(final Currency[] currencyArray) {
+    this.currencyArray = currencyArray;
   }
 
-  public void setArray(final String[] array) {
-    this.array = array;
+  public Set<Currency> getCurrencySet() {
+    return currencySet;
   }
 
-  public Set<String> getSet() {
-    return set;
+  public void setCurrencySet(final Set<Currency> currencySet) {
+    this.currencySet = currencySet;
   }
 
-  public void setSet(final Set<String> set) {
-    this.set = set;
+  public Collection<Currency> getCurrencyCollection() {
+    return currencyCollection;
   }
 
-  public Collection<String> getCollection() {
-    return collection;
+  public void setCurrencyCollection(final Collection<Currency> currencyCollection) {
+    this.currencyCollection = currencyCollection;
   }
 
-  public void setCollection(final Collection<String> collection) {
-    this.collection = collection;
+  public Currency[] getCurrencyItems() {
+    return currencyItems;
   }
 }

Modified: myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/selectManyListbox/selectManyListbox-value.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/selectManyListbox/selectManyListbox-value.xhtml?rev=1683664&r1=1683663&r2=1683664&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/selectManyListbox/selectManyListbox-value.xhtml (original)
+++ myfaces/tobago/trunk/tobago-example/tobago-example-test/src/main/webapp/test/selectManyListbox/selectManyListbox-value.xhtml Fri Jun  5 06:34:05 2015
@@ -22,29 +22,54 @@
     xmlns:f="http://java.sun.com/jsf/core">
 
   <tc:page>
-    <tc:gridLayoutConstraint width="630px" height="600px"/>
+    <tc:gridLayoutConstraint width="630px" height="800px"/>
     <f:facet name="layout">
-      <tc:gridLayout rows="auto;auto;auto;auto;auto;auto"/>
+      <tc:gridLayout rows="20px;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto;auto"/>
     </f:facet>
 
     <tc:messages>
       <tc:gridLayoutConstraint columnSpan="2"/>
     </tc:messages>
 
+    <tc:out value="The value attribute of the component has different type in this example:"/>
+
     <tc:label value="&lt;tx:selectManyListbox>"/>
 
-    <tx:selectManyListbox value="#{selectManyListboxBean.list}" label="list">
+    <tx:selectManyListbox value="#{selectManyListboxBean.stringList}" label="list of strings">
       <tc:selectItem itemValue="a" itemLabel="A Value"/>
       <tc:selectItem itemValue="b" itemLabel="An Alternative"/>
     </tx:selectManyListbox>
-    <tx:selectManyListbox value="#{selectManyListboxBean.array}" label="array">
+    <tx:selectManyListbox value="#{selectManyListboxBean.stringArray}" label="array of strings">
       <tc:selectItem itemValue="a" itemLabel="A Value"/>
       <tc:selectItem itemValue="b" itemLabel="An Alternative"/>
     </tx:selectManyListbox>
-    <tx:selectManyListbox value="#{selectManyListboxBean.collection}" label="array">
+    <tx:selectManyListbox value="#{selectManyListboxBean.stringSet}" label="set of strings">
       <tc:selectItem itemValue="a" itemLabel="A Value"/>
       <tc:selectItem itemValue="b" itemLabel="An Alternative"/>
     </tx:selectManyListbox>
+    <tx:selectManyListbox value="#{selectManyListboxBean.stringCollection}" label="collection of strings">
+      <tc:selectItem itemValue="a" itemLabel="A Value"/>
+      <tc:selectItem itemValue="b" itemLabel="An Alternative"/>
+    </tx:selectManyListbox>
+
+    <tc:label value="&lt;tx:selectManyListbox> width java.util.Currency as value"/>
+
+    <tx:selectManyListbox value="#{selectManyListboxBean.stringList}" label="list of currencies">
+      <tc:selectItems value="#{selectManyListboxBean.currencyItems}"
+                      var="currency" itemValue="#{currency.currencyCode}" itemLabel="#{currency.displayName}"/>
+    </tx:selectManyListbox>
+    <tx:selectManyListbox value="#{selectManyListboxBean.stringArray}" label="array of currencies">
+      <tc:selectItems value="#{selectManyListboxBean.currencyItems}"
+                      var="currency" itemValue="#{currency.currencyCode}" itemLabel="#{currency.displayName}"/>
+    </tx:selectManyListbox>
+    <tx:selectManyListbox value="#{selectManyListboxBean.stringSet}" label="set of currencies">
+      <tc:selectItems value="#{selectManyListboxBean.currencyItems}"
+                      var="currency" itemValue="#{currency.currencyCode}" itemLabel="#{currency.displayName}"/>
+    </tx:selectManyListbox>
+    <tx:selectManyListbox value="#{selectManyListboxBean.stringCollection}" label="collection of currencies">
+      <tc:selectItems value="#{selectManyListboxBean.currencyItems}"
+                      var="currency" itemValue="#{currency.currencyCode}" itemLabel="#{currency.displayName}"/>
+    </tx:selectManyListbox>
 
     <tc:button label="submit"/>