selectItems.add(new SelectItem(uiSelectItem.getItemValue(), uiSelectItem.getItemLabel(), uiSelectItem.getItemDescription(), uiSelectItem.isItemDisabled(), uiSelectItem.isItemEscaped(),
/** * Renders a single <option> tag. For some reason, * <code>SelectItem</code> and <code>UISelectItem</code> don't share a * common interface, so this method is repeated twice. * * @param rw * The response writer * @param selectItem * The current SelectItem * @param selectedOption * the currently selected option * @throws IOException * thrown if something's wrong with the response writer */ protected void renderOption(ResponseWriter rw, UISelectItem selectItem, String[] selectedOption, int index) throws IOException { String itemLabel = selectItem.getItemLabel(); final String itemDescription = selectItem.getItemDescription(); final Object itemValue = selectItem.getItemValue(); boolean isItemLabelBlank = itemLabel == null || itemLabel.trim().length() == 0; itemLabel = isItemLabelBlank ? " " : itemLabel; renderOption(rw, selectedOption, index, itemLabel, itemDescription, itemValue); }
/** * Renders a single <option> tag. For some reason, * <code>SelectItem</code> and <code>UISelectItem</code> don't share a * common interface, so this method is repeated twice. * * @param rw * The response writer * @param selectItem * The current SelectItem * @param selectedOption * the currently selected option * @throws IOException * thrown if something's wrong with the response writer */ protected void renderOption(ResponseWriter rw, UISelectItem selectItem, String[] selectedOption, int index) throws IOException { String itemLabel = selectItem.getItemLabel(); final String itemDescription = selectItem.getItemDescription(); final Object itemValue = selectItem.getItemValue(); boolean isItemLabelBlank = itemLabel == null || itemLabel.trim().length() == 0; itemLabel = isItemLabelBlank ? " " : itemLabel; renderOption(rw, selectedOption, index, itemLabel, itemDescription, itemValue); }
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(); }
/** * <p>Construct a <code>SelectItem</code> with property values initialized from the corresponding * properties on the <code>UISelectItem</code>. * </p> * @param uiSelectItem The UI select item. */ public ExtendedSelectItem(UISelectItem uiSelectItem) { super( uiSelectItem.getItemValue(), getItemLabel(uiSelectItem), uiSelectItem.getItemDescription(), uiSelectItem.isItemDisabled(), uiSelectItem.isItemEscaped(), uiSelectItem.isNoSelectionOption() ); }
/** * <p>Construct a <code>SelectItem</code> with property values initialized from the corresponding * properties on the <code>UISelectItem</code>. * </p> * @param uiSelectItem The UI select item. */ public ExtendedSelectItem(UISelectItem uiSelectItem) { super( uiSelectItem.getItemValue(), getItemLabel(uiSelectItem), uiSelectItem.getItemDescription(), uiSelectItem.isItemDisabled(), uiSelectItem.isItemEscaped(), uiSelectItem.isNoSelectionOption() ); }
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); } }
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; }
SelectItem item = (SelectItem) ui.getValue(); if (item == null) { item = new SelectItem(ui.getItemValue(), ui.getItemLabel(), ui.getItemDescription(), ui.isItemDisabled(), ui.isItemEscaped(), ui.isNoSelectionOption());
SelectItem item = (SelectItem) ui.getValue(); if (item == null) { item = new SelectItem(ui.getItemValue(), ui.getItemLabel(), ui.getItemDescription(), ui.isItemDisabled(), ui.isItemEscaped(), ui.isNoSelectionOption());
SelectItem item = (SelectItem) ui.getValue(); if (item == null) { item = new SelectItem(ui.getItemValue(), ui.getItemLabel(), ui.getItemDescription(), ui.isItemDisabled(), ui.isItemEscaped(), ui.isNoSelectionOption());
SelectItem item = (SelectItem) ui.getValue(); if (item == null) { item = new SelectItem(ui.getItemValue(), ui.getItemLabel(), ui.getItemDescription(), ui.isItemDisabled(), ui.isItemEscaped(), ui.isNoSelectionOption());
item = new SelectItem(ui.getItemValue(), ui.getItemLabel(), ui.getItemDescription(), ui.isItemDisabled(), ui.isItemEscaped(),
item = new SelectItem(ui.getItemValue(), ui.getItemLabel(), ui.getItemDescription(), ui.isItemDisabled(), ui.isItemEscaped(),
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> 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); }
item = new SelectItem(ui.getItemValue(), ui.getItemLabel(), ui.getItemDescription(), ui.isItemDisabled(), ui.isItemEscaped(),
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 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; }