org.apache.myfaces.renderkit
Class RendererUtils

java.lang.Object
  extended byorg.apache.myfaces.renderkit.RendererUtils

public class RendererUtils
extends java.lang.Object

Version:
$Revision: 1.16 $ $Date: 2004/12/14 14:12:33 $ $Log: RendererUtils.java,v $ Revision 1.16 2004/12/14 14:12:33 mmarinschek PR: Obtained from: Submitted by: Reviewed by: Revision 1.15 2004/12/09 12:18:43 mmarinschek changes in Calendar-Renderer to check for submitted-value first Revision 1.14 2004/10/13 11:51:01 matze renamed packages to org.apache Revision 1.13 2004/09/06 08:41:49 tinytoony changes to calendar - rendering wrong weekday, check output-text behavior Revision 1.12 2004/07/01 22:01:18 mwessendorf ASF switch Revision 1.11 2004/06/23 12:42:26 tinytoony just a tad more information ;) Revision 1.10 2004/05/18 14:31:40 manolito user role support completely moved to components source tree Revision 1.9 2004/04/28 10:38:33 tinytoony child is of type added to exception message Revision 1.8 2004/04/28 10:37:14 tinytoony child is of type added to exception message Revision 1.7 2004/04/28 08:17:11 tinytoony child is of type added to exception message Revision 1.6 2004/04/07 08:21:10 manolito handling of select items with label == null Revision 1.5 2004/04/06 15:33:21 manolito getStringValue must return submitted value if any
Author:
Manfred Geiler (latest modification by $Author: mmarinschek $)

Field Summary
static java.lang.String SELECT_ITEM_LIST_ATTR
           
 
Constructor Summary
RendererUtils()
           
 
Method Summary
static void checkParamValidity(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent uiComponent, java.lang.Class compClass)
           
static void copyHtmlInputTextAttributes(javax.faces.component.html.HtmlInputText src, javax.faces.component.html.HtmlInputText dest)
           
static javax.faces.component.UIForm findParentForm(javax.faces.component.UIComponentBase comp)
           
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, java.lang.String attrName, boolean defaultValue)
           
static java.lang.Object getConvertedUIOutputValue(javax.faces.context.FacesContext facesContext, javax.faces.component.UIOutput output, java.lang.Object submittedValue)
           
static java.lang.Object getConvertedUISelectManyValue(javax.faces.context.FacesContext facesContext, javax.faces.component.UISelectMany selectMany, java.lang.Object submittedValue)
           
static java.util.Date getDateValue(javax.faces.component.UIComponent component)
           
static int getIntegerAttribute(javax.faces.component.UIComponent component, java.lang.String attrName, int defaultValue)
           
static java.util.Set getSelectedValuesAsSet(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 java.util.List getSelectItemList(javax.faces.component.UISelectMany uiSelectMany)
           
static java.util.List getSelectItemList(javax.faces.component.UISelectOne uiSelectOne)
           
static java.lang.String getStringValue(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component)
           
static java.util.Set getSubmittedValuesAsSet(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 boolean isDefaultAttributeValue(java.lang.Object value)
          See JSF Spec. 8.5 Table 8-1
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 java.lang.String SELECT_ITEM_LIST_ATTR
Constructor Detail

RendererUtils

public RendererUtils()
Method Detail

getDateValue

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

getStringValue

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

isDefaultAttributeValue

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

Parameters:
value -
Returns:

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,
                                      java.lang.Class compClass)

renderChildren

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

renderChild

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

getSelectItemList

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

getSelectItemList

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

getSubmittedValuesAsSet

public static java.util.Set getSubmittedValuesAsSet(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 java.util.Set getSelectedValuesAsSet(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

getConvertedUIOutputValue

public static java.lang.Object getConvertedUIOutputValue(javax.faces.context.FacesContext facesContext,
                                                         javax.faces.component.UIOutput output,
                                                         java.lang.Object submittedValue)
                                                  throws javax.faces.convert.ConverterException
Throws:
javax.faces.convert.ConverterException

getConvertedUISelectManyValue

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

getBooleanAttribute

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

getIntegerAttribute

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

findParentForm

public static javax.faces.component.UIForm findParentForm(javax.faces.component.UIComponentBase comp)

copyHtmlInputTextAttributes

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