| java.lang.Object org.sakaiproject.jsf.util.RendererUtil
RendererUtil | public class RendererUtil (Code) | | Common static utility methods that help in implementing JSF tags.
|
Method Summary | |
public static void | encodeRecursive(FacesContext context, UIComponent component) Helper method for recursively encoding a component. | public static Object | getAttribute(FacesContext context, UIComponent component, String name) Return the attribute value - handles getting the value from a
ValueBinding if necessary. | public static Object | getDefaultedAttribute(FacesContext context, UIComponent component, String name, Object defaultValue) Same as getAttribute, but if not found, we return a default value. | public static String | getFormId(FacesContext context, UIComponent component) | public 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. | public static String | makeSwitchString(String rawSwitch, boolean supportOnOff, boolean supportTrueFalse, boolean supportYesNo, boolean returnOnOff, boolean returnYesNo, boolean defaultValue) Switch handling utility. | public static Map | mapComponentAttributes(Collection collection, UIComponent component) | public static Map | mapComponentAttributes(String[] attributeNames, UIComponent component) | public static void | renderMenu(ResponseWriter out, List items, int selected, String clientId, String styleClass, UIComponent component) | public 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. | public static void | writeAttr(Writer inWriter, String inAttr, String inAttrValue) | public static void | writeAttributes(Map attributeMap, ResponseWriter writer) | public static void | writeAttributes(Map attributeMap, FacesContext context) | public static void | writeExternalCSSDependencies(FacesContext context, ResponseWriter writer, String key, String path) | public static void | writeExternalJSDependencies(FacesContext context, ResponseWriter writer, String key, String path) | public static void | writePassthroughAttributes(String[] passthrus, boolean writeNullAttrs, FacesContext context, UIComponent component) | public static void | writePassthroughs(FacesContext context, UIComponent component) | public 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. | public 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. |
encodeRecursive | public static void encodeRecursive(FacesContext context, UIComponent component) throws IOException(Code) | | Helper method for recursively encoding a component.
Parameters: context - the given FacesContext Parameters: component - the UIComponent to render throws: IOException - |
getAttribute | public static Object getAttribute(FacesContext context, UIComponent component, String name)(Code) | | Return the attribute value - handles getting the value from a
ValueBinding if necessary. This is necessary because of a difference in
the Sun JSF RI versus the MyFaces RI. The Sun RI
component.getAttributes().get(attrName) will automatically return value
bindings, whereas the MyFaces implmentation requires getting values from
ValueBinding seperately.
|
getDefaultedAttribute | public static Object getDefaultedAttribute(FacesContext context, UIComponent component, String name, Object defaultValue)(Code) | | Same as getAttribute, but if not found, we return a default value.
|
getFormId | public static String getFormId(FacesContext context, UIComponent component)(Code) | | Return the form ID of the form containing the given component
|
isDisabledOrReadonly | public static boolean isDisabledOrReadonly(FacesContext context, UIComponent component)(Code) | | If renderer supports disabled or readonly attributes use this method to
obtain an early exit from decode method. Good idea to include it anyway,
compnent will continue to work when these properties are added.
|
makeSwitchString | public static String makeSwitchString(String rawSwitch, boolean supportOnOff, boolean supportTrueFalse, boolean supportYesNo, boolean returnOnOff, boolean returnYesNo, boolean defaultValue)(Code) | | Switch handling utility.
Parameters: rawSwitch - String input string Parameters: supportOnOff - boolean can input string be on, off? Parameters: supportTrueFalse - boolean can input string be true, false? Parameters: supportYesNo - boolean can input string be yes, no? Parameters: returnOnOff - boolean output on, off instead of true false Parameters: returnYesNo - boolean output yes, no instead of true false Parameters: defaultValue - boolean if unknown, return true or false? String raw swrich sring translated to correct switch value ordefault |
mapComponentAttributes | public static Map mapComponentAttributes(Collection collection, UIComponent component)(Code) | | Get a Map of String key/value pairs from a UIComponent for all attributes
keys in a collection
Parameters: collection - Parameters: component - Map of String key/value pairs from a UIComponent for all keys ina collection |
mapComponentAttributes | public static Map mapComponentAttributes(String[] attributeNames, UIComponent component)(Code) | | Get String key/value pairs from a UIComponent for all attributes keys in
an array
Parameters: attributeNames - Parameters: component - Map of String key/value pairs from a UIComponent for all keys ina collection |
renderMenu | public static void renderMenu(ResponseWriter out, List items, int selected, String clientId, String styleClass, UIComponent component) throws IOException(Code) | | Given a List of SelectItems render the select options
Parameters: out - Parameters: items - List of SelectItems Parameters: selected - seelcted choice Parameters: clientId - the id Parameters: styleClass - the optional style class Parameters: component - the component being rendered throws: IOException - |
setAttribute | public static void setAttribute(FacesContext context, UIComponent component, String name, Object value)(Code) | | Sets component attribute value - if a ValueBinding exists for that
attribute, set through the binding; otherwise, set the value directly on
the component.
|
writeAttributes | public static void writeAttributes(Map attributeMap, ResponseWriter writer) throws IOException(Code) | | Parameters: attributeMap - String key/value pairs Parameters: writer - response writer |
writeAttributes | public static void writeAttributes(Map attributeMap, FacesContext context) throws IOException(Code) | | Parameters: attributeMap - String key/value pairs Parameters: context - Faces context Parameters: component - the UIComponent throws: IOException - |
writeExternalCSSDependencies | public static void writeExternalCSSDependencies(FacesContext context, ResponseWriter writer, String key, String path) throws IOException(Code) | | Parameters: context - FacesContext for the request we are processing Parameters: writer - ResponseWriter to be used Parameters: key - key to use to look up the value in the request Parameters: path - path to the file exception: IOException - if an input/output error occurs while rendering |
writeExternalJSDependencies | public static void writeExternalJSDependencies(FacesContext context, ResponseWriter writer, String key, String path) throws IOException(Code) | | Parameters: context - FacesContext for the request we are processing Parameters: writer - ResponseWriter to be used Parameters: key - key to use to look up the value in the request Parameters: path - path to the file exception: IOException - if an input/output error occurs while rendering |
writePassthroughAttributes | public static void writePassthroughAttributes(String[] passthrus, boolean writeNullAttrs, FacesContext context, UIComponent component) throws IOException(Code) | | write passthough attributes on the current element
|
writePassthroughs | public static void writePassthroughs(FacesContext context, UIComponent component) throws IOException(Code) | | Write default HTML passthrough attributes
|
writeSmartExternalScripts | public static void writeSmartExternalScripts(FacesContext context, String gateKey, String gateValue, String contextBasePath, String[] scriptPaths) throws IOException(Code) | | 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.
This effectively makes the script inclusion a per request JavaScript
singleton.
Parameters: gateKey - for key value pair Parameters: gateValue - value for key value pair for gatekeeper Parameters: contextBasePath - the web app with the script Parameters: scriptPath - the webapp-relative path throws: IOException - |
writeSmartExternalScripts | public static void writeSmartExternalScripts(ResponseWriter writer, String gateKey, String gateValue, String contextBasePath, String[] scriptPaths) throws IOException(Code) | | 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.
This effectively makes the script inclusion a per request JavaScript
singleton.
Parameters: writer - the ResponseWriter Parameters: gateKey - for key value pair Parameters: gateValue - value for key value pair for gatekeeper Parameters: contextBasePath - the web app with the script Parameters: scriptPath - the webapp-relative path throws: IOException - |
|
|