org.openfaces.util
Class Rendering

java.lang.Object
  extended by org.openfaces.util.Rendering

public class Rendering
extends java.lang.Object

This class contain methods for working with components tree and client-side javascript


Field Summary
static java.lang.String CLIENT_ID_SUFFIX_SEPARATOR
           
static java.lang.String DEFAULT_FOCUSED_STYLE
           
static java.lang.String ON_LOAD_SCRIPTS_KEY
           
static java.lang.String SERVER_ID_SUFFIX_SEPARATOR
           
 
Method Summary
static void addJsonParam(JSONObject paramsObject, java.lang.String paramName, boolean paramValue, boolean defaultValue)
          Add boolean parameter to json parameters
static void addJsonParam(JSONObject paramsObject, java.lang.String paramName, java.awt.Color paramValue)
          Format color string and add it to json parameters
static void addJsonParam(JSONObject paramsObject, java.lang.String paramName, double paramValue)
          Add double parameter to json parameters
static void addJsonParam(JSONObject paramsObject, java.lang.String paramName, double paramValue, double defaultValue)
          Add double parameter to json parameters
static void addJsonParam(JSONObject paramsObject, java.lang.String paramName, int paramValue)
          Add integer parameter to json parameters
static void addJsonParam(JSONObject paramsObject, java.lang.String paramName, int paramValue, int defaultValue)
          Add integer parameter to json parameters
static void addJsonParam(JSONObject paramsObject, java.lang.String paramName, java.lang.Object paramValue)
          Add object to json parameters
static void addJsonParam(JSONObject paramsObject, java.lang.String paramName, java.lang.Object paramValue, java.lang.Object defaultValue)
          Add object to json parameters
static void appendOnLoadScript(javax.faces.context.FacesContext context, Script script)
          Appends javascript to be executed on onLoad phase on client browser
static java.lang.Object convertFromString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.String str)
          Converts string to object with associated converter
static java.lang.String convertToString(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object value)
          Converts object to string with associated converter
static void decodeBehaviors(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           
static byte[] encodeAsPNG(java.awt.image.RenderedImage data)
          Encode png image as array of bytes
static void encodeClientActions(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Render all children of the component, which are instances of OUIClientAction
static void encodeInitComponentCall(javax.faces.context.FacesContext context, OUIComponent component)
          Render javascript initialization of component and css style and styleclasses
static void encodeInitComponentCall(javax.faces.context.FacesContext context, OUIComponent component, boolean skipIfNotNeeded)
          Render javascript initialization of component and css style and styleclasses
static void ensureComponentInsideForm(javax.faces.component.UIComponent component)
          Return true if component is inside form component, throw exception otherwise
static javax.faces.component.behavior.ClientBehavior getA4jAjaxForComponent(javax.faces.component.UIComponent component)
          Find ajax support component in children and facets of component
static java.util.List<InitScript> getAjaxInitScripts(javax.faces.context.FacesContext context)
           
static boolean getBooleanAttribute(javax.faces.component.UIComponent component, java.lang.String attrName, boolean defaultValue)
          Retrieve boolean value of the component attribute or default
static boolean getBooleanContextParam(javax.faces.context.FacesContext context, java.lang.String webXmlContextParam)
           
static boolean getBooleanContextParam(javax.faces.context.FacesContext context, java.lang.String webXmlContextParam, boolean defaultValue)
           
static java.lang.String getChangeHandlerScript(javax.faces.component.UIComponent component)
           
static java.lang.String getContextParam(javax.faces.context.FacesContext context, java.lang.String webXmlContextParam)
           
static java.lang.String getContextParam(javax.faces.context.FacesContext context, java.lang.String webXmlContextParam, java.lang.String defaultValue)
           
static java.lang.Object getConvertedUISelectManyValue(javax.faces.context.FacesContext context, javax.faces.component.UIInput selectMany, java.lang.Object submittedValue)
          Retrive array of converted submitted values from UISelectMany component
static javax.faces.convert.Converter getConverter(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           
static javax.faces.convert.Converter getConverterForType(javax.faces.context.FacesContext context, java.lang.Class valueType)
           
static ImageDataModel getDataModel(byte[] data)
          Create image data model from array of bytes
static ImageDataModel getDataModel(java.lang.Object data)
          Create image data model from array of bytes or RenderedImage
static ImageDataModel getDataModel(java.awt.image.RenderedImage data)
          Create image data model from RenderedImage
static java.lang.String getEventHandlerScript(javax.faces.component.UIComponent component, java.lang.String event)
           
static java.lang.String getEventHandlerScript(javax.faces.component.UIComponent component, java.lang.String event, java.lang.String logicalEvent)
           
static java.lang.String getEventHandlerScript(javax.faces.component.UIComponent component, javax.faces.component.UIComponent sourceComponent, java.lang.String event, java.lang.String logicalEvent)
           
static JSONObject getEventsParam(javax.faces.component.UIComponent component, java.lang.String... eventNames)
          Return event handlers for a given events
static java.lang.String getEventWithOnPrefix(javax.faces.context.FacesContext context, OUIClientAction component, java.lang.String componentName)
           
static java.lang.String getFocusedClass(javax.faces.context.FacesContext context, OUIInput component)
          Return focused css class for component
static DynamicImagePool getImagePool(javax.faces.context.FacesContext context)
          Return the current session's in-memory image pool
static java.lang.String getRolloverClass(javax.faces.context.FacesContext context, OUIComponent component)
          Return rollover css class for component
static java.lang.String getStringValue(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          Return converted to string value of component
static boolean isComponentWithA4jAjax(javax.faces.component.UIComponent component)
          Check if the component has ajax4jsf support
static boolean isDefaultAttributeValue(java.lang.Object value)
          See JSF Spec.
static boolean isDynamicResource(java.lang.String uri)
          Check resource uri if it is dymamic resource or not
static boolean isNullOrEmpty(java.lang.String string)
          Check string for nullable and empty
static java.lang.String joinScripts(java.lang.String script1, java.lang.String script2)
          Join two javascripts into one
static void logWarning(javax.faces.context.FacesContext context, java.lang.String message)
          Log OpenFaces warning to external context
static void registerDateTimeFormatObject(java.util.Locale locale)
          Render javascript initiation of DateTimeFormatObject
static void renderChildren(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
          This method render all children of a given component
static void renderComponents(javax.faces.context.FacesContext context, java.util.List<javax.faces.component.UIComponent> components)
          This method calls encodeAll with a given context for all passed components
static void renderHiddenField(javax.faces.context.ResponseWriter writer, java.lang.String idAndName, java.lang.String value)
          Render the hidden field
static void renderHTMLAttribute(javax.faces.context.ResponseWriter writer, java.lang.String componentProperty, java.lang.String attrName, java.lang.Object value)
          Write attribute and replace styleClass attribute with style
static void renderInitScript(javax.faces.context.FacesContext context, Script script, java.lang.String... jsFiles)
          Renders the specified JavaScript code into the response and ensures including the specified JavaScript files to the rendered page prior to the rendered script.
static void renderInitScripts(javax.faces.context.FacesContext context, InitScript... initScripts)
          Combine javascript scripts into one script and links to javascript files and render them
static void renderJavascriptEnd(javax.faces.context.ResponseWriter writer)
          Write javascript start html tag
static void renderJavascriptStart(javax.faces.context.ResponseWriter writer, javax.faces.component.UIComponent component)
          Write javascript start html tag
static void renderPreloadImagesScript(javax.faces.context.FacesContext context, java.util.List<java.lang.String> imageUrls, boolean prependContextPath)
          Render javascript for preloading images
static void startWriteIMG(javax.faces.context.ResponseWriter writer, javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.String extension, ImageDataModel model, int[] size)
          Render image html tag with hack for ie transparency
static void writeAttribute(javax.faces.context.ResponseWriter writer, java.lang.String name, int value, int emptyValue)
           
static void writeAttribute(javax.faces.context.ResponseWriter writer, java.lang.String name, java.lang.String value)
          Check value for nullable and write it to writer
static void writeAttributes(javax.faces.context.ResponseWriter writer, javax.faces.component.UIComponent component, java.lang.String... attributes)
          Renders the specified list of component's attributes as is for all non-null attributes.
static void writeComponentClassAttribute(javax.faces.context.ResponseWriter writer, OUIComponent component)
          Render component css style class attribute
static void writeComponentClassAttribute(javax.faces.context.ResponseWriter writer, OUIComponent component, java.lang.String defaultClass)
          Render component css style class attribute
static java.lang.String writeIdAttribute(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           
static void writeIdIfNecessary(javax.faces.context.ResponseWriter writer, javax.faces.component.UIComponent component, javax.faces.context.FacesContext context)
          Render component id attribute if it is not null and not starts with UIViewRoot.UNIQUE_ID_PREFIX
static void writeNameAttribute(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component)
           
static void writeNewLine(javax.faces.context.ResponseWriter writer)
          Write newline symbol to writer
static void writeNonBreakableSpace(javax.faces.context.ResponseWriter writer)
          Write HTML.NBSP_ENTITY to writer
static void writeStandardEvents(javax.faces.context.ResponseWriter writer, OUIComponent component)
           
static void writeStandardEvents(javax.faces.context.ResponseWriter writer, OUIComponent component, boolean skipOnclick)
           
static void writeStandardEvents(javax.faces.context.ResponseWriter writer, OUIInput component)
           
static void writeStyleAndClassAttributes(javax.faces.context.ResponseWriter writer, OUIComponent component)
           
static void writeStyleAndClassAttributes(javax.faces.context.ResponseWriter writer, java.lang.String style, java.lang.String styleClass)
          Write style and class html attributes
static void writeStyleAndClassAttributes(javax.faces.context.ResponseWriter writer, java.lang.String style, java.lang.String styleClass, java.lang.String defaultStyleClass)
          Write style and class html attributes
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLIENT_ID_SUFFIX_SEPARATOR

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

SERVER_ID_SUFFIX_SEPARATOR

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

DEFAULT_FOCUSED_STYLE

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

ON_LOAD_SCRIPTS_KEY

public static final java.lang.String ON_LOAD_SCRIPTS_KEY
Method Detail

renderChildren

public static void renderChildren(javax.faces.context.FacesContext context,
                                  javax.faces.component.UIComponent component)
                           throws java.io.IOException
This method render all children of a given component

Parameters:
context - FacesContext for the current request
component - The component, which children will be rendered
Throws:
java.io.IOException - if an input/output error occurs while rendering

renderComponents

public static void renderComponents(javax.faces.context.FacesContext context,
                                    java.util.List<javax.faces.component.UIComponent> components)
                             throws java.io.IOException
This method calls encodeAll with a given context for all passed components

Parameters:
context - FacesContext for the current request
components - The list of components to be rendered
Throws:
java.io.IOException - if an input/output error occurs while rendering

logWarning

public static void logWarning(javax.faces.context.FacesContext context,
                              java.lang.String message)
Log OpenFaces warning to external context

Parameters:
context - FacesContext for the current request
message - The message to log

renderHTMLAttribute

public static void renderHTMLAttribute(javax.faces.context.ResponseWriter writer,
                                       java.lang.String componentProperty,
                                       java.lang.String attrName,
                                       java.lang.Object value)
                                throws java.io.IOException
Write attribute and replace styleClass attribute with style

Parameters:
writer - The character-based output
attrName - Attribute name to be added
value - Attribute value to be added
componentProperty - Name of the property or attribute (if any) of the UIComponent associated with the containing element, to which this generated attribute corresponds
Throws:
java.io.IOException - if an input/output error occurs

renderJavascriptStart

public static void renderJavascriptStart(javax.faces.context.ResponseWriter writer,
                                         javax.faces.component.UIComponent component)
                                  throws java.io.IOException
Write javascript start html tag

Parameters:
writer - The character-based output
component - The UIComponent (if any) to which this element corresponds
Throws:
java.io.IOException - if an input/output error occurs

renderJavascriptEnd

public static void renderJavascriptEnd(javax.faces.context.ResponseWriter writer)
                                throws java.io.IOException
Write javascript start html tag

Parameters:
writer - The character-based output
Throws:
java.io.IOException - if an input/output error occurs

registerDateTimeFormatObject

public static void registerDateTimeFormatObject(java.util.Locale locale)
                                         throws java.io.IOException
Render javascript initiation of DateTimeFormatObject

Parameters:
locale - The locale for DateTimeFormat
Throws:
java.io.IOException - if an input/output error occurs

renderHiddenField

public static void renderHiddenField(javax.faces.context.ResponseWriter writer,
                                     java.lang.String idAndName,
                                     java.lang.String value)
                              throws java.io.IOException
Render the hidden field

Parameters:
writer - The character-based output
idAndName - The id and name of hidden field
value - The value of hidden field
Throws:
java.io.IOException - if an input/output error occurs

getBooleanAttribute

public static boolean getBooleanAttribute(javax.faces.component.UIComponent component,
                                          java.lang.String attrName,
                                          boolean defaultValue)
Retrieve boolean value of the component attribute or default

Parameters:
component - The component
attrName - The attribute name
defaultValue - The default value to return if such attribute doesn't exist
Returns:
boolean value of a given attribute or default value if not found

isDefaultAttributeValue

public static boolean isDefaultAttributeValue(java.lang.Object value)
See JSF Spec. 8.5 DataTable 8-1

Parameters:
value - The value to check
Returns:
true if value is null or default value, false otherwise

writeIdIfNecessary

public static void writeIdIfNecessary(javax.faces.context.ResponseWriter writer,
                                      javax.faces.component.UIComponent component,
                                      javax.faces.context.FacesContext context)
                               throws java.io.IOException
Render component id attribute if it is not null and not starts with UIViewRoot.UNIQUE_ID_PREFIX

Parameters:
writer - The character-based output
component - The component, which id will be written
context - FacesContext for the current request
Throws:
java.io.IOException - if an input/output error occurs

getConvertedUISelectManyValue

public static java.lang.Object getConvertedUISelectManyValue(javax.faces.context.FacesContext context,
                                                             javax.faces.component.UIInput selectMany,
                                                             java.lang.Object submittedValue)
                                                      throws javax.faces.convert.ConverterException
Retrive array of converted submitted values from UISelectMany component

Parameters:
context - FacesContext for the current request
selectMany - The submitted component
submittedValue - The submitted value
Returns:
converted value
Throws:
javax.faces.convert.ConverterException - if submittedValue is not a String array

getConverter

public static javax.faces.convert.Converter getConverter(javax.faces.context.FacesContext context,
                                                         javax.faces.component.UIComponent component)

getConverterForType

public static javax.faces.convert.Converter getConverterForType(javax.faces.context.FacesContext context,
                                                                java.lang.Class valueType)

convertFromString

public static java.lang.Object convertFromString(javax.faces.context.FacesContext context,
                                                 javax.faces.component.UIComponent component,
                                                 java.lang.String str)
Converts string to object with associated converter

Parameters:
context - FacesContext for the current request
component - The component, which converter will be used
str - The string to convert
Returns:
converted object or string if converter was not found

getStringValue

public static java.lang.String getStringValue(javax.faces.context.FacesContext context,
                                              javax.faces.component.UIComponent component)
Return converted to string value of component

Parameters:
context - FacesContext for the current request
component - The component, which value will be converted
Returns:
converted value on this component

convertToString

public static java.lang.String convertToString(javax.faces.context.FacesContext context,
                                               javax.faces.component.UIComponent component,
                                               java.lang.Object value)
Converts object to string with associated converter

Parameters:
context - FacesContext for the current request
component - The component, which converter will be used
value - The object to convert
Returns:
converted string

appendOnLoadScript

public static void appendOnLoadScript(javax.faces.context.FacesContext context,
                                      Script script)
Appends javascript to be executed on onLoad phase on client browser

Parameters:
context - FacesContext for the current request
script - The script to append

renderInitScript

public static void renderInitScript(javax.faces.context.FacesContext context,
                                    Script script,
                                    java.lang.String... jsFiles)
                             throws java.io.IOException
Renders the specified JavaScript code into the response and ensures including the specified JavaScript files to the rendered page prior to the rendered script.

Parameters:
context - FacesContext for the current request
script - The javascript to be rendered
jsFiles - The collection of javascript files to be added
Throws:
java.io.IOException - if an input/output error occurs

getAjaxInitScripts

public static java.util.List<InitScript> getAjaxInitScripts(javax.faces.context.FacesContext context)

renderInitScripts

public static void renderInitScripts(javax.faces.context.FacesContext context,
                                     InitScript... initScripts)
                              throws java.io.IOException
Combine javascript scripts into one script and links to javascript files and render them

Parameters:
context - FacesContext for the current request
initScripts - The javascript files to combine and render
Throws:
java.io.IOException - if an input/output error occurs

renderPreloadImagesScript

public static void renderPreloadImagesScript(javax.faces.context.FacesContext context,
                                             java.util.List<java.lang.String> imageUrls,
                                             boolean prependContextPath)
                                      throws java.io.IOException
Render javascript for preloading images

Parameters:
context - FacesContext for the current request
imageUrls - The list of images to preload
prependContextPath - true means that the resulting url should be prefixed with context root. This is the case when the returned URL is rendered without any modifications. Passing false to this parameter is required in cases when the returned URL is passed to some component which expects application URL, so the component will prepend the URL with context root itself.
Throws:
java.io.IOException - if an input/output error occurs

ensureComponentInsideForm

public static void ensureComponentInsideForm(javax.faces.component.UIComponent component)
Return true if component is inside form component, throw exception otherwise

Parameters:
component - The component to check

isNullOrEmpty

public static boolean isNullOrEmpty(java.lang.String string)
Check string for nullable and empty

Parameters:
string - The string to check
Returns:
true, if string is null or empty, false otherwise

joinScripts

public static java.lang.String joinScripts(java.lang.String script1,
                                           java.lang.String script2)
Join two javascripts into one

Parameters:
script1 - The first script to join
script2 - The second script to join
Returns:
joined resulting javascript

writeNonBreakableSpace

public static void writeNonBreakableSpace(javax.faces.context.ResponseWriter writer)
                                   throws java.io.IOException
Write HTML.NBSP_ENTITY to writer

Parameters:
writer - The character-based output
Throws:
java.io.IOException - if an input/output error occurs

writeStyleAndClassAttributes

public static void writeStyleAndClassAttributes(javax.faces.context.ResponseWriter writer,
                                                java.lang.String style,
                                                java.lang.String styleClass)
                                         throws java.io.IOException
Write style and class html attributes

Parameters:
writer - The character-based output
style - The value of css style attribute to render
styleClass - The value of css style class attribute to render
Throws:
java.io.IOException - if an input/output error occurs

writeStyleAndClassAttributes

public static void writeStyleAndClassAttributes(javax.faces.context.ResponseWriter writer,
                                                OUIComponent component)
                                         throws java.io.IOException
Throws:
java.io.IOException

writeStyleAndClassAttributes

public static void writeStyleAndClassAttributes(javax.faces.context.ResponseWriter writer,
                                                java.lang.String style,
                                                java.lang.String styleClass,
                                                java.lang.String defaultStyleClass)
                                         throws java.io.IOException
Write style and class html attributes

Parameters:
writer - The character-based output
style - The value of css style attribute to render
styleClass - The value of css style class attribute to render
defaultStyleClass - The default css style class to merge with a given css style
Throws:
java.io.IOException - if an input/output error occurs
See Also:
writeStyleAndClassAttributes(javax.faces.context.ResponseWriter, String, String)

writeComponentClassAttribute

public static void writeComponentClassAttribute(javax.faces.context.ResponseWriter writer,
                                                OUIComponent component)
                                         throws java.io.IOException
Render component css style class attribute

Parameters:
writer - The character-based output
component - The component, which attribute renders
Throws:
java.io.IOException - if an input/output error occurs

writeComponentClassAttribute

public static void writeComponentClassAttribute(javax.faces.context.ResponseWriter writer,
                                                OUIComponent component,
                                                java.lang.String defaultClass)
                                         throws java.io.IOException
Render component css style class attribute

Parameters:
writer - The character-based output
component - The component, which attribute renders
defaultClass - The default style class to merge with
Throws:
java.io.IOException - if an input/output error occurs

isDynamicResource

public static boolean isDynamicResource(java.lang.String uri)
Check resource uri if it is dymamic resource or not

Parameters:
uri - The uri to check
Returns:
true, if uri represent dynamic image, false otherwise

startWriteIMG

public static void startWriteIMG(javax.faces.context.ResponseWriter writer,
                                 javax.faces.context.FacesContext context,
                                 javax.faces.component.UIComponent component,
                                 java.lang.String extension,
                                 ImageDataModel model,
                                 int[] size)
                          throws java.io.IOException
Render image html tag with hack for ie transparency

Parameters:
writer - The character-based output
context - FacesContext for the current request
component - The UIComponent (if any) to which this element corresponds
extension - The image extension
model - The data model of image - array of byte
size - The array of integers, where first element is width of image and second is a heigth
Throws:
java.io.IOException - if an input/output error occurs

getImagePool

public static DynamicImagePool getImagePool(javax.faces.context.FacesContext context)
Return the current session's in-memory image pool

Parameters:
context - FacesContext for the current request
Returns:
the current session's in-memory image pool

getDataModel

public static ImageDataModel getDataModel(java.lang.Object data)
Create image data model from array of bytes or RenderedImage

Parameters:
data - The data to create model
Returns:
created image data model or null

getDataModel

public static ImageDataModel getDataModel(byte[] data)
Create image data model from array of bytes

Parameters:
data - The array of bytes, representing image
Returns:
image model

getDataModel

public static ImageDataModel getDataModel(java.awt.image.RenderedImage data)
Create image data model from RenderedImage

Parameters:
data - The RenderedImage, representing png image
Returns:
image model

encodeAsPNG

public static byte[] encodeAsPNG(java.awt.image.RenderedImage data)
Encode png image as array of bytes

Parameters:
data - The png image
Returns:
the array of bytes, representing a given image

addJsonParam

public static void addJsonParam(JSONObject paramsObject,
                                java.lang.String paramName,
                                java.awt.Color paramValue)
Format color string and add it to json parameters

Parameters:
paramsObject - The json parameters
paramName - The name of parameter
paramValue - The value of parameter
See Also:
addJsonParam(org.openfaces.org.json.JSONObject, String, Object, Object)

addJsonParam

public static void addJsonParam(JSONObject paramsObject,
                                java.lang.String paramName,
                                java.lang.Object paramValue)
Add object to json parameters

Parameters:
paramsObject - The json parameters
paramName - The name of parameter
paramValue - The value of parameter
See Also:
addJsonParam(org.openfaces.org.json.JSONObject, String, Object, Object)

addJsonParam

public static void addJsonParam(JSONObject paramsObject,
                                java.lang.String paramName,
                                java.lang.Object paramValue,
                                java.lang.Object defaultValue)
Add object to json parameters

Parameters:
paramsObject - The json parameters
paramName - The name of parameter
paramValue - The value of parameter
defaultValue - The default value to compare

addJsonParam

public static void addJsonParam(JSONObject paramsObject,
                                java.lang.String paramName,
                                double paramValue,
                                double defaultValue)
Add double parameter to json parameters

Parameters:
paramsObject - The json parameters
paramName - The name of parameter
paramValue - The value of parameter
defaultValue - The default value to compare

addJsonParam

public static void addJsonParam(JSONObject paramsObject,
                                java.lang.String paramName,
                                double paramValue)
Add double parameter to json parameters

Parameters:
paramsObject - The json parameters
paramName - The name of parameter
paramValue - The value of parameter

addJsonParam

public static void addJsonParam(JSONObject paramsObject,
                                java.lang.String paramName,
                                boolean paramValue,
                                boolean defaultValue)
Add boolean parameter to json parameters

Parameters:
paramsObject - The json parameters
paramName - The name of parameter
paramValue - The value of parameter
defaultValue - The default value to compare

addJsonParam

public static void addJsonParam(JSONObject paramsObject,
                                java.lang.String paramName,
                                int paramValue,
                                int defaultValue)
Add integer parameter to json parameters

Parameters:
paramsObject - The json parameters
paramName - The name of parameter
paramValue - The value of parameter
defaultValue - The default value to compare

addJsonParam

public static void addJsonParam(JSONObject paramsObject,
                                java.lang.String paramName,
                                int paramValue)
Add integer parameter to json parameters

Parameters:
paramsObject - The json parameters
paramName - The name of parameter
paramValue - The value of parameter

isComponentWithA4jAjax

public static boolean isComponentWithA4jAjax(javax.faces.component.UIComponent component)
Check if the component has ajax4jsf support

Parameters:
component - The component to check
Returns:
true, if component has ajax4jsf support

getA4jAjaxForComponent

public static javax.faces.component.behavior.ClientBehavior getA4jAjaxForComponent(javax.faces.component.UIComponent component)
Find ajax support component in children and facets of component

Parameters:
component - The component to check
Returns:
UIComponent of ajax support, if component has support, null, otherwise

encodeInitComponentCall

public static void encodeInitComponentCall(javax.faces.context.FacesContext context,
                                           OUIComponent component)
                                    throws java.io.IOException
Render javascript initialization of component and css style and styleclasses

Parameters:
context - FacesContext for the current request
component - The component, which init script is rendered
Throws:
java.io.IOException - if an input/output error occurs
See Also:
encodeInitComponentCall(javax.faces.context.FacesContext, org.openfaces.component.OUIComponent, boolean)

encodeInitComponentCall

public static void encodeInitComponentCall(javax.faces.context.FacesContext context,
                                           OUIComponent component,
                                           boolean skipIfNotNeeded)
                                    throws java.io.IOException
Render javascript initialization of component and css style and styleclasses

Parameters:
context - FacesContext for the current request
component - The component, which init script is rendered
skipIfNotNeeded -
Throws:
java.io.IOException - if an input/output error occurs

getRolloverClass

public static java.lang.String getRolloverClass(javax.faces.context.FacesContext context,
                                                OUIComponent component)
Return rollover css class for component

Parameters:
context - FacesContext for the current request
component - The component
Returns:
rollover css class for component

getFocusedClass

public static java.lang.String getFocusedClass(javax.faces.context.FacesContext context,
                                               OUIInput component)
Return focused css class for component

Parameters:
context - FacesContext for the current request
component - The component
Returns:
focused css class for component

encodeClientActions

public static void encodeClientActions(javax.faces.context.FacesContext context,
                                       javax.faces.component.UIComponent component)
                                throws java.io.IOException
Render all children of the component, which are instances of OUIClientAction

Parameters:
context - FacesContext for the current request
component - The component
Throws:
java.io.IOException - if an input/output error occurs

getEventsParam

public static JSONObject getEventsParam(javax.faces.component.UIComponent component,
                                        java.lang.String... eventNames)
Return event handlers for a given events

Parameters:
component - The component, which event handlers retrieve
eventNames - The event names
Returns:
JSONObject with events and their handlers

writeNewLine

public static void writeNewLine(javax.faces.context.ResponseWriter writer)
                         throws java.io.IOException
Write newline symbol to writer

Parameters:
writer - The character-based output
Throws:
java.io.IOException - if an input/output error occurs

writeAttribute

public static void writeAttribute(javax.faces.context.ResponseWriter writer,
                                  java.lang.String name,
                                  java.lang.String value)
                           throws java.io.IOException
Check value for nullable and write it to writer

Parameters:
value - The value of attribute
name - The name of attribute
writer - The character-based output
Throws:
java.io.IOException - if an input/output error occurs

writeAttributes

public static void writeAttributes(javax.faces.context.ResponseWriter writer,
                                   javax.faces.component.UIComponent component,
                                   java.lang.String... attributes)
                            throws java.io.IOException
Renders the specified list of component's attributes as is for all non-null attributes.

Throws:
java.io.IOException

writeIdAttribute

public static java.lang.String writeIdAttribute(javax.faces.context.FacesContext context,
                                                javax.faces.component.UIComponent component)
                                         throws java.io.IOException
Throws:
java.io.IOException

writeNameAttribute

public static void writeNameAttribute(javax.faces.context.FacesContext context,
                                      javax.faces.component.UIComponent component)
                               throws java.io.IOException
Throws:
java.io.IOException

writeAttribute

public static void writeAttribute(javax.faces.context.ResponseWriter writer,
                                  java.lang.String name,
                                  int value,
                                  int emptyValue)
                           throws java.io.IOException
Throws:
java.io.IOException

writeStandardEvents

public static void writeStandardEvents(javax.faces.context.ResponseWriter writer,
                                       OUIInput component)
                                throws java.io.IOException
Throws:
java.io.IOException

writeStandardEvents

public static void writeStandardEvents(javax.faces.context.ResponseWriter writer,
                                       OUIComponent component)
                                throws java.io.IOException
Throws:
java.io.IOException

writeStandardEvents

public static void writeStandardEvents(javax.faces.context.ResponseWriter writer,
                                       OUIComponent component,
                                       boolean skipOnclick)
                                throws java.io.IOException
Throws:
java.io.IOException

getEventHandlerScript

public static java.lang.String getEventHandlerScript(javax.faces.component.UIComponent component,
                                                     java.lang.String event)

getChangeHandlerScript

public static java.lang.String getChangeHandlerScript(javax.faces.component.UIComponent component)

getEventHandlerScript

public static java.lang.String getEventHandlerScript(javax.faces.component.UIComponent component,
                                                     java.lang.String event,
                                                     java.lang.String logicalEvent)

getEventHandlerScript

public static java.lang.String getEventHandlerScript(javax.faces.component.UIComponent component,
                                                     javax.faces.component.UIComponent sourceComponent,
                                                     java.lang.String event,
                                                     java.lang.String logicalEvent)

decodeBehaviors

public static void decodeBehaviors(javax.faces.context.FacesContext context,
                                   javax.faces.component.UIComponent component)

getEventWithOnPrefix

public static java.lang.String getEventWithOnPrefix(javax.faces.context.FacesContext context,
                                                    OUIClientAction component,
                                                    java.lang.String componentName)

getBooleanContextParam

public static boolean getBooleanContextParam(javax.faces.context.FacesContext context,
                                             java.lang.String webXmlContextParam)

getBooleanContextParam

public static boolean getBooleanContextParam(javax.faces.context.FacesContext context,
                                             java.lang.String webXmlContextParam,
                                             boolean defaultValue)

getContextParam

public static java.lang.String getContextParam(javax.faces.context.FacesContext context,
                                               java.lang.String webXmlContextParam)

getContextParam

public static java.lang.String getContextParam(javax.faces.context.FacesContext context,
                                               java.lang.String webXmlContextParam,
                                               java.lang.String defaultValue)


Copyright © 1998-2010 TeamDev Ltd. All Rights Reserved.