org.apache.myfaces.renderkit.html

Class HtmlRendererUtils


public final class HtmlRendererUtils
extends java.lang.Object

Version:
$Revision: 278710 $ $Date: 2005-09-05 12:22:40 +0200 (Mon, 05 Sep 2005) $
Author:
Manfred Geiler (latest modification by $Author: mmarinschek $)

Nested Class Summary

static class
HtmlRendererUtils.LinkParameter

Method Summary

static void
decodeUIInput(FacesContext facesContext, UIComponent component)
X-CHECKED: tlddoc h:inputText
static void
decodeUISelectBoolean(FacesContext facesContext, UIComponent component)
X-CHECKED: tlddoc h:selectBooleanCheckbox
static void
decodeUISelectMany(FacesContext facesContext, UIComponent component)
X-CHECKED: tlddoc h:selectManyListbox
static void
decodeUISelectOne(FacesContext facesContext, UIComponent component)
X-CHECKED: tlddoc h:selectManyListbox
static Converter
findUIOutputConverterFailSafe(FacesContext facesContext, UIComponent uiComponent)
static Converter
findUISelectManyConverterFailsafe(FacesContext facesContext, UIComponent uiComponent)
static String
getClearHiddenCommandFormParamsFunctionName(String formName)
Prefixes the given String with "clear_" and removes special characters
static String
getDisplayValueOnlyStyle(UIComponent component)
static String
getDisplayValueOnlyStyleClass(UIComponent component)
static String
getFormName(UIComponent component, FacesContext context)
static String
getHiddenCommandLinkFieldName(String formName)
static Set
getSubmittedOrSelectedValuesAsSet(boolean selectMany, UIComponent uiComponent, FacesContext facesContext, Converter converter)
static boolean
isDisabledOrReadOnly(UIComponent component)
static boolean
isDisplayValueOnly(UIComponent component)
static void
renderClearHiddenCommandFormParamsFunction(ResponseWriter writer, String formName, Set dummyFormParams, String formTarget)
Render the javascript function that is called on a click on a commandLink to clear the hidden inputs.
static void
renderDisplayValueOnly(FacesContext facesContext, UIInput input)
static void
renderDisplayValueOnlyAttributes(UIComponent uiComponent, ResponseWriter writer)
static void
renderDisplayValueOnlyForSelects(FacesContext facesContext, UIComponent uiComponent)
static boolean
renderHTMLAttribute(ResponseWriter writer, String componentProperty, String attrName, Object value)
static boolean
renderHTMLAttribute(ResponseWriter writer, UIComponent component, String componentProperty, String htmlAttrName)
static boolean
renderHTMLAttributeWithOptionalStartElement(ResponseWriter writer, UIComponent component, String elementName, String attrName, Object value, boolean startElementWritten)
static boolean
renderHTMLAttributes(ResponseWriter writer, UIComponent component, String[] attributes)
static boolean
renderHTMLAttributesWithOptionalStartElement(ResponseWriter writer, UIComponent component, String elementName, String[] attributes)
static void
renderHiddenCommandFormParams(ResponseWriter writer, Set dummyFormParams)
static void
renderListbox(FacesContext facesContext, UISelectMany selectMany, boolean disabled, int size)
static void
renderListbox(FacesContext facesContext, UISelectOne selectOne, boolean disabled, int size)
static void
renderMenu(FacesContext facesContext, UISelectMany selectMany, boolean disabled)
static void
renderMenu(FacesContext facesContext, UISelectOne selectOne, boolean disabled)
static boolean
renderOptionalEndElement(ResponseWriter writer, UIComponent component, String elementName, String[] attributes)
static void
renderSelectOptions(FacesContext context, UIComponent component, Converter converter, Set lookupSet, List selectItemList)
Renders the select options for a UIComponent that is rendered as an HTML select element.
static void
writeIdIfNecessary(ResponseWriter writer, UIComponent component, FacesContext facesContext)
static void
writePrettyIndent(FacesContext facesContext)
static void
writePrettyLineSeparator(FacesContext facesContext)

Method Details

decodeUIInput

public static void decodeUIInput(FacesContext facesContext,
                                 UIComponent component)
X-CHECKED: tlddoc h:inputText
Parameters:
facesContext -
component -

decodeUISelectBoolean

public static void decodeUISelectBoolean(FacesContext facesContext,
                                         UIComponent component)
X-CHECKED: tlddoc h:selectBooleanCheckbox
Parameters:
facesContext -
component -

decodeUISelectMany

public static void decodeUISelectMany(FacesContext facesContext,
                                      UIComponent component)
X-CHECKED: tlddoc h:selectManyListbox
Parameters:
facesContext -
component -

decodeUISelectOne

public static void decodeUISelectOne(FacesContext facesContext,
                                     UIComponent component)
X-CHECKED: tlddoc h:selectManyListbox
Parameters:
facesContext -
component -

findUIOutputConverterFailSafe

public static Converter findUIOutputConverterFailSafe(FacesContext facesContext,
                                                      UIComponent uiComponent)

findUISelectManyConverterFailsafe

public static Converter findUISelectManyConverterFailsafe(FacesContext facesContext,
                                                          UIComponent uiComponent)

getClearHiddenCommandFormParamsFunctionName

public static String getClearHiddenCommandFormParamsFunctionName(String formName)
Prefixes the given String with "clear_" and removes special characters
Parameters:
formName -
Returns:
String

getDisplayValueOnlyStyle

public static String getDisplayValueOnlyStyle(UIComponent component)

getDisplayValueOnlyStyleClass

public static String getDisplayValueOnlyStyleClass(UIComponent component)

getFormName

public static String getFormName(UIComponent component,
                                 FacesContext context)

getHiddenCommandLinkFieldName

public static String getHiddenCommandLinkFieldName(String formName)

getSubmittedOrSelectedValuesAsSet

public static Set getSubmittedOrSelectedValuesAsSet(boolean selectMany,
                                                    UIComponent uiComponent,
                                                    FacesContext facesContext,
                                                    Converter converter)

isDisabledOrReadOnly

public static boolean isDisabledOrReadOnly(UIComponent component)

isDisplayValueOnly

public static boolean isDisplayValueOnly(UIComponent component)

renderClearHiddenCommandFormParamsFunction

public static void renderClearHiddenCommandFormParamsFunction(ResponseWriter writer,
                                                              String formName,
                                                              Set dummyFormParams,
                                                              String formTarget)
            throws IOException
Render the javascript function that is called on a click on a commandLink to clear the hidden inputs. This is necessary because on a browser back, each hidden input still has it's old value (browser cache!) and therefore a new submit would cause the according action once more!
Parameters:
writer -
formName -
dummyFormParams -
formTarget -

renderDisplayValueOnly

public static void renderDisplayValueOnly(FacesContext facesContext,
                                          UIInput input)
            throws IOException

renderDisplayValueOnlyAttributes

public static void renderDisplayValueOnlyAttributes(UIComponent uiComponent,
                                                    ResponseWriter writer)
            throws IOException

renderDisplayValueOnlyForSelects

public static void renderDisplayValueOnlyForSelects(FacesContext facesContext,
                                                    UIComponent uiComponent)
            throws IOException

renderHTMLAttribute

public static boolean renderHTMLAttribute(ResponseWriter writer,
                                          String componentProperty,
                                          String attrName,
                                          Object value)
            throws IOException
Returns:
true, if the attribute was written

renderHTMLAttribute

public static boolean renderHTMLAttribute(ResponseWriter writer,
                                          UIComponent component,
                                          String componentProperty,
                                          String htmlAttrName)
            throws IOException
Returns:
true, if the attribute was written

renderHTMLAttributeWithOptionalStartElement

public static boolean renderHTMLAttributeWithOptionalStartElement(ResponseWriter writer,
                                                                  UIComponent component,
                                                                  String elementName,
                                                                  String attrName,
                                                                  Object value,
                                                                  boolean startElementWritten)
            throws IOException

renderHTMLAttributes

public static boolean renderHTMLAttributes(ResponseWriter writer,
                                           UIComponent component,
                                           String[] attributes)
            throws IOException
Returns:
true, if an attribute was written

renderHTMLAttributesWithOptionalStartElement

public static boolean renderHTMLAttributesWithOptionalStartElement(ResponseWriter writer,
                                                                   UIComponent component,
                                                                   String elementName,
                                                                   String[] attributes)
            throws IOException

renderHiddenCommandFormParams

public static void renderHiddenCommandFormParams(ResponseWriter writer,
                                                 Set dummyFormParams)
            throws IOException

renderListbox

public static void renderListbox(FacesContext facesContext,
                                 UISelectMany selectMany,
                                 boolean disabled,
                                 int size)
            throws IOException

renderListbox

public static void renderListbox(FacesContext facesContext,
                                 UISelectOne selectOne,
                                 boolean disabled,
                                 int size)
            throws IOException

renderMenu

public static void renderMenu(FacesContext facesContext,
                              UISelectMany selectMany,
                              boolean disabled)
            throws IOException

renderMenu

public static void renderMenu(FacesContext facesContext,
                              UISelectOne selectOne,
                              boolean disabled)
            throws IOException

renderOptionalEndElement

public static boolean renderOptionalEndElement(ResponseWriter writer,
                                               UIComponent component,
                                               String elementName,
                                               String[] attributes)
            throws IOException

renderSelectOptions

public static void renderSelectOptions(FacesContext context,
                                       UIComponent component,
                                       Converter converter,
                                       Set lookupSet,
                                       List selectItemList)
            throws IOException
Renders the select options for a UIComponent that is rendered as an HTML select element.
Parameters:
context - the current FacesContext.
component - the UIComponent whose options need to be rendered.
converter - component's converter
lookupSet - the Set to use to look up selected options
selectItemList - the List of SelectItem s to be rendered as HTML option elements.

writeIdIfNecessary

public static void writeIdIfNecessary(ResponseWriter writer,
                                      UIComponent component,
                                      FacesContext facesContext)
            throws IOException

writePrettyIndent

public static void writePrettyIndent(FacesContext facesContext)
            throws IOException

writePrettyLineSeparator

public static void writePrettyLineSeparator(FacesContext facesContext)
            throws IOException