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 2014/02/26 10:33:21 UTC
svn commit: r1571977 - in /myfaces/tobago/branches/tobago-3.0.x: ./
tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/
tobago-core/src/main/java/org/apache/myfaces/tobago/model/
tobago-example/tobago-example-data/src/main/re...
Author: lofwyr
Date: Wed Feb 26 09:33:20 2014
New Revision: 1571977
URL: http://svn.apache.org/r1571977
Log:
Merged from trunk
TOBAGO-1362: Support dynamic list of objects for f:selectItems
- clean up
- implement dynamic-list-support for tc:selectItems [from revision 1571941]
TOBAGO-1371: Radio buttons should render icons, if available [from revision 1571945]
TOBAGO-1362: Support dynamic list of objects for f:selectItems
- var is not required [from revision 1571962]
TOBAGO-1371: Radio buttons should render icons, if available
- example [from revision 1571966]
Added:
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/EUR-14.png
- copied unchanged from r1571945, myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/EUR-14.png
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/EUR.png
- copied unchanged from r1571945, myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/EUR.png
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/JPY-14.png
- copied unchanged from r1571945, myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/JPY-14.png
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/JPY.png
- copied unchanged from r1571945, myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/JPY.png
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/TTD-14.png
- copied unchanged from r1571945, myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/TTD-14.png
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/TTD.png
- copied unchanged from r1571945, myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/TTD.png
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/USD-14.png
- copied unchanged from r1571945, myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/USD-14.png
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/USD.png
- copied unchanged from r1571945, myfaces/tobago/trunk/tobago-example/tobago-example-data/src/main/resources/META-INF/resources/data/USD.png
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/taglib/component/SelectItemTagDeclaration.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SelectItemsTagDeclaration.java
myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/model/SelectItem.java
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/basic.xhtml (contents, props changed)
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/05-toolBar/toolBar.xhtml (contents, props changed)
myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/selectItem/list-of-objects.xhtml
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyCheckboxRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyListboxRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyShuttleRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneChoiceRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneListboxRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneRadioRenderer.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java
myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/SelectItemUtils.java
Propchange: myfaces/tobago/branches/tobago-3.0.x/
------------------------------------------------------------------------------
Merged /myfaces/tobago/trunk:r1571941,1571945,1571962,1571966
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SelectItemTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SelectItemTagDeclaration.java?rev=1571977&r1=1571976&r2=1571977&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SelectItemTagDeclaration.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SelectItemTagDeclaration.java Wed Feb 26 09:33:20 2014
@@ -43,9 +43,12 @@ import org.apache.myfaces.tobago.interna
uiComponentFacesClass = "javax.faces.component.UISelectItem",
allowedChildComponenents = "NONE")
public interface SelectItemTagDeclaration extends HasBinding, HasId, HasMarkup, HasCurrentMarkup, HasItemLabel {
+
/**
- * Description of an item for use in tools.
+ * Description of an item, might be rendered as a tool tip.
+ * @deprecated since 2.0.0, please use itemTip.
*/
+ @Deprecated
@TagAttribute
@UIComponentTagAttribute(type = {"java.lang.String"})
void setItemDescription(String itemDescription);
@@ -81,4 +84,11 @@ public interface SelectItemTagDeclaratio
@TagAttribute
@UIComponentTagAttribute()
void setItemImage(String itemImage);
+
+ /**
+ * Text value to display as tooltip.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute()
+ void setTip(String tip);
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SelectItemsTagDeclaration.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SelectItemsTagDeclaration.java?rev=1571977&r1=1571976&r2=1571977&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SelectItemsTagDeclaration.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/internal/taglib/component/SelectItemsTagDeclaration.java Wed Feb 26 09:33:20 2014
@@ -27,6 +27,7 @@ import org.apache.myfaces.tobago.apt.ann
import org.apache.myfaces.tobago.apt.annotation.UIComponentTagAttribute;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasBinding;
import org.apache.myfaces.tobago.internal.taglib.declaration.HasId;
+import org.apache.myfaces.tobago.internal.taglib.declaration.HasItemLabel;
/**
* Add a child UISelectItems component to the UIComponent
@@ -40,7 +41,7 @@ import org.apache.myfaces.tobago.interna
uiComponentFacesClass = "javax.faces.component.UISelectItems",
isComponentAlreadyDefined = false,
allowedChildComponenents = "NONE")
-public interface SelectItemsTagDeclaration extends HasId, HasBinding {
+public interface SelectItemsTagDeclaration extends HasId, HasBinding, HasItemLabel {
/**
* Value binding expression pointing at a List or array of SelectItem instances containing
@@ -48,8 +49,45 @@ public interface SelectItemsTagDeclarati
*/
@TagAttribute
@UIComponentTagAttribute(
- type = "javax.faces.model.SelectItem[]",
+ type = {"javax.faces.model.SelectItem[]", "java.lang.Object[]", "java.util.Collection"},
expression = DynamicExpression.VALUE_EXPRESSION_REQUIRED)
void setValue(String value);
+ /**
+ * Name of a variable under which the iterated data will be exposed.
+ * It may be referred to in EL of other attributes.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute(expression = DynamicExpression.PROHIBITED)
+ void setVar(final String var);
+
+ /**
+ * Flag indicating whether the option created
+ * by this component is disabled.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute(type = {"boolean"}, defaultValue = "false")
+ void setItemDisabled(String itemDisabled);
+
+ /**
+ * Value to be returned to the server if this option is selected by the user.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute()
+ void setItemValue(String itemValue);
+
+ /**
+ * Image to be displayed to the user for this option.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute()
+ void setItemImage(String itemImage);
+
+ /**
+ * Text value to display as tooltip.
+ */
+ @TagAttribute
+ @UIComponentTagAttribute()
+ void setTip(String tip);
+
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/model/SelectItem.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/model/SelectItem.java?rev=1571977&r1=1571976&r2=1571977&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/model/SelectItem.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-core/src/main/java/org/apache/myfaces/tobago/model/SelectItem.java Wed Feb 26 09:33:20 2014
@@ -42,12 +42,12 @@ public class SelectItem extends javax.fa
super(value, label);
}
- public SelectItem(final Object value, final String label, final String description) {
- super(value, label, description);
+ public SelectItem(final Object value, final String label, final String tip) {
+ super(value, label, tip);
}
- public SelectItem(final Object value, final String label, final String description, final String image) {
- this(value, label, description, false, image);
+ public SelectItem(final Object value, final String label, final String tip, final String image) {
+ this(value, label, tip, false, image);
}
/**
@@ -55,37 +55,51 @@ public class SelectItem extends javax.fa
*/
@Deprecated
public SelectItem(
- final Object value, final String label, final String description, final String image, final String[] markup) {
- this(value, label, description, false, image, markup);
+ final Object value, final String label, final String tip, final String image, final String[] markup) {
+ this(value, label, tip, false, image, markup);
}
public SelectItem(
- final Object value, final String label, final String description, final String image, final Markup markup) {
- this(value, label, description, false, image, markup);
+ final Object value, final String label, final String tip, final String image, final Markup markup) {
+ this(value, label, tip, false, image, markup);
}
public SelectItem(
- final Object value, final String label, final String description, final boolean disabled, final String image) {
- this(value, label, description, disabled, image, Markup.NULL);
+ final Object value, final String label, final String tip, final boolean disabled, final String image) {
+ this(value, label, tip, disabled, image, Markup.NULL);
}
/**
* @deprecated since 1.5.0
*/
public SelectItem(
- final Object value, final String label, final String description, final boolean disabled, final String image,
+ final Object value, final String label, final String tip, final boolean disabled, final String image,
final String[] markup) {
- this(value, label, description, disabled, image, Markup.valueOf(markup));
+ this(value, label, tip, disabled, image, Markup.valueOf(markup));
}
public SelectItem(
- final Object value, final String label, final String description, final boolean disabled, final String image,
+ final Object value, final String label, final String tip, final boolean disabled, final String image,
final Markup markup) {
- super(value, label, description, disabled);
+ super(value, label, tip, disabled);
this.image = image;
this.markup = markup;
}
+ /**
+ * Alias name for description.
+ */
+ public String getTip() {
+ return getDescription();
+ }
+
+ /**
+ * Alias name for description.
+ */
+ public void setTip(String tip) {
+ setDescription(tip);
+ }
+
public String getImage() {
return image;
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java?rev=1571977&r1=1571976&r2=1571977&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/java/org/apache/myfaces/tobago/example/demo/overview/OverviewController.java Wed Feb 26 09:33:20 2014
@@ -45,6 +45,7 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
+import java.util.Currency;
import java.util.Date;
import java.util.List;
@@ -69,7 +70,8 @@ public class OverviewController implemen
Selectable.SIBLING_LEAF_ONLY.getValue()
};
- private Salutation radioValue;
+ private String radioValue;
+ private Currency[] currencyItems;
private Salutation singleValue;
@@ -110,7 +112,13 @@ public class OverviewController implemen
public OverviewController() {
- radioValue = Salutation.UNKNOWN;
+ radioValue = "JPY";
+ currencyItems = new Currency[]{
+ Currency.getInstance("JPY"),
+ Currency.getInstance("TTD"),
+ Currency.getInstance("USD"),
+ Currency.getInstance("EUR")
+ };
singleValue = Salutation.UNKNOWN;
treeSelectMode = TREE_SELECT_MODE_KEYS[3];
treeListboxSelectMode = TREELISTBOX_SELECT_MODE_KEYS[0];
@@ -266,6 +274,10 @@ public class OverviewController implemen
return "popupButton".equals(lastAction) || "popupButton2".equals(lastAction);
}
+ public Currency[] getCurrencyItems() {
+ return currencyItems;
+ }
+
public SelectItem[] getItems() {
return getSalutationSelectItems("overview");
}
@@ -286,11 +298,11 @@ public class OverviewController implemen
}
- public Salutation getRadioValue() {
+ public String getRadioValue() {
return radioValue;
}
- public void setRadioValue(final Salutation radioValue) {
+ public void setRadioValue(final String radioValue) {
this.radioValue = radioValue;
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/basic.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/basic.xhtml?rev=1571977&r1=1571976&r2=1571977&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/basic.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/basic.xhtml Wed Feb 26 09:33:20 2014
@@ -80,12 +80,16 @@
<f:facet name="layout">
<tc:gridLayout columns="*;*" border="0"/>
</f:facet>
- <tc:selectOneRadio value="#{overviewController.radioValue}"
- id="rg0" converter="salutationId">
- <f:selectItems value="#{overviewController.items}" id="items0"/>
+ <tc:selectOneRadio value="#{overviewController.radioValue}" id="rg0">
+ <tc:selectItems value="#{overviewController.currencyItems}" id="items0"
+ var="currency" itemValue="#{currency.currencyCode}" itemLabel="#{currency.displayName}"
+ itemImage="data/#{currency.currencyCode}-14.png" />
+ <!-- images come from tobago-example-data -->
+<!--
<f:facet name="click">
<tc:command/>
</f:facet>
+-->
</tc:selectOneRadio>
<tc:panel>
Propchange: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/basic.xhtml
------------------------------------------------------------------------------
Merged /myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/01-basic/basic.xhtml:r1571966
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/05-toolBar/toolBar.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/05-toolBar/toolBar.xhtml?rev=1571977&r1=1571976&r2=1571977&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/05-toolBar/toolBar.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/05-toolBar/toolBar.xhtml Wed Feb 26 09:33:20 2014
@@ -200,8 +200,10 @@
<tc:menu label="#{overviewBundle.toolbar_selectSingleselect}">
- <tx:menuRadio value="#{overviewController.radioValue}" converter="salutationId">
- <f:selectItems value="#{overviewController.items}"/>
+ <tx:menuRadio value="#{overviewController.radioValue}">
+ <tc:selectItems value="#{overviewController.currencyItems}"
+ var="currency" itemValue="#{currency.currencyCode}" itemLabel="#{currency.displayName}"
+ itemImage="data/#{currency.currencyCode}-14.png" />
</tx:menuRadio>
</tc:menu>
Propchange: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-demo/src/main/webapp/content/05-toolBar/toolBar.xhtml
------------------------------------------------------------------------------
Merged /myfaces/tobago/trunk/tobago-example/tobago-example-demo/src/main/webapp/content/05-toolBar/toolBar.xhtml:r1571966
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/selectItem/list-of-objects.xhtml
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/selectItem/list-of-objects.xhtml?rev=1571977&r1=1571976&r2=1571977&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/selectItem/list-of-objects.xhtml (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-example/tobago-example-test/src/main/webapp/test/selectItem/list-of-objects.xhtml Wed Feb 26 09:33:20 2014
@@ -25,14 +25,26 @@
<tc:page>
<tc:gridLayoutConstraint width="600px" height="600px"/>
<f:facet name="layout">
- <tc:gridLayout rows="auto;*" />
+ <tc:gridLayout rows="auto;auto;auto;auto;auto;auto"/>
</f:facet>
<tc:messages/>
+ <tc:out value="<f:selectItems>"/>
+
<tc:selectOneRadio required="true">
<f:selectItems value="#{selectItemModel.availableCurrenciesAsObject}" var="currency"
- itemValue="#{currency.currencyCode}" itemLabel="#{currency.displayName}" />
+ itemValue="#{currency.currencyCode}" itemLabel="#{currency.displayName}"/>
+ </tc:selectOneRadio>
+
+ <tc:out value="<tc:selectItems>"/>
+
+ <tc:selectOneRadio required="true">
+ <tc:selectItems
+ value="#{selectItemModel.availableCurrenciesAsObject}" var="currency"
+ itemValue="#{currency.currencyCode}" itemLabel="#{currency.displayName}"
+ itemImage="data/#{currency.currencyCode}-14.png"/>
+ <!-- images come from tobago-example-data -->
</tc:selectOneRadio>
<tc:button label="Submit"/>
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css?rev=1571977&r1=1571976&r2=1571977&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-scarborough/src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/style/tobago.css Wed Feb 26 09:33:20 2014
@@ -911,6 +911,11 @@ li.tobago-menu-markup-selected {
margin: 0;
}
+.tobago-selectOneRadio img {
+ margin-right: 5px;
+ margin-left: 5px;
+}
+
.tobago-selectOneRadio-markup-disabled {
color: #778899;
}
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java?rev=1571977&r1=1571976&r2=1571977&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/MenuCommandRenderer.java Wed Feb 26 09:33:20 2014
@@ -87,7 +87,7 @@ public class MenuCommandRenderer extends
final String clientId = command.getClientId(facesContext);
final UISelectOne radio = (UISelectOne) command.getFacet(Facets.RADIO);
final String hiddenId = radio.getClientId(facesContext);
- for (final SelectItem item : SelectItemUtils.getItems(facesContext, radio)) {
+ for (final SelectItem item : SelectItemUtils.getItemIterator(facesContext, radio)) {
final boolean checked = item.getValue().equals(radio.getValue());
final String image = checked ? "image/MenuRadioChecked.gif" : null;
final String labelText = item.getLabel();
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyCheckboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyCheckboxRenderer.java?rev=1571977&r1=1571976&r2=1571977&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyCheckboxRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyCheckboxRenderer.java Wed Feb 26 09:33:20 2014
@@ -74,7 +74,7 @@ public class SelectManyCheckboxRenderer
}
boolean first = true;
final Object[] values = select.getSelectedValues();
- for (final SelectItem item : SelectItemUtils.getItems(facesContext, select)) {
+ for (final SelectItem item : SelectItemUtils.getItemIterator(facesContext, select)) {
final String itemId = id + ComponentUtils.SUB_SEPARATOR + item.getValue().toString();
writer.startElement(HtmlElements.LI, select);
writer.startElement(HtmlElements.INPUT, select);
@@ -124,7 +124,7 @@ public class SelectManyCheckboxRenderer
return heightOfOne;
} else {
int count = 0;
- for(SelectItem ignored : SelectItemUtils.getItems(facesContext, (UISelectMany) component)) {
+ for(SelectItem ignored : SelectItemUtils.getItemIterator(facesContext, (UISelectMany) component)) {
count++;
}
return heightOfOne.multiply(count);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyListboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyListboxRenderer.java?rev=1571977&r1=1571976&r2=1571977&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyListboxRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyListboxRenderer.java Wed Feb 26 09:33:20 2014
@@ -56,7 +56,7 @@ public class SelectManyListboxRenderer e
final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
final String id = select.getClientId(facesContext);
- final Iterable<SelectItem> items = SelectItemUtils.getItems(facesContext, select);
+ final Iterable<SelectItem> items = SelectItemUtils.getItemIterator(facesContext, select);
final boolean readonly = select.isReadonly();
final boolean disabled = !items.iterator().hasNext() || select.isDisabled() || readonly;
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyShuttleRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyShuttleRenderer.java?rev=1571977&r1=1571976&r2=1571977&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyShuttleRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectManyShuttleRenderer.java Wed Feb 26 09:33:20 2014
@@ -72,7 +72,7 @@ public class SelectManyShuttleRenderer e
style.setHeight(style.getHeight().subtract(labelHeight));
style.setTop(style.getTop().add(labelHeight));
}
- final Iterable<SelectItem> items = SelectItemUtils.getItems(facesContext, select);
+ final Iterable<SelectItem> items = SelectItemUtils.getItemIterator(facesContext, select);
final boolean disabled = !items.iterator().hasNext() || select.isDisabled() || select.isReadonly();
final String unselectedLabel = select.getUnselectedLabel();
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneChoiceRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneChoiceRenderer.java?rev=1571977&r1=1571976&r2=1571977&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneChoiceRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneChoiceRenderer.java Wed Feb 26 09:33:20 2014
@@ -57,7 +57,7 @@ public class SelectOneChoiceRenderer ext
final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
final String id = select.getClientId(facesContext);
- final Iterable<SelectItem> items = SelectItemUtils.getItems(facesContext, select);
+ final Iterable<SelectItem> items = SelectItemUtils.getItemIterator(facesContext, select);
final String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, select);
final boolean disabled = !items.iterator().hasNext() || select.isDisabled() || select.isReadonly();
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneListboxRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneListboxRenderer.java?rev=1571977&r1=1571976&r2=1571977&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneListboxRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneListboxRenderer.java Wed Feb 26 09:33:20 2014
@@ -56,7 +56,7 @@ public class SelectOneListboxRenderer ex
final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
final String id = select.getClientId(facesContext);
- final Iterable<SelectItem> items = SelectItemUtils.getItems(facesContext, select);
+ final Iterable<SelectItem> items = SelectItemUtils.getItemIterator(facesContext, select);
final boolean disabled = !items.iterator().hasNext() || select.isDisabled() || select.isReadonly();
writer.startElement(HtmlElements.SELECT, select);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneRadioRenderer.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneRadioRenderer.java?rev=1571977&r1=1571976&r2=1571977&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneRadioRenderer.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/SelectOneRadioRenderer.java Wed Feb 26 09:33:20 2014
@@ -22,6 +22,7 @@ package org.apache.myfaces.tobago.render
import org.apache.myfaces.tobago.component.UISelectOneRadio;
import org.apache.myfaces.tobago.config.Configurable;
import org.apache.myfaces.tobago.context.Markup;
+import org.apache.myfaces.tobago.context.ResourceManagerUtils;
import org.apache.myfaces.tobago.layout.Measure;
import org.apache.myfaces.tobago.renderkit.SelectOneRendererBase;
import org.apache.myfaces.tobago.renderkit.css.Classes;
@@ -56,7 +57,7 @@ public class SelectOneRadioRenderer exte
final TobagoResponseWriter writer = HtmlRendererUtils.getTobagoResponseWriter(facesContext);
final String id = select.getClientId(facesContext);
- final Iterable<SelectItem> items = SelectItemUtils.getItems(facesContext, select);
+ final Iterable<SelectItem> items = SelectItemUtils.getItemIterator(facesContext, select);
final String title = HtmlRendererUtils.getTitleFromTipAndMessages(facesContext, select);
final boolean disabled = select.isDisabled();
final boolean readonly = select.isReadonly();
@@ -100,6 +101,19 @@ public class SelectOneRadioRenderer exte
HtmlRendererUtils.renderCommandFacet(select, itemId, facesContext, writer);
writer.endElement(HtmlElements.INPUT);
+ if (item instanceof org.apache.myfaces.tobago.model.SelectItem) {
+ org.apache.myfaces.tobago.model.SelectItem tobagoItem = (org.apache.myfaces.tobago.model.SelectItem) item;
+ final String image = tobagoItem.getImage();
+ if (image != null) {
+ final String imageToRender
+ = ResourceManagerUtils.getImageOrDisabledImageWithPath(facesContext, image, item.isDisabled());
+ writer.startElement(HtmlElements.IMG, select);
+ writer.writeAttribute(HtmlAttributes.SRC, imageToRender, true);
+ writer.writeAttribute(HtmlAttributes.ALT, "", false);
+ writer.endElement(HtmlElements.IMG);
+ }
+ }
+
final String label = item.getLabel();
if (label != null) {
writer.startElement(HtmlElements.LABEL, select);
@@ -125,7 +139,7 @@ public class SelectOneRadioRenderer exte
return heightOfOne;
} else {
int count = 0;
- for(SelectItem ignored : SelectItemUtils.getItems(facesContext, (UISelectOne) component)) {
+ for(SelectItem ignored : SelectItemUtils.getItemIterator(facesContext, (UISelectOne) component)) {
count++;
}
return heightOfOne.multiply(count);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java?rev=1571977&r1=1571976&r2=1571977&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/standard/standard/tag/ToolBarRendererBase.java Wed Feb 26 09:33:20 2014
@@ -60,7 +60,6 @@ import javax.faces.component.UIComponent
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.List;
public abstract class ToolBarRendererBase extends LayoutComponentRendererBase {
@@ -123,20 +122,15 @@ public abstract class ToolBarRendererBas
final FacesContext facesContext, final UIToolBar toolBar, final AbstractUICommandBase command,
final TobagoResponseWriter writer, Measure width) throws IOException {
- final Iterable<SelectItem> items;
+ final List<SelectItem> items;
UIMenuSelectOne radio = (UIMenuSelectOne) command.getFacet(Facets.RADIO);
if (radio == null) {
- items = SelectItemUtils.getItems(facesContext, command);
+ items = SelectItemUtils.getItemList(facesContext, command);
radio = CreateComponentUtils.createUIMenuSelectOneFacet(facesContext, command);
radio.setId(facesContext.getViewRoot().createUniqueId());
} else {
- items = SelectItemUtils.getItems(facesContext, radio);
- }
-
- List<SelectItem> list = new ArrayList<SelectItem>();
- for (final SelectItem item : items) {
- list.add(item);
+ items = SelectItemUtils.getItemList(facesContext, radio);
}
if (radio != null) {
@@ -145,9 +139,9 @@ public abstract class ToolBarRendererBas
final Object value = radio.getValue();
String currentValue = "";
- boolean markFirst = !hasSelectedValue(list, value);
+ boolean markFirst = !hasSelectedValue(items, value);
final String radioId = radio.getClientId(facesContext);
- for (final SelectItem item : list) {
+ for (final SelectItem item : items) {
final String labelText = item.getLabel();
if (labelText != null) {
command.getAttributes().put(Attributes.LABEL, labelText);
Modified: myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/SelectItemUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/SelectItemUtils.java?rev=1571977&r1=1571976&r2=1571977&view=diff
==============================================================================
--- myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/SelectItemUtils.java (original)
+++ myfaces/tobago/branches/tobago-3.0.x/tobago-theme/tobago-theme-standard/src/main/java/org/apache/myfaces/tobago/renderkit/util/SelectItemUtils.java Wed Feb 26 09:33:20 2014
@@ -20,6 +20,7 @@ package org.apache.myfaces.tobago.render
*/
import org.apache.myfaces.tobago.component.Attributes;
+import org.apache.myfaces.tobago.component.SupportsMarkup;
import org.apache.myfaces.tobago.context.Markup;
import javax.el.ValueExpression;
@@ -33,6 +34,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
@@ -41,7 +43,10 @@ import java.util.NoSuchElementException;
*/
public class SelectItemUtils {
- public static Iterable<SelectItem> getItems(final FacesContext facesContext, final UIComponent selector) {
+ /**
+ * Creates a list of SelectItems to use for rendering.
+ */
+ public static Iterable<SelectItem> getItemIterator(final FacesContext facesContext, final UIComponent selector) {
if (selector.getChildCount() == 0) {
return Collections.emptyList();
} else {
@@ -59,7 +64,25 @@ public class SelectItemUtils {
}
}
- public static class SelectItemsIterator implements Iterator<SelectItem> {
+ /**
+ * Creates a list of SelectItems to use for rendering.
+ * You should only use this method (which returns a list), when you need a list.
+ * Otherwise please use {@link #getItemIterator(javax.faces.context.FacesContext, javax.faces.component.UIComponent)}
+ */
+ public static List<SelectItem> getItemList(final FacesContext facesContext, final UIComponent selector) {
+ if (selector.getChildCount() == 0) {
+ return Collections.emptyList();
+ } else {
+ final Iterable<SelectItem> iterator = getItemIterator(facesContext, selector);
+ final List<SelectItem> result = new ArrayList<SelectItem>();
+ for (SelectItem selectItem : iterator) {
+ result.add(selectItem);
+ }
+ return result;
+ }
+ }
+
+ private static class SelectItemsIterator implements Iterator<SelectItem> {
private final FacesContext facesContext;
private final Iterator<UIComponent> children;
@@ -216,12 +239,19 @@ public class SelectItemUtils {
itemDescription = itemDescription.toString();
}
final Boolean itemDisabled = getBooleanAttribute(currentUISelectItems, Attributes.ITEM_DISABLED, false);
+ final String itemImage = (String) attributeMap.get(Attributes.ITEM_IMAGE);
+ final Markup markup;
+ if (currentUISelectItems instanceof SupportsMarkup) {
+ markup = ((SupportsMarkup) currentUISelectItems).getCurrentMarkup();
+ } else {
+ markup = Markup.NULL;
+ }
// TBD: should this be possible?
// Boolean itemLabelEscaped = getBooleanAttribute(currentUISelectItems, ITEM_LABEL_ESCAPED_PROP, true);
// TBD ?
// Object noSelectionValue = attributeMap.get(NO_SELECTION_VALUE_PROP);
item = new org.apache.myfaces.tobago.model.SelectItem(
- itemValue, (String) itemLabel, (String) itemDescription, itemDisabled, null);
+ itemValue, (String) itemLabel, (String) itemDescription, itemDisabled, itemImage, markup);
// remove the value with the key from var from the request map, if previously written
if (wroteRequestMapVarValue) {