selectItems.add(new SelectItem(uiSelectItem.getItemValue(), uiSelectItem.getItemLabel(), uiSelectItem.getItemDescription(),
private static String getItemLabel(UISelectItem uiSelectItem) { if (uiSelectItem.getItemLabel() != null) { return uiSelectItem.getItemLabel(); } else if (uiSelectItem.getItemValue() != null) { return uiSelectItem.getItemValue().toString(); } else { return null; } }
private static String getItemLabel(UISelectItem uiSelectItem) { if (uiSelectItem.getItemLabel() != null) { return uiSelectItem.getItemLabel(); } else if (uiSelectItem.getItemValue() != null) { return uiSelectItem.getItemValue().toString(); } else { return null; } }
private String getSelectItemValue(String componentID) { UIComponent uiComponent = jsfServerSession.findComponent(componentID); if (!(uiComponent instanceof UISelectItem)) { throw new IllegalArgumentException(componentID + " is not a UISelectItem."); } return ((UISelectItem)uiComponent).getItemValue().toString(); }
@Override public Object getItemValue() { if (itemValueLiteral && !(getParent() instanceof UISelectMany)) { final Object converted = ComponentUtils.getConvertedValue( FacesContext.getCurrentInstance(), getParent(), (String) super.getItemValue()); return converted; } else { return super.getItemValue(); } } }
public void onCatalogChanged() { this.cubeItems = null; if (getCubes().size() > 1) { this.cubeName = (String) getCubes().get(1).getItemValue(); } else { this.cubeName = null; } }
private void assignDataIfNull(Object selectItem) { UISelectItem uiSelectItem = (UISelectItem) selectItem; if (uiSelectItem.getItemValue() == null) { if (uiSelectItem.getItemLabel() != null) { uiSelectItem.setItemValue(uiSelectItem.getItemLabel()); } } if (uiSelectItem.getItemLabel() == null) { if (uiSelectItem.getItemValue() != null) { uiSelectItem .setItemLabel(uiSelectItem.getItemValue().toString()); } } }
static void assignDataIfNull(Object selectItem) { UISelectItem uiSelectItem = (UISelectItem) selectItem; if (uiSelectItem.getItemValue() == null) { if (uiSelectItem.getItemLabel() != null) { uiSelectItem.setItemValue(uiSelectItem.getItemLabel()); } } if (uiSelectItem.getItemLabel() == null) { if (uiSelectItem.getItemValue() != null) { uiSelectItem .setItemLabel(uiSelectItem.getItemValue().toString()); } } }
/** * @see org.pivot4j.analytics.property.AbstractPropertyEditor#getValue(org.pivot4j.ui.property.SimpleRenderProperty) */ @Override protected Object getValue(SimpleRenderProperty property) { String stringValue = StringUtils.trimToNull(property.getValue()); List<UISelectItem> items = getItems(); boolean matches = false; if (stringValue != null && items != null) { for (UISelectItem item : items) { if (stringValue.equals(item.getItemValue())) { matches = true; break; } } } if (!matches) { stringValue = null; } return stringValue; }
/** * 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; }
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); }
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; }