org.apache.tapestry.javascript
Class JavascriptManagerImpl

java.lang.Object
  extended by org.apache.tapestry.javascript.JavascriptManagerImpl
All Implemented Interfaces:
JavascriptManager

public class JavascriptManagerImpl
extends Object
implements JavascriptManager

An implementation that accepts a comma separated String for files, formFiles and widgetFiles.

Since:
4.1.4
Author:
Andreas Andreou

Constructor Summary
JavascriptManagerImpl()
           
 
Method Summary
protected  void appendAssetAsJavascript(IMarkupWriter writer, IRequestCycle cycle, IAsset asset)
          Appends a script tag to include the given asset.
protected  void appendAssetsAsJavascript(IMarkupWriter writer, IRequestCycle cycle, List jsAssets)
           
protected  List buildAssetList(String files, String name)
          Builds a List of IAsset from a comma separated input string.
protected  IAsset findAsset(String path, String description)
          Finds the given asset (in classpath, context, e.t.c.).
 List getAssets()
          The javascript files that should always be included.
 IAsset getFirstAsset()
           
 IAsset getFirstFormAsset()
           
 IAsset getFirstWidgetAsset()
           
 List getFormAssets()
          The javascript files that provide form-related functionality.
 IAsset getPath()
          The base path to the javascript files.
 IAsset getTapestryAsset()
          The tapestry js file.
 IAsset getTapestryPath()
          The base path to the tapestry js files.
 List getWidgetAssets()
          The javascript files that provide widget-related functionality.
 void renderLibraryAdaptor(IMarkupWriter writer, IRequestCycle cycle)
          Output the resources needed for tapestry in order to use the current javascript library.
 void renderLibraryResources(IMarkupWriter writer, IRequestCycle cycle, boolean hasForm, boolean hasWidget)
          Output the resources (could be .js, .css, e.t.c.
 void setAssetSource(AssetSource assetSource)
           
 void setFiles(String files)
           
 void setFolder(String path)
           
 void setFormFiles(String formFiles)
           
 void setTapestryFile(String tapestryFile)
           
 void setTapestryFolder(String tapestryPath)
           
 void setWidgetFiles(String widgetFiles)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavascriptManagerImpl

public JavascriptManagerImpl()
Method Detail

getFirstAsset

public IAsset getFirstAsset()
Specified by:
getFirstAsset in interface JavascriptManager

getFirstFormAsset

public IAsset getFirstFormAsset()
Specified by:
getFirstFormAsset in interface JavascriptManager

getFirstWidgetAsset

public IAsset getFirstWidgetAsset()
Specified by:
getFirstWidgetAsset in interface JavascriptManager

getAssets

public List getAssets()
Description copied from interface: JavascriptManager
The javascript files that should always be included.

Specified by:
getAssets in interface JavascriptManager
Returns:
A not-null (but possibly empty) list of IAssets.

getFormAssets

public List getFormAssets()
Description copied from interface: JavascriptManager
The javascript files that provide form-related functionality. They're dynamically included when the page contains forms.

Specified by:
getFormAssets in interface JavascriptManager
Returns:
A not-null (but possibly empty) list of IAssets.

getWidgetAssets

public List getWidgetAssets()
Description copied from interface: JavascriptManager
The javascript files that provide widget-related functionality. They're dynamically included when the page contains widgets.

Specified by:
getWidgetAssets in interface JavascriptManager
Returns:
A not-null (but possibly empty) list of IAssets.

getPath

public IAsset getPath()
Description copied from interface: JavascriptManager
The base path to the javascript files.

Specified by:
getPath in interface JavascriptManager
Returns:
if null, it is left unused.

getTapestryAsset

public IAsset getTapestryAsset()
Description copied from interface: JavascriptManager
The tapestry js file.

Specified by:
getTapestryAsset in interface JavascriptManager
Returns:
if null then no tapestry file is included.

getTapestryPath

public IAsset getTapestryPath()
Description copied from interface: JavascriptManager
The base path to the tapestry js files.

Specified by:
getTapestryPath in interface JavascriptManager
Returns:
if null, it is left unused.

setFiles

public void setFiles(String files)

setFormFiles

public void setFormFiles(String formFiles)

setWidgetFiles

public void setWidgetFiles(String widgetFiles)

setFolder

public void setFolder(String path)

setTapestryFile

public void setTapestryFile(String tapestryFile)

setTapestryFolder

public void setTapestryFolder(String tapestryPath)

setAssetSource

public void setAssetSource(AssetSource assetSource)

renderLibraryResources

public void renderLibraryResources(IMarkupWriter writer,
                                   IRequestCycle cycle,
                                   boolean hasForm,
                                   boolean hasWidget)
Description copied from interface: JavascriptManager
Output the resources (could be .js, .css, e.t.c. files) needed for the current javascript library.

Specified by:
renderLibraryResources in interface JavascriptManager
hasForm - true if current page includes forms.
hasWidget - true if current page includes widgets.

renderLibraryAdaptor

public void renderLibraryAdaptor(IMarkupWriter writer,
                                 IRequestCycle cycle)
Description copied from interface: JavascriptManager
Output the resources needed for tapestry in order to use the current javascript library.

Specified by:
renderLibraryAdaptor in interface JavascriptManager

appendAssetAsJavascript

protected void appendAssetAsJavascript(IMarkupWriter writer,
                                       IRequestCycle cycle,
                                       IAsset asset)
Appends a script tag to include the given asset.

Parameters:
writer -
cycle -
asset -

appendAssetsAsJavascript

protected void appendAssetsAsJavascript(IMarkupWriter writer,
                                        IRequestCycle cycle,
                                        List jsAssets)

buildAssetList

protected List buildAssetList(String files,
                              String name)
Builds a List of IAsset from a comma separated input string.

Parameters:
files - A comma separated string.
name - Description of assets.
Returns:

findAsset

protected IAsset findAsset(String path,
                           String description)
Finds the given asset (in classpath, context, e.t.c.).

Parameters:
path -
description -
Returns:


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