- java.lang.Object
-
- jakarta.faces.component.UIComponent
-
- jakarta.faces.component.UIComponentBase
-
- jakarta.faces.component.UISelectItems
-
- org.omnifaces.component.model.SelectItemGroups
-
- All Implemented Interfaces:
PartialStateHolder,StateHolder,TransientStateHolder,ComponentSystemEventListener,FacesListener,SystemEventListenerHolder,EventListener
public class SelectItemGroups extends UISelectItems
The
o:selectItemGroupsis an extension ofUISelectItemswhich allows you to iterate over a nested collection representing groups of select items. This is basically theUIComponentcounterpart ofjakarta.faces.model.SelectItemGroup. There is no equivalent (yet) in the standard Faces API. Currently the only way to representSelectItemGroupin UI is to manually create and populate them in a backing bean which can end up to be quite verbose.Usage
Below example assumes a
List<Category>as value whereinCategoryin turn has aList<Product>.<h:selectOneMenu value="#{bean.selectedProduct}" converter="omnifaces.SelectItemsConverter"> <f:selectItem itemValue="#{null}" /> <o:selectItemGroups value="#{bean.categories}" var="category" itemLabel="#{category.name}"> <f:selectItems value="#{category.products}" var="product" itemLabel="#{product.name}" /> </o:selectItemGroups> </h:selectOneMenu>- Since:
- 3.0
- Author:
- Bauke Scholtz
-
-
Field Summary
Fields Modifier and Type Field Description static StringCOMPONENT_TYPEThe component type, which is "org.omnifaces.component.model.SelectItemGroups".-
Fields inherited from class jakarta.faces.component.UISelectItems
COMPONENT_FAMILY
-
Fields inherited from class jakarta.faces.component.UIComponent
ATTRS_WITH_DECLARED_DEFAULT_VALUES, BEANINFO_KEY, bindings, COMPOSITE_COMPONENT_TYPE_KEY, COMPOSITE_FACET_NAME, CURRENT_COMPONENT, CURRENT_COMPOSITE_COMPONENT, FACETS_KEY, HONOR_CURRENT_COMPONENT_ATTRIBUTES_PARAM_NAME, VIEW_LOCATION_KEY
-
-
Constructor Summary
Constructors Constructor Description SelectItemGroups()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ObjectgetValue()An override which wraps each UISelectItem(s) child in aSelectItemGroup.voidsetValueExpression(String name, ValueExpression binding)An override which checks if this isn't been invoked onvarattribute.-
Methods inherited from class jakarta.faces.component.UISelectItems
getFamily, setValue
-
Methods inherited from class jakarta.faces.component.UIComponentBase
addClientBehavior, addFacesListener, broadcast, clearInitialState, decode, encodeBegin, encodeChildren, encodeEnd, findComponent, getAttributes, getChildCount, getChildren, getClientBehaviors, getClientId, getDefaultEventName, getEventNames, getFacesContext, getFacesListeners, getFacet, getFacetCount, getFacets, getFacetsAndChildren, getId, getListenersForEventClass, getParent, getPassThroughAttributes, getRenderer, getRendererType, getRendersChildren, getValueBinding, invokeOnComponent, isRendered, isTransient, markInitialState, processDecodes, processRestoreState, processSaveState, processUpdates, processValidators, queueEvent, removeFacesListener, restoreAttachedState, restoreState, saveAttachedState, saveState, setId, setParent, setRendered, setRendererType, setTransient, setValueBinding, subscribeToEvent, unsubscribeFromEvent
-
Methods inherited from class jakarta.faces.component.UIComponent
encodeAll, getClientId, getCompositeComponentParent, getContainerClientId, getCurrentComponent, getCurrentCompositeComponent, getNamingContainer, getPassThroughAttributes, getResourceBundleMap, getStateHelper, getStateHelper, getTransientStateHelper, getTransientStateHelper, getValueExpression, initialStateMarked, isCompositeComponent, isInView, isVisitable, popComponentFromEL, processEvent, pushComponentToEL, restoreTransientState, saveTransientState, setInView, visitTree
-
-
-
-
Field Detail
-
COMPONENT_TYPE
public static final String COMPONENT_TYPE
The component type, which is "org.omnifaces.component.model.SelectItemGroups".- See Also:
- Constant Field Values
-
-
Method Detail
-
setValueExpression
public void setValueExpression(String name, ValueExpression binding)
An override which checks if this isn't been invoked onvarattribute. Finally it delegates to the super method.- Overrides:
setValueExpressionin classUIComponent- Throws:
IllegalArgumentException- When this value expression is been set onvarattribute.
-
getValue
public Object getValue()
An override which wraps each UISelectItem(s) child in aSelectItemGroup.- Overrides:
getValuein classUISelectItems
-
-