public class

ComponentUtils

extends Object
java.lang.Object
   ↳ org.apache.myfaces.tobago.util.ComponentUtils

Summary

Constants
Class[] ACTION_ARGS
Class[] ACTION_LISTENER_ARGS
String LIST_SEPARATOR_CHARS
String SUB_SEPARATOR
Class[] VALIDATOR_ARGS
Class[] VALUE_CHANGE_LISTENER_ARGS
Public Methods
static void addCurrentMarkup(SupportsMarkup component, Markup markup)
static boolean containsPopupActionListener(UICommand command)
static ActionListener createActionListener(String type)
static String createPickerId(FacesContext facesContext, UIComponent component, String postfix)
static ValueBinding createValueBinding(String value)
static void evaluateAutoFor(UIComponent component)
This method is deprecated. No replacement.
static void evaluateAutoFor(UIComponent component, Class<? extends UIComponent> clazz)
Looks for the attribute "for" of the component.
static <T> T findAncestor(UIComponent component, Class<T> type)
static String findClientIdFor(UIComponent component, FacesContext facesContext)
Looks for the attribute "for" in the component.
static UIComponent findComponent(UIComponent from, String relativeId)
The search depends on the number of colons in the relativeId:
colonCount == 0
fully relative
colonCount == 1
absolute (still normal findComponent syntax)
colonCount > 1
for each extra colon after 1, go up a naming container
(to the view root, if naming containers run out)
static <T extends UIComponent> T findDescendant(UIComponent component, Class<T> type)
Searches the component tree beneath the component and return the first component matching the type.
static UIComponent findFor(UIComponent component)
static AbstractUIForm findForm(UIComponent component)
static AbstractUIPage findPage(UIComponent component)
static AbstractUIPage findPage(FacesContext facesContext)
static AbstractUIPage findPage(FacesContext context, UIComponent component)
static Object findParameter(UIComponent component, String name)
static List<AbstractUIForm> findSubForms(UIComponent component)
Find all sub forms of a component, and collects it.
static Object getAttribute(UIComponent component, String name)
static boolean getBooleanAttribute(UIComponent component, String name)
static Character getCharacterAttribute(UIComponent component, String name)
static String[] getChildrenWithMessages(FacesContext facesContext, NamingContainer container)
static String getComponentId(FacesContext facesContext, UIComponent component)
static Object getConvertedValue(FacesContext facesContext, UIComponent component, String stringValue)
static String getFacesMessageAsString(FacesContext facesContext, UIComponent component)
static UIGraphic getFirstGraphicChild(UIComponent component)
static UIOutput getFirstNonGraphicChild(UIComponent component)
static int getIntAttribute(UIComponent component, String name)
static int getIntAttribute(UIComponent component, String name, int defaultValue)
static int getIntValue(ValueBinding valueBinding)
static String[] getMarkupBinding(FacesContext facesContext, SupportsMarkup component)
This method is deprecated. since 1.5
static FacesMessage.Severity getMaximumSeverity(UIComponent component)
static FacesMessage.Severity getMaximumSeverityOfChildrenMessages(FacesContext facesContext, NamingContainer container)
static Object getObjectAttribute(UIComponent component, String name)
static RendererBase getRenderer(FacesContext facesContext, String family, String rendererType)
static RendererBase getRenderer(FacesContext facesContext, UIComponent component)
static String getStringAttribute(UIComponent component, String name)
static boolean hasChildrenWithMessages(FacesContext facesContext, NamingContainer container)
static boolean hasErrorMessages(FacesContext context)
static boolean hasSelectedValue(List<SelectItem> items, Object value)
static boolean isError(UIComponent component)
static boolean isError(UIInput uiInput)
static boolean isFacetOf(UIComponent component, UIComponent parent)
static boolean isHoverEnabled(UIComponent component)
static boolean isInActiveForm(UIComponent component)
static boolean isInPopup(UIComponent component)
static boolean isOutputOnly(UIComponent component)
static Markup markupOfSeverity(FacesMessage.Severity maximumSeverity)
static boolean mayUpdateModel(UIComponent component)
static boolean mayValidate(UIComponent component)
static UIComponent provideLabel(FacesContext facesContext, UIComponent component)
Checks if the Component has a label facet and if not creates one with the label attribute.
static String removePx(String value)
static void resetPage(FacesContext context)
static void setAction(ActionSource component, String action)
This method is deprecated. since 1.5.0
static void setActionListener(ActionSource command, String actionListener)
This method is deprecated. since 1.5.0
static void setConverter(ValueHolder valueHolder, String converterId)
This method is deprecated. since 1.5.0
static void setIntegerSizeProperty(UIComponent component, String name, String value)
This method is deprecated. since 1.5.0
static void setMarkup(UIComponent markupComponent, String markup)
This method is deprecated. since 1.5.0
static void setStyleClasses(UIComponent component, String styleClasses)
This method is deprecated. Please define a Markup and set it to the component with setMarkup(Markup) before the rendering phase.
static void setValidator(EditableValueHolder editableValueHolder, String validator)
This method is deprecated. since 1.5.0
static void setValueBinding(UIComponent component, String name, String state)
This method is deprecated. since 1.5.0
static void setValueChangeListener(EditableValueHolder valueHolder, String valueChangeListener)
This method is deprecated. since 1.5.0
static void setValueForValueBinding(String name, Object value)
static String[] splitList(String renderers)
static Markup updateMarkup(UIComponent component, Markup markup)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final Class[] ACTION_ARGS

public static final Class[] ACTION_LISTENER_ARGS

public static final String LIST_SEPARATOR_CHARS

Constant Value: ", "

public static final String SUB_SEPARATOR

Constant Value: "::"

public static final Class[] VALIDATOR_ARGS

public static final Class[] VALUE_CHANGE_LISTENER_ARGS

Public Methods

public static void addCurrentMarkup (SupportsMarkup component, Markup markup)

public static boolean containsPopupActionListener (UICommand command)

public static ActionListener createActionListener (String type)

Throws
JspException

public static String createPickerId (FacesContext facesContext, UIComponent component, String postfix)

public static ValueBinding createValueBinding (String value)

public static void evaluateAutoFor (UIComponent component)

This method is deprecated.
No replacement.

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 a UIInput. The "id" of the first one will be used to reset the "for" attribute of the component.

public static void evaluateAutoFor (UIComponent component, Class<? extends 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.

public static T findAncestor (UIComponent component, Class<T> type)

public static String findClientIdFor (UIComponent component, 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.

public static UIComponent findComponent (UIComponent from, String relativeId)

The search depends on the number of colons in the relativeId:

colonCount == 0
fully relative
colonCount == 1
absolute (still normal findComponent syntax)
colonCount > 1
for each extra colon after 1, go up a naming container
(to the view root, if naming containers run out)

public static T findDescendant (UIComponent component, Class<T> type)

Searches the component tree beneath the component and return the first component matching the type.

public static UIComponent findFor (UIComponent component)

public static AbstractUIForm findForm (UIComponent component)

public static AbstractUIPage findPage (UIComponent component)

public static AbstractUIPage findPage (FacesContext facesContext)

public static AbstractUIPage findPage (FacesContext context, UIComponent component)

public static Object findParameter (UIComponent component, String name)

public static List<AbstractUIForm> findSubForms (UIComponent component)

Find all sub forms of a component, and collects it. It does not find sub forms of sub forms.

public static Object getAttribute (UIComponent component, String name)

public static boolean getBooleanAttribute (UIComponent component, String name)

public static Character getCharacterAttribute (UIComponent component, String name)

public static String[] getChildrenWithMessages (FacesContext facesContext, NamingContainer container)

public static String getComponentId (FacesContext facesContext, UIComponent component)

public static Object getConvertedValue (FacesContext facesContext, UIComponent component, String stringValue)

public static String getFacesMessageAsString (FacesContext facesContext, UIComponent component)

public static UIGraphic getFirstGraphicChild (UIComponent component)

public static UIOutput getFirstNonGraphicChild (UIComponent component)

public static int getIntAttribute (UIComponent component, String name)

public static int getIntAttribute (UIComponent component, String name, int defaultValue)

public static int getIntValue (ValueBinding valueBinding)

public static String[] getMarkupBinding (FacesContext facesContext, SupportsMarkup component)

This method is deprecated.
since 1.5

public static FacesMessage.Severity getMaximumSeverity (UIComponent component)

public static FacesMessage.Severity getMaximumSeverityOfChildrenMessages (FacesContext facesContext, NamingContainer container)

public static Object getObjectAttribute (UIComponent component, String name)

public static RendererBase getRenderer (FacesContext facesContext, String family, String rendererType)

public static RendererBase getRenderer (FacesContext facesContext, UIComponent component)

public static String getStringAttribute (UIComponent component, String name)

public static boolean hasChildrenWithMessages (FacesContext facesContext, NamingContainer container)

public static boolean hasErrorMessages (FacesContext context)

public static boolean hasSelectedValue (List<SelectItem> items, Object value)

public static boolean isError (UIComponent component)

public static boolean isError (UIInput uiInput)

public static boolean isFacetOf (UIComponent component, UIComponent parent)

public static boolean isHoverEnabled (UIComponent component)

public static boolean isInActiveForm (UIComponent component)

public static boolean isInPopup (UIComponent component)

public static boolean isOutputOnly (UIComponent component)

public static Markup markupOfSeverity (FacesMessage.Severity maximumSeverity)

public static boolean mayUpdateModel (UIComponent component)

public static boolean mayValidate (UIComponent component)

public static UIComponent provideLabel (FacesContext facesContext, UIComponent component)

Checks if the Component has a label facet and if not creates one with the label attribute. Todo: check if this method should be set to deprecated.

public static String removePx (String value)

public static void resetPage (FacesContext context)

public static void setAction (ActionSource component, String action)

This method is deprecated.
since 1.5.0

public static void setActionListener (ActionSource command, String actionListener)

This method is deprecated.
since 1.5.0

public static void setConverter (ValueHolder valueHolder, String converterId)

This method is deprecated.
since 1.5.0

public static void setIntegerSizeProperty (UIComponent component, String name, String value)

This method is deprecated.
since 1.5.0

public static void setMarkup (UIComponent markupComponent, String markup)

This method is deprecated.
since 1.5.0

public static void setStyleClasses (UIComponent component, String styleClasses)

This method is deprecated.
Please define a Markup and set it to the component with setMarkup(Markup) before the rendering phase.

public static void setValidator (EditableValueHolder editableValueHolder, String validator)

This method is deprecated.
since 1.5.0

public static void setValueBinding (UIComponent component, String name, String state)

This method is deprecated.
since 1.5.0

public static void setValueChangeListener (EditableValueHolder valueHolder, String valueChangeListener)

This method is deprecated.
since 1.5.0

public static void setValueForValueBinding (String name, Object value)

public static String[] splitList (String renderers)

public static Markup updateMarkup (UIComponent component, Markup markup)