@Override public void handleAction(Object sender, Object target) { ShortcutTriggeredEvent event = WebComponentsHelper.getShortcutEvent(container, (com.vaadin.ui.Component) target); action.getHandler().accept(event); }
@Override public void addShortcutAction(ShortcutAction action) { KeyCombination keyCombination = action.getShortcutCombination(); com.vaadin.event.ShortcutListener shortcut = new ContainerShortcutActionWrapper(action, this, keyCombination); component.addShortcutListener(shortcut); if (shortcuts == null) { shortcuts = new HashMap<>(4); } shortcuts.put(action, shortcut); }
/** * Adds ESCAPE shortcut that invokes cancel() method. */ protected void initShortcuts() { ComponentContainer editBox = getEditBox(); if (editBox instanceof ShortcutNotifier) { ((ShortcutNotifier) editBox).addShortcutAction( new ShortcutAction(new KeyCombination(KeyCombination.Key.ESCAPE), shortcutTriggeredEvent -> cancel())); } }
/** * Adds ESCAPE shortcut that invokes cancel() method. */ protected void initShortcuts() { ComponentContainer editBox = getEditBox(); if (editBox instanceof ShortcutNotifier) { ((ShortcutNotifier) editBox).addShortcutAction( new ShortcutAction(new KeyCombination(KeyCombination.Key.ESCAPE), shortcutTriggeredEvent -> discardChanges())); } }
@Override public void addShortcutAction(ShortcutAction action) { KeyCombination keyCombination = action.getShortcutCombination(); com.vaadin.event.ShortcutListener shortcut = new ContainerShortcutActionWrapper(action, this, keyCombination); component.addShortcutListener(shortcut); if (shortcuts == null) { shortcuts = new HashMap<>(4); } shortcuts.put(action, shortcut); }
@Override public void addShortcutAction(ShortcutAction action) { KeyCombination keyCombination = action.getShortcutCombination(); com.vaadin.event.ShortcutListener shortcut = new ContainerShortcutActionWrapper(action, this, keyCombination); component.addShortcutListener(shortcut); if (shortcuts == null) { shortcuts = new HashMap<>(4); } shortcuts.put(action, shortcut); }
@Override public void addShortcutAction(ShortcutAction action) { KeyCombination keyCombination = action.getShortcutCombination(); com.vaadin.event.ShortcutListener shortcut = new ContainerShortcutActionWrapper(action, this, keyCombination); component.addShortcutListener(shortcut); if (shortcuts == null) { shortcuts = new HashMap<>(4); } shortcuts.put(action, shortcut); }
@Override public void addShortcutAction(ShortcutAction action) { KeyCombination keyCombination = action.getShortcutCombination(); com.vaadin.event.ShortcutListener shortcut = new ContainerShortcutActionWrapper(action, this, keyCombination); component.addShortcutListener(shortcut); if (shortcuts == null) { shortcuts = new HashMap<>(4); } shortcuts.put(action, shortcut); }