org.omnifaces.util.selectitems
Class SelectItemsCollector

java.lang.Object
  extended by org.omnifaces.util.selectitems.SelectItemsCollector

public final class SelectItemsCollector
extends java.lang.Object

Collection of utility methods for collecting SelectItem instances from various sources.

Author:
Arjan Tijms

Method Summary
static java.util.List<javax.faces.model.SelectItem> collectFromParent(javax.faces.context.FacesContext context, javax.faces.component.UIComponent parent)
          This method gets all select items that are expressed via UISelectItem or UISelectItems children of the given parent component.
static java.util.List<javax.faces.model.SelectItem> collectFromUISelectItemsIterator(javax.faces.context.FacesContext facesContext, javax.faces.component.UISelectItems uiSelectItems, java.lang.Iterable<?> items)
          This method runs the algorithm expressed by a UISelectItems component that uses the var iterator construct to generate a list of SelectItems.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

collectFromParent

public static java.util.List<javax.faces.model.SelectItem> collectFromParent(javax.faces.context.FacesContext context,
                                                                             javax.faces.component.UIComponent parent)
This method gets all select items that are expressed via UISelectItem or UISelectItems children of the given parent component.

Note that if SelectItemGroup instances are present then those will be inserted directly in the returned list and the using code still has to iterate over its children recursively to obtain all separate SelectItem instances.

Parameters:
parent - the parent whose children are scanned
context -
Returns:
list of select items obtained from parent's children.

collectFromUISelectItemsIterator

public static java.util.List<javax.faces.model.SelectItem> collectFromUISelectItemsIterator(javax.faces.context.FacesContext facesContext,
                                                                                            javax.faces.component.UISelectItems uiSelectItems,
                                                                                            java.lang.Iterable<?> items)
This method runs the algorithm expressed by a UISelectItems component that uses the var iterator construct to generate a list of SelectItems.

Parameters:
uiSelectItems -
items -
facesContext -
Returns:
list of SelectItem obtained from the given parameters