Custom Bootstrap theme
The Apache Causeway Wicket viewer uses Bootstrap styles and components, courtesy of the Wicket Bootstrap integration.
By default the viewer uses the default bootstrap theme. It is possible to configure the Wicket viewer to allow the user to select other themes provided by bootswatch.com, and if required one of these can be set as the default.
However, you may instead want to write your own custom theme, for example to fit your company’s look-n-feel/interface guidelines.
This is done by implementing Wicket Bootstrap's de.agilecoders.wicket.core.settings.ITheme class.
This defines:
-
the name of the theme
-
the resources it needs (the CSS and optional JS and/or fonts), and
-
optional urls to load them from a Content Delivery Network (CDN).
To make use of the custom ITheme the application should register it by subclassing CausewayWicketApplication (also register this in web.xml) and add the following snippet:
public void init() {
...
IBootstrapSettings settings = new BootstrapSettings();
ThemeProvider themeProvider = new SingleThemeProvider(new MyTheme());
settings.setThemeProvider(themeProvider);
Bootstrap.install(getClass(), settings);
}