use of org.linkki.framework.ui.application.menu.ApplicationMenuItemDefinition 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 org.linkki.framework.ui.application.menu.ApplicationMenuItemDefinition in project linkki by linkki-framework.
the class ApplicationHeaderTest method testLeftMenu.
@Test
void testLeftMenu() {
ApplicationHeader header = new ApplicationHeader(new TestApplicationInfo(), Sequence.of(new ApplicationMenuItemDefinition("name1", "id1", Handler.NOP_HANDLER), new ApplicationMenuItemDefinition("name2", "id2", Handler.NOP_HANDLER)));
header.init();
assertThat(header.getContent().getComponentAt(0)).isInstanceOf(ApplicationMenu.class);
ApplicationMenu leftComponent = (ApplicationMenu) header.getContent().getComponentAt(0);
assertThat(leftComponent.getItems()).hasSize(2);
}
use of org.linkki.framework.ui.application.menu.ApplicationMenuItemDefinition in project linkki by linkki-framework.
the class CustomApplicationHeader method addHelpMenuItems.
@Override
protected void addHelpMenuItems(MenuItem helpMenu) {
new ApplicationMenuItemDefinition(PlaygroundNlsText.getString("ApplicationHeader.Feedback"), "appmenu-custom", () -> Notification.show("Thank you for customizing me!")).createItem(helpMenu.getSubMenu());
addApplicationInfoMenuItem(helpMenu);
}
Aggregations