本文整理汇总了Java中de.agilecoders.wicket.core.markup.html.bootstrap.navbar.ImmutableNavbarComponent类的典型用法代码示例。如果您正苦于以下问题:Java ImmutableNavbarComponent类的具体用法?Java ImmutableNavbarComponent怎么用?Java ImmutableNavbarComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImmutableNavbarComponent类属于de.agilecoders.wicket.core.markup.html.bootstrap.navbar包,在下文中一共展示了ImmutableNavbarComponent类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: newNavbar
import de.agilecoders.wicket.core.markup.html.bootstrap.navbar.ImmutableNavbarComponent; //导入依赖的package包/类
protected Navbar newNavbar(String markupId) {
Navbar navbar = new Navbar(markupId);
navbar.setPosition(Navbar.Position.TOP);
// show brand name
navbar.brandName(Model.of("matetracker.de"));
navbar.addComponents(NavbarComponents.transform(
Navbar.ComponentPosition.LEFT, new NavbarButton<Homepage>(
Homepage.class, Model.of("Home"))
.setIconType(IconType.home)
));
if (getUser().getObject().getRole() == Role.Admin) {
navbar.addComponents(NavbarComponents.transform(
Navbar.ComponentPosition.RIGHT,
new NavbarButton<UserPage>(UserPage.class, Model.of(_(
"menu.user").getString()))
.setIconType(IconType.user)));
navbar.addComponents(NavbarComponents.transform(
Navbar.ComponentPosition.RIGHT,
new NavbarButton<AdminPage>(AdminPage.class, Model.of(_(
"menu.admin").getString()))
.setIconType(IconType.warningsign)));
}
navbar.addComponents(new ImmutableNavbarComponent(
new NavbarButton<LogoutPage>(LogoutPage.class, Model
.of("Logout")).setIconType(IconType.off),
Navbar.ComponentPosition.RIGHT));
return navbar;
}
示例2: addThemesNav
import de.agilecoders.wicket.core.markup.html.bootstrap.navbar.ImmutableNavbarComponent; //导入依赖的package包/类
private void addThemesNav(final Navbar navbar, final ComponentPosition position) {
final DropDownButton dropdown = new NavbarDropDownButton(Model.of(" Themes")) {
@Override
public boolean isActive(final Component item) {
return false;
}
@Override
protected List<AbstractLink> newSubMenuButtons(final String buttonMarkupId) {
final List<AbstractLink> subMenu = new ArrayList<AbstractLink>();
final IBootstrapSettings settings = Bootstrap.getSettings(getApplication());
final List<ITheme> themes = settings.getThemeProvider().available();
for (final ITheme theme : themes) {
final PageParameters params = new PageParameters();
final String themeName = theme.name();
params.set(PAGE_PARAM_THEME, themeName);
final IModel<String> labelModel = new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
final String activeThemeName = Bootstrap.getSettings(getApplication())
.getActiveThemeProvider()
.getActiveTheme()
.name();
String themeLabel = themeName.toLowerCase();
if (themeName.equals(activeThemeName)) {
themeLabel = "<b>" + themeLabel + "</b>";
}
return themeLabel;
}
};
subMenu.add(new MenuBookmarkablePageLink<Void>(getPageClass(), params, labelModel) {
@Override
protected Component newLabel(final String markupId) {
final Label label = (Label) super.newLabel(markupId);
label.setEscapeModelStrings(false);
return label;
}
});
}
return subMenu;
}
}.setIconType(GlyphIconType.book);
navbar.addComponents(new ImmutableNavbarComponent(dropdown, position));
}
示例3: onConfigure
import de.agilecoders.wicket.core.markup.html.bootstrap.navbar.ImmutableNavbarComponent; //导入依赖的package包/类
@Override
protected void onConfigure() {
super.onConfigure();
if (!menusAdded) {
menusAdded = true;
// add logo
addUQasarLogo();
if (UQasar.getSession().getLoggedInUser() != null) {
// add projects submenu
addComponents(new ImmutableNavbarComponent(new ProjectsSubMenu(
new StringResourceModel("menu.projects.link.text", this,
null)), Navbar.ComponentPosition.LEFT));
// add quality models submenu
addComponents(new ImmutableNavbarComponent(new QModelsSubMenu(
new StringResourceModel("menu.qmodels.link.text", this,
null)), Navbar.ComponentPosition.LEFT));
// add search form
addComponents(newNavbarSearchForm());
// add notifications
addComponents(new ImmutableNavbarComponent(
new NotificationsSubMenu(
NotificationDropDownMenu.createNotifications(treeNodeService)),
Navbar.ComponentPosition.RIGHT));
// add languages
addComponents(newLanguageMenu());
// add admin menu, if user has admin rights
if (UQasar.getSession().getLoggedInUser().getRole() == Role.Administrator) {
addComponents(new ImmutableNavbarComponent(new AdminSubMenu(
Model.of("")), Navbar.ComponentPosition.RIGHT));
}
// add user menu
addComponents(new ImmutableNavbarComponent(new UserSubMenu(
UQasar.getSession().getLoggedInUser()),
Navbar.ComponentPosition.RIGHT));
} else {
addComponents(newLanguageMenu());
addComponents(newLoginButton());
}
}
}
示例4: newLanguageMenu
import de.agilecoders.wicket.core.markup.html.bootstrap.navbar.ImmutableNavbarComponent; //导入依赖的package包/类
private AbstractNavbarComponent newLanguageMenu() {
return new ImmutableNavbarComponent(
new LanguageSubMenu(containingPage, new StringResourceModel("menu.languages.submenu.text", this, null)),
Navbar.ComponentPosition.RIGHT);
}
示例5: newLoginButton
import de.agilecoders.wicket.core.markup.html.bootstrap.navbar.ImmutableNavbarComponent; //导入依赖的package包/类
private AbstractNavbarComponent newLoginButton() {
NavbarButton<LoginPage> loginButton = new NavbarButton<>(LoginPage.class, new StringResourceModel(
"menu.login.link.text", this, null));
return new ImmutableNavbarComponent(loginButton, Navbar.ComponentPosition.RIGHT);
}
示例6: initLayout
import de.agilecoders.wicket.core.markup.html.bootstrap.navbar.ImmutableNavbarComponent; //导入依赖的package包/类
private void initLayout() {
Navbar navbar = new Navbar(ID_NAVBAR) {
@Override
protected Label newBrandLabel(String markupId) {
Label label = super.newBrandLabel(markupId);
label.add(AttributeAppender.replace("title", createStringResource("GizmoApplication.projectVersion")));
return label;
}
};
navbar.setBrandName(createStringResource("GizmoApplication.projectName"));
navbar.setPosition(Navbar.Position.STATIC_TOP);
add(navbar);
TopMenuItem item = new TopMenuItem(createStringResource("PageAppTemplate.menu.dashboard"), PageDashboard.class);
navbar.addComponents(new ImmutableNavbarComponent(item));
item = new TopMenuItem(createStringResource("PageAppTemplate.menu.customers"), PageCustomers.class);
navbar.addComponents(new ImmutableNavbarComponent(item));
item = new TopMenuItem(createStringResource("PageAppTemplate.menu.projects"), PageProjects.class);
navbar.addComponents(new ImmutableNavbarComponent(item));
item = new TopMenuItem(createStringResource("PageAppTemplate.menu.users"), PageUsers.class);
navbar.addComponents(new ImmutableNavbarComponent(item));
item = new TopMenuItem(createStringResource("PageAppTemplate.menu.emails"), PageEmails.class);
navbar.addComponents(new ImmutableNavbarComponent(item));
item = new TopMenuItem(createUsernameModel(), PageUser.class, createUserPageParams());
item.setActive(true);
navbar.addComponents(new ImmutableNavbarComponent(item, Navbar.ComponentPosition.RIGHT));
NavbarExternalLink logoutLink = new NavbarExternalLink(
new Model<>(RequestCycle.get().getRequest().getContextPath() + "/j_spring_security_logout"));
logoutLink.setLabel(createStringResource("PageAppTemplate.menu.logout"));
navbar.addComponents(new ImmutableNavbarComponent(logoutLink, Navbar.ComponentPosition.RIGHT));
Label title = new Label(ID_TITLE, createPageTitleModel());
add(title);
MainFeedback feedback = new MainFeedback(ID_FEEDBACK);
feedback.setOutputMarkupId(true);
add(feedback);
}