org.apache.tapestry.dojo
Class AjaxShellDelegate

java.lang.Object
  extended by org.apache.tapestry.dojo.AjaxShellDelegate
All Implemented Interfaces:
IRender

public class AjaxShellDelegate
extends Object
implements IRender

The default rendering delegate responsible for include the dojo sources in to the Shell component.


Field Summary
static String BROWSER_LOG_CRITICAL
          Client side critical log level.
static String BROWSER_LOG_DEBUG
          Client side debug log level.
static String BROWSER_LOG_ERROR
          Client side error log level.
static String BROWSER_LOG_INFO
          Client side info log level.
static String BROWSER_LOG_WARNING
          Client side warning log level.
protected  String[] SUPPORTED_LOCALES
          Default list of pre-bundled dojo supported locales.
 
Constructor Summary
AjaxShellDelegate()
           
 
Method Summary
protected  boolean isLocaleSupported(String locale)
          Checks if the provided locale string matches one of the predefined SUPPORTED_LOCALES in the dojo javascript library.
 void render(IMarkupWriter writer, IRequestCycle cycle)
          The principal rendering/rewinding method.
 void setConsoleEnabled(boolean enabled)
          Enables/disables the dojo.debug.console functionality which should redirect most logging messages to your browsers javascript console.
 void setDebug(boolean debug)
          Allows for turning browser debugging on/off.
 void setDebugAtAllCosts(boolean value)
          Turns off deep context level javascript debugging mode for dojo.
 void setDebugContainerId(String debugContainerId)
          Sets the html element node id of the element you would like all browser debug content to go to.
 void setDojoFormSource(IAsset formSource)
           
 void setDojoPath(IAsset dojoPath)
          Sets the dojo baseRelativePath value.
 void setDojoSource(IAsset dojoSource)
          Sets a valid path to the base dojo javascript installation directory.
 void setDojoWidgetSource(IAsset widgetSource)
           
 void setLogLevel(String level)
          Sets the dojo logging level.
 void setParseWidgets(boolean parseWidgets)
          Tells dojo whether or not to parse widgets by traversing the entire dom node of your document.
 void setPreventBackButtonFix(boolean prevent)
          Sets the dojo preventBackButtonFix djConfig configuration.
 void setSearchIds(String searchIds)
          Provides a way to have dojo automatically parse a known set of page widgets without enabling full automatic parsing.
 void setTapestryPath(IAsset tapestryPath)
          Sets the path to the tapestry javascript modules.
 void setTapestrySource(IAsset tapestrySource)
          Sets a valid base path to resolve tapestry core.js.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BROWSER_LOG_DEBUG

public static final String BROWSER_LOG_DEBUG
Client side debug log level.

See Also:
Constant Field Values

BROWSER_LOG_INFO

public static final String BROWSER_LOG_INFO
Client side info log level.

See Also:
Constant Field Values

BROWSER_LOG_WARNING

public static final String BROWSER_LOG_WARNING
Client side warning log level.

See Also:
Constant Field Values

BROWSER_LOG_ERROR

public static final String BROWSER_LOG_ERROR
Client side error log level.

See Also:
Constant Field Values

BROWSER_LOG_CRITICAL

public static final String BROWSER_LOG_CRITICAL
Client side critical log level.

See Also:
Constant Field Values

SUPPORTED_LOCALES

protected String[] SUPPORTED_LOCALES
Default list of pre-bundled dojo supported locales.

Constructor Detail

AjaxShellDelegate

public AjaxShellDelegate()
Method Detail

render

public void render(IMarkupWriter writer,
                   IRequestCycle cycle)
The principal rendering/rewinding method. This will cause the receiving component to render its top level elements (HTML text and components).

Renderring and rewinding are the exact same process. The same code that renders must be able to restore state by going through the exact same operations (even though the output is discarded).

Specified by:
render in interface IRender

isLocaleSupported

protected boolean isLocaleSupported(String locale)
Checks if the provided locale string matches one of the predefined SUPPORTED_LOCALES in the dojo javascript library.

Parameters:
locale - The Dojo formatted locale string to check.
Returns:
True if locale is supported and ok to define in dojoConfig - false otherwise.

setLogLevel

public void setLogLevel(String level)
Sets the dojo logging level. Similar to log4j style log levels.

Parameters:
level - The string constant for the level, valid values are:


setDebug

public void setDebug(boolean debug)
Allows for turning browser debugging on/off.

Parameters:
debug - If false, no logging output will be written.

setDebugAtAllCosts

public void setDebugAtAllCosts(boolean value)
Turns off deep context level javascript debugging mode for dojo. This means that exceptions/debug statements will show you line numbers from the actual javascript file that generated them instead of the normal default which is usually bootstrap.js .

The default value is false if not set.

People should be wary of turning this on as it may cause problems under certain conditions, and you definitely don't ever want this on in production.

Parameters:
value - If true deep debugging will be turned on.

setDebugContainerId

public void setDebugContainerId(String debugContainerId)
Sets the html element node id of the element you would like all browser debug content to go to.

Parameters:
debugContainerId - the debugContainerId to set

setConsoleEnabled

public void setConsoleEnabled(boolean enabled)
Enables/disables the dojo.debug.console functionality which should redirect most logging messages to your browsers javascript console. (if it supports one).

The debug console is disabled by default. Currently known supported browsers are FireFox(having FireBug extension helps a great deal)/Opera/Safari.

Parameters:
enabled - Whether or not the enable debug console.

setPreventBackButtonFix

public void setPreventBackButtonFix(boolean prevent)
Sets the dojo preventBackButtonFix djConfig configuration. This should typically be avoided but is provided for flexibility.

Parameters:
prevent - Whether or not to prevent back button fix.

setParseWidgets

public void setParseWidgets(boolean parseWidgets)
Tells dojo whether or not to parse widgets by traversing the entire dom node of your document. It is highly reccomended that you keep this at its default value of false.

Parameters:
parseWidgets - the parseWidgets to set

setSearchIds

public void setSearchIds(String searchIds)
Provides a way to have dojo automatically parse a known set of page widgets without enabling full automatic parsing.

Parameters:
searchIds - the html ids within which to search for widgets

setDojoSource

public void setDojoSource(IAsset dojoSource)
Sets a valid path to the base dojo javascript installation directory.

Parameters:
dojoSource - Path to dojo source directory core "dojo.js" file.

setDojoFormSource

public void setDojoFormSource(IAsset formSource)

setDojoWidgetSource

public void setDojoWidgetSource(IAsset widgetSource)

setDojoPath

public void setDojoPath(IAsset dojoPath)
Sets the dojo baseRelativePath value.

Parameters:
dojoPath - The base path to dojo directory.

setTapestrySource

public void setTapestrySource(IAsset tapestrySource)
Sets a valid base path to resolve tapestry core.js.

Parameters:
tapestrySource - Main tapestry core.js file.

setTapestryPath

public void setTapestryPath(IAsset tapestryPath)
Sets the path to the tapestry javascript modules. (Needed for dojo to resolve the path to tapestry javascript, esp when overriding the default bundled dojo.)

Parameters:
tapestryPath - The path to tapestry.


Copyright © 2006-2008 Apache Software Foundation. All Rights Reserved.