public class RendererUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
encodeRecursive(FacesContext context,
UIComponent component)
Helper method for recursively encoding a component.
|
static Object |
getAttribute(FacesContext context,
UIComponent component,
String name)
Return the attribute value - handles getting the value from a
ValueBinding if necessary.
|
static Object |
getDefaultedAttribute(FacesContext context,
UIComponent component,
String name,
Object defaultValue)
Same as getAttribute, but if not found, we return a default value.
|
static String |
getFormId(FacesContext context,
UIComponent component)
Return the form ID of the form containing the given component
|
static boolean |
isDisabledOrReadonly(FacesContext context,
UIComponent component)
If renderer supports disabled or readonly attributes use this method to
obtain an early exit from decode method.
|
static String |
makeSwitchString(String rawSwitch,
boolean supportOnOff,
boolean supportTrueFalse,
boolean supportYesNo,
boolean returnOnOff,
boolean returnYesNo,
boolean defaultValue)
Switch handling utility.
|
static Map |
mapComponentAttributes(Collection collection,
UIComponent component)
Get a Map of String key/value pairs from a UIComponent for all attributes
keys in a collection
|
static Map |
mapComponentAttributes(String[] attributeNames,
UIComponent component)
Get String key/value pairs from a UIComponent for all attributes keys in
an array
|
static void |
renderMenu(ResponseWriter out,
List items,
int selected,
String clientId,
String styleClass,
UIComponent component)
Given a List of SelectItems render the select options
|
static void |
setAttribute(FacesContext context,
UIComponent component,
String name,
Object value)
Sets component attribute value - if a ValueBinding exists for that
attribute, set through the binding; otherwise, set the value directly on
the component.
|
static void |
writeAttr(Writer inWriter,
String inAttr,
String inAttrValue) |
static void |
writeAttributes(Map attributeMap,
FacesContext context) |
static void |
writeAttributes(Map attributeMap,
ResponseWriter writer) |
static void |
writeExternalCSSDependencies(FacesContext context,
ResponseWriter writer,
String key,
String path) |
static void |
writeExternalJSDependencies(FacesContext context,
ResponseWriter writer,
String key,
String path) |
static void |
writePassthroughAttributes(String[] passthrus,
boolean writeNullAttrs,
FacesContext context,
UIComponent component)
write passthough attributes on the current element
|
static void |
writePassthroughs(FacesContext context,
UIComponent component)
Write default HTML passthrough attributes
|
static void |
writeSmartExternalScripts(FacesContext context,
String gateKey,
String gateValue,
String contextBasePath,
String[] scriptPaths)
Renders a script that includes an external JavaScript that gets added to
the document through a document.write() if a gatekeeper value is NOT set.
|
static void |
writeSmartExternalScripts(ResponseWriter writer,
String gateKey,
String gateValue,
String contextBasePath,
String[] scriptPaths)
Renders a script that includes an external JavaScript that gets added to
the document through a document.write() if a gatekeeper value is NOT set.
|
public static void setAttribute(FacesContext context, UIComponent component, String name, Object value)
public static Object getAttribute(FacesContext context, UIComponent component, String name)
public static Object getDefaultedAttribute(FacesContext context, UIComponent component, String name, Object defaultValue)
public static void encodeRecursive(FacesContext context, UIComponent component) throws IOException
context - the given FacesContextcomponent - the UIComponent to renderIOExceptionpublic static boolean isDisabledOrReadonly(FacesContext context, UIComponent component)
public static void writePassthroughs(FacesContext context, UIComponent component) throws IOException
IOExceptionpublic static void writePassthroughAttributes(String[] passthrus, boolean writeNullAttrs, FacesContext context, UIComponent component) throws IOException
IOExceptionpublic static void writeAttributes(Map attributeMap, ResponseWriter writer) throws IOException
attributeMap - String key/value pairswriter - response writerIOExceptionpublic static void writeAttributes(Map attributeMap, FacesContext context) throws IOException
attributeMap - String key/value pairscontext - Faces contextcomponent - the UIComponentIOExceptionpublic static void writeSmartExternalScripts(FacesContext context, String gateKey, String gateValue, String contextBasePath, String[] scriptPaths) throws IOException
gateKey - for key value pairgateValue - value for key value pair for gatekeepercontextBasePath - the web app with the scriptscriptPath - the webapp-relative pathIOExceptionpublic static void writeSmartExternalScripts(ResponseWriter writer, String gateKey, String gateValue, String contextBasePath, String[] scriptPaths) throws IOException
writer - the ResponseWritergateKey - for key value pairgateValue - value for key value pair for gatekeepercontextBasePath - the web app with the scriptscriptPath - the webapp-relative pathIOExceptionpublic static Map mapComponentAttributes(Collection collection, UIComponent component)
collection - component - public static Map mapComponentAttributes(String[] attributeNames, UIComponent component)
attributeNames - component - public static String makeSwitchString(String rawSwitch, boolean supportOnOff, boolean supportTrueFalse, boolean supportYesNo, boolean returnOnOff, boolean returnYesNo, boolean defaultValue)
rawSwitch - String input stringsupportOnOff - boolean can input string be on, off?supportTrueFalse - boolean can input string be true, false?supportYesNo - boolean can input string be yes, no?returnOnOff - boolean output on, off instead of true falsereturnYesNo - boolean output yes, no instead of true falsedefaultValue - boolean if unknown, return true or false?public static void renderMenu(ResponseWriter out, List items, int selected, String clientId, String styleClass, UIComponent component) throws IOException
out - items - List of SelectItemsselected - seelcted choiceclientId - the idstyleClass - the optional style classcomponent - the component being renderedIOExceptionpublic static String getFormId(FacesContext context, UIComponent component)
public static void writeExternalJSDependencies(FacesContext context, ResponseWriter writer, String key, String path) throws IOException
context - FacesContext for the request we are processingwriter - ResponseWriter to be usedkey - key to use to look up the value in the requestpath - path to the fileIOException - if an input/output error occurs while renderingpublic static void writeExternalCSSDependencies(FacesContext context, ResponseWriter writer, String key, String path) throws IOException
context - FacesContext for the request we are processingwriter - ResponseWriter to be usedkey - key to use to look up the value in the requestpath - path to the fileIOException - if an input/output error occurs while renderingpublic static void writeAttr(Writer inWriter, String inAttr, String inAttrValue) throws IOException
IOExceptionCopyright © 2003–2017 University of Michigan. All rights reserved.