com.sun.j2ee.blueprints.ui.util
Class Util

java.lang.Object
  extended by com.sun.j2ee.blueprints.ui.util.Util

public class Util
extends java.lang.Object


Field Summary
static java.lang.String UI_COMMON_DOJO_RESOURCE
           
static java.lang.String UI_COMMON_SCRIPT_RESOURCE
           
static java.lang.String UI_LOG_STRINGS
           
static java.lang.String UI_LOGGER
           
static java.lang.String UI_MESSAGE_STRINGS
           
static java.lang.String UTIL_LOGGER
           
 
Method Summary
static javax.faces.el.MethodBinding createConstantMethodBinding(java.lang.String outcome)
           
static java.util.logging.Logger getLogger(java.lang.String loggerName)
           
static java.lang.String getMessage(java.lang.String key)
          Return the message text for the specified key, localized by the Locale in the view root of the current response.
static javax.faces.el.ValueBinding getValueExpression(java.lang.String exprString, java.lang.Class expectedType, javax.faces.context.FacesContext context)
           
static java.lang.String renderBooleanPassthruAttributes(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Render any boolean "passthru" attributes.
static void renderDojoLoading(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, javax.faces.context.ResponseWriter writer)
          Render script to dynamically load DOJO if it has not already been loaded (which could have been by the user manually including it, so we cannot rely on a request scope attribute to check).
static java.lang.String renderPassthruAttributes(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Render any "passthru" attributes, where we simply just output the raw name and value of the attribute.
static void renderResourceOnce(javax.faces.context.FacesContext context, javax.faces.context.ResponseWriter writer, javax.faces.component.UIComponent component, java.lang.String pathToResource, java.lang.String contentType)
          Render a resource once per request, such as a javascript <script> tag.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UI_MESSAGE_STRINGS

public static final java.lang.String UI_MESSAGE_STRINGS
See Also:
Constant Field Values

UTIL_LOGGER

public static final java.lang.String UTIL_LOGGER
See Also:
Constant Field Values

UI_LOG_STRINGS

public static final java.lang.String UI_LOG_STRINGS
See Also:
Constant Field Values

UI_LOGGER

public static final java.lang.String UI_LOGGER
See Also:
Constant Field Values

UI_COMMON_DOJO_RESOURCE

public static final java.lang.String UI_COMMON_DOJO_RESOURCE
See Also:
Constant Field Values

UI_COMMON_SCRIPT_RESOURCE

public static final java.lang.String UI_COMMON_SCRIPT_RESOURCE
See Also:
Constant Field Values
Method Detail

getLogger

public static java.util.logging.Logger getLogger(java.lang.String loggerName)

renderBooleanPassthruAttributes

public static java.lang.String renderBooleanPassthruAttributes(javax.faces.context.FacesContext context,
                                                               javax.faces.component.UIComponent component)

Render any boolean "passthru" attributes.

Parameters:
context - FacesContext for the current request
component - UIComponent being rendered

renderDojoLoading

public static void renderDojoLoading(javax.faces.context.FacesContext context,
                                     javax.faces.component.UIComponent component,
                                     javax.faces.context.ResponseWriter writer)
                              throws java.io.IOException

Render script to dynamically load DOJO if it has not already been loaded (which could have been by the user manually including it, so we cannot rely on a request scope attribute to check).

WARNING - The JavaScript code rendered by this method assumes you have previously loaded the UI_COMMON_SCRIPT_RESOURCE JavaScript resource.

Parameters:
context - FacesContext for the current request
cmponent - UIComponent to associate with this rendered script
writer - ResponseWriter for the current page
Throws:
java.io.IOException - if an input/output error occurs

renderPassthruAttributes

public static java.lang.String renderPassthruAttributes(javax.faces.context.FacesContext context,
                                                        javax.faces.component.UIComponent component)
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.

Returns:
the rendererd attributes as specified in the component. Padded with leading and trailing ' '. If there are no passthru attributes in the component, return the empty String.

getValueExpression

public static javax.faces.el.ValueBinding getValueExpression(java.lang.String exprString,
                                                             java.lang.Class expectedType,
                                                             javax.faces.context.FacesContext context)

renderResourceOnce

public static void renderResourceOnce(javax.faces.context.FacesContext context,
                                      javax.faces.context.ResponseWriter writer,
                                      javax.faces.component.UIComponent component,
                                      java.lang.String pathToResource,
                                      java.lang.String contentType)
                               throws java.io.IOException

Render a resource once per request, such as a javascript <script> tag.

Parameters:
context - The FacesContext
writer - The ResponseWriter to use
component - The component that needs the resource (used for designtime purposes).
pathToResource - The path to the resource, e.g., "/META-INF/autocomplete/script.js"
contentType - The content type, e.g., "text/javascript"
Throws:
java.io.IOException

createConstantMethodBinding

public static javax.faces.el.MethodBinding createConstantMethodBinding(java.lang.String outcome)

getMessage

public static java.lang.String getMessage(java.lang.String key)

Return the message text for the specified key, localized by the Locale in the view root of the current response.

Parameters:
key - Message key to return