use of com.vaadin.flow.component.menubar.MenuBar in project linkki by linkki-framework.
the class PlaygroundApplicationHeader method createRightMenuBar.
// tag::applicationheader-createRightMenuBar[]
@Override
protected MenuBar createRightMenuBar() {
MenuBar rightMenuBar = super.createRightMenuBar();
MenuItem settings = rightMenuBar.addItem(VaadinIcon.COG.create());
settings.setId("appmenu-settings");
addThemeVariantToggles(settings, ThemeVariantToggleMenuItemDefinition.LUMO_DARK, ThemeVariantToggleMenuItemDefinition.LINKKI_CARD, ThemeVariantToggleMenuItemDefinition.LINKKI_COMPACT);
// end::applicationheader-createRightMenuBar[]
new ApplicationMenuItemDefinition("Locale", "appmenu-locale", () -> new PmoBasedDialogFactory().newOkDialog("Browser Locale", new LocaleInfoPmo()).open()).createItem(settings.getSubMenu());
return rightMenuBar;
}
use of com.vaadin.flow.component.menubar.MenuBar in project linkki by linkki-framework.
the class ApplicationHeaderTest method testRightMenu.
@Test
void testRightMenu() {
ApplicationHeader header = new ApplicationHeader(new TestApplicationInfo(), Sequence.empty());
header.init();
MenuBar rightComponent = (MenuBar) ((HorizontalLayout) header.getContent().getComponentAt(1)).getComponentAt(0);
assertThat(rightComponent.getId()).hasValue(ApplicationHeader.APPMENU_RIGHT_ID);
}
use of com.vaadin.flow.component.menubar.MenuBar in project linkki by linkki-framework.
the class ApplicationMenuItemDefinitionTest method testCreateItem_SubMenu_NoSubMenu.
@Test
void testCreateItem_SubMenu_NoSubMenu() {
ApplicationMenuItemDefinition itemDefinition = new ApplicationMenuItemDefinition("name", "id", Handler.NOP_HANDLER);
MenuBar menuBar = new MenuBar();
SubMenu subMenu = menuBar.addItem("item").getSubMenu();
itemDefinition.createItem(subMenu);
assertThat(subMenu.getItems()).hasSize(1);
assertThat(subMenu.getItems().get(0).getText()).isEqualTo("name");
assertThat(subMenu.getItems().get(0).getId()).hasValue("id");
}
use of com.vaadin.flow.component.menubar.MenuBar in project aire-components by aire-ux.
the class MainView method createTop.
protected HasComponents createTop() {
val topNav = super.createTop();
topNav.add(new BreadcrumbNavigation());
val menuBar = new MenuBar();
menuBar.addThemeVariants(MenuBarVariant.LUMO_SMALL, MenuBarVariant.LUMO_ICON);
var homeButton = new NavigationBarButton(MainView.class, new Image("images/icon.svg", "Home"));
homeButton.setClassName("container-end");
topNav.add(homeButton);
val item = menuBar.addItem(VaadinIcon.MENU.create());
val submenu = item.getSubMenu();
submenu.addItem(new RouterLink("Zephyr", ModuleGrid.class));
topNav.add(menuBar);
return topNav;
}
use of com.vaadin.flow.component.menubar.MenuBar in project aire-components by aire-ux.
the class UploadPluginOverlay method addFooter.
private void addFooter() {
val menubar = new MenuBar();
menubar.addThemeVariants(MenuBarVariant.LUMO_ICON, MenuBarVariant.LUMO_TERTIARY_INLINE);
val cancel = new Button("Cancel", VaadinIcon.CLOSE.create());
cancel.addClickListener(event -> this.cancel());
val install = new Button("Upload", VaadinIcon.UPLOAD_ALT.create());
install.addClickListener(this::onSuccess);
menubar.addItem(cancel);
menubar.addItem(install);
getFooter().add(menubar);
}
Aggregations