if (child instanceof UISelectItem) { UISelectItem uiSelectItem = (UISelectItem) child; Object selectItemValue = uiSelectItem.getValue();
private SelectItem processUISelectItem(ELContext elContext, UISelectItem itemComponent) { ValueExpression itemExpression = null; SelectItem selectItem = null; if (itemComponent.getValue() instanceof SelectItem) selectItem = (SelectItem) itemComponent.getValue(); else if ((itemExpression = itemComponent.getValueExpression("value")) != null && itemExpression.getType(elContext).equals(SelectItem.class)) { selectItem = (SelectItem)itemExpression.getValue(elContext); } else if (itemComponent.getItemLabel() != null) { selectItem = new SelectItem( itemComponent.getItemValue(), itemComponent.getItemLabel(), itemComponent.getItemDescription(), itemComponent.isItemDisabled(), itemComponent.isItemEscaped(), itemComponent.isNoSelectionOption() ); } return selectItem; }
private static SelectItem getFromUISelectItem(UISelectItem uiSelectItem) { Object value = uiSelectItem.getValue(); if (value instanceof SelectItem) { // A single SelectItem can be added directly without any further processing. return (SelectItem)value; } else if (value == null) { // No value binding specified, create a select item out of the properties of the UI component. return new ExtendedSelectItem(uiSelectItem); } else { // A value binding was specified, but of a type we don't support. throw new IllegalArgumentException(format(ERROR_UNKNOWN_SELECT_TYPE, value.getClass().toString())); } }
private Iterator<SelectItem> createUISelectItemIterator(UISelectItem selectItem) { Object value = selectItem.getValue(); SelectItem result = null; if (value == null) { result = new SelectItem(selectItem.getItemValue(), selectItem.getItemLabel(), selectItem.getItemDescription(), selectItem.isItemDisabled(), selectItem.isItemEscaped(), selectItem.isNoSelectionOption()); } else if (value instanceof SelectItem) { result = (SelectItem) value; } else { ValueExpression expression = selectItem.getValueExpression("value"); throw new IllegalArgumentException("ValueExpression '" + (expression == null ? null : expression.getExpressionString()) + "' of UISelectItem : " + RichfacesLogger.getComponentPath(selectItem) + " does not reference an Object of type SelectItem"); } return Iterators.singletonIterator(result); }
private static SelectItem getFromUISelectItem(UISelectItem uiSelectItem) { Object value = uiSelectItem.getValue(); if (value instanceof SelectItem) { // A single SelectItem can be added directly without any further processing. return (SelectItem)value; } else if (value == null) { // No value binding specified, create a select item out of the properties of the UI component. return new ExtendedSelectItem(uiSelectItem); } else { // A value binding was specified, but of a type we don't support. throw new IllegalArgumentException(format(ERROR_UNKNOWN_SELECT_TYPE, value.getClass().toString())); } }
private Iterator<SelectItem> createUISelectItemIterator(UISelectItem selectItem) { Object value = selectItem.getValue(); SelectItem result = null; if (value == null) { result = new SelectItem(selectItem.getItemValue(), selectItem.getItemLabel(), selectItem.getItemDescription(), selectItem.isItemDisabled(), selectItem.isItemEscaped(), selectItem.isNoSelectionOption()); } else if (value instanceof SelectItem) { result = (SelectItem) value; } else { ValueExpression expression = selectItem.getValueExpression("value"); throw new IllegalArgumentException("ValueExpression '" + (expression == null ? null : expression.getExpressionString()) + "' of UISelectItem : " + RichfacesLogger.getComponentPath(selectItem) + " does not reference an Object of type SelectItem"); } return Iterators.singletonIterator(result); }
@Override public VisitResult visit(VisitContext arg0, UIComponent component) { if (component instanceof UISelectItem) { UISelectItem option = (UISelectItem) component; if ("true".equals(option.getAttributes().get("isoption"))) { // don't override traditional values if (option.getChildCount() > 0) { UIComponent label = option.getChildren().get(0); if (label.getClass().getName().contains("UIInstructions")) { String itemLabel = label.toString(); option.setItemLabel(itemLabel); } Object o = option.getValue(); if (o instanceof String) { option.setItemValue(o); } option.getChildren().clear(); } } } return VisitResult.ACCEPT; } }
private Iterator<SelectItem> createUISelectItemIterator(UISelectItem selectItem) { Object value = selectItem.getValue(); SelectItem result = null; if (value == null) { result = new SelectItem(selectItem.getItemValue(), selectItem.getItemLabel(), selectItem.getItemDescription(), selectItem.isItemDisabled(), selectItem.isItemEscaped(), selectItem.isNoSelectionOption()); } else if (value instanceof SelectItem) { result = (SelectItem) value; } else { ValueExpression expression = selectItem.getValueExpression("value"); throw new IllegalArgumentException("ValueExpression '" + (expression == null ? null : expression.getExpressionString()) + "' of UISelectItem : " + RichfacesLogger.getComponentPath(selectItem) + " does not reference an Object of type SelectItem"); } return Iterators.singletonIterator(result); }
private Iterator<SelectItem> newSelectItemsIterator(UISelectItem component) { SelectItem value = (SelectItem) component.getValue(); if (value == null) { value = new SelectItem(component.getItemValue(), component.getItemLabel(), component.getItemDescription(), component.isItemDisabled(), component.isItemEscaped(), component.isNoSelectionOption()); } return Collections.singleton(value).iterator(); }
protected SelectItem createSelectItem(final UISelectItem ui) { final Object value = ui.getValue(); if (value != null) { return convertValueAsSelectItem(value, ui); } else { final Object itemValue = ui.getItemValue(); final String label = ui.getItemLabel(); final String description = ui.getItemDescription(); final boolean disabled = ui.isItemDisabled(); return createSelectItem(itemValue, label, description, disabled); } }
SelectItem item = (SelectItem) ui.getValue(); if (item == null) { item = new SelectItem(ui.getItemValue(), ui.getItemLabel(), ui.getItemDescription(), ui.isItemDisabled(), ui.isItemEscaped(),
SelectItem item = (SelectItem) ui.getValue(); if (item == null) { item = new SelectItem(ui.getItemValue(), ui.getItemLabel(), ui.getItemDescription(), ui.isItemDisabled(), ui.isItemEscaped(),
SelectItem item = (SelectItem) ui.getValue(); if (item == null) { item = new SelectItem(ui.getItemValue(), ui.getItemLabel(), ui.getItemDescription(), ui.isItemDisabled(), ui.isItemEscaped(),
SelectItem item = (SelectItem) ui.getValue(); if (item == null) { item = new SelectItem(ui.getItemValue(), ui.getItemLabel(), ui.getItemDescription(), ui.isItemDisabled(), ui.isItemEscaped(),
SelectItem item = (SelectItem) ui.getValue(); if (item == null) { item = new SelectItem(ui.getItemValue(),
SelectItem item = (SelectItem) ui.getValue(); if (item == null) { item = new SelectItem(ui.getItemValue(),
SelectItem item = (SelectItem) ui.getValue(); if (item == null) { item = new SelectItem(ui.getItemValue(),
SelectItem item = (SelectItem) ui.getValue(); if (item == null) { item = new SelectItem(ui.getItemValue(),
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; }