This documentation is for an old version of fiftyfive-wicket (2.0.9).


fiftyfive.wicket.resource
Class MergedResourceBuilder

java.lang.Object
  extended by fiftyfive.wicket.resource.MergedResourceBuilder
Direct Known Subclasses:
MergedCssBuilder, MergedJavaScriptBuilder

public abstract class MergedResourceBuilder
extends Object

Simplifies usage of the wicketstuff-merged-resources library by mounting merged resources with an easy builder API and a good set defaults. This is an abstract base class intended to be subclassed for CSS and JavaScript specific uses. See MergedCssBuilder for more details and example usage.

The reasonable defaults provided by this class are as follows:

Furthermore, this class fixes some shortcomings of the wicketstuff-merged-resources library, namely:


Constructor Summary
protected MergedResourceBuilder()
           
 
Method Summary
protected  void add(ResourceReference ref)
          Add a resource to the list of merged resources.
 AbstractHeaderContributor build(WebApplication app)
          Constructs a special merged resource using the path and resources options specified in this builder, and mounts the result in the application.
protected abstract  IHeaderContributor newContributor(ResourceReference ref)
          Constructs a header contributor for the given resource.
 MergedResourceBuilder setPath(String path)
          Sets the path at which the merged resources will be mounted.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MergedResourceBuilder

protected MergedResourceBuilder()
Method Detail

setPath

public MergedResourceBuilder setPath(String path)
Sets the path at which the merged resources will be mounted. For example, "/styles/all.css".


build

public AbstractHeaderContributor build(WebApplication app)
Constructs a special merged resource using the path and resources options specified in this builder, and mounts the result in the application. The resources will remain separate in development mode, but will be merged together into a single file in deployment mode.

This method must be called after all of the options have been set.

If desired, the HeaderContributor returned by this method can be used to contribute the merged resource to the pages or components of your choice.

Returns:
A HeaderContributor that will contribute all the JavaScript or CSS resources that were specified in this builder.
Throws:
IllegalStateException - if a path or resources have not been specified prior to calling this method.

add

protected void add(ResourceReference ref)
Add a resource to the list of merged resources.

Since:
2.0

newContributor

protected abstract IHeaderContributor newContributor(ResourceReference ref)
Constructs a header contributor for the given resource. Subclasses should implement the appropriate CSS or JS contributor.

Since:
2.0


Copyright © 2011 55 Minutes. All Rights Reserved.