Skip to content
l0rdn1kk0n edited this page Aug 14, 2012 · 6 revisions

You have to override the Application.init() method and call Bootstrap.install(this, settings) where settings is a new instance of BoostrapSettings or your own implementation of IBootstrapSettings.

    /**
     * @see org.apache.wicket.Application#init()
     */
    @Override
    public void init() {
        super.init();

        BootstrapSettings settings = new BootstrapSettings();
        settings.minify(true); // use minimized version of all bootstrap references

        Bootstrap.install(this, settings);
    }

Interface

public interface IBootstrapSettings {

    /**
     * @return the base twitter bootstrap css resource reference
     */
    ResourceReference getCssResourceReference();

    /**
     * @return the twitter bootstrap responsive css resource reference
     */
    ResourceReference getResponsiveCssResourceReference();

    /**
     * @return the base twitter bootstrap javascript resource reference
     */
    ResourceReference getJsResourceReference();

    /**
     * @return returns the jquery cdn url
     */
    String getJqueryUrl();

    void setJqueryUrl(final String url);

    boolean isMinified();

    void minify(final boolean minify);

    boolean useModernizr();

    void setUseModernizr(final boolean useModernizr);

    boolean useResponsiveCss();

    void setUseResponsiveCss(final boolean useResponsiveCss);

    void setActiveThemeProvider(ActiveThemeProvider themeProvider);

    ActiveThemeProvider getActiveThemeProvider();

    ThemeProvider getThemeProvider();

    void setThemeProvider(ThemeProvider themeProvider);
}

LessCompiler Settings

package de.agilecoders.wicket.settings;

import com.asual.lesscss.LessOptions;
import de.agilecoders.wicket.util.IBootstrapLessCompiler;

import java.nio.charset.Charset;

/**
 * The {@link IBootstrapLessCompilerSettings} interface.
 *
 * @author miha
 * @version 1.0
 */
public interface IBootstrapLessCompilerSettings {

    public enum CacheStrategy {
        Never, Forever, Modified
    }

    /**
     * Turns on the less compiler.
     *
     * @param value true, if less compiler should be used
     */
    void setUseLessCompiler(boolean value);

    /**
     * @return true, if less compiler should be used
     */
    boolean useLessCompiler();

    /**
     * Sets the charset to use when reading and writing less/css files.
     * Default: UTF-8
     *
     * @param charset the charset to use.
     */
    void setCharset(Charset charset);

    /**
     * @return the charset to use.
     */
    Charset getCharset();

    /**
     * The less compiler implementation that generates the css files.
     *
     * @param lessCompiler The less compiler to use
     */
    void setLessCompiler(IBootstrapLessCompiler lessCompiler);

    /**
     * @return The less compiler to use
     */
    IBootstrapLessCompiler getLessCompiler();

    /**
     * sets the less compiler options
     *
     * @param lessOptions the less compiler options
     */
    void setLessOptions(LessOptions lessOptions);

    /**
     * @return the less compiler options
     */
    LessOptions getLessOptions();

    /**
     * @return the cache strategy
     */
    CacheStrategy getCacheStrategy();

    /**
     * sets the {@link CacheStrategy} to use.
     *
     * @param strategy the cache strategy
     */
    void setCacheStrategy(CacheStrategy strategy);

    /**
     * whether to store all less file changes to the css file or not
     *
     * @param value true, if file should stored.
     */
    void storeChanges(boolean value);

    /**
     * @return true, if less file changes should stored in css file.
     */
    boolean storeChanges();
}
Clone this wiki locally