- java.lang.Object
-
- org.omnifaces.util.Components.ForEach
-
- Enclosing class:
- Components
public static class Components.ForEach extends Object
Builder class used to collect a number of query parameters for a visit (for each) of components in the Faces component tree. The chain of collecting parameters is terminated by calling one of the invoke methods.- Since:
- 2.0
- Author:
- Arjan Tijms
-
-
Constructor Summary
Constructors Constructor Description ForEach()
ForEach(FacesContext facesContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Components.ForEach
fromRoot(UIComponent root)
The root component where tree visiting startsprotected FacesContext
getFacesContext()
protected Set<VisitHint>
getHints()
protected Collection<String>
getIds()
protected UIComponent
getRoot()
Components.ForEach
havingIds(String... ids)
The IDs of the components that are to be visitedComponents.ForEach
havingIds(Collection<String> ids)
The IDs of the components that are visitedvoid
invoke(VisitCallback operation)
Invokes the given operation on the components as specified by the query parameters set via this builder.<C extends UIComponent>
voidinvoke(Consumer<C> operation)
Invokes the given operation on the components as specified by the query parameters set via this builder.Components.ForEach
ofTypes(Class<?>... types)
The types of the components that are to be visitedComponents.ForEach
withHints(VisitHint... hints)
The VisitHints that are used for the visit.Components.ForEach
withHints(Set<VisitHint> hints)
The VisitHints that are used for the visit.
-
-
-
Constructor Detail
-
ForEach
public ForEach()
-
ForEach
public ForEach(FacesContext facesContext)
-
-
Method Detail
-
fromRoot
public Components.ForEach fromRoot(UIComponent root)
The root component where tree visiting starts- Parameters:
root
- the root component where tree visiting starts- Returns:
- the intermediate builder object to continue the builder chain
-
havingIds
public Components.ForEach havingIds(Collection<String> ids)
The IDs of the components that are visited- Parameters:
ids
- the IDs of the components that are visited- Returns:
- the intermediate builder object to continue the builder chain
-
havingIds
public Components.ForEach havingIds(String... ids)
The IDs of the components that are to be visited- Parameters:
ids
- the IDs of the components that are to be visited- Returns:
- the intermediate builder object to continue the builder chain
-
withHints
public Components.ForEach withHints(Set<VisitHint> hints)
The VisitHints that are used for the visit.- Parameters:
hints
- the VisitHints that are used for the visit.- Returns:
- the intermediate builder object to continue the builder chain
-
withHints
public Components.ForEach withHints(VisitHint... hints)
The VisitHints that are used for the visit.- Parameters:
hints
- the VisitHints that are used for the visit.- Returns:
- the intermediate builder object to continue the builder chain
-
ofTypes
@SafeVarargs public final Components.ForEach ofTypes(Class<?>... types)
The types of the components that are to be visited- Parameters:
types
- the types of the components that are to be visited- Returns:
- the intermediate builder object to continue the builder chain
-
invoke
public <C extends UIComponent> void invoke(Consumer<C> operation)
Invokes the given operation on the components as specified by the query parameters set via this builder.- Type Parameters:
C
- The expected component type.- Parameters:
operation
- the operation to invoke on each component- Throws:
ClassCastException
- WhenC
is of wrong type.
-
invoke
public void invoke(VisitCallback operation)
Invokes the given operation on the components as specified by the query parameters set via this builder.- Parameters:
operation
- the operation to invoke on each component
-
getFacesContext
protected FacesContext getFacesContext()
-
getRoot
protected UIComponent getRoot()
-
getIds
protected Collection<String> getIds()
-
-