Search in sources :

Example 1 with PmoBasedDialogFactory

use of org.linkki.framework.ui.dialogs.PmoBasedDialogFactory in project linkki by linkki-framework.

the class PlaygroundApplicationHeader method addHelpMenuItems.

@Override
protected void addHelpMenuItems(MenuItem helpMenu) {
    super.addHelpMenuItems(helpMenu);
    helpMenu.getSubMenu().addItem("Locale", i -> {
        new PmoBasedDialogFactory().newOkDialog("Browser Locale", new LocaleInfoPmo()).open();
    });
    helpMenu.getSubMenu().addItem("Toogle Dark Mode", i -> {
        ThemeList themeList = UI.getCurrent().getElement().getThemeList();
        if (themeList.contains(Lumo.DARK)) {
            themeList.remove(Lumo.DARK);
        } else {
            themeList.add(Lumo.DARK);
        }
    });
}
Also used : ThemeList(com.vaadin.flow.dom.ThemeList) PmoBasedDialogFactory(org.linkki.framework.ui.dialogs.PmoBasedDialogFactory)

Example 2 with PmoBasedDialogFactory

use of org.linkki.framework.ui.dialogs.PmoBasedDialogFactory 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;
}
Also used : PmoBasedDialogFactory(org.linkki.framework.ui.dialogs.PmoBasedDialogFactory) MenuBar(com.vaadin.flow.component.menubar.MenuBar) MenuItem(com.vaadin.flow.component.contextmenu.MenuItem) ApplicationMenuItemDefinition(org.linkki.framework.ui.application.menu.ApplicationMenuItemDefinition)

Example 3 with PmoBasedDialogFactory

use of org.linkki.framework.ui.dialogs.PmoBasedDialogFactory in project linkki by linkki-framework.

the class DialogWithCustomSizePmo method showDialog.

@UIButton(position = 40, label = "Opens a dialog with a custom size", caption = "Open dialog")
public void showDialog() {
    var dialog = new PmoBasedDialogFactory().newOkDialog("Dialog with a custom size");
    dialog.setSize(width, height);
    dialog.open();
}
Also used : PmoBasedDialogFactory(org.linkki.framework.ui.dialogs.PmoBasedDialogFactory) UIButton(org.linkki.core.ui.element.annotation.UIButton)

Example 4 with PmoBasedDialogFactory

use of org.linkki.framework.ui.dialogs.PmoBasedDialogFactory in project linkki by linkki-framework.

the class OkCancelDialogMessagePmo method button.

@UIButton(position = 0, caption = "Open dialog")
public void button() {
    FieldValidationPmo validationDialogPmo = new FieldValidationPmo();
    OkCancelDialog dialog = new PmoBasedDialogFactory(validationDialogPmo::validate).openOkCancelDialog("Validation Dialog PMO", Handler.NOP_HANDLER, validationDialogPmo);
    dialog.setWidth("600px");
}
Also used : PmoBasedDialogFactory(org.linkki.framework.ui.dialogs.PmoBasedDialogFactory) FieldValidationPmo(org.linkki.samples.playground.ts.messages.FieldValidationPmo) OkCancelDialog(org.linkki.framework.ui.dialogs.OkCancelDialog) UIButton(org.linkki.core.ui.element.annotation.UIButton)

Example 5 with PmoBasedDialogFactory

use of org.linkki.framework.ui.dialogs.PmoBasedDialogFactory in project linkki by linkki-framework.

the class SetFormItemLabelWidthDialogPmo method showDialog.

@UIButton(position = 40, label = "Opens a dialog with a custom label width", caption = "Open dialog")
public void showDialog() {
    var dialog = new PmoBasedDialogFactory().newOkDialog("Custom label width dialog", new LabelTextfieldPmo());
    ComponentStyles.setFormItemLabelWidth(dialog, width);
    dialog.open();
}
Also used : PmoBasedDialogFactory(org.linkki.framework.ui.dialogs.PmoBasedDialogFactory) UIButton(org.linkki.core.ui.element.annotation.UIButton)

Aggregations

PmoBasedDialogFactory (org.linkki.framework.ui.dialogs.PmoBasedDialogFactory)6 UIButton (org.linkki.core.ui.element.annotation.UIButton)3 OkCancelDialog (org.linkki.framework.ui.dialogs.OkCancelDialog)2 MenuItem (com.vaadin.flow.component.contextmenu.MenuItem)1 MenuBar (com.vaadin.flow.component.menubar.MenuBar)1 ThemeList (com.vaadin.flow.dom.ThemeList)1 ApplicationMenuItemDefinition (org.linkki.framework.ui.application.menu.ApplicationMenuItemDefinition)1 FieldValidationPmo (org.linkki.samples.playground.ts.messages.FieldValidationPmo)1