Save This Page
Home » mojarra-1.2_09-b02-FCS-source » com.sun.faces.renderkit » [javadoc | source]
com.sun.faces.renderkit
public class: RenderKitUtils [javadoc | source]
java.lang.Object
   com.sun.faces.renderkit.RenderKitUtils

A set of utilities for use in RenderKit s.

Field Summary
protected static final  Logger LOGGER     
Method from com.sun.faces.renderkit.RenderKitUtils Summary:
compressJS,   createValidECMAIdentifier,   determineContentType,   getCommandLinkOnClickScript,   getCurrentRenderKit,   getResponseStateManager,   getSelectItems,   isXml,   loadSunJsfJs,   prefixAttribute,   prefixAttribute,   renderFormInitScript,   renderPassThruAttributes,   renderXHTMLStyleBooleanAttributes,   writeSunJS
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from com.sun.faces.renderkit.RenderKitUtils Detail:
 public static char[] compressJS(String JSString) 

    This is a utility method for compressing multi-lined javascript. In the case of #SUN_JSF_JS it offers about a 47% decrease in length.

    For our purposes, compression is just trimming each line and then writing it out. It's pretty simplistic, but it works.

 public static String createValidECMAIdentifier(String origIdentifier) 

    Replaces all occurrences of - with $_.

 public static String determineContentType(String accept,
    String serverSupportedTypes,
    String preferredType) 

    Given an accept String from the client, and a String of server supported content types, determine the best qualified content type for the client. If no match is found, or either of the arguments are null, null is returned.

 public static String getCommandLinkOnClickScript(String formClientId,
    String commandClientId,
    String target,
    Param[] params) 

    Returns a string that can be inserted into the onclick handler of a command. This string will add all request parameters as well as the client ID of the activated command to the form as hidden input parameters, update the target of the link if necessary, and handle the form submission. The content of #SUN_JSF_JS must be rendered prior to using this method.

 public static RenderKit getCurrentRenderKit(FacesContext context) 

    Return the RenderKit for the current request.

 public static ResponseStateManager getResponseStateManager(FacesContext context,
    String renderKitId) throws FacesException 
 public static List getSelectItems(FacesContext context,
    UIComponent component) 
 public static boolean isXml(String contentType) 
 public static synchronized  void loadSunJsfJs(ExternalContext extContext) 

    Loads the contents of the sunjsf.js file into memory removing any comments/empty lines it encoutners, and, if enabled, compressing the result.

    This method should only be called when the application is being initialized.
 public static String prefixAttribute(String attrName,
    ResponseWriter writer) 
 public static String prefixAttribute(String attrName,
    boolean isXhtml) 
 public static  void renderFormInitScript(ResponseWriter writer,
    FacesContext context) throws IOException 

    Renders the Javascript necessary to add and remove request parameters to the current form.

 public static  void renderPassThruAttributes(ResponseWriter writer,
    UIComponent component,
    String[] attributes) throws IOException 

    Render any "passthru" attributes, where we simply just output the raw name and value of the attribute. This method is aware of the set of HTML4 attributes that fall into this bucket. Examples are all the javascript attributes, alt, rows, cols, etc.

 public static  void renderXHTMLStyleBooleanAttributes(ResponseWriter writer,
    UIComponent component) throws IOException 

    Renders the attributes from #BOOLEAN_ATTRIBUTES using XHMTL semantics (i.e., disabled="disabled").

 public static  void writeSunJS(FacesContext context,
    Writer writer) throws IOException 

    Return the implementation JavaScript. If compression is enabled, the result will be compressed.