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)); } }
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); } }
@SuppressWarnings("rawtypes") public static void renderXHTMLStyleBooleanAttributes(ResponseWriter writer, UIComponent component) throws IOException { assert (writer != null); assert (component != null); Map attrMap = component.getAttributes(); for (String attrName : BOOLEAN_ATTRIBUTES) { Object val = attrMap.get(attrName); if (val == null) { continue; } if (Boolean.valueOf(val.toString())) { writer.writeAttribute(attrName, true, attrName); } } }
public static boolean shouldDecode(UIComponent component) { boolean disabled = Boolean.valueOf(String.valueOf(component.getAttributes().get("disabled"))); boolean readonly = Boolean.valueOf(String.valueOf(component.getAttributes().get("readonly"))); return !disabled && !readonly; }