public static UISelectItems getPseudoSelectItems(SelectItemsInterface selectItemsInterface) { UISelectItems selectItems = null; if (selectItemsInterface.getVar() != null && selectItemsInterface.getItemValues() != null) { selectItems = new UISelectItems(); selectItems.setValue(selectItemsInterface.getItemValues()); selectItems.getAttributes().put("var", selectItemsInterface.getVar()); if (selectItemsInterface.getItemValue() != null) { selectItems.getAttributes().put("itemValue", selectItemsInterface.getItemValue()); } if (selectItemsInterface.getItemLabel() != null) { selectItems.getAttributes().put("itemLabel", selectItemsInterface.getItemLabel()); } } return selectItems; }
private GenericObjectSelectItem(UISelectItems sourceComponent) { var = (String) sourceComponent.getAttributes().get(VAR); itemValue = sourceComponent.getValueExpression(ITEM_VALUE); itemLabel = sourceComponent.getValueExpression(ITEM_LABEL); itemDescription = sourceComponent.getValueExpression(ITEM_DESCRIPTION); itemEscaped = sourceComponent.getValueExpression(ITEM_ESCAPED); itemDisabled = sourceComponent.getValueExpression(ITEM_DISABLED); noSelectionOption = sourceComponent.getValueExpression(NO_SELECTION_OPTION); }
protected SelectItem createSelectItem( FacesContext context, UISelectItems uiSelectItems, String itemLabel, Object itemValue) { String var = (String) uiSelectItems.getAttributes().get("var"); if (var != null) { context.getExternalContext().getRequestMap().put(var, itemValue); String description = (String) uiSelectItems.getAttributes().get("itemDescription"); Boolean disabled = Boolean.valueOf(((String) uiSelectItems.getAttributes().get("itemDisabled"))); Boolean escaped = Boolean.valueOf(((String) uiSelectItems.getAttributes().get("itemLabelEscaped"))); Boolean noSelectionOption = Boolean.valueOf(((String) uiSelectItems.getAttributes().get("noSelectionOption"))); return new SelectItem( itemValue, itemLabel, description, disabled, escaped, noSelectionOption); } else { return new SelectItem(itemValue, itemLabel); } }
protected SelectItem createSelectItem( FacesContext context, UISelectItems uiSelectItems, Object object) { String var = (String) uiSelectItems.getAttributes().get("var"); if (var != null) { context.getExternalContext().getRequestMap().put(var, object); Object itemLabelAsObject = uiSelectItems.getAttributes().get("itemLabel"); Object itemValue = uiSelectItems.getAttributes().get("itemValue"); String description = (String) uiSelectItems.getAttributes().get("itemDescription"); Object itemDisabled = uiSelectItems.getAttributes().get("itemDisabled"); Object itemEscaped = uiSelectItems.getAttributes().get("itemLabelEscaped"); Object noSelection = uiSelectItems.getAttributes().get("noSelectionOption"); if (itemValue == null) { itemValue = object; } String itemLabel = itemLabelAsObject == null ? String.valueOf(object) : String.valueOf(itemLabelAsObject); boolean disabled = itemDisabled == null ? false : Boolean.valueOf(itemDisabled.toString()); boolean escaped = itemEscaped == null ? false : Boolean.valueOf(itemEscaped.toString()); boolean noSelectionOption = noSelection == null ? false : Boolean.valueOf(noSelection.toString()); return new SelectItem( itemValue, itemLabel, description, disabled, escaped, noSelectionOption); } else { return new SelectItem(object, String.valueOf(object)); } }