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


fiftyfive.wicket.css
Class MergedCssBuilder

java.lang.Object
  extended by fiftyfive.wicket.resource.MergedResourceBuilder
      extended by fiftyfive.wicket.css.MergedCssBuilder

public class MergedCssBuilder
extends MergedResourceBuilder

Instructs Wicket to merge a list of CSS resources into a single file when the application is in deployment mode. Consider using this in your application as a performance optimization.

Example usage:

 public class MyApplication extends WebApplication
 {
     @Override
     protected void init()
     {
         super.init();
 
         new MergedCssBuilder()
             .setPath("/styles/all.css")
             .addCss(WicketApplication.class, "styles/reset.css")
             .addCss(WicketApplication.class, "styles/core.css")
             .addCss(WicketApplication.class, "styles/layout.css")
             .addCss(WicketApplication.class, "styles/content.css")
             .addCss(WicketApplication.class, "styles/forms.css")
             .addCss(WicketApplication.class, "styles/page-specific.css")
             .build(this);
 
         // The return value from build() can be used on your base page to
         // inject all these CSS resources in one shot.
     }
 }

Since:
2.0

Constructor Summary
MergedCssBuilder()
          Creates an empty builder object.
 
Method Summary
 MergedCssBuilder addCss(Class<?> scope, String path)
          Adds a CSS resource to the list of merged resources.
 MergedCssBuilder addCss(ResourceReference ref)
          Adds a CSS resource to the list of merged resources.
protected  IHeaderContributor newContributor(ResourceReference ref)
          Constructs a header contributor for the given resource.
 MergedCssBuilder setCssMedia(String media)
          Sets the CSS media type that will be used for the merged CSS resources.
 MergedCssBuilder setPath(String path)
          Sets the path at which the merged resources will be mounted.
 
Methods inherited from class fiftyfive.wicket.resource.MergedResourceBuilder
add, build
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MergedCssBuilder

public MergedCssBuilder()
Creates an empty builder object. See the class documentation for example usage.

Method Detail

setPath

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

Overrides:
setPath in class MergedResourceBuilder

setCssMedia

public MergedCssBuilder setCssMedia(String media)
Sets the CSS media type that will be used for the merged CSS resources. By default the merged CSS will not have a media type, meaning it will apply to all media. Alternatively you could specify "screen" or "print" to limit the CSS to those media.


addCss

public MergedCssBuilder addCss(Class<?> scope,
                               String path)
Adds a CSS resource to the list of merged resources.

Parameters:
scope - The class relative to which the resource will be resolved.
path - The path, relative to the scope, where the CSS file is is located.

addCss

public MergedCssBuilder addCss(ResourceReference ref)
Adds a CSS resource to the list of merged resources.

Parameters:
ref - The CSS resource to add.

newContributor

protected IHeaderContributor newContributor(ResourceReference ref)
Description copied from class: MergedResourceBuilder
Constructs a header contributor for the given resource. Subclasses should implement the appropriate CSS or JS contributor.

Specified by:
newContributor in class MergedResourceBuilder


Copyright © 2011 55 Minutes. All Rights Reserved.