|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.myfaces.custom.dojo.DojoUtils
public final class DojoUtils
Utils class for the dojo infrastructure to ease the component building mechanisms note this class uses its own double entries filter due to the fact that we can mix and match header and body scripts as needed (we do not want to lose portal functionality do we?)
Method Summary | |
---|---|
static void |
addDebugConsole(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component)
adds a debug console to the output this is for helping to debug the dojo system a debug:true is required for this to work properly it will not be set by this method (due to the avoidance of unwanted automatisms causing sideefects) |
static void |
addMainInclude(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component,
String javascriptLocation,
DojoConfig config)
|
static void |
addNamespace(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component,
String namespace,
String location)
adds a new namespace location to the mix |
static void |
addProvide(javax.faces.context.FacesContext context,
String provided)
adds a dojo provide to the current list of definitions within the header |
static void |
addProvide(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component,
String provided)
adds a dojo provide |
static void |
addRequire(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component,
String required)
adds a dojo require include to our mix of stuff used |
static void |
addRequire(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component,
String[] requires)
convenience method for easier requires handling |
static String |
calculateWidgetId(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent widget)
|
static String |
calculateWidgetVarName(javax.faces.context.FacesContext context,
javax.faces.component.UIComponent widget)
|
static String |
calculateWidgetVarName(String clientId)
helper method to centralize the widget variable name calculation for our dojo javascript widget init code |
static String |
createDebugStatement(String stmnt)
creates a debug statement for the debug console |
static String |
createDebugStatement(String stmnt,
String value)
creates a debug statement and a corresponding value for the debug console |
static String |
createDojoProvideScript(String provided)
helper method which does the proper dojo provide script creation |
static String |
createDojoRequireString(String required)
helper method for the proper dojo require script creation |
static Map |
getAttributeMap(javax.faces.context.FacesContext facesContext,
String[] attributeNames,
javax.faces.component.UIComponent component)
creates a dojoed attribute map upon the given array of attribute names |
static DojoConfig |
getDjConfigInstance(javax.faces.context.FacesContext context)
Request singleton getter method for the djConfig object |
static Boolean |
getExpanded(javax.faces.context.FacesContext facesContext)
getter for the expanded flat |
static boolean |
isDojoInitialized(javax.faces.context.FacesContext facesContext)
check if dojo is going to be used |
static boolean |
isInlineScriptCheck(javax.faces.context.FacesContext context,
String inlineScript)
check if the script with the given inlineScript-name has been added |
static boolean |
isInlineScriptSet(javax.faces.context.FacesContext context,
String inlineScript)
Inline script set |
static void |
mergeExternalDjConfig(javax.faces.context.FacesContext context,
DojoConfig config)
helper to merge in an external dojo config instance the merge algorithm is that an existing entry is overwritten if a new config entry is set make sure that this is not called too often due to the fact that we do heavy reflection in here |
static String |
renderWidgetInitializationCode(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component,
String dojoType,
Map paramMap)
please, instead of using standard dojo taglib mechanisms use this code for initialisation it will render a clean and proper javascript initialisation instead. |
static String |
renderWidgetInitializationCode(javax.faces.context.FacesContext facesContext,
javax.faces.component.UIComponent component,
String dojoType,
String[] attributeNames)
convenience method to render the widget init code automatically for a given component and a set of attribute names |
static String |
renderWidgetInitializationCode(javax.faces.context.ResponseWriter writer,
javax.faces.component.UIComponent component,
String dojoType,
Map paramMap,
String clientId,
boolean refId)
same for a given neutral id... |
static void |
setExpanded(javax.faces.context.FacesContext facesContext,
Boolean expanded)
if this flag is set to true somewhere before the rendering, the expanded version is loaded otherwise the nonexpanded version is loaded |
static void |
writeDebugStatement(javax.faces.context.ResponseWriter writer,
String stmnt)
helper to write out debug statements this is only a convenience method to reduce the code bloat |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Map getAttributeMap(javax.faces.context.FacesContext facesContext, String[] attributeNames, javax.faces.component.UIComponent component)
facesContext
- standard faces context used internallyattributeNames
- string array of traversable attribute namescomponent
- the source component with the values set
public static void addDebugConsole(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component) throws IOException
facesContext
- component
-
IOException
public static boolean isDojoInitialized(javax.faces.context.FacesContext facesContext)
public static void addMainInclude(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, String javascriptLocation, DojoConfig config) throws IOException
IOException
public static void addNamespace(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, String namespace, String location) throws IOException
facesContext
- the faces context which is used internallycomponent
- the affected componentnamespace
- the namespace which has to be appliedlocation
- the script location
IOException
public static void addProvide(javax.faces.context.FacesContext context, String provided)
context
- the faces context for accessing the resources internallyprovided
- the package with the class provided by this implementationpublic static void addProvide(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, String provided) throws IOException
facesContext
- component
- provided
-
IOException
public static void addRequire(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, String[] requires) throws IOException
facesContext
- standard faces contextcomponent
- the componentrequires
- an array of requires which is rendered into single dojo.require statements
IOException
public static void addRequire(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, String required) throws IOException
facesContext
- required
-
IOException
public static String createDebugStatement(String stmnt)
stmnt
- the debug message displayed by the debug console
public static String createDebugStatement(String stmnt, String value)
stmnt
- the debug message displayed and given value by the debug
console
public static String createDojoProvideScript(String provided)
provided
- the provided class name
public static String createDojoRequireString(String required)
required
- the creation package for the require functionality
public static DojoConfig getDjConfigInstance(javax.faces.context.FacesContext context)
context
-
public static Boolean getExpanded(javax.faces.context.FacesContext facesContext)
facesContext
-
public static boolean isInlineScriptSet(javax.faces.context.FacesContext context, String inlineScript)
context
- standard faces contextinlineScript
- key to the inline script
public static boolean isInlineScriptCheck(javax.faces.context.FacesContext context, String inlineScript)
public static String renderWidgetInitializationCode(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, String dojoType, Map paramMap) throws IOException
facesContext
- standard faces contextcomponent
- standard componentdojoType
- the dojo type of this componentparamMap
-
IOException
public static String renderWidgetInitializationCode(javax.faces.context.FacesContext facesContext, javax.faces.component.UIComponent component, String dojoType, String[] attributeNames) throws IOException
facesContext
- component
- dojoType
- attributeNames
-
IOException
public static String renderWidgetInitializationCode(javax.faces.context.ResponseWriter writer, javax.faces.component.UIComponent component, String dojoType, Map paramMap, String clientId, boolean refId) throws IOException
dojoType
- paramMap
- clientId
- the referencing id which the widget has to render to (note the
id is enforced the uicomponent does nothing in this case!!!!)refId
- if true the refid is set in the dojo javascript init code if
false no ref is set the false often is needed for containers
which dynamically generated widgets with no referencing div
IOException
public static String calculateWidgetVarName(String clientId)
clientId
- the client id upon which the var name has to be generated
public static String calculateWidgetId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent widget)
public static String calculateWidgetVarName(javax.faces.context.FacesContext context, javax.faces.component.UIComponent widget)
public static void mergeExternalDjConfig(javax.faces.context.FacesContext context, DojoConfig config)
context
- config
- public static void setExpanded(javax.faces.context.FacesContext facesContext, Boolean expanded)
facesContext
- context because we again have a full request singleton hereexpanded
- if set to true the expanded version of the dojo scripts are
loaded otherwise the non expanded ones are loadedpublic static void writeDebugStatement(javax.faces.context.ResponseWriter writer, String stmnt) throws IOException
writer
- stmnt
-
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |