org.apache.tapestry5.services.javascript
Class ExtensibleJavaScriptStack

java.lang.Object
  extended by org.apache.tapestry5.services.javascript.ExtensibleJavaScriptStack
All Implemented Interfaces:
JavaScriptStack

@UsesOrderedConfiguration(value=StackExtension.class)
public class ExtensibleJavaScriptStack
extends Object
implements JavaScriptStack

An extensible implementation of JavaScriptStack that can be used as the implementation of a service. The contributions to the service are used to supply the libraries, stylesheets, and initialization for a JavaScriptStack, allowing the stack to be more dynamically configured. In practice, one will use ServiceBinder.bind(Class, Class) and ServiceBindingOptions.withMarker(Class...) to construct the service, then use the marker annotation to inject the service when contributing the service into to the JavaScriptStackSource.

A limitation of this implementation is that the contributed assets are not localized at all.

Since:
5.3
See Also:
StackExtension

Constructor Summary
ExtensibleJavaScriptStack(AssetSource assetSource, List<StackExtension> configuration)
           
 
Method Summary
 String getInitialization()
          Returns static JavaScript initialization for the stack.
 List<Asset> getJavaScriptLibraries()
          Returns a list of localized assets for JavaScript libraries that form the stack.
 List<String> getStacks()
          Returns a list of JavaScriptStack names that this stack depends on.
 List<StylesheetLink> getStylesheets()
          Returns a list of localized links for stylesheets that form the stack.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtensibleJavaScriptStack

public ExtensibleJavaScriptStack(AssetSource assetSource,
                                 List<StackExtension> configuration)
Method Detail

getStacks

public List<String> getStacks()
Description copied from interface: JavaScriptStack
Returns a list of JavaScriptStack names that this stack depends on. Each stack will be processed before the current stack (thus a dependency stack's libraries, stylesheets and initialization is emitted before the dependent stack).

Specified by:
getStacks in interface JavaScriptStack

getJavaScriptLibraries

public List<Asset> getJavaScriptLibraries()
Description copied from interface: JavaScriptStack
Returns a list of localized assets for JavaScript libraries that form the stack.

Specified by:
getJavaScriptLibraries in interface JavaScriptStack

getStylesheets

public List<StylesheetLink> getStylesheets()
Description copied from interface: JavaScriptStack
Returns a list of localized links for stylesheets that form the stack.

Specified by:
getStylesheets in interface JavaScriptStack

getInitialization

public String getInitialization()
Description copied from interface: JavaScriptStack
Returns static JavaScript initialization for the stack. This block of JavaScript code will be added to the page that imports the stack. The code executes outside of any other function (i.e., the code is not deferred until the DOM is loaded). As with the other methods, if localization is a factor, the result of this method should be localized.

Specified by:
getInitialization in interface JavaScriptStack


Copyright © 2003-2012 The Apache Software Foundation.