public class RendererUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static void |
encodeRecursive(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Helper method for recursively encoding a component.
|
static Object |
getAttribute(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String name)
Return the attribute value - handles getting the value from a
ValueBinding if necessary.
|
static Object |
getDefaultedAttribute(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String name,
Object defaultValue)
Same as getAttribute, but if not found, we return a default value.
|
static String |
getFormId(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Return the form ID of the form containing the given component
|
static boolean |
isDisabledOrReadonly(javax.faces.context.FacesContext context,
javax.faces.component.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,
javax.faces.component.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,
javax.faces.component.UIComponent component)
Get String key/value pairs from a UIComponent for all attributes keys in
an array
|
static void |
renderMenu(javax.faces.context.ResponseWriter out,
List items,
int selected,
String clientId,
String styleClass,
javax.faces.component.UIComponent component)
Given a List of SelectItems render the select options
|
static void |
setAttribute(javax.faces.context.FacesContext context,
javax.faces.component.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,
javax.faces.context.FacesContext context) |
static void |
writeAttributes(Map attributeMap,
javax.faces.context.ResponseWriter writer) |
static void |
writeExternalCSSDependencies(javax.faces.context.FacesContext context,
javax.faces.context.ResponseWriter writer,
String key,
String path) |
static void |
writeExternalJSDependencies(javax.faces.context.FacesContext context,
javax.faces.context.ResponseWriter writer,
String key,
String path) |
static void |
writePassthroughAttributes(String[] passthrus,
boolean writeNullAttrs,
javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
write passthough attributes on the current element
|
static void |
writePassthroughs(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
Write default HTML passthrough attributes
|
static void |
writeSmartExternalScripts(javax.faces.context.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(javax.faces.context.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(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component,
String name,
Object value)
public static Object getAttribute(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String name)
public static Object getDefaultedAttribute(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, String name, Object defaultValue)
public static void encodeRecursive(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
throws IOException
context - the given FacesContextcomponent - the UIComponent to renderIOExceptionpublic static boolean isDisabledOrReadonly(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
public static void writePassthroughs(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent component)
throws IOException
IOExceptionpublic static void writePassthroughAttributes(String[] passthrus, boolean writeNullAttrs, javax.faces.context.FacesContext context, javax.faces.component.UIComponent component) throws IOException
IOExceptionpublic static void writeAttributes(Map attributeMap, javax.faces.context.ResponseWriter writer) throws IOException
attributeMap - String key/value pairswriter - response writerIOExceptionpublic static void writeAttributes(Map attributeMap, javax.faces.context.FacesContext context) throws IOException
attributeMap - String key/value pairscontext - Faces contextcomponent - the UIComponentIOExceptionpublic static void writeSmartExternalScripts(javax.faces.context.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(javax.faces.context.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, javax.faces.component.UIComponent component)
collection - component - public static Map mapComponentAttributes(String[] attributeNames, javax.faces.component.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(javax.faces.context.ResponseWriter out,
List items,
int selected,
String clientId,
String styleClass,
javax.faces.component.UIComponent component)
throws IOException
out - items - List of SelectItemsselected - seelcted choiceclientId - the idstyleClass - the optional style classcomponent - the component being renderedIOExceptionpublic static String getFormId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
public static void writeExternalJSDependencies(javax.faces.context.FacesContext context,
javax.faces.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(javax.faces.context.FacesContext context,
javax.faces.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–2020 University of Michigan. All rights reserved.