Per-user Themes

From this thread on the Apache Causeway users mailing list:

  • Is it possible to have each of our resellers (using our Apache Causeway application) use their own theme/branding with their own logo and colors? Would this also be possible for the login page, possibly depending on the used host name?

Yes, you can do this, by installing a custom implementation of the Wicket Bootstrap’s ActiveThemeProvider.

ActiveThemeProvider implementation
public class MyThemeProvider implements ActiveThemeProvider {
    // ...
    @Override
    public ITheme getActiveTheme() { ... }                      (1)
    @Override
    public void setActiveTheme(final String themeName) { ... }  (1)
}
1 these methods won’t necessarily be called within a regular Causeway "interaction", so you may need to use the headless access pattern if - for example - persisting to Causeway-managed entities.

To egister

Using the ActiveThemeProvider
@Override
protected void init() {
    super.init();

    final IBootstrapSettings settings = Bootstrap.getSettings();
    settings.setThemeProvider(new BootswatchThemeProvider(BootswatchTheme.Flatly));

    settings.setActiveThemeProvider(new MyThemeProvider(settings));
}