org.apache.myfaces.shared_orchestra.renderkit
Class RendererUtils

java.lang.Object
  extended by org.apache.myfaces.shared_orchestra.renderkit.RendererUtils

public final class RendererUtils
extends Object

Version:
$Revision: 777357 $ $Date: 2009-05-21 21:40:33 -0500 (Thu, 21 May 2009) $
Author:
Manfred Geiler (latest modification by $Author: lu4242 $)

Field Summary
static String ACTION_FOR_LIST
           
static String ACTION_FOR_PHASE_LIST
           
static String EMPTY_STRING
           
static Object NOTHING
           
static String SELECT_ITEM_LIST_ATTR
           
 
Method Summary
static void addOrReplaceChild(javax.faces.component.UIInput component, javax.faces.component.UIComponent child)
           
static void checkParamValidity(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, Class compClass)
           
static List convertIdsToClientIds(String actionFor, javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component)
           
static List convertPhasesToPhasesIds(String actionForPhase)
           
static void copyHtmlInputTextAttributes(javax.faces.component.html.HtmlInputText src, javax.faces.component.html.HtmlInputText dest)
           
static javax.faces.component.UIComponent findComponent(javax.faces.component.UIComponent headerComp, Class clazz)
           
static FormInfo findNestingForm(javax.faces.component.UIComponent uiComponent, javax.faces.context.FacesContext facesContext)
          Find the enclosing form of a component in the view-tree.
static javax.faces.convert.Converter findUIOutputConverter(javax.faces.context.FacesContext facesContext, javax.faces.component.UIOutput component)
          Find the proper Converter for the given UIOutput component.
static javax.faces.convert.Converter findUISelectManyConverter(javax.faces.context.FacesContext facesContext, javax.faces.component.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(javax.faces.component.UIComponent component, String attrName, boolean defaultValue)
           
static boolean getBooleanValue(String attribute, Object value, boolean defaultValue)
           
static Boolean getBooleanValue(javax.faces.component.UIComponent component)
           
static String getClientId(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, String forAttr)
           
static String getConcatenatedId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           
static String getConcatenatedId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent container, String clientId)
           
static String getConvertedStringValue(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.convert.Converter converter, Object value)
          Convenient utility method that returns the currently given value as String, using the given converter.
static String getConvertedStringValue(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.convert.Converter converter, javax.faces.model.SelectItem selectItem)
          Convenient utility method that returns the currently given SelectItem value as String, using the given converter.
static Object getConvertedUIOutputValue(javax.faces.context.FacesContext facesContext, javax.faces.component.UIOutput output, Object submittedValue)
           
static Object getConvertedUISelectManyValue(javax.faces.context.FacesContext facesContext, javax.faces.component.UISelectMany selectMany, Object submittedValue)
           
static Date getDateValue(javax.faces.component.UIComponent component)
           
static int getIntegerAttribute(javax.faces.component.UIComponent component, String attrName, int defaultValue)
           
static Object getObjectValue(javax.faces.component.UIComponent component)
           
static String getPathToComponent(javax.faces.component.UIComponent component)
           
static Set getSelectedValuesAsSet(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.convert.Converter converter, javax.faces.component.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 List getSelectItemList(javax.faces.component.UISelectMany uiSelectMany)
           
static List getSelectItemList(javax.faces.component.UISelectOne uiSelectOne)
           
static String getStringValue(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component)
           
static String getStringValue(javax.faces.context.FacesContext context, javax.faces.el.ValueBinding vb)
           
static Set getSubmittedValuesAsSet(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.convert.Converter converter, javax.faces.component.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 void initPartialValidationAndModelUpdate(javax.faces.component.UIComponent component, javax.faces.context.FacesContext facesContext)
          check for partial validation or model update attributes being set and initialize the request-map accordingly.
static boolean isAdfOrTrinidadForm(javax.faces.component.UIComponent component)
           
static boolean isDefaultAttributeValue(Object value)
          See JSF Spec.
static String loadResourceFile(javax.faces.context.FacesContext ctx, String file)
          Helper method which loads a resource file (such as css) by a given context path and a file name.
static void renderChild(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent child)
           
static void renderChildren(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SELECT_ITEM_LIST_ATTR

public static final String SELECT_ITEM_LIST_ATTR

EMPTY_STRING

public static final String EMPTY_STRING
See Also:
Constant Field Values

NOTHING

public static final Object NOTHING

ACTION_FOR_LIST

public static final String ACTION_FOR_LIST
See Also:
Constant Field Values

ACTION_FOR_PHASE_LIST

public static final String ACTION_FOR_PHASE_LIST
See Also:
Constant Field Values
Method Detail

getPathToComponent

public static String getPathToComponent(javax.faces.component.UIComponent component)

getConcatenatedId

public static String getConcatenatedId(javax.faces.context.FacesContext context,
                                       javax.faces.component.UIComponent container,
                                       String clientId)

getConcatenatedId

public static String getConcatenatedId(javax.faces.context.FacesContext context,
                                       javax.faces.component.UIComponent component)

getBooleanValue

public static Boolean getBooleanValue(javax.faces.component.UIComponent component)

getDateValue

public static Date getDateValue(javax.faces.component.UIComponent component)

getObjectValue

public static Object getObjectValue(javax.faces.component.UIComponent component)

getStringValue

public static String getStringValue(javax.faces.context.FacesContext context,
                                    javax.faces.el.ValueBinding vb)

getStringValue

public static String getStringValue(javax.faces.context.FacesContext facesContext,
                                    javax.faces.component.UIComponent component)

isDefaultAttributeValue

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

Parameters:
value -
Returns:
boolean

findUIOutputConverter

public static javax.faces.convert.Converter findUIOutputConverter(javax.faces.context.FacesContext facesContext,
                                                                  javax.faces.component.UIOutput component)
                                                           throws javax.faces.FacesException
Find the proper Converter for the given UIOutput component.

Returns:
the Converter or null if no Converter specified or needed
Throws:
javax.faces.FacesException - if the Converter could not be created

findUISelectManyConverter

public static javax.faces.convert.Converter findUISelectManyConverter(javax.faces.context.FacesContext facesContext,
                                                                      javax.faces.component.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
Throws:
javax.faces.FacesException - if the Converter could not be created

checkParamValidity

public static void checkParamValidity(javax.faces.context.FacesContext facesContext,
                                      javax.faces.component.UIComponent uiComponent,
                                      Class compClass)

renderChildren

public static void renderChildren(javax.faces.context.FacesContext facesContext,
                                  javax.faces.component.UIComponent component)
                           throws IOException
Throws:
IOException

renderChild

public static void renderChild(javax.faces.context.FacesContext facesContext,
                               javax.faces.component.UIComponent child)
                        throws IOException
Throws:
IOException

getSelectItemList

public static List getSelectItemList(javax.faces.component.UISelectOne uiSelectOne)
Parameters:
uiSelectOne -
Returns:
List of SelectItem Objects

getSelectItemList

public static List getSelectItemList(javax.faces.component.UISelectMany uiSelectMany)
Parameters:
uiSelectMany -
Returns:
List of SelectItem Objects

getSubmittedValuesAsSet

public static Set getSubmittedValuesAsSet(javax.faces.context.FacesContext context,
                                          javax.faces.component.UIComponent component,
                                          javax.faces.convert.Converter converter,
                                          javax.faces.component.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

getSelectedValuesAsSet

public static Set getSelectedValuesAsSet(javax.faces.context.FacesContext context,
                                         javax.faces.component.UIComponent component,
                                         javax.faces.convert.Converter converter,
                                         javax.faces.component.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

getConvertedStringValue

public static String getConvertedStringValue(javax.faces.context.FacesContext context,
                                             javax.faces.component.UIComponent component,
                                             javax.faces.convert.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(javax.faces.context.FacesContext context,
                                             javax.faces.component.UIComponent component,
                                             javax.faces.convert.Converter converter,
                                             javax.faces.model.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(javax.faces.context.FacesContext facesContext,
                                               javax.faces.component.UIOutput output,
                                               Object submittedValue)
                                        throws javax.faces.convert.ConverterException
Throws:
javax.faces.convert.ConverterException

getConvertedUISelectManyValue

public static Object getConvertedUISelectManyValue(javax.faces.context.FacesContext facesContext,
                                                   javax.faces.component.UISelectMany selectMany,
                                                   Object submittedValue)
                                            throws javax.faces.convert.ConverterException
Throws:
javax.faces.convert.ConverterException

getBooleanAttribute

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

getIntegerAttribute

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

findNestingForm

public static FormInfo findNestingForm(javax.faces.component.UIComponent uiComponent,
                                       javax.faces.context.FacesContext facesContext)
Find the enclosing form of a component in the view-tree. All Subclasses of UIForm and all known form-families are searched for. Currently those are the Trinidad form family, and the (old) ADF Faces form family.

There might be additional form families which have to be explicitly entered here.

Parameters:
uiComponent -
facesContext -
Returns:
FormInfo Information about the form - the form itself and its name.

getBooleanValue

public static boolean getBooleanValue(String attribute,
                                      Object value,
                                      boolean defaultValue)

copyHtmlInputTextAttributes

public static void copyHtmlInputTextAttributes(javax.faces.component.html.HtmlInputText src,
                                               javax.faces.component.html.HtmlInputText dest)

findComponent

public static javax.faces.component.UIComponent findComponent(javax.faces.component.UIComponent headerComp,
                                                              Class clazz)

addOrReplaceChild

public static void addOrReplaceChild(javax.faces.component.UIInput component,
                                     javax.faces.component.UIComponent child)

getClientId

public static String getClientId(javax.faces.context.FacesContext facesContext,
                                 javax.faces.component.UIComponent uiComponent,
                                 String forAttr)

convertIdsToClientIds

public static List convertIdsToClientIds(String actionFor,
                                         javax.faces.context.FacesContext facesContext,
                                         javax.faces.component.UIComponent component)

convertPhasesToPhasesIds

public static List convertPhasesToPhasesIds(String actionForPhase)

loadResourceFile

public static String loadResourceFile(javax.faces.context.FacesContext ctx,
                                      String file)
Helper method which loads a resource file (such as css) by a given context path and a file name. Useful to provide css files (or js files) inline.

Parameters:
ctx - FacesContext object to calculate the context path of the web application.
file - name of the resource file (e.g. foo.css).
Returns:
the content of the resource file, or null if no such file is available.

initPartialValidationAndModelUpdate

public static void initPartialValidationAndModelUpdate(javax.faces.component.UIComponent component,
                                                       javax.faces.context.FacesContext facesContext)
check for partial validation or model update attributes being set and initialize the request-map accordingly. SubForms will work with this information.


isAdfOrTrinidadForm

public static boolean isAdfOrTrinidadForm(javax.faces.component.UIComponent component)


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.