com.ibm.xsp.renderkit.dojo
Class DojoUtil

java.lang.Object
  extended by com.ibm.xsp.renderkit.dojo.DojoUtil

public class DojoUtil
extends java.lang.Object

Useful utilities for writing out the associated html for building DOJO controls


Field Summary
static boolean DOJO_INLINEGENERATION
          Not part of the API.
 
Constructor Summary
DojoUtil()
           
 
Method Summary
static java.lang.String addComponentDojoAttributes(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.String dojoType, java.util.Map<java.lang.String,java.lang.String> attrs)
          Generate the HTML for dojo type and dojo attributes, used when the component does not implement FacesDojoComponent, so the methods "getDojoType" and "getDojoAttributes" from that interface are not called.
static java.lang.String addDojoAttributes(javax.faces.context.FacesContext context, FacesDojoComponent component)
          Generate the dojo type and dojo attributes with no dojo type specified
static java.lang.String addDojoAttributes(javax.faces.context.FacesContext context, FacesDojoComponent component, java.lang.String defaultDojoType)
          Generate the dojo type and related attributes where you specify default dojo type
static java.lang.String addDojoAttributes(javax.faces.context.FacesContext context, FacesDojoComponent component, java.lang.String defaultDojoType, boolean preventGetDojoType, java.util.Map<java.lang.String,java.lang.String> extraAttributes, boolean loadXspClientDojoUI)
          Generate the dojo type and related attributes, used when the component implements FacesDojoComponent, so the methods "getDojoType" and "getDojoAttributes" from that interface are called.
static java.lang.String addDojoAttributes(javax.faces.context.FacesContext context, FacesDojoComponent component, java.lang.String defaultDojoType, java.util.Map<java.lang.String,java.lang.String> extraAttributes)
          Generate the dojo type and related attributes
static void addDojoHtmlAttributes(javax.faces.context.FacesContext context, java.lang.String dojoType, java.util.List<DojoAttribute> attributes, java.util.Map<java.lang.String,java.lang.String> extraAttributes)
          Writes out html for dojotype, dojo attributes and html attributes
static void instanciateDojoComponent(javax.faces.context.FacesContext context, java.lang.String dojoId, java.lang.String dojoType, java.util.List<DojoAttribute> attributes, java.util.Map<java.lang.String,java.lang.String> extraAttributes)
          Writes out script onload to instantiate a DojoComponent.
static boolean isDojoEnabled(javax.faces.context.FacesContext context)
          Is dojo JS library being used
static boolean useDojoParser(javax.faces.context.FacesContext context)
          Generate JavaScript statements for initializing Dojo dijits instead of relying on the Dojo parser
static void writeDojoHtmlAttributes(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.String dojoType)
           
static void writeDojoHtmlAttributes(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.String dojoType, java.util.Map<java.lang.String,java.lang.String> attributes)
           
static void writeDojoHtmlAttributesMap(javax.faces.context.FacesContext context, java.util.Map<java.lang.String,java.lang.String> attrs)
          Writes out html for map of attributes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DOJO_INLINEGENERATION

public static boolean DOJO_INLINEGENERATION
Not part of the API. This is prototype and not enabled.

Constructor Detail

DojoUtil

public DojoUtil()
Method Detail

useDojoParser

public static boolean useDojoParser(javax.faces.context.FacesContext context)
Generate JavaScript statements for initializing Dojo dijits instead of relying on the Dojo parser

Parameters:
javax.faces.context.FacesContext -

isDojoEnabled

public static boolean isDojoEnabled(javax.faces.context.FacesContext context)
Is dojo JS library being used

Parameters:
context -
Returns:
true if dojo js library is enabled

addDojoAttributes

public static java.lang.String addDojoAttributes(javax.faces.context.FacesContext context,
                                                 FacesDojoComponent component)
                                          throws java.io.IOException
Generate the dojo type and dojo attributes with no dojo type specified

Parameters:
javax.faces.context.FacesContext -
com.ibm.xsp.dojo.FacesDojoComponent - return dojo type
Throws:
java.io.IOException

addDojoAttributes

public static java.lang.String addDojoAttributes(javax.faces.context.FacesContext context,
                                                 FacesDojoComponent component,
                                                 java.lang.String defaultDojoType)
                                          throws java.io.IOException
Generate the dojo type and related attributes where you specify default dojo type

Parameters:
javax.faces.context.FacesContext -
com.ibm.xsp.dojo.FacesDojoComponent -
default - dojo type return dojo type
Throws:
java.io.IOException

addDojoAttributes

public static java.lang.String addDojoAttributes(javax.faces.context.FacesContext context,
                                                 FacesDojoComponent component,
                                                 java.lang.String defaultDojoType,
                                                 java.util.Map<java.lang.String,java.lang.String> extraAttributes)
                                          throws java.io.IOException
Generate the dojo type and related attributes

Parameters:
javax.faces.context.FacesContext -
com.ibm.xsp.dojo.FacesDojoComponent -
default - dojo type
java.util.Map - attributes return dojo type
Throws:
java.io.IOException

addDojoAttributes

public static java.lang.String addDojoAttributes(javax.faces.context.FacesContext context,
                                                 FacesDojoComponent component,
                                                 java.lang.String defaultDojoType,
                                                 boolean preventGetDojoType,
                                                 java.util.Map<java.lang.String,java.lang.String> extraAttributes,
                                                 boolean loadXspClientDojoUI)
                                          throws java.io.IOException
Generate the dojo type and related attributes, used when the component implements FacesDojoComponent, so the methods "getDojoType" and "getDojoAttributes" from that interface are called. Note, anywhere this is called, it is usually appropriate to check whether the result dojoType is non-empty, and if present, force an id attribute on the containing HTML element, even where the "id" was absent in the XPage source (false returned by HtmlUtil.isUserId(String))

Parameters:
context -
component - com.ibm.xsp.dojo.FacesDojoComponent
defaultDojoType - default dojo type, to use if the dojoType hasn't been explicitly set on the component
preventGetDojoType - used when the defaultDojoType is the value previously returned from FacesDojoComponent.getDojoType(), prevents re-invoking that method. Defaults to false in the other methods of this util.
extraAttributes - null or some extra attributes to render as if they were in the FacesDojoComponent.getDojoAttributes() list.
loadXspClientDojoUI - defaults to true in the other methods of this util.
Returns:
the dojoType that was output, either the non-empty value returned from FacesDojoComponent.getDojoType(), or the value of the defaultDojoType parameter.
Throws:
java.io.IOException
Since:
8.5.3 This method was added in 8.5.3; the other addDojoAttributes(FacesContext, FacesDojoComponent, String, Map) method was present in 8.5.2.

addComponentDojoAttributes

public static java.lang.String addComponentDojoAttributes(javax.faces.context.FacesContext context,
                                                          javax.faces.component.UIComponent component,
                                                          java.lang.String dojoType,
                                                          java.util.Map<java.lang.String,java.lang.String> attrs)
                                                   throws java.io.IOException
Generate the HTML for dojo type and dojo attributes, used when the component does not implement FacesDojoComponent, so the methods "getDojoType" and "getDojoAttributes" from that interface are not called.

Parameters:
context - javax.faces.context.FacesContext
component -
dojoType - the dojoType to output.
attributes - java.util.Map
Returns:
dojo type
Throws:
java.io.IOException

addDojoHtmlAttributes

public static void addDojoHtmlAttributes(javax.faces.context.FacesContext context,
                                         java.lang.String dojoType,
                                         java.util.List<DojoAttribute> attributes,
                                         java.util.Map<java.lang.String,java.lang.String> extraAttributes)
                                  throws java.io.IOException
Writes out html for dojotype, dojo attributes and html attributes

Parameters:
javax.faces.context.FacesContext -
dojo - type
java.util.List - Dojo Attributes
java.util.Map - HTML Attributes
Throws:
java.io.IOException

writeDojoHtmlAttributes

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

writeDojoHtmlAttributes

public static void writeDojoHtmlAttributes(javax.faces.context.FacesContext context,
                                           javax.faces.component.UIComponent component,
                                           java.lang.String dojoType,
                                           java.util.Map<java.lang.String,java.lang.String> attributes)
                                    throws java.io.IOException
Throws:
java.io.IOException

writeDojoHtmlAttributesMap

public static void writeDojoHtmlAttributesMap(javax.faces.context.FacesContext context,
                                              java.util.Map<java.lang.String,java.lang.String> attrs)
                                       throws java.io.IOException
Writes out html for map of attributes

Parameters:
javax.faces.context.FacesContext -
java.util.Map -
Throws:
java.io.IOException

instanciateDojoComponent

public static void instanciateDojoComponent(javax.faces.context.FacesContext context,
                                            java.lang.String dojoId,
                                            java.lang.String dojoType,
                                            java.util.List<DojoAttribute> attributes,
                                            java.util.Map<java.lang.String,java.lang.String> extraAttributes)
                                     throws java.io.IOException
Writes out script onload to instantiate a DojoComponent.

Parameters:
javax.faces.context.FacesContext -
dojo - Id
dojoType -
dojoAttribute - attributes
Throws:
java.io.IOException