Class ExtensibleJavaScriptStack
- java.lang.Object
-
- org.apache.tapestry5.services.javascript.ExtensibleJavaScriptStack
-
- All Implemented Interfaces:
JavaScriptStack
@UsesOrderedConfiguration(StackExtension.class) public class ExtensibleJavaScriptStack extends java.lang.Object implements JavaScriptStack
An extensible implementation ofJavaScriptStackthat 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 useServiceBinder.bind(Class, Class)andServiceBindingOptions.withMarker(Class...)to construct the service, then use the marker annotation to inject the service when contributing the service into to theJavaScriptStackSource. A limitation of this implementation is that the contributed assets are not localized at all.- Since:
- 5.3
- See Also:
StackExtension
-
-
Constructor Summary
Constructors Constructor Description ExtensibleJavaScriptStack(AssetSource assetSource, java.util.List<StackExtension> configuration)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetInitialization()Returns static JavaScript initialization for the stack.JavaScriptAggregationStrategygetJavaScriptAggregationStrategy()Identifies how to aggregate JavaScript within the stack.java.util.List<Asset>getJavaScriptLibraries()Returns a list of localized assets for JavaScript libraries that form the stack.java.util.List<java.lang.String>getModules()Returns a list of modules to include with the stack, when aggregating the stack's JavaScript.java.util.List<java.lang.String>getStacks()Returns a list of JavaScriptStack names that this stack depends on.java.util.List<StylesheetLink>getStylesheets()Returns a list of localized links for stylesheets that form the stack.
-
-
-
Constructor Detail
-
ExtensibleJavaScriptStack
public ExtensibleJavaScriptStack(AssetSource assetSource, java.util.List<StackExtension> configuration)
-
-
Method Detail
-
getStacks
public java.util.List<java.lang.String> getStacks()
Description copied from interface:JavaScriptStackReturns 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:
getStacksin interfaceJavaScriptStack
-
getJavaScriptLibraries
public java.util.List<Asset> getJavaScriptLibraries()
Description copied from interface:JavaScriptStackReturns a list of localized assets for JavaScript libraries that form the stack.- Specified by:
getJavaScriptLibrariesin interfaceJavaScriptStack
-
getStylesheets
public java.util.List<StylesheetLink> getStylesheets()
Description copied from interface:JavaScriptStackReturns a list of localized links for stylesheets that form the stack.- Specified by:
getStylesheetsin interfaceJavaScriptStack
-
getInitialization
public java.lang.String getInitialization()
Description copied from interface:JavaScriptStackReturns 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:
getInitializationin interfaceJavaScriptStack
-
getModules
public java.util.List<java.lang.String> getModules()
Description copied from interface:JavaScriptStackReturns a list of modules to include with the stack, when aggregating the stack's JavaScript. It is still necessary to explicitly require such modules.- Specified by:
getModulesin interfaceJavaScriptStack- See Also:
ModuleManager,SymbolConstants.COMBINE_SCRIPTS
-
getJavaScriptAggregationStrategy
public JavaScriptAggregationStrategy getJavaScriptAggregationStrategy()
Description copied from interface:JavaScriptStackIdentifies how to aggregate JavaScript within the stack. The default isJavaScriptAggregationStrategy.COMBINE_AND_MINIMIZE.- Specified by:
getJavaScriptAggregationStrategyin interfaceJavaScriptStack
-
-