private static <S extends SelectItem> S createSelectItem(UIComponent component, Object value, Supplier<S> supplier) { Map<String, Object> attributes = component.getAttributes(); Object itemValue = getItemValue(attributes, value); Object itemLabel = attributes.get("itemLabel"); Object itemLabelEscaped = coalesce(attributes.get("itemEscaped"), attributes.get("itemLabelEscaped")); // f:selectItem || f:selectItems Object itemDisabled = attributes.get("itemDisabled"); S selectItem = supplier.get(); selectItem.setValue(itemValue); selectItem.setLabel(String.valueOf(itemLabel != null ? itemLabel : selectItem.getValue())); selectItem.setEscape(itemLabelEscaped == null || Boolean.parseBoolean(itemLabelEscaped.toString())); selectItem.setDisabled(itemDisabled != null && Boolean.parseBoolean(itemDisabled.toString())); return selectItem; }
private static <S extends SelectItem> S createSelectItem(UIComponent component, Object value, Supplier<S> supplier) { Map<String, Object> attributes = component.getAttributes(); Object itemValue = getItemValue(attributes, value); Object itemLabel = attributes.get("itemLabel"); Object itemLabelEscaped = coalesce(attributes.get("itemEscaped"), attributes.get("itemLabelEscaped")); // f:selectItem || f:selectItems Object itemDisabled = attributes.get("itemDisabled"); S selectItem = supplier.get(); selectItem.setValue(itemValue); selectItem.setLabel(String.valueOf(itemLabel != null ? itemLabel : selectItem.getValue())); selectItem.setEscape(itemLabelEscaped == null || Boolean.parseBoolean(itemLabelEscaped.toString())); selectItem.setDisabled(itemDisabled != null && Boolean.parseBoolean(itemDisabled.toString())); return selectItem; }
if (itemLabelEscaped != null) { selectItem = (SelectItem) selectItemsValue; selectItem.setEscape(isItemLabelEscaped); if (itemLabelEscaped != null) { selectItem = (SelectItem) item; selectItem.setEscape(isItemLabelEscaped); Object itemValue = nextSelectItemChild.getAttributes().get("itemValue"); selectItem = new SelectItem((itemValue != null) ? itemValue : item, itemLabel); selectItem.setEscape(isItemLabelEscaped); selectItems.add(selectItem); continue; selectItem.setEscape(isItemLabelEscaped); selectItems.add(selectItem); for (int i = 0; i < selectItemArray.length; i++) { if (itemLabelEscaped != null) { selectItemArray[i].setEscape(isItemLabelEscaped); Object itemValue = nextSelectItemChild.getAttributes().get("itemValue"); selectItem = new SelectItem((itemValue != null) ? itemValue : item, itemLabel); selectItem.setEscape(isItemLabelEscaped); selectItems.add(selectItem); } else { selectItem = new SelectItem(item); selectItem.setEscape(isItemLabelEscaped); selectItems.add(selectItem);
/** * <p>Construct a <code>SelectItem</code> instance with the specified * property values.</p> * * @param value Value to be delivered to the model if this * item is selected by the user * @param label Label to be rendered for this item in the response * @param description Description of this item, for use in tools * @param disabled Flag indicating that this option is disabled * @param escape Flag indicating that the text of this option should be * escaped when rendered. * @since 1.2 */ public SelectItem(Object value, String label, String description, boolean disabled, boolean escape) { super(); setValue(value); setLabel(label); setDescription(description); setDisabled(disabled); setEscape(escape); }
private static SelectItem cloneSelectItem(SelectItem o) { SelectItem copy = new SelectItem(); String description = o.getDescription(); if (description != null) copy.setDescription(new String(description)); copy.setDisabled(o.isDisabled()); copy.setEscape(o.isEscape()); String label = o.getLabel(); if (label != null) copy.setLabel(new String(label)); copy.setNoSelectionOption(o.isNoSelectionOption()); copy.setValue(o.getValue()); return copy; } }
/** * <p>Construct a <code>SelectItem</code> instance with the specified * property values.</p> * * @param value Value to be delivered to the model if this * item is selected by the user * @param label Label to be rendered for this item in the response * @param description Description of this item, for use in tools * @param disabled Flag indicating that this option is disabled * @param escape Flag indicating that the text of this option should be * escaped when rendered. * @param noSelectionOption Flag indicating that the current option is a "no selection" option * @since 1.2 */ public SelectItem(Object value, String label, String description, boolean disabled, boolean escape, boolean noSelectionOption) { super(); setValue(value); setLabel(label); setDescription(description); setDisabled(disabled); setEscape(escape); setNoSelectionOption(noSelectionOption); }
/** * <p>Construct a <code>SelectItem</code> instance with the specified * property values.</p> * * @param value Value to be delivered to the model if this * item is selected by the user * @param label Label to be rendered for this item in the response * @param description Description of this item, for use in tools * @param disabled Flag indicating that this option is disabled * @param escape Flag indicating that the text of this option should be * escaped when rendered. * @param noSelectionOption Flag indicating that the current option is a "no selection" option * @since 1.2 */ public SelectItem(Object value, String label, String description, boolean disabled, boolean escape, boolean noSelectionOption) { super(); setValue(value); setLabel(label); setDescription(description); setDisabled(disabled); setEscape(escape); setNoSelectionOption(noSelectionOption); }
/** * <p>Construct a <code>SelectItem</code> instance with the specified * property values.</p> * * @param value Value to be delivered to the model if this * item is selected by the user * @param label Label to be rendered for this item in the response * @param description Description of this item, for use in tools * @param disabled Flag indicating that this option is disabled * @param escape Flag indicating that the text of this option should be * escaped when rendered. * @param noSelectionOption Flag indicating that the current option is a "no selection" option * @since 1.2 */ public SelectItem(Object value, String label, String description, boolean disabled, boolean escape, boolean noSelectionOption) { super(); setValue(value); setLabel(label); setDescription(description); setDisabled(disabled); setEscape(escape); setNoSelectionOption(noSelectionOption); }
/** * <p>Construct a <code>SelectItem</code> instance with the specified * property values.</p> * * @param value Value to be delivered to the model if this * item is selected by the user * @param label Label to be rendered for this item in the response * @param description Description of this item, for use in tools * @param disabled Flag indicating that this option is disabled * @param escape Flag indicating that the text of this option should be * escaped when rendered. * @param noSelectionOption Flag indicating that the current option is a "no selection" option * @since 1.2 */ public SelectItem(Object value, String label, String description, boolean disabled, boolean escape, boolean noSelectionOption) { super(); setValue(value); setLabel(label); setDescription(description); setDisabled(disabled); setEscape(escape); setNoSelectionOption(noSelectionOption); }
/** * <p>Construct a <code>SelectItem</code> instance with the specified * property values.</p> * * @param value Value to be delivered to the model if this * item is selected by the user * @param label Label to be rendered for this item in the response * @param description Description of this item, for use in tools * @param disabled Flag indicating that this option is disabled * @param escape Flag indicating that the text of this option should be * escaped when rendered. * @param noSelectionOption Flag indicating that the current option is a "no selection" option * @since 1.2 */ public SelectItem(Object value, String label, String description, boolean disabled, boolean escape, boolean noSelectionOption) { super(); setValue(value); setLabel(label); setDescription(description); setDisabled(disabled); setEscape(escape); setNoSelectionOption(noSelectionOption); }
/** * <p>Construct a <code>SelectItem</code> instance with the specified * property values.</p> * * @param value Value to be delivered to the model if this * item is selected by the user * @param label Label to be rendered for this item in the response * @param description Description of this item, for use in tools * @param disabled Flag indicating that this option is disabled * @param escape Flag indicating that the text of this option should be * escaped when rendered. * @param noSelectionOption Flag indicating that the current option is a "no selection" option * @since 1.2 */ public SelectItem(Object value, String label, String description, boolean disabled, boolean escape, boolean noSelectionOption) { super(); setValue(value); setLabel(label); setDescription(description); setDisabled(disabled); setEscape(escape); setNoSelectionOption(noSelectionOption); }
/** * <p>Construct a <code>SelectItem</code> instance with the specified * property values.</p> * * @param value Value to be delivered to the model if this * item is selected by the user * @param label Label to be rendered for this item in the response * @param description Description of this item, for use in tools * @param disabled Flag indicating that this option is disabled * @param escape Flag indicating that the text of this option should be * escaped when rendered. * @param noSelectionOption Flag indicating that the current option is a "no selection" option * @since 1.2 */ public SelectItem(Object value, String label, String description, boolean disabled, boolean escape, boolean noSelectionOption) { super(); setValue(value); setLabel(label); setDescription(description); setDisabled(disabled); setEscape(escape); setNoSelectionOption(noSelectionOption); }
/** * <p>Construct a <code>SelectItem</code> instance with the specified * property values.</p> * * @param value Value to be delivered to the model if this * item is selected by the user * @param label Label to be rendered for this item in the response * @param description Description of this item, for use in tools * @param disabled Flag indicating that this option is disabled * @param escape Flag indicating that the text of this option should be * escaped when rendered. * @param noSelectionOption Flag indicating that the current option is a "no selection" option * @since 1.2 */ public SelectItem(Object value, String label, String description, boolean disabled, boolean escape, boolean noSelectionOption) { super(); setValue(value); setLabel(label); setDescription(description); setDisabled(disabled); setEscape(escape); setNoSelectionOption(noSelectionOption); }
/** * <p>Construct a <code>SelectItem</code> instance with the specified * property values.</p> * * @param value Value to be delivered to the model if this * item is selected by the user * @param label Label to be rendered for this item in the response * @param description Description of this item, for use in tools * @param disabled Flag indicating that this option is disabled * @param escape Flag indicating that the text of this option should be * escaped when rendered. * @param noSelectionOption Flag indicating that the current option is a "no selection" option * @since 1.2 */ public SelectItem(Object value, String label, String description, boolean disabled, boolean escape, boolean noSelectionOption) { super(); setValue(value); setLabel(label); setDescription(description); setDisabled(disabled); setEscape(escape); setNoSelectionOption(noSelectionOption); }
private static SelectItem toSelectItem(UISelectItem option) { SelectItem item = (SelectItem) option.getValue(); if (item == null) { item = new SelectItem(); item.setDescription(option.getItemDescription()); item.setDisabled(option.isItemDisabled()); item.setEscape(option.isItemEscaped()); item.setLabel(option.getItemLabel()); item.setNoSelectionOption(option.isNoSelectionOption()); item.setValue(option.getItemValue()); } return item; }
private static SelectItem toSelectItem(UISelectItem option) { SelectItem item = (SelectItem) option.getValue(); if (item == null) { item = new SelectItem(); item.setDescription(option.getItemDescription()); item.setDisabled(option.isItemDisabled()); item.setEscape(option.isItemEscaped()); item.setLabel(option.getItemLabel()); item.setNoSelectionOption(option.isNoSelectionOption()); item.setValue(option.getItemValue()); } return item; }