private String option; // +getter +setter private List<SelectItem> options; // +getter public Bean() { options = new ArrayList<SelectItem>(); SelectItemGroup group1 = new SelectItemGroup("Group 1"); group1.setSelectItems(new SelectItem[] { new SelectItem("Group 1 Value 1", "Group 1 Label 1"), new SelectItem("Group 1 Value 2", "Group 1 Label 2"), new SelectItem("Group 1 Value 3", "Group 1 Label 3") }); options.add(group1); SelectItemGroup group2 = new SelectItemGroup("Group 2"); group2.setSelectItems(new SelectItem[] { new SelectItem("Group 2 Value 1", "Group 2 Label 1"), new SelectItem("Group 2 Value 2", "Group 2 Label 2"), new SelectItem("Group 2 Value 3", "Group 2 Label 3") }); options.add(group2); }
public SelectItemGroup(String label, String description, boolean disabled, SelectItem[] selectItems) { super("", label, description, disabled); setSelectItems(selectItems); }
/** * <p>Construct a <code>SelectItemGroup</code> with the specified * properties. The <code>value</code> property will be set to a * zero-length String.</p> * * @param label Label to be rendered for this group in the response * @param description Description of this group, for use in tools * @param disabled Flag indicating that this group is disabled * @param selectItems Array of {@link SelectItem} describing the * items available in this group * * @throws NullPointerException if <code>label</code> * or <code>selectItems</code> is <code>false</code> */ public SelectItemGroup(String label, String description, boolean disabled, SelectItem selectItems[]) { super("", label, description, disabled); setSelectItems(selectItems); }
/** * <p>Construct a <code>SelectItemGroup</code> with the specified * properties. The <code>value</code> property will be set to a * zero-length String.</p> * * @param label Label to be rendered for this group in the response * @param description Description of this group, for use in tools * @param disabled Flag indicating that this group is disabled * @param selectItems Array of {@link SelectItem} describing the * items available in this group * * @throws NullPointerException if <code>label</code> * or <code>selectItems</code> is <code>false</code> */ public SelectItemGroup(String label, String description, boolean disabled, SelectItem selectItems[]) { super("", label, description, disabled); setSelectItems(selectItems); }
/** * <p>Construct a <code>SelectItemGroup</code> with the specified * properties. The <code>value</code> property will be set to a * zero-length String.</p> * * @param label Label to be rendered for this group in the response * @param description Description of this group, for use in tools * @param disabled Flag indicating that this group is disabled * @param selectItems Array of {@link SelectItem} describing the * items available in this group * * @throws NullPointerException if <code>label</code> * or <code>selectItems</code> is <code>false</code> */ public SelectItemGroup(String label, String description, boolean disabled, SelectItem selectItems[]) { super("", label, description, disabled); setSelectItems(selectItems); }
/** * <p>Construct a <code>SelectItemGroup</code> with the specified * properties. The <code>value</code> property will be set to a * zero-length String.</p> * * @param label Label to be rendered for this group in the response * @param description Description of this group, for use in tools * @param disabled Flag indicating that this group is disabled * @param selectItems Array of {@link SelectItem} describing the * items available in this group * * @throws NullPointerException if <code>label</code> * or <code>selectItems</code> is <code>false</code> */ public SelectItemGroup(String label, String description, boolean disabled, SelectItem selectItems[]) { super("", label, description, disabled); setSelectItems(selectItems); }
/** * <p>Construct a <code>SelectItemGroup</code> with the specified * properties. The <code>value</code> property will be set to a * zero-length String.</p> * * @param label Label to be rendered for this group in the response * @param description Description of this group, for use in tools * @param disabled Flag indicating that this group is disabled * @param selectItems Array of {@link SelectItem} describing the * items available in this group * * @throws NullPointerException if <code>label</code> * or <code>selectItems</code> is <code>false</code> */ public SelectItemGroup(String label, String description, boolean disabled, SelectItem selectItems[]) { super("", label, description, disabled); setSelectItems(selectItems); }
/** * <p>Construct a <code>SelectItemGroup</code> with the specified * properties. The <code>value</code> property will be set to a * zero-length String.</p> * * @param label Label to be rendered for this group in the response * @param description Description of this group, for use in tools * @param disabled Flag indicating that this group is disabled * @param selectItems Array of {@link SelectItem} describing the * items available in this group * * @throws NullPointerException if <code>label</code> * or <code>selectItems</code> is <code>false</code> */ public SelectItemGroup(String label, String description, boolean disabled, SelectItem selectItems[]) { super("", label, description, disabled); setSelectItems(selectItems); }
/** * <p>Construct a <code>SelectItemGroup</code> with the specified * properties. The <code>value</code> property will be set to a * zero-length String.</p> * * @param label Label to be rendered for this group in the response * @param description Description of this group, for use in tools * @param disabled Flag indicating that this group is disabled * @param selectItems Array of {@link SelectItem} describing the * items available in this group * * @throws NullPointerException if <code>label</code> * or <code>selectItems</code> is <code>false</code> */ public SelectItemGroup(String label, String description, boolean disabled, SelectItem selectItems[]) { super("", label, description, disabled); setSelectItems(selectItems); }
/** * <p>Construct a <code>SelectItemGroup</code> with the specified * properties. The <code>value</code> property will be set to a * zero-length String.</p> * * @param label Label to be rendered for this group in the response * @param description Description of this group, for use in tools * @param disabled Flag indicating that this group is disabled * @param selectItems Array of {@link SelectItem} describing the * items available in this group * * @throws NullPointerException if <code>label</code> * or <code>selectItems</code> is <code>false</code> */ public SelectItemGroup(String label, String description, boolean disabled, SelectItem selectItems[]) { super("", label, description, disabled); setSelectItems(selectItems); }
/** * <p>Construct a <code>SelectItemGroup</code> with the specified * properties. The <code>value</code> property will be set to a * zero-length String.</p> * * @param label Label to be rendered for this group in the response * @param description Description of this group, for use in tools * @param disabled Flag indicating that this group is disabled * @param selectItems Array of {@link SelectItem} describing the * items available in this group * * @throws NullPointerException if <code>label</code> * or <code>selectItems</code> is <code>false</code> */ public SelectItemGroup(String label, String description, boolean disabled, SelectItem selectItems[]) { super("", label, description, disabled); setSelectItems(selectItems); }
/** * <p>Construct a <code>SelectItemGroup</code> with the specified * properties. The <code>value</code> property will be set to a * zero-length String.</p> * * @param label Label to be rendered for this group in the response * @param description Description of this group, for use in tools * @param disabled Flag indicating that this group is disabled * @param selectItems Array of {@link SelectItem} describing the * items available in this group * * @throws NullPointerException if <code>label</code> * or <code>selectItems</code> is <code>false</code> */ public SelectItemGroup(String label, String description, boolean disabled, SelectItem selectItems[]) { super("", label, description, disabled); setSelectItems(selectItems); }
public List<SelectItem> getAllSavedSearchesSelectItems() { List<SelectItem> items = new ArrayList<>(); // Add flagged content views SelectItemGroup flaggedGroup = new SelectItemGroup(messages.get(SEARCH_FILTERS_LABEL)); List<ContentViewHeader> flaggedSavedSearches = getContentViewHeaders(); List<SelectItem> flaggedSavedSearchesItems = convertCVToSelectItems(flaggedSavedSearches); flaggedGroup.setSelectItems( flaggedSavedSearchesItems.toArray(new SelectItem[flaggedSavedSearchesItems.size()])); items.add(flaggedGroup); // Add saved searches List<DocumentModel> userSavedSearches = getSavedSearches(); if (!userSavedSearches.isEmpty()) { SelectItemGroup userGroup = new SelectItemGroup(messages.get(SAVED_SEARCHES_LABEL)); List<SelectItem> userSavedSearchesItems = convertToSelectItems(userSavedSearches); userGroup.setSelectItems(userSavedSearchesItems.toArray(new SelectItem[userSavedSearchesItems.size()])); items.add(userGroup); } // Add shared searches List<DocumentModel> otherUsersSavedFacetedSearches = getSharedSearches(); if (!otherUsersSavedFacetedSearches.isEmpty()) { List<SelectItem> otherUsersSavedSearchesItems = convertToSelectItems(otherUsersSavedFacetedSearches); SelectItemGroup allGroup = new SelectItemGroup(messages.get(SHARED_SEARCHES_LABEL)); allGroup.setSelectItems( otherUsersSavedSearchesItems.toArray(new SelectItem[otherUsersSavedSearchesItems.size()])); items.add(allGroup); } return items; }
/** * An override which wraps each UISelectItem(s) child in a {@link SelectItemGroup}. */ @Override public Object getValue() { List<SelectItemGroup> groups = new ArrayList<>(); createSelectItems(this, super.getValue(), SelectItemGroup::new, selectItemGroup -> { List<SelectItem> items = new ArrayList<>(); for (UIComponent child : getChildren()) { if (child instanceof UISelectItems) { createSelectItems(child, ((UISelectItems) child).getValue(), SelectItem::new, items::add); } else if (child instanceof UISelectItem) { items.add(createSelectItem(child, null, SelectItem::new)); } } selectItemGroup.setSelectItems(items.toArray(new SelectItem[items.size()])); groups.add(selectItemGroup); }); return groups; }
/** * An override which wraps each UISelectItem(s) child in a {@link SelectItemGroup}. */ @Override public Object getValue() { List<SelectItemGroup> groups = new ArrayList<>(); createSelectItems(this, super.getValue(), SelectItemGroup::new, selectItemGroup -> { List<SelectItem> items = new ArrayList<>(); for (UIComponent child : getChildren()) { if (child instanceof UISelectItems) { createSelectItems(child, ((UISelectItems) child).getValue(), SelectItem::new, items::add); } else if (child instanceof UISelectItem) { items.add(createSelectItem(child, null, SelectItem::new)); } } selectItemGroup.setSelectItems(items.toArray(new SelectItem[items.size()])); groups.add(selectItemGroup); }); return groups; }
public List<SelectItem> getPropertyList() { List<SelectItem> propertyNames = new ArrayList<SelectItem>(); TablePropertyDefinition[] propDefinitions = TablePropertyDefinitionUtils .getDefaultDefinitionsForTable(TABLE_TYPE, InheritanceLevel.TABLE, true); SelectItem selectItem = new SelectItem(""); selectItem.setLabel(""); propertyNames.add(selectItem); Map<String, List<TablePropertyDefinition>> propGroups = TablePropertyDefinitionUtils .groupProperties(propDefinitions); for (Map.Entry<String, List<TablePropertyDefinition>> entry : propGroups.entrySet()) { List<SelectItem> items = new ArrayList<SelectItem>(); for (TablePropertyDefinition propDefinition : entry.getValue()) { String propName = propDefinition.getName(); if (propDefinition.getDeprecation() == null) { items.add(new SelectItem(propName, propDefinition.getDisplayName())); } } if (!items.isEmpty()) { SelectItemGroup itemGroup = new SelectItemGroup(entry.getKey()); itemGroup.setSelectItems(items.toArray(new SelectItem[items.size()])); propertyNames.add(itemGroup); } } return propertyNames; }
public List<SelectItem> getPropertyList() { List<SelectItem> propertyNames = new ArrayList<SelectItem>(); TablePropertyDefinition[] propDefinitions = TablePropertyDefinitionUtils .getDefaultDefinitionsForTable(TABLE_TYPE, InheritanceLevel.TABLE, true); SelectItem selectItem = new SelectItem(""); selectItem.setLabel(""); propertyNames.add(selectItem); Map<String, List<TablePropertyDefinition>> propGroups = TablePropertyDefinitionUtils .groupProperties(propDefinitions); for (Map.Entry<String, List<TablePropertyDefinition>> entry : propGroups.entrySet()) { List<SelectItem> items = new ArrayList<SelectItem>(); for (TablePropertyDefinition propDefinition : entry.getValue()) { String propName = propDefinition.getName(); if (propDefinition.getDeprecation() == null) { items.add(new SelectItem(propName, propDefinition.getDisplayName())); } } if (!items.isEmpty()) { SelectItemGroup itemGroup = new SelectItemGroup(entry.getKey()); itemGroup.setSelectItems(items.toArray(new SelectItem[items.size()])); propertyNames.add(itemGroup); } } return propertyNames; }
itemGroup.setSelectItems(items.toArray(new SelectItem[items.size()])); propertiesToAdd.add(itemGroup);
itemGroup.setSelectItems(items.toArray(new SelectItem[items.size()])); propertiesToAdd.add(itemGroup);