org.apache.myfaces.renderkit

Class RendererUtils


public class RendererUtils
extends java.lang.Object

Version:
$Revision: 267196 $ $Date: 2005-09-02 14:49:18 +0200 (Fri, 02 Sep 2005) $
Author:
Manfred Geiler (latest modification by $Author: mbr $)

Field Summary

static String
EMPTY_STRING
static Object
NOTHING
static String
SELECT_ITEM_LIST_ATTR

Method Summary

static void
checkParamValidity(FacesContext facesContext, UIComponent uiComponent, Class compClass)
static void
copyHtmlInputTextAttributes(HtmlInputText src, HtmlInputText dest)
static UIForm
findParentForm(UIComponentBase comp)
static Converter
findUIOutputConverter(FacesContext facesContext, UIOutput component)
Find the proper Converter for the given UIOutput component.
static Converter
findUISelectManyConverter(FacesContext facesContext, UISelectMany component)
Find proper Converter for the entries in the associated List or Array of the given UISelectMany as specified in API Doc of UISelectMany.
static boolean
getBooleanAttribute(UIComponent component, String attrName, boolean defaultValue)
static Boolean
getBooleanValue(UIComponent component)
static String
getConcatenatedId(FacesContext context, UIComponent component)
static String
getConcatenatedId(FacesContext context, UIComponent container, String clientId)
static String
getConvertedStringValue(FacesContext context, UIComponent component, Converter converter, Object value)
Convenient utility method that returns the currently given value as String, using the given converter.
static String
getConvertedStringValue(FacesContext context, UIComponent component, Converter converter, SelectItem selectItem)
Convenient utility method that returns the currently given SelectItem value as String, using the given converter.
static Object
getConvertedUIOutputValue(FacesContext facesContext, UIOutput output, Object submittedValue)
static Object
getConvertedUISelectManyValue(FacesContext facesContext, UISelectMany selectMany, Object submittedValue)
static Date
getDateValue(UIComponent component)
static int
getIntegerAttribute(UIComponent component, String attrName, int defaultValue)
static Object
getObjectValue(UIComponent component)
static String
getPathToComponent(UIComponent component)
static List
getSelectItemList(UISelectMany uiSelectMany)
static List
getSelectItemList(UISelectOne uiSelectOne)
static Set
getSelectedValuesAsSet(FacesContext context, UIComponent component, Converter converter, UISelectMany uiSelectMany)
Convenient utility method that returns the currently selected values of a UISelectMany component as a Set, of which the contains method can then be easily used to determine if a value is currently selected.
static String
getStringValue(FacesContext facesContext, UIComponent component)
static Set
getSubmittedValuesAsSet(FacesContext context, UIComponent component, Converter converter, UISelectMany uiSelectMany)
Convenient utility method that returns the currently submitted values of a UISelectMany component as a Set, of which the contains method can then be easily used to determine if a select item is currently selected.
static boolean
isDefaultAttributeValue(Object value)
See JSF Spec.
static void
renderChild(FacesContext facesContext, UIComponent child)
static void
renderChildren(FacesContext facesContext, UIComponent component)

Field Details

EMPTY_STRING

public static final String EMPTY_STRING

NOTHING

public static final Object NOTHING

SELECT_ITEM_LIST_ATTR

public static final String SELECT_ITEM_LIST_ATTR

Method Details

checkParamValidity

public static void checkParamValidity(FacesContext facesContext,
                                      UIComponent uiComponent,
                                      Class compClass)

copyHtmlInputTextAttributes

public static void copyHtmlInputTextAttributes(HtmlInputText src,
                                               HtmlInputText dest)

findParentForm

public static UIForm findParentForm(UIComponentBase comp)

findUIOutputConverter

public static Converter findUIOutputConverter(FacesContext facesContext,
                                              UIOutput component)
            throws FacesException
Find the proper Converter for the given UIOutput component.
Returns:
the Converter or null if no Converter specified or needed

findUISelectManyConverter

public static Converter findUISelectManyConverter(FacesContext facesContext,
                                                  UISelectMany component)
Find proper Converter for the entries in the associated List or Array of the given UISelectMany as specified in API Doc of UISelectMany.
Returns:
the Converter or null if no Converter specified or needed

getBooleanAttribute

public static boolean getBooleanAttribute(UIComponent component,
                                          String attrName,
                                          boolean defaultValue)

getBooleanValue

public static Boolean getBooleanValue(UIComponent component)

getConcatenatedId

public static String getConcatenatedId(FacesContext context,
                                       UIComponent component)

getConcatenatedId

public static String getConcatenatedId(FacesContext context,
                                       UIComponent container,
                                       String clientId)

getConvertedStringValue

public static String getConvertedStringValue(FacesContext context,
                                             UIComponent component,
                                             Converter converter,
                                             Object value)
Convenient utility method that returns the currently given value as String, using the given converter. Especially usefull for dealing with primitive types.

getConvertedStringValue

public static String getConvertedStringValue(FacesContext context,
                                             UIComponent component,
                                             Converter converter,
                                             SelectItem selectItem)
Convenient utility method that returns the currently given SelectItem value as String, using the given converter. Especially usefull for dealing with primitive types.

getConvertedUIOutputValue

public static Object getConvertedUIOutputValue(FacesContext facesContext,
                                               UIOutput output,
                                               Object submittedValue)
            throws ConverterException

getConvertedUISelectManyValue

public static Object getConvertedUISelectManyValue(FacesContext facesContext,
                                                   UISelectMany selectMany,
                                                   Object submittedValue)
            throws ConverterException

getDateValue

public static Date getDateValue(UIComponent component)

getIntegerAttribute

public static int getIntegerAttribute(UIComponent component,
                                      String attrName,
                                      int defaultValue)

getObjectValue

public static Object getObjectValue(UIComponent component)

getPathToComponent

public static String getPathToComponent(UIComponent component)

getSelectItemList

public static List getSelectItemList(UISelectMany uiSelectMany)
Parameters:
uiSelectMany -
Returns:
List of SelectItem Objects

getSelectItemList

public static List getSelectItemList(UISelectOne uiSelectOne)
Parameters:
uiSelectOne -
Returns:
List of SelectItem Objects

getSelectedValuesAsSet

public static Set getSelectedValuesAsSet(FacesContext context,
                                         UIComponent component,
                                         Converter converter,
                                         UISelectMany uiSelectMany)
Convenient utility method that returns the currently selected values of a UISelectMany component as a Set, of which the contains method can then be easily used to determine if a value is currently selected. Calling the contains method of this Set with the item value as argument returns true if this item is selected.
Parameters:
uiSelectMany -
Returns:
Set containing all currently selected values

getStringValue

public static String getStringValue(FacesContext facesContext,
                                    UIComponent component)

getSubmittedValuesAsSet

public static Set getSubmittedValuesAsSet(FacesContext context,
                                          UIComponent component,
                                          Converter converter,
                                          UISelectMany uiSelectMany)
Convenient utility method that returns the currently submitted values of a UISelectMany component as a Set, of which the contains method can then be easily used to determine if a select item is currently selected. Calling the contains method of this Set with the renderable (String converted) item value as argument returns true if this item is selected.
Parameters:
uiSelectMany -
Returns:
Set containing all currently selected values

isDefaultAttributeValue

public static boolean isDefaultAttributeValue(Object value)
See JSF Spec. 8.5 Table 8-1
Parameters:
value -
Returns:
boolean

renderChild

public static void renderChild(FacesContext facesContext,
                               UIComponent child)
            throws IOException

renderChildren

public static void renderChildren(FacesContext facesContext,
                                  UIComponent component)
            throws IOException