org.apache.myfaces.tobago.component
Class ComponentUtil

java.lang.Object
  extended by org.apache.myfaces.tobago.component.ComponentUtil

public class ComponentUtil
extends Object


Field Summary
static Class[] ACTION_ARGS
           
static Class[] ACTION_LISTENER_ARGS
           
static Class[] VALIDATOR_ARGS
           
static Class[] VALUE_CHANGE_LISTENER_ARGS
           
 
Method Summary
static void addOnloadCommands(UIComponent component, String[] cmds)
           
static void addScripts(UIComponent component, String[] scripts)
           
static void addStyles(UIComponent component, String[] styles)
           
static boolean containsPopupActionListener(UICommand command)
           
static ActionListener createActionListener(String type)
           
static UIColumn createColumn(String label, String sortable, String align, UIComponent child)
          Deprecated.  
static UIColumn createColumn(String label, String sortable, String align, UIComponent child, String id)
           
static UIComponent createComponent(FacesContext facesContext, String componentType, String rendererType)
          Deprecated.  
static UIComponent createComponent(FacesContext facesContext, String componentType, String rendererType, String id)
           
static UIComponent createComponent(String componentType, String rendererType)
          Deprecated.  
static UIComponent createComponent(String componentType, String rendererType, String id)
           
static String createPickerId(FacesContext facesContext, UIComponent component, String postfix)
           
static UIColumn createTextColumn(String label, String sortable, String align, String value)
          Deprecated.  
static UIColumn createTextColumn(String label, String sortable, String align, String value, String id)
           
static UIMenuSelectOne createUIMenuSelectOneFacet(FacesContext facesContext, UICommand command)
          Deprecated.  
static UIMenuSelectOne createUIMenuSelectOneFacet(FacesContext facesContext, UICommand command, String id)
           
static UIComponent createUISelectBooleanFacet(FacesContext facesContext, UICommand command)
          Deprecated.  
static UIComponent createUISelectBooleanFacet(FacesContext facesContext, UICommand command, String id)
           
static ValueBinding createValueBinding(String value)
           
static String currentValue(UIComponent component)
           
static String findClientIdFor(UIComponent component, FacesContext facesContext)
          Looks for the attribute "for" in the component.
static UIComponent findComponent(UIComponent from, String 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)
           
static UIComponent findFor(UIComponent component)
           
static UIForm findForm(UIComponent component)
           
static UIPage findPage(FacesContext facesContext)
           
static UIPage findPage(FacesContext context, UIComponent component)
           
static UIPage findPage(UIComponent component)
           
static Object findParameter(UIComponent component, String name)
           
static List<UIForm> findSubForms(UIComponent component)
          Find all subforms 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 Character getCharakterAttribute(UIComponent component, String name)
          Deprecated. please use the method getCharacterAttribute(javax.faces.component.UIComponent, String)
static String getComponentId(FacesContext facesContext, UIComponent component)
           
static Object getConvertedValue(FacesContext facesContext, UIInput 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 List<SelectItem> getItemsToRender(UISelectMany component)
           
static List<SelectItem> getItemsToRender(UISelectOne component)
           
static String[] getMarkupBinding(FacesContext facesContext, SupportsMarkup component)
           
static FacesMessage.Severity getMaximumSeverity(UIComponent component)
           
static LayoutableRendererBase getRenderer(FacesContext facesContext, String family, String rendererType)
           
static LayoutableRendererBase getRenderer(FacesContext facesContext, UIComponent component)
           
static List<SelectItem> getSelectItems(UIComponent component)
           
static String getStringAttribute(UIComponent component, String name)
           
static String getValueFromEl(String script)
           
static boolean hasErrorMessages(FacesContext context)
           
static boolean hasSelectedValue(List<SelectItem> items, Object value)
           
static void invokeOnComponent(FacesContext facesContext, String clientId, UIComponent component, Callback callback)
           
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 boolean mayUpdateModel(UIComponent component)
           
static boolean mayValidate(UIComponent component)
           
static UIComponent provideLabel(FacesContext facesContext, UIComponent component)
           
static String removePx(String value)
           
static void resetPage(FacesContext context)
           
static void setAction(UICommand component, String type, String action)
           
static void setAction(UIComponent component, String type, String action)
          Deprecated. please use the typesave method setAction(javax.faces.component.UICommand, String, String)
static void setActionListener(ActionSource command, String actionListener)
           
static void setBooleanProperty(UIComponent component, String name, String value)
           
static void setConverter(UIComponent component, String converterId)
          Deprecated. please use the typesave method setConverter(javax.faces.component.ValueHolder, String)
static void setConverter(ValueHolder valueHolder, String converterId)
           
static void setIntegerProperty(UIComponent component, String name, String value)
           
static void setIntegerSizeProperty(UIComponent component, String name, String value)
           
static void setMarkup(UIComponent markupComponent, String markup)
           
static void setRenderedPartially(UICommand command, String renderers)
           
static void setSortActionListener(UIData data, String actionListener)
           
static void setStateChangeListener(UIData data, String stateChangeListener)
           
static void setStringProperty(UIComponent component, String name, String value)
           
static void setStyleClasses(UIComponent component, String styleClasses)
           
static void setSuggestMethodBinding(UIComponent component, String suggestMethod)
          Deprecated. please use the typesave method setSuggestMethodBinding(UIInput, String)
static void setSuggestMethodBinding(UIInput component, String suggestMethod)
           
static void setValidator(EditableValueHolder editableValueHolder, String validator)
           
static void setValueBinding(UIComponent component, String name, String state)
           
static void setValueChangeListener(EditableValueHolder valueHolder, String valueChangeListener)
           
static void setValueForValueBinding(String name, Object value)
           
static String toString(UIComponent component, int offset)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTION_ARGS

public static final Class[] ACTION_ARGS

ACTION_LISTENER_ARGS

public static final Class[] ACTION_LISTENER_ARGS

VALUE_CHANGE_LISTENER_ARGS

public static final Class[] VALUE_CHANGE_LISTENER_ARGS

VALIDATOR_ARGS

public static final Class[] VALIDATOR_ARGS
Method Detail

hasErrorMessages

public static boolean hasErrorMessages(FacesContext context)

containsPopupActionListener

public static boolean containsPopupActionListener(UICommand command)

getFacesMessageAsString

public static String getFacesMessageAsString(FacesContext facesContext,
                                             UIComponent component)

isInPopup

public static boolean isInPopup(UIComponent component)

resetPage

public static void resetPage(FacesContext context)

findPage

public static UIPage findPage(FacesContext context,
                              UIComponent component)

findPage

public static UIPage findPage(UIComponent component)

addStyles

public static void addStyles(UIComponent component,
                             String[] styles)

addScripts

public static void addScripts(UIComponent component,
                              String[] scripts)

addOnloadCommands

public static void addOnloadCommands(UIComponent component,
                                     String[] cmds)

findPage

public static UIPage findPage(FacesContext facesContext)

findForm

public static UIForm findForm(UIComponent component)

findSubForms

public static List<UIForm> findSubForms(UIComponent component)
Find all subforms of a component, and collects it. It does not find subforms of subforms.


findDescendant

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

findClientIdFor

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.


findFor

public static UIComponent findFor(UIComponent component)

isInActiveForm

public static boolean isInActiveForm(UIComponent component)

getMaximumSeverity

public static FacesMessage.Severity getMaximumSeverity(UIComponent component)

isError

public static boolean isError(UIInput uiInput)

isError

public static boolean isError(UIComponent component)

isOutputOnly

public static boolean isOutputOnly(UIComponent component)

mayValidate

public static boolean mayValidate(UIComponent component)

mayUpdateModel

public static boolean mayUpdateModel(UIComponent component)

getBooleanAttribute

public static boolean getBooleanAttribute(UIComponent component,
                                          String name)

setRenderedPartially

public static void setRenderedPartially(UICommand command,
                                        String renderers)

setStyleClasses

public static void setStyleClasses(UIComponent component,
                                   String styleClasses)

setMarkup

public static void setMarkup(UIComponent markupComponent,
                             String markup)

getAttribute

public static Object getAttribute(UIComponent component,
                                  String name)

getStringAttribute

public static String getStringAttribute(UIComponent component,
                                        String name)

getIntAttribute

public static int getIntAttribute(UIComponent component,
                                  String name)

getIntAttribute

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

getCharakterAttribute

@Deprecated
public static Character getCharakterAttribute(UIComponent component,
                                                         String name)
Deprecated. please use the method getCharacterAttribute(javax.faces.component.UIComponent, String)

Parameters:
component -
name -

getCharacterAttribute

public static Character getCharacterAttribute(UIComponent component,
                                              String name)

isFacetOf

public static boolean isFacetOf(UIComponent component,
                                UIComponent parent)

getRenderer

public static LayoutableRendererBase getRenderer(FacesContext facesContext,
                                                 UIComponent component)

getRenderer

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

currentValue

public static String currentValue(UIComponent component)

getSelectItems

public static List<SelectItem> getSelectItems(UIComponent component)

findParameter

public static Object findParameter(UIComponent component,
                                   String name)

toString

public static String toString(UIComponent component,
                              int offset)

createActionListener

public static ActionListener createActionListener(String type)
                                           throws JspException
Throws:
JspException

getFirstGraphicChild

public static UIGraphic getFirstGraphicChild(UIComponent component)

isHoverEnabled

public static boolean isHoverEnabled(UIComponent component)

getFirstNonGraphicChild

public static UIOutput getFirstNonGraphicChild(UIComponent component)

setIntegerSizeProperty

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

removePx

public static String removePx(String value)

setIntegerProperty

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

setBooleanProperty

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

setStringProperty

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

setValueForValueBinding

public static void setValueForValueBinding(String name,
                                           Object value)

createValueBinding

public static ValueBinding createValueBinding(String value)

getValueFromEl

public static String getValueFromEl(String script)

createComponent

@Deprecated
public static UIComponent createComponent(String componentType,
                                                     String rendererType)
Deprecated. 

Please use createComponent(String componentType, String rendererType, String id)


createComponent

public static UIComponent createComponent(String componentType,
                                          String rendererType,
                                          String id)

createComponent

@Deprecated
public static UIComponent createComponent(FacesContext facesContext,
                                                     String componentType,
                                                     String rendererType)
Deprecated. 

Please use createComponent(FacesContext facesContext, String componentType, String rendererType, String id)


createComponent

public static UIComponent createComponent(FacesContext facesContext,
                                          String componentType,
                                          String rendererType,
                                          String id)

createTextColumn

@Deprecated
public static UIColumn createTextColumn(String label,
                                                   String sortable,
                                                   String align,
                                                   String value)
Deprecated. 

Please use createTextColumn(String label, String sortable, String align, String value, String id)


createTextColumn

public static UIColumn createTextColumn(String label,
                                        String sortable,
                                        String align,
                                        String value,
                                        String id)

createColumn

@Deprecated
public static UIColumn createColumn(String label,
                                               String sortable,
                                               String align,
                                               UIComponent child)
Deprecated. 

Please use createColumn(String label, String sortable, String align, UIComponent child)


createColumn

public static UIColumn createColumn(String label,
                                    String sortable,
                                    String align,
                                    UIComponent child,
                                    String id)

createUIMenuSelectOneFacet

@Deprecated
public static UIMenuSelectOne createUIMenuSelectOneFacet(FacesContext facesContext,
                                                                    UICommand command)
Deprecated. 

Please use createUIMenuSelectOneFacet(FacesContext facesContext, UICommand command, String id)


createUIMenuSelectOneFacet

public static UIMenuSelectOne createUIMenuSelectOneFacet(FacesContext facesContext,
                                                         UICommand command,
                                                         String id)

hasSelectedValue

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

createUISelectBooleanFacet

@Deprecated
public static UIComponent createUISelectBooleanFacet(FacesContext facesContext,
                                                                UICommand command)
Deprecated. 

Please use createUISelectBooleanFacet(FacesContext facesContext, UICommand command, String id)


createUISelectBooleanFacet

public static UIComponent createUISelectBooleanFacet(FacesContext facesContext,
                                                     UICommand command,
                                                     String id)

getIntValue

public static int getIntValue(ValueBinding valueBinding)

createPickerId

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

getComponentId

public static String getComponentId(FacesContext facesContext,
                                    UIComponent component)

provideLabel

public static UIComponent provideLabel(FacesContext facesContext,
                                       UIComponent component)

getItemsToRender

public static List<SelectItem> getItemsToRender(UISelectOne component)

getItemsToRender

public static List<SelectItem> getItemsToRender(UISelectMany component)

setValidator

public static void setValidator(EditableValueHolder editableValueHolder,
                                String validator)

setConverter

@Deprecated
public static void setConverter(UIComponent component,
                                           String converterId)
Deprecated. please use the typesave method setConverter(javax.faces.component.ValueHolder, String)

Parameters:
component -
converterId -

setConverter

public static void setConverter(ValueHolder valueHolder,
                                String converterId)

setAction

@Deprecated
public static void setAction(UIComponent component,
                                        String type,
                                        String action)
Deprecated. please use the typesave method setAction(javax.faces.component.UICommand, String, String)

Parameters:
component -
type -
action -

setAction

public static void setAction(UICommand component,
                             String type,
                             String action)

setSuggestMethodBinding

@Deprecated
public static void setSuggestMethodBinding(UIComponent component,
                                                      String suggestMethod)
Deprecated. please use the typesave method setSuggestMethodBinding(UIInput, String)

Parameters:
component -
suggestMethod -

setSuggestMethodBinding

public static void setSuggestMethodBinding(UIInput component,
                                           String suggestMethod)

setActionListener

public static void setActionListener(ActionSource command,
                                     String actionListener)

setValueChangeListener

public static void setValueChangeListener(EditableValueHolder valueHolder,
                                          String valueChangeListener)

setSortActionListener

public static void setSortActionListener(UIData data,
                                         String actionListener)

setValueBinding

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

setStateChangeListener

public static void setStateChangeListener(UIData data,
                                          String stateChangeListener)

getMarkupBinding

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

findComponent

public static UIComponent findComponent(UIComponent from,
                                        String 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)


invokeOnComponent

public static void invokeOnComponent(FacesContext facesContext,
                                     String clientId,
                                     UIComponent component,
                                     Callback callback)

getConvertedValue

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


Copyright © 2002-2011 Apache Software Foundation. All Rights Reserved.