org.apache.myfaces.trinidadinternal.renderkit.core.xhtml
Class XhtmlUtils

java.lang.Object
  extended by org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlUtils

public class XhtmlUtils
extends java.lang.Object

XHTML rendering utilities.


Field Summary
static java.lang.String CORE_LIB
          Library key for the locale lib
 
Constructor Summary
XhtmlUtils()
           
 
Method Summary
static void addLib(javax.faces.context.FacesContext context, org.apache.myfaces.trinidad.context.RenderingContext rc, java.lang.Object libKey)
           
static java.lang.String escapeJS(java.lang.String inString)
          Handle escaping '/', and single quotes, plus escaping text inside of quotes with just a String for input.
static java.lang.String escapeJS(java.lang.String inString, boolean inQuotes)
          Handle escaping '/', and single quotes, plus escaping text inside of quotes with just a String for input.
static void escapeJS(java.lang.StringBuilder outBuilder, java.lang.String inString)
          Handle escaping '/', and single quotes, plus escaping text inside of quotes.
static void escapeJS(java.lang.StringBuilder outBuilder, java.lang.String inString, boolean inQuotes)
          Handle escaping '/', and single quotes, plus escaping text inside of quotes.
static void escapeJS(java.lang.StringBuilder outBuilder, java.lang.String inString, boolean inQuotes, int escapeCount)
          Handle escaping '/', and single quotes, plus escaping text inside of quotes.
static java.lang.String getChainedJS(boolean shortCircuit, java.lang.String... scripts)
          Return the chained JavaScript
static java.lang.String getChainedJS(java.lang.String evh1, java.lang.String evh2, boolean shortCircuit)
          Return the chained JavaScript
static java.lang.String getClientEventHandler(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, java.lang.String eventName, java.lang.String secondaryEventName, java.lang.String userHandlerScript, java.lang.String eventHandlerScript)
          Build a client event handler (onfocus for example) including any associated client behaviors for the event.
static java.lang.String getCompositeId(java.lang.String baseid, java.lang.String suffix)
          Returns a composite ID based on a base and a suffix.
static java.lang.String getEncodedNameAttribute(java.lang.String[] param)
           
static java.lang.String getEncodedParameter(java.lang.String param)
           
static java.lang.String getFormattedString(java.lang.String pattern, java.lang.String[] parameters)
           
static java.lang.String getJSIdentifier(java.lang.String clientId)
           
static javax.faces.component.UIComponent getStructuralParent(javax.faces.component.UIComponent component)
          Skip over pure iteration components to find a "structural" parent.
static void registerScriptlet(java.lang.Object key, Scriptlet scriptlet)
          Registers a scriptlet.
static boolean supportsSeparateWindow(org.apache.myfaces.trinidad.context.Agent agent)
          Returns true if the agent has enough support for Trinidad to launch separate windows.
static void writeLibImport(javax.faces.context.FacesContext context, org.apache.myfaces.trinidad.context.RenderingContext rc, java.lang.Object libURL)
          Write out a script element importing a library.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CORE_LIB

public static final java.lang.String CORE_LIB
Library key for the locale lib

See Also:
Constant Field Values
Constructor Detail

XhtmlUtils

public XhtmlUtils()
Method Detail

getStructuralParent

public static javax.faces.component.UIComponent getStructuralParent(javax.faces.component.UIComponent component)
Skip over pure iteration components to find a "structural" parent. This code is not guaranteed to work, but will work well enough.

Returns:
a structural parent, or null if none exists

supportsSeparateWindow

public static final boolean supportsSeparateWindow(org.apache.myfaces.trinidad.context.Agent agent)
Returns true if the agent has enough support for Trinidad to launch separate windows. We require both multiple window support and PPR support.


getCompositeId

public static java.lang.String getCompositeId(java.lang.String baseid,
                                              java.lang.String suffix)
Returns a composite ID based on a base and a suffix.


registerScriptlet

public static void registerScriptlet(java.lang.Object key,
                                     Scriptlet scriptlet)
Registers a scriptlet.


addLib

public static void addLib(javax.faces.context.FacesContext context,
                          org.apache.myfaces.trinidad.context.RenderingContext rc,
                          java.lang.Object libKey)
                   throws java.io.IOException
Throws:
java.io.IOException

writeLibImport

public static void writeLibImport(javax.faces.context.FacesContext context,
                                  org.apache.myfaces.trinidad.context.RenderingContext rc,
                                  java.lang.Object libURL)
                           throws java.io.IOException
Write out a script element importing a library. The given URL will only be written once to the page.

Throws:
java.io.IOException

getChainedJS

public static java.lang.String getChainedJS(java.lang.String evh1,
                                            java.lang.String evh2,
                                            boolean shortCircuit)
Return the chained JavaScript


getChainedJS

public static java.lang.String getChainedJS(boolean shortCircuit,
                                            java.lang.String... scripts)
Return the chained JavaScript


escapeJS

public static java.lang.String escapeJS(java.lang.String inString)
Handle escaping '/', and single quotes, plus escaping text inside of quotes with just a String for input. If a String in and a String out is all that is required, this version is more efficient if the String does not need to be escaped.


escapeJS

public static java.lang.String escapeJS(java.lang.String inString,
                                        boolean inQuotes)
Handle escaping '/', and single quotes, plus escaping text inside of quotes with just a String for input. If a String in and a String out is all that is required, this version is more efficient if the String does not need to be escaped.


escapeJS

public static void escapeJS(java.lang.StringBuilder outBuilder,
                            java.lang.String inString)
Handle escaping '/', and single quotes, plus escaping text inside of quotes.


escapeJS

public static void escapeJS(java.lang.StringBuilder outBuilder,
                            java.lang.String inString,
                            boolean inQuotes)
Handle escaping '/', and single quotes, plus escaping text inside of quotes.


escapeJS

public static void escapeJS(java.lang.StringBuilder outBuilder,
                            java.lang.String inString,
                            boolean inQuotes,
                            int escapeCount)
Handle escaping '/', and single quotes, plus escaping text inside of quotes.


getJSIdentifier

public static java.lang.String getJSIdentifier(java.lang.String clientId)

getFormattedString

public static java.lang.String getFormattedString(java.lang.String pattern,
                                                  java.lang.String[] parameters)

getEncodedParameter

public static java.lang.String getEncodedParameter(java.lang.String param)

getEncodedNameAttribute

public static java.lang.String getEncodedNameAttribute(java.lang.String[] param)

getClientEventHandler

public static java.lang.String getClientEventHandler(javax.faces.context.FacesContext facesContext,
                                                     javax.faces.component.UIComponent component,
                                                     java.lang.String eventName,
                                                     java.lang.String secondaryEventName,
                                                     java.lang.String userHandlerScript,
                                                     java.lang.String eventHandlerScript)
Build a client event handler (onfocus for example) including any associated client behaviors for the event.

Parameters:
facesContext - The faces context
component - The component
eventName - The event, without the "on*" prefix, to render
secondaryEventName - If applicable, the secondary event name. For command components, "click" and "action" behaviors are included together and for input components, "change" and "valueChange" are included together.
eventHandlerScript - Script to be executed after the behaviors. May be null
userHandlerScript - user event handler to be executed before the event handler script and any client behavior scripts. May be null.


Copyright © 2001-2011 The Apache Software Foundation. All Rights Reserved.