Class ComponentUtils
java.lang.Object
org.apache.myfaces.tobago.util.ComponentUtils
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescriptionstatic jakarta.faces.component.UIComponentcreateComponent(jakarta.faces.context.FacesContext facesContext, String componentType, RendererTypes rendererType, String clientId) static voidevaluateAutoFor(jakarta.faces.component.UIComponent component, Class<? extends jakarta.faces.component.UIComponent> clazz) Looks for the attribute "for" of the component.static StringevaluateClientId(jakarta.faces.context.FacesContext context, jakarta.faces.component.UIComponent component, String componentId) Resolves the real clientId.static StringevaluateClientIds(jakarta.faces.context.FacesContext context, jakarta.faces.component.UIComponent component, String[] componentIds) Resolves the real clientIds.static <T> TfindAncestor(jakarta.faces.component.UIComponent component, Class<T> type) static <T extends jakarta.faces.component.UIComponent>
 TSearches the children beneath the component and return the first component matching the type.static StringfindClientIdFor(jakarta.faces.component.UIComponent component, jakarta.faces.context.FacesContext facesContext) Looks for the attribute "for" in the component.static jakarta.faces.component.UIComponentfindComponent(jakarta.faces.component.UIComponent from, String relativeId) The search depends on the number of prefixed colons in the relativeId:static jakarta.faces.component.UIComponentfindComponent(jakarta.faces.context.FacesContext facesContext, jakarta.faces.component.UIComponent from, String relativeId) The search depends on the number of prefixed colons in the relativeId:static <T extends jakarta.faces.component.UIComponent>
 TfindDescendant(jakarta.faces.component.UIComponent component, Class<T> type) Searches the component tree beneath the component and return the first component matching the type.static <T extends jakarta.faces.component.UIComponent>
 List<T> findDescendantList(jakarta.faces.component.UIComponent component, Class<T> type) Searches the component tree beneath the component and return all component matching the type.static <T extends jakarta.faces.component.UIComponent>
 TfindFacetDescendant(jakarta.faces.component.UIComponent component, Facets facet, Class<T> type) Searches the component tree beneath the component and return the first component matching the type.static jakarta.faces.component.UIComponentfindFor(jakarta.faces.component.UIComponent component) static AbstractUIFormBasefindForm(jakarta.faces.component.UIComponent component) static List<jakarta.faces.component.UIComponent> findLayoutChildren(jakarta.faces.component.UIComponent container) static AbstractUIPagefindPage(jakarta.faces.component.UIComponent component) static AbstractUIPagefindPage(jakarta.faces.context.FacesContext facesContext) static AbstractUIPagefindPage(jakarta.faces.context.FacesContext context, jakarta.faces.component.UIComponent component) static ObjectfindParameter(jakarta.faces.component.UIComponent component, String name) static List<AbstractUIForm> findSubForms(jakarta.faces.component.UIComponent component) Find all sub forms of a component, and collects it.static jakarta.faces.component.UIViewRootfindViewRoot(jakarta.faces.view.facelets.FaceletContext faceletContext, jakarta.faces.component.UIComponent component) Tries to walk up the parents to find the UIViewRoot, if not found, then go to FaceletContext's FacesContext for the view root.static ObjectgetAttribute(jakarta.faces.component.UIComponent component, Attributes name) static booleangetBooleanAttribute(jakarta.faces.component.UIComponent component, Attributes name) static booleangetBooleanAttribute(jakarta.faces.component.UIComponent component, Attributes name, boolean defaultValue) static CharactergetCharacterAttribute(jakarta.faces.component.UIComponent component, Attributes name) static StringgetConfirmation(jakarta.faces.component.UIComponent component) returns the "confirmation" attribute or the value of the "confirmation" facet of a component.static ObjectgetConvertedValue(jakarta.faces.context.FacesContext facesContext, jakarta.faces.component.UIComponent component, String stringValue) static jakarta.faces.convert.ConvertergetConverter(jakarta.faces.context.FacesContext facesContext, jakarta.faces.component.UIComponent component, Object value) Deprecated.since 5.0.0.static ObjectgetDataAttribute(jakarta.faces.component.UIComponent component, String name) getDataAttributes(jakarta.faces.component.UIComponent component) static StringgetFacesMessageAsString(jakarta.faces.context.FacesContext facesContext, jakarta.faces.component.UIComponent component) static jakarta.faces.component.UIComponentstatic StringgetFormattedValue(jakarta.faces.context.FacesContext facesContext, jakarta.faces.component.UIComponent component, Object currentValue) Deprecated.since 5.0.0.static intgetIntAttribute(jakarta.faces.component.UIComponent component, Attributes name) static intgetIntAttribute(jakarta.faces.component.UIComponent component, Attributes name, int defaultValue) static jakarta.faces.application.FacesMessage.SeveritygetMaximumSeverity(jakarta.faces.component.UIComponent component) static jakarta.faces.application.FacesMessage.SeveritygetMaximumSeverity(List<jakarta.faces.application.FacesMessage> messages) static jakarta.faces.application.FacesMessage.SeveritygetMaximumSeverityOfChildrenMessages(jakarta.faces.context.FacesContext facesContext, jakarta.faces.component.NamingContainer container) static AbstractUIReloadgetReloadFacet(jakarta.faces.component.UIComponent component) static RendererBasegetRenderer(jakarta.faces.context.FacesContext facesContext, jakarta.faces.component.UIComponent component) static RendererBasegetRenderer(jakarta.faces.context.FacesContext facesContext, String family, String rendererType) static StringgetStringAttribute(jakarta.faces.component.UIComponent component, Attributes name) static StringgetStringAttribute(jakarta.faces.component.UIComponent component, Attributes name, String defaultValue) static booleanhasErrorMessages(jakarta.faces.context.FacesContext context) Deprecated.since 3.0.1static booleanisError(jakarta.faces.component.UIComponent component) Deprecated.since 5.0.0static booleanisError(jakarta.faces.component.UIInput uiInput) Deprecated.since 5.0.0static booleanisFacetOf(jakarta.faces.component.UIComponent component, jakarta.faces.component.UIComponent parent) Deprecated.since 5.0.0static booleanisInActiveForm(jakarta.faces.component.UIComponent component) Deprecated.since 4.0.0static booleanisInPopup(jakarta.faces.component.UIComponent component) Deprecated.since 3.0.1static booleanisOutputOnly(jakarta.faces.component.UIComponent component) Deprecated.since 5.0.0static MarkupmarkupOfSeverity(jakarta.faces.application.FacesMessage.Severity maximumSeverity) static voidputDataAttribute(jakarta.faces.component.UIComponent component, Object name, Object value) Adding a data attribute to the component.static voidputDataAttributeWithPrefix(jakarta.faces.component.UIComponent component, DataAttributes name, Object value) Adding a data attribute to the component.static voidremoveAttribute(jakarta.faces.component.UIComponent component, Attributes name) static voidremoveFacet(jakarta.faces.component.UIComponent component, Facets facet) static voidresetPage(jakarta.faces.context.FacesContext context) Deprecated.since 3.0.1static voidsetAttribute(jakarta.faces.component.UIComponent component, Attributes name, Object value) static voidsetFacet(jakarta.faces.component.UIComponent component, Facets facet, jakarta.faces.component.UIComponent child) static String[]
- 
Field Details- 
SUB_SEPARATOR- See Also:
 
- 
ACTION_ARGS
- 
ACTION_LISTENER_ARGS
- 
VALUE_CHANGE_LISTENER_ARGS
- 
VALIDATOR_ARGS
- 
LIST_SEPARATOR_CHARS- See Also:
 
- 
DATA_ATTRIBUTES_KEYName of the map for data attributes in components. New in JSF 2.2.- Since:
- 2.0.0
- See Also:
 
 
- 
- 
Method Details- 
hasErrorMessagesDeprecated.since 3.0.1
- 
getFacesMessageAsStringpublic static String getFacesMessageAsString(jakarta.faces.context.FacesContext facesContext, jakarta.faces.component.UIComponent component) 
- 
isInPopupDeprecated.since 3.0.1
- 
resetPageDeprecated.since 3.0.1
- 
findViewRootpublic static jakarta.faces.component.UIViewRoot findViewRoot(jakarta.faces.view.facelets.FaceletContext faceletContext, jakarta.faces.component.UIComponent component) Tries to walk up the parents to find the UIViewRoot, if not found, then go to FaceletContext's FacesContext for the view root.
- 
findPagepublic static AbstractUIPage findPage(jakarta.faces.context.FacesContext context, jakarta.faces.component.UIComponent component) 
- 
findPage
- 
findPage
- 
findForm
- 
findAncestor
- 
findSubFormsFind all sub forms of a component, and collects it. It does not find sub forms of sub forms.
- 
findDescendantpublic static <T extends jakarta.faces.component.UIComponent> T findDescendant(jakarta.faces.component.UIComponent component, Class<T> type) Searches the component tree beneath the component and return the first component matching the type.
- 
findFacetDescendant
- 
findChildpublic static <T extends jakarta.faces.component.UIComponent> T findChild(jakarta.faces.component.UIComponent component, Class<T> type) Searches the children beneath the component and return the first component matching the type.
- 
findDescendantList
- 
findClientIdForpublic static String findClientIdFor(jakarta.faces.component.UIComponent component, jakarta.faces.context.FacesContext facesContext) Looks for the attribute "for" in the component. If there is any search for the component which is referenced by the "for" attribute, and return their clientId. If there is no "for" attribute, return the "clientId" of the parent (if it has a parent). This is useful for labels.
- 
findForpublic static jakarta.faces.component.UIComponent findFor(jakarta.faces.component.UIComponent component) 
- 
evaluateAutoForpublic static void evaluateAutoFor(jakarta.faces.component.UIComponent component, Class<? extends jakarta.faces.component.UIComponent> clazz) Looks for the attribute "for" of the component. In case that the value is equals to "@auto" the children of the parent will be checked if they are of the type of the parameter clazz. The "id" of the first one will be used to reset the "for" attribute of the component.
- 
isInActiveFormDeprecated.since 4.0.0
- 
getMaximumSeveritypublic static jakarta.faces.application.FacesMessage.Severity getMaximumSeverity(jakarta.faces.component.UIComponent component) 
- 
getMaximumSeveritypublic static jakarta.faces.application.FacesMessage.Severity getMaximumSeverity(List<jakarta.faces.application.FacesMessage> messages) 
- 
isErrorDeprecated.since 5.0.0
- 
isErrorDeprecated.since 5.0.0
- 
isOutputOnlyDeprecated.since 5.0.0
- 
getAttribute
- 
getBooleanAttributepublic static boolean getBooleanAttribute(jakarta.faces.component.UIComponent component, Attributes name) 
- 
getBooleanAttributepublic static boolean getBooleanAttribute(jakarta.faces.component.UIComponent component, Attributes name, boolean defaultValue) 
- 
getStringAttributepublic static String getStringAttribute(jakarta.faces.component.UIComponent component, Attributes name) 
- 
getStringAttributepublic static String getStringAttribute(jakarta.faces.component.UIComponent component, Attributes name, String defaultValue) 
- 
getIntAttribute
- 
getIntAttributepublic static int getIntAttribute(jakarta.faces.component.UIComponent component, Attributes name, int defaultValue) 
- 
getCharacterAttributepublic static Character getCharacterAttribute(jakarta.faces.component.UIComponent component, Attributes name) 
- 
setAttributepublic static void setAttribute(jakarta.faces.component.UIComponent component, Attributes name, Object value) 
- 
removeAttribute
- 
getFacetpublic static jakarta.faces.component.UIComponent getFacet(jakarta.faces.component.UIComponent component, Facets facet) 
- 
setFacetpublic static void setFacet(jakarta.faces.component.UIComponent component, Facets facet, jakarta.faces.component.UIComponent child) 
- 
removeFacet
- 
getReloadFacet
- 
isFacetOf@Deprecated public static boolean isFacetOf(jakarta.faces.component.UIComponent component, jakarta.faces.component.UIComponent parent) Deprecated.since 5.0.0
- 
getRendererpublic static RendererBase getRenderer(jakarta.faces.context.FacesContext facesContext, jakarta.faces.component.UIComponent component) 
- 
getRendererpublic static RendererBase getRenderer(jakarta.faces.context.FacesContext facesContext, String family, String rendererType) 
- 
findParameter
- 
findComponentpublic static jakarta.faces.component.UIComponent findComponent(jakarta.faces.component.UIComponent from, String relativeId) The search depends on the number of prefixed colons in the relativeId: - number of prefixed colons == 0
- fully relative
- number of prefixed colons == 1
- absolute (still normal findComponent syntax)
- number of prefixed colons == 2
- search in the current naming container (same as 0 colons)
- number of prefixed colons == 3
- search in the parent naming container of the current naming container
- number of prefixed colons > 3
- go to the next parent naming container for each additional colon
 If a literal is specified: to use more than one identifier the identifiers must be space delimited. 
- 
findComponentpublic static jakarta.faces.component.UIComponent findComponent(jakarta.faces.context.FacesContext facesContext, jakarta.faces.component.UIComponent from, String relativeId) The search depends on the number of prefixed colons in the relativeId: - number of prefixed colons == 0
- fully relative
- number of prefixed colons == 1
- absolute (still normal findComponent syntax)
- number of prefixed colons == 2
- search in the current naming container (same as 0 colons)
- number of prefixed colons == 3
- search in the parent naming container of the current naming container
- number of prefixed colons > 3
- go to the next parent naming container for each additional colon
 If a literal is specified: to use more than one identifier the identifiers must be space delimited. 
- 
evaluateClientIds
- 
evaluateClientId
- 
splitList
- 
getConvertedValue
- 
markupOfSeveritypublic static Markup markupOfSeverity(jakarta.faces.application.FacesMessage.Severity maximumSeverity) 
- 
getMaximumSeverityOfChildrenMessagespublic static jakarta.faces.application.FacesMessage.Severity getMaximumSeverityOfChildrenMessages(jakarta.faces.context.FacesContext facesContext, jakarta.faces.component.NamingContainer container) 
- 
putDataAttributeWithPrefixpublic static void putDataAttributeWithPrefix(jakarta.faces.component.UIComponent component, DataAttributes name, Object value) Adding a data attribute to the component. The name must start with "data-", e. g. "data-tobago-foo" or "data-bar"
- 
putDataAttribute
- 
getDataAttributes
- 
getDataAttribute
- 
getConverter@Deprecated public static jakarta.faces.convert.Converter getConverter(jakarta.faces.context.FacesContext facesContext, jakarta.faces.component.UIComponent component, Object value) Deprecated.since 5.0.0. Please useRendererBase.getConverter(jakarta.faces.context.FacesContext, T, java.lang.Object).May return null, if no converter can be find.
- 
getFormattedValue@Deprecated public static String getFormattedValue(jakarta.faces.context.FacesContext facesContext, jakarta.faces.component.UIComponent component, Object currentValue) throws jakarta.faces.convert.ConverterException Deprecated.since 5.0.0. Please useRendererBase.getFormattedValue(jakarta.faces.context.FacesContext, T, java.lang.Object)- Throws:
- jakarta.faces.convert.ConverterException
 
- 
createComponentpublic static jakarta.faces.component.UIComponent createComponent(jakarta.faces.context.FacesContext facesContext, String componentType, RendererTypes rendererType, String clientId) 
- 
findLayoutChildrenpublic static List<jakarta.faces.component.UIComponent> findLayoutChildren(jakarta.faces.component.UIComponent container) 
- 
getConfirmationreturns the "confirmation" attribute or the value of the "confirmation" facet of a component.- Since:
- Tobago 4.4.0
 
 
-