2016-02-04 122 views
1

我一定會錯過一些簡單的東西,但我很難讓MaterialDesignTheme在我的最小WicketApplication中使用。Wicket Bootstrap MaterialDesignTheme未選擇?

這是我做的:

public class WicketApplication extends WebApplication 
{ 

    @Override 
    public Class<? extends WebPage> getHomePage() 
    { 
     return HomePage.class; 
    } 

    @Override 
    public void init() 
    { 
     super.init(); 
     Bootstrap.install(this); 

     BootstrapSettings settings = new BootstrapSettings(); 
     settings.setThemeProvider(new SingleThemeProvider(new MaterialDesignTheme())); 
     Bootstrap.install(this, settings); 

     // add your configuration here 
     System.out.println(settings.getThemeProvider().available()); 
    } 
} 

我看到syso主題。

然後,在我的主頁:

public class HomePage extends WebPage { 
    private static final long serialVersionUID = 1L; 

    public HomePage(final PageParameters parameters) { 
     super(parameters); 

     IBootstrapSettings settings = Bootstrap.getSettings(Application.get()); 

     settings.getActiveThemeProvider().setActiveTheme(new MaterialDesignTheme()); 

     add(new Heading("version", getApplication().getFrameworkSettings().getVersion())); 

     Form f = new BootstrapForm<Void>("f") { 

     }; 

     f.add(new TextField<String>("text", Model.of("aap"))); 
     add(f); 
    } 

    public void renderHead(final IHeaderResponse response) { 
     super.renderHead(response); 
     Bootstrap.renderHead(response); 
    } 
} 

我沒有看到在渲染頭上的任何材料設計的CSS或JS ..

任何提示?

回答

2

好吧,這真的很愚蠢,但我加了兩次Bootstrap.install(this);。這似乎弄亂了事情。