You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by de...@apache.org on 2015/06/10 09:21:02 UTC
svn commit: r1684581 - in /myfaces/tobago/branches/tobago-3.0.x: ./
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/util/
tobago-example/tobago-example-test/src/main/java/org/a...
Author: deki
Date: Wed Jun 10 07:21:02 2015
New Revision: 1684581
URL: http://svn.apache.org/r1684581
Log:
Merged from trunk
TOBAGO-1453 - SelectManyRendererBase should support Collection [from revision 1676030]
TOBAGO-1453 - SelectManyRendererBase should support Collection: update copied code to myfaces 2.2.8 version [from revision 1676035]
TOBAGO-1453 - SelectManyRendererBase should support Collection: checkstyle [from revision 1676038]
TOBAGO-1453: fixed StackOverflowError [from revision 1682187]
TOBAGO-1453: SelectManyRendererBase should support Collection [from revision 1682548]
TOBAGO-1453: SelectManyRendererBase should support Collection
- test [from revision 1683664]
Modified:
myfaces/tobago/branches/tobago-3.0.x/ (props changed)
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectItem.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/SelectManyListboxBean.java
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/selectManyListbox/selectManyListbox-value.xhtml
Propchange: myfaces/tobago/branches/tobago-3.0.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jun 10 07:21:02 2015
@@ -1,3 +1,3 @@
/myfaces/tobago/branches/tobago-1.5.x:1356585,1357124
/myfaces/tobago/branches/tobago-tree-table:1226794-1341423
-/myfaces/tobago/trunk:1571193,1571804,1571816,1571941,1571945,1571962,1571966,1576730,1589960,1591854,1600239,1600818,1601860,1602151,1602154,1602343,1604224,1606201,1607642,1609696-1609697,1609718,1610942,1610948,1610970,1610989,1611011,1611259,1611264,1611276,1611329,1611338-1611339,1611571,1613015,1613032,1614827,1614853,1615053,1615114,1615121,1617310,1619789,1621101,1621107,1621134,1621156,1621264,1621282,1621332,1622222,1622243,1622508,1623934,1624033,1625968,1625972,1626270,1628899,1628953,1636842,1636911,1640117,1640147,1640541,1640548,1640638,1640761,1640917,1641575,1641635,1641772,1641775,1641777,1656502,1657180,1657269,1657276,1657279,1658909,1658912,1659026,1659031,1660696,1660699,1660708,1660714,1665486,1665521,1665549,1665569-1665570,1666464,1667304,1667306-1667307,1667309,1668147,1668153,1668249,1675330,1675565,1675584,1675588-1675589,1675636,1679031,1680197,1681981,1682448,1682545,1682548,1683231,1683306,1683373
+/myfaces/tobago/trunk:1571193,1571804,1571816,1571941,1571945,1571962,1571966,1576730,1589960,1591854,1600239,1600818,1601860,1602151,1602154,1602343,1604224,1606201,1607642,1609696-1609697,1609718,1610942,1610948,1610970,1610989,1611011,1611259,1611264,1611276,1611329,1611338-1611339,1611571,1613015,1613032,1614827,1614853,1615053,1615114,1615121,1617310,1619789,1621101,1621107,1621134,1621156,1621264,1621282,1621332,1622222,1622243,1622508,1623934,1624033,1625968,1625972,1626270,1628899,1628953,1636842,1636911,1640117,1640147,1640541,1640548,1640638,1640761,1640917,1641575,1641635,1641772,1641775,1641777,1656502,1657180,1657269,1657276,1657279,1658909,1658912,1659026,1659031,1660696,1660699,1660708,1660714,1665486,1665521,1665549,1665569-1665570,1666464,1667304,1667306-1667307,1667309,1668147,1668153,1668249,1675330,1675565,1675584,1675588-1675589,1675636,1676030,1676035,1676038,1679031,1680197,1681981,1682187,1682448,1682545,1682548,1683231,1683306,1683373,1683664
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectItem.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectItem.java?rev=1684581&r1=1684580&r2=1684581&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectItem.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectItem.java Wed Jun 10 07:21:02 2015
@@ -24,6 +24,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.faces.component.UISelectItem;
+import javax.faces.component.UISelectMany;
import javax.faces.context.FacesContext;
public class AbstractUISelectItem extends UISelectItem {
@@ -47,7 +48,7 @@ public class AbstractUISelectItem extend
@Override
public Object getItemValue() {
- if (itemValueLiteral) {
+ if (itemValueLiteral && !(getParent() instanceof UISelectMany)) {
final Object converted = ComponentUtils.getConvertedValue(
FacesContext.getCurrentInstance(), getParent(), (String) super.getItemValue());
return converted;
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java?rev=1684581&r1=1684580&r2=1684581&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java Wed Jun 10 07:21:02 2015
@@ -19,6 +19,7 @@
package org.apache.myfaces.tobago.util;
+import org.apache.commons.collections.CollectionUtils;
import org.apache.myfaces.tobago.component.Attributes;
import org.apache.myfaces.tobago.component.Facets;
import org.apache.myfaces.tobago.component.RendererTypes;
@@ -65,6 +66,7 @@ import javax.faces.render.RenderKitFacto
import javax.faces.render.Renderer;
import javax.faces.view.facelets.FaceletContext;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@@ -897,7 +899,7 @@ public final class ComponentUtils {
if (renderer != null) {
if (component instanceof UISelectMany) {
final Object converted = renderer.getConvertedValue(facesContext, component, new String[]{stringValue});
- return converted instanceof List ? ((List) converted).get(0) : ((Object[]) converted)[0];
+ return converted instanceof Collection ? CollectionUtils.get(converted, 0) : ((Object[]) converted)[0];
} else {
return renderer.getConvertedValue(facesContext, component, stringValue);
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/SelectManyListboxBean.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/SelectManyListboxBean.java?rev=1684581&r1=1684580&r2=1684581&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/SelectManyListboxBean.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/java/org/apache/myfaces/tobago/example/test/SelectManyListboxBean.java Wed Jun 10 07:21:02 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/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/selectManyListbox/selectManyListbox-value.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/selectManyListbox/selectManyListbox-value.xhtml?rev=1684581&r1=1684580&r2=1684581&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/selectManyListbox/selectManyListbox-value.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/selectManyListbox/selectManyListbox-value.xhtml Wed Jun 10 07:21:02 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="<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="<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"/>