Search in sources :

Example 6 with ClickEvent

use of com.vaadin.flow.component.ClickEvent in project aire-components by aire-ux.

the class TopologyView method createStopButtonMenu.

private Button createStopButtonMenu() {
    val button = new Button("Stop", VaadinIcon.STOP.create());
    button.addThemeVariants(ButtonVariant.LUMO_TERTIARY, ButtonVariant.LUMO_ERROR);
    registerLifecycleItem(button, Lifecycle.State.Resolved, Lifecycle.State.Installed, Lifecycle.State.Uninstalled);
    button.addClickListener((ComponentEventListener<ClickEvent<Button>>) event -> {
        Overlays.open(this, ModuleScheduleOverlay.class, Mode.Scheduling, getZephyr().getKernel(), getSelectedModule(), Actions.Stop);
    });
    return button;
}
Also used : lombok.val(lombok.val) ComponentEventListener(com.vaadin.flow.component.ComponentEventListener) Mode(io.sunshower.zephyr.management.ModuleScheduleOverlay.Mode) MenuBar(com.vaadin.flow.component.menubar.MenuBar) Getter(lombok.Getter) MenuBarVariant(com.vaadin.flow.component.menubar.MenuBarVariant) CanvasEvent(io.sunshower.zephyr.ui.canvas.listeners.CanvasEvent) Registration(com.vaadin.flow.shared.Registration) CondensationUtilities(io.sunshower.zephyr.condensation.CondensationUtilities) SetAllCellAttributesAction(io.sunshower.zephyr.ui.canvas.actions.SetAllCellAttributesAction) HashMap(java.util.HashMap) ContextMenu(io.sunshower.zephyr.ui.components.ContextMenu) Route(com.vaadin.flow.router.Route) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) EventType(io.sunshower.zephyr.ui.canvas.listeners.VertexEvent.EventType) Coordinate(io.zephyr.kernel.Coordinate) Vertex(io.sunshower.zephyr.ui.canvas.Vertex) Overlays(io.sunshower.zephyr.ui.components.Overlays) Map(java.util.Map) Canvas(io.sunshower.zephyr.ui.canvas.Canvas) CellAttributes(io.sunshower.zephyr.ui.canvas.CellAttributes) Zephyr(io.zephyr.cli.Zephyr) ButtonVariant(com.vaadin.flow.component.button.ButtonVariant) AddVerticesAction(io.sunshower.zephyr.ui.canvas.actions.AddVerticesAction) EnumMap(java.util.EnumMap) lombok.val(lombok.val) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) Breadcrumb(io.sunshower.zephyr.ui.controls.Breadcrumb) ClickEvent(com.vaadin.flow.component.ClickEvent) VertexTemplate(io.sunshower.zephyr.ui.canvas.VertexTemplate) Actions(io.zephyr.kernel.module.ModuleLifecycle.Actions) CanvasReadyEvent(io.sunshower.zephyr.ui.canvas.CanvasReadyEvent) Edge(io.sunshower.zephyr.ui.canvas.Edge) Serializable(java.io.Serializable) Model(io.sunshower.zephyr.ui.canvas.Model) Objects(java.util.Objects) Button(com.vaadin.flow.component.button.Button) List(java.util.List) ConnectVerticesAction(io.sunshower.zephyr.ui.canvas.actions.ConnectVerticesAction) Lifecycle(io.zephyr.kernel.Lifecycle) ModuleCoordinate(io.zephyr.kernel.core.ModuleCoordinate) MainView(io.sunshower.zephyr.MainView) AddVertexTemplateAction(io.sunshower.zephyr.ui.canvas.actions.AddVertexTemplateAction) EdgeTemplate(io.sunshower.zephyr.ui.canvas.EdgeTemplate) Module(io.zephyr.kernel.Module) Button(com.vaadin.flow.component.button.Button) ClickEvent(com.vaadin.flow.component.ClickEvent)

Example 7 with ClickEvent

use of com.vaadin.flow.component.ClickEvent in project testbench by vaadin.

the class ButtonWrapTest method clickWithMeta_metaKeysMarkedAsUsed.

@Test
public void clickWithMeta_metaKeysMarkedAsUsed() {
    Button button = new Button();
    AtomicReference<ClickEvent> event = new AtomicReference<>(null);
    button.addClickListener(clickEvent -> event.set(clickEvent));
    getCurrentView().getElement().appendChild(button.getElement());
    final ButtonWrap button_ = wrap(ButtonWrap.class, button);
    button_.click(new MetaKeys(true, true, true, true));
    Assertions.assertNotNull(event.get(), "event should have fired and recorded");
    Assertions.assertTrue(event.get().isCtrlKey(), "Ctrl should have been used");
    Assertions.assertTrue(event.get().isShiftKey(), "Shift should have been used");
    Assertions.assertTrue(event.get().isAltKey(), "Alt should have been used");
    Assertions.assertTrue(event.get().isMetaKey(), "Meta should have been used");
    button_.click(new MetaKeys(true, true, false, false));
    Assertions.assertTrue(event.get().isCtrlKey(), "Ctrl should have been used");
    Assertions.assertTrue(event.get().isShiftKey(), "Shift should have been used");
    Assertions.assertFalse(event.get().isAltKey(), "Alt should not have been used");
    Assertions.assertFalse(event.get().isMetaKey(), "Meta should not have been used");
}
Also used : MetaKeys(com.vaadin.testbench.unit.MetaKeys) ClickEvent(com.vaadin.flow.component.ClickEvent) AtomicReference(java.util.concurrent.atomic.AtomicReference) Test(org.junit.jupiter.api.Test) UIUnitTest(com.vaadin.testbench.unit.UIUnitTest)

Example 8 with ClickEvent

use of com.vaadin.flow.component.ClickEvent in project karnak by OsiriX-Foundation.

the class DicomWorkListView method buildSelectWorkListBtn.

@SuppressWarnings("serial")
private void buildSelectWorkListBtn() {
    selectWorkListBtn = new Button("Select Worklist");
    selectWorkListBtn.getStyle().set("cursor", "pointer");
    selectWorkListBtn.addClickListener(new ComponentEventListener<ClickEvent<Button>>() {

        @Override
        public void onComponentEvent(ClickEvent<Button> event) {
            openDicomWorklistSelectionDialog();
        }
    });
}
Also used : Button(com.vaadin.flow.component.button.Button) ItemClickEvent(com.vaadin.flow.component.grid.ItemClickEvent) ClickEvent(com.vaadin.flow.component.ClickEvent)

Example 9 with ClickEvent

use of com.vaadin.flow.component.ClickEvent in project karnak by OsiriX-Foundation.

the class WarningConfirmDialog method createButtonValidate.

@SuppressWarnings("serial")
private void createButtonValidate() {
    buttonValidate = new Button();
    buttonValidate.setText(valueValidate);
    buttonValidate.addThemeVariants(ButtonVariant.LUMO_ERROR, ButtonVariant.LUMO_PRIMARY);
    buttonValidate.setWidth("90px");
    buttonValidate.focus();
    buttonValidate.addClickListener((ComponentEventListener<ClickEvent<Button>>) event -> {
        fireConfirmationEvent();
        dialog.close();
    });
    buttonValidate.addClickShortcut(Key.ENTER);
}
Also used : ComponentEventListener(com.vaadin.flow.component.ComponentEventListener) Composite(com.vaadin.flow.component.Composite) ButtonVariant(com.vaadin.flow.component.button.ButtonVariant) Registration(com.vaadin.flow.shared.Registration) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout) VerticalLayout(com.vaadin.flow.component.orderedlayout.VerticalLayout) Div(com.vaadin.flow.component.html.Div) ClickEvent(com.vaadin.flow.component.ClickEvent) ComponentEvent(com.vaadin.flow.component.ComponentEvent) FlexComponent(com.vaadin.flow.component.orderedlayout.FlexComponent) Button(com.vaadin.flow.component.button.Button) Key(com.vaadin.flow.component.Key) Dialog(com.vaadin.flow.component.dialog.Dialog) Span(com.vaadin.flow.component.html.Span) Button(com.vaadin.flow.component.button.Button) ClickEvent(com.vaadin.flow.component.ClickEvent)

Example 10 with ClickEvent

use of com.vaadin.flow.component.ClickEvent in project karnak by OsiriX-Foundation.

the class DicomWorkListSelectionDialog method buildSelectBtn.

@SuppressWarnings("serial")
private void buildSelectBtn() {
    selectBtn = new Button("Select");
    selectBtn.addClassName("stroked-button");
    selectBtn.addClickListener(new ComponentEventListener<ClickEvent<Button>>() {

        @Override
        public void onComponentEvent(ClickEvent<Button> event) {
            fireWorkListSelectionEvent();
            dialog.close();
        }
    });
}
Also used : Button(com.vaadin.flow.component.button.Button) ClickEvent(com.vaadin.flow.component.ClickEvent)

Aggregations

ClickEvent (com.vaadin.flow.component.ClickEvent)13 Button (com.vaadin.flow.component.button.Button)12 ComponentEventListener (com.vaadin.flow.component.ComponentEventListener)5 ButtonVariant (com.vaadin.flow.component.button.ButtonVariant)5 Registration (com.vaadin.flow.shared.Registration)5 ItemClickEvent (com.vaadin.flow.component.grid.ItemClickEvent)3 VaadinIcon (com.vaadin.flow.component.icon.VaadinIcon)3 MenuBar (com.vaadin.flow.component.menubar.MenuBar)3 MenuBarVariant (com.vaadin.flow.component.menubar.MenuBarVariant)3 Route (com.vaadin.flow.router.Route)3 MainView (io.sunshower.zephyr.MainView)3 CondensationUtilities (io.sunshower.zephyr.condensation.CondensationUtilities)3 Mode (io.sunshower.zephyr.management.ModuleScheduleOverlay.Mode)3 Canvas (io.sunshower.zephyr.ui.canvas.Canvas)3 CanvasReadyEvent (io.sunshower.zephyr.ui.canvas.CanvasReadyEvent)3 CellAttributes (io.sunshower.zephyr.ui.canvas.CellAttributes)3 Edge (io.sunshower.zephyr.ui.canvas.Edge)3 EdgeTemplate (io.sunshower.zephyr.ui.canvas.EdgeTemplate)3 Model (io.sunshower.zephyr.ui.canvas.Model)3 Vertex (io.sunshower.zephyr.ui.canvas.Vertex)3