*
* @param markupId The components markup id.
* @return a new {@link Navbar} instance
*/
protected Navbar newNavbar(String markupId) {
Navbar navbar = new Navbar(markupId);
navbar.setPosition(Navbar.Position.TOP);
navbar.setInverted(true);
// show brand name
navbar.setBrandName(Model.of("Wicket Bootstrap"));
navbar.addComponents(NavbarComponents.transform(Navbar.ComponentPosition.LEFT,
new NavbarButton<Void>(HomePage.class, Model.of("Overview")).setIconType(GlyphIconType.home),
new NavbarButton<Void>(BaseCssPage.class, Model.of("Base CSS")),
new NavbarButton<Void>(ComponentsPage.class, Model.of("Components")),
new NavbarButton<Void>(Scaffolding.class, Model.of("Scaffolding")),
new NavbarExternalLink(Model.of("https://github.com/l0rdn1kk0n/wicket-bootstrap"))
.setLabel(Model.of("Github"))
.setTarget(BootstrapExternalLink.Target.blank)
.setIconType(GlyphIconType.export),
newAddonsDropDownButton())
);
navbar.addComponents(new NavbarText(navbar.newExtraItemId(), "Plain text").position(Navbar.ComponentPosition.RIGHT));
DropDownButton dropdown = new NavbarDropDownButton(Model.of("Themes")) {
@Override
public boolean isActive(Component item) {
return false;
}
@Override
protected List<AbstractLink> newSubMenuButtons(final String buttonMarkupId) {
final List<AbstractLink> subMenu = new ArrayList<AbstractLink>();
subMenu.add(new MenuHeader(Model.of("all available themes:")));
subMenu.add(new MenuDivider());
final IBootstrapSettings settings = Bootstrap.getSettings(getApplication());
final List<ITheme> themes = settings.getThemeProvider().available();
for (final ITheme theme : themes) {
PageParameters params = new PageParameters();
params.set("theme", theme.name());
subMenu.add(new MenuBookmarkablePageLink<Void>(getPageClass(), params, Model.of(theme.name())));
}
return subMenu;
}
}.setIconType(GlyphIconType.book);
navbar.addComponents(new ImmutableNavbarComponent(dropdown, Navbar.ComponentPosition.RIGHT));
return navbar;
}