|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.omnifaces.util.Components
public final class Components
Collection of utility methods for the JSF API with respect to working with UIComponent
.
Method Summary | ||
---|---|---|
static
|
findComponent(java.lang.String clientId)
Returns the UI component matching the given client ID search expression. |
|
static
|
findComponentInChildren(javax.faces.component.UIComponent component,
java.lang.String clientId)
Returns the UI component matching the given client ID search expression relative to the point in the component tree of the given component, searching only in its children. |
|
static
|
findComponentInParents(javax.faces.component.UIComponent component,
java.lang.String clientId)
Returns the UI component matching the given client ID search expression relative to the point in the component tree of the given component, searching only in its parents. |
|
static
|
findComponentRelatively(javax.faces.component.UIComponent component,
java.lang.String clientId)
Returns the UI component matching the given client ID search expression relative to the point in the component tree of the given component. |
|
static
|
getClosestParent(javax.faces.component.UIComponent component,
java.lang.Class<T> parentType)
Returns from the given component the closest parent of the given parent type, or null if none
is found. |
|
static javax.faces.component.UIComponent |
getCurrentComponent()
Returns the current UI component from the EL context. |
|
static javax.faces.component.UIForm |
getCurrentForm()
Returns the currently submitted UI form component, or null if there is none, which may happen when
the current request is not a postback request at all, or when the view has been changed by for example a
successful navigation. |
|
static
|
getImmediateValue(javax.faces.component.UIInput input)
Returns the value of the given input component whereby any unconverted submitted string value will immediately be converted/validated as this method is called. |
|
static java.lang.String |
getLabel(javax.faces.component.UIComponent input)
Returns the value of the label attribute associated with the given UI component if any, else
the client ID. |
|
static java.lang.String |
getOptionalLabel(javax.faces.component.UIComponent input)
Returns the value of the label attribute associated with the given UI component if any, else
null. |
|
static
|
getValue(javax.faces.component.EditableValueHolder component)
Returns the value of the given editable value holder component without the need to know if the given component has already been converted/validated or not. |
|
static boolean |
hasInvokedSubmit(javax.faces.component.UIComponent component)
Returns whether the given component has invoked the form submit. |
|
static boolean |
hasSubmittedValue(javax.faces.component.EditableValueHolder component)
Returns whether the given editable value holder component has a submitted value. |
|
static boolean |
isEditable(javax.faces.component.UIInput input)
Returns whether the given UI input component is editable. |
|
static boolean |
shouldVisitSkipIteration(javax.faces.component.visit.VisitContext context)
Returns true if the given visit context contains the visit hint that iteration should be skipped. |
|
static
|
validateHasDirectParent(javax.faces.component.UIComponent component,
java.lang.Class<T> parentType)
Validate if the given component has a direct parent of the given parent type. |
|
static void |
validateHasNoChildren(javax.faces.component.UIComponent component)
Validate if the given component has no children. |
|
static
|
validateHasParent(javax.faces.component.UIComponent component,
java.lang.Class<T> parentType)
Validate if the given component has a parent of the given parent type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static javax.faces.component.UIComponent getCurrentComponent()
UIComponent.getCurrentComponent(FacesContext)
public static <T extends javax.faces.component.UIComponent> T findComponent(java.lang.String clientId)
clientId
- The client ID search expression.
java.lang.ClassCastException
- When T
is of wrong type.UIComponent.findComponent(String)
public static <T extends javax.faces.component.UIComponent> T findComponentRelatively(javax.faces.component.UIComponent component, java.lang.String clientId)
component
- the component from which the relative search is started.clientId
- The client ID search expression.
java.lang.ClassCastException
- When T
is of wrong type.UIComponent.findComponent(String)
public static <T extends javax.faces.component.UIComponent> T findComponentInParents(javax.faces.component.UIComponent component, java.lang.String clientId)
component
- the component from which the relative search is started.clientId
- The client ID search expression.
java.lang.ClassCastException
- When T
is of wrong type.UIComponent.findComponent(String)
public static <T extends javax.faces.component.UIComponent> T findComponentInChildren(javax.faces.component.UIComponent component, java.lang.String clientId)
component
- the component from which the relative search is started.clientId
- The client ID search expression.
java.lang.ClassCastException
- When T
is of wrong type.UIComponent.findComponent(String)
public static <T extends javax.faces.component.UIComponent> T getClosestParent(javax.faces.component.UIComponent component, java.lang.Class<T> parentType)
null
if none
is found.
T
- The generic parent type.component
- The component to return the closest parent of the given parent type for.parentType
- The parent type.
null
if none
is found.
java.lang.ClassCastException
- When T
is of wrong type.public static boolean shouldVisitSkipIteration(javax.faces.component.visit.VisitContext context)
context
- The involved visit context.public static javax.faces.component.UIForm getCurrentForm()
null
if there is none, which may happen when
the current request is not a postback request at all, or when the view has been changed by for example a
successful navigation.
UIForm.isSubmitted()
public static boolean isEditable(javax.faces.component.UIInput input)
input
- The UI input component to be checked.
true
if the given UI input component is editable.public static java.lang.String getLabel(javax.faces.component.UIComponent input)
label
attribute associated with the given UI component if any, else
the client ID. It never returns null.
input
- The UI input component for which the label is to be retrieved.
label
attribute associated with the given UI component if any, else
the client ID.public static java.lang.String getOptionalLabel(javax.faces.component.UIComponent input)
label
attribute associated with the given UI component if any, else
null.
input
- The UI input component for which the label is to be retrieved.
label
attribute associated with the given UI component if any, else
null.public static <T> T getValue(javax.faces.component.EditableValueHolder component)
component
- The editable value holder component to obtain the value for.
java.lang.ClassCastException
- When T
is of wrong type.public static <T> T getImmediateValue(javax.faces.component.UIInput input)
input
- The input component to obtain the converted/validated value for.
java.lang.ClassCastException
- When T
is of wrong type.public static boolean hasSubmittedValue(javax.faces.component.EditableValueHolder component)
component
- The editable value holder component to be checked.
true
if the given editable value holder component has a submitted value, otherwise
false
.public static boolean hasInvokedSubmit(javax.faces.component.UIComponent component)
UICommand
component. In ajax requests, that can also be among others an UIInput
component.
component
- The component to be checked.
true
if the given component has invoked the form submit.public static <T extends javax.faces.component.UIComponent> void validateHasParent(javax.faces.component.UIComponent component, java.lang.Class<T> parentType) throws java.lang.IllegalArgumentException
component
- The component to be validated.parentType
- The parent type to be checked.
java.lang.IllegalArgumentException
- When the given component doesn't have any parent of the given type.public static <T extends javax.faces.component.UIComponent> void validateHasDirectParent(javax.faces.component.UIComponent component, java.lang.Class<T> parentType) throws java.lang.IllegalArgumentException
component
- The component to be validated.parentType
- The parent type to be checked.
java.lang.IllegalArgumentException
- When the given component doesn't have a direct parent of the given type.public static void validateHasNoChildren(javax.faces.component.UIComponent component) throws java.lang.IllegalArgumentException
component
- The component to be validated.
java.lang.IllegalArgumentException
- When the given component has any children.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |