-
Notifications
You must be signed in to change notification settings - Fork 163
BootstrapSettings
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);
}
package de.agilecoders.wicket.settings;
import org.apache.wicket.request.resource.ResourceReference;
/**
* Settings interface for bootstrap settings.
*
* @author miha
* @version 1.0
*/
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 the jquery++ resource reference
*/
ResourceReference getJqueryPPResourceReference();
/**
* @return true, if modernizr should be loaded
*/
boolean useJqueryPP();
/**
* @param useJqueryPP true, if modernizr should be loaded
*/
void useJqueryPP(final boolean useJqueryPP);
/**
* @return true if minification is active
*/
boolean isMinified();
/**
* @param minify true, if all references should be loaded minified
*/
void minify(final boolean minify);
/**
* @return true, if modernizr should be loaded
*/
boolean useModernizr();
/**
* @param useModernizr true, if modernizr js library will be included
*/
void useModernizr(final boolean useModernizr);
/**
* @return true, if responsive css will be included
*/
boolean useResponsiveCss();
/**
* @param useResponsiveCss set to true if responsive css should be included
*/
void useResponsiveCss(final boolean useResponsiveCss);
/**
* The {@link ActiveThemeProvider} provides access to the active theme
*
* @param themeProvider The {@link ActiveThemeProvider} instance
*/
void setActiveThemeProvider(ActiveThemeProvider themeProvider);
/**
* @return The {@link ActiveThemeProvider} instance
*/
ActiveThemeProvider getActiveThemeProvider();
/**
* @return The {@link ThemeProvider} instance
*/
ThemeProvider getThemeProvider();
/**
* The {@link ThemeProvider} instance provides access to all available themes.
*
* @param themeProvider The {@link ThemeProvider} instance
*/
void setThemeProvider(ThemeProvider themeProvider);
/**
* @return the {@link IBootstrapLessCompilerSettings} implementation
*/
IBootstrapLessCompilerSettings getBootstrapLessCompilerSettings();
}
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();
}
Copyright 2012 AgileCoders.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.