@Override public void performAction(Action action) { action.actionPerform(WebAbstractDataGrid.this); } };
@Override public void performAction(Action action) { action.actionPerform(WebTree.this); } };
public void performAction(Action action) { action.actionPerform(null); }
protected void selectItemsOnClick(@SuppressWarnings("unused") Collection collection) { Action selectAction = getActionNN(LOOKUP_SELECT_ACTION_ID); selectAction.actionPerform(getLookupComponent()); }
protected void onItemClick(com.vaadin.ui.Tree.ItemClick<E> event) { if (event.getMouseEventDetails().isDoubleClick()) { CubaUI ui = (CubaUI) component.getUI(); if (!ui.isAccessibleForUser(component)) { LoggerFactory.getLogger(WebTree.class) .debug("Ignore click attempt because Tree is inaccessible for user"); return; } if (doubleClickAction != null) { doubleClickAction.actionPerform(WebTree.this); } } }
@Override public void handleAction(com.vaadin.event.Action actionImpl, Object sender, Object target) { Action cubaAction = getAction(actionImpl); if (cubaAction != null && cubaAction.isEnabled() && cubaAction.isVisible()) { cubaAction.actionPerform(actionSource); } } }
protected ShortcutListenerDelegate createEnterShortcutListener() { return new ShortcutListenerDelegate("treeEnter", KeyCode.ENTER, null) .withHandler((sender, target) -> { if (sender == componentComposition) { CubaUI ui = (CubaUI) componentComposition.getUI(); if (!ui.isAccessibleForUser(componentComposition)) { LoggerFactory.getLogger(WebTree.class) .debug("Ignore click attempt because Tree is inaccessible for user"); return; } if (enterPressAction != null) { enterPressAction.actionPerform(this); } else { handleClickAction(); } } }); }
@Override public void setSelectHandler(Consumer lookupHandler) { super.setSelectHandler(lookupHandler); setLookupComponent(entitiesTable); Action selectAction = getAction(LOOKUP_SELECT_ACTION_ID); entitiesTable.setLookupSelectHandler(items -> selectAction.actionPerform(entitiesTable) ); }
protected ShortcutListenerDelegate createEnterShortcutListener() { return new ShortcutListenerDelegate("dataGridEnter", KeyCode.ENTER, null) .withHandler((sender, target) -> { if (sender == componentComposition) { if (isEditorEnabled()) { // Prevent custom actions on Enter if DataGrid editor is enabled // since it's the default shortcut to open editor return; } CubaUI ui = (CubaUI) componentComposition.getUI(); if (!ui.isAccessibleForUser(componentComposition)) { LoggerFactory.getLogger(WebDataGrid.class) .debug("Ignore click attempt because DataGrid is inaccessible for user"); return; } if (enterPressAction != null) { enterPressAction.actionPerform(this); } else { handleDoubleClickAction(); } } }); }
protected void handleClickAction() { Action action = getItemClickAction(); if (action == null) { action = getEnterPressAction(); if (action == null) { action = getAction("edit"); if (action == null) { action = getAction("view"); } } } if (action != null && action.isEnabled()) { action.actionPerform(this); } }
protected void handleDoubleClickAction() { Action action = getItemClickAction(); if (action == null) { action = getEnterAction(); if (action == null) { action = getAction("edit"); if (action == null) { action = getAction("view"); } } } if (action != null && action.isEnabled()) { action.actionPerform(WebAbstractDataGrid.this); } }
protected void handleClickAction() { Action action = getItemClickAction(); if (action == null) { action = getEnterAction(); if (action == null) { action = getAction("edit"); if (action == null) { action = getAction("view"); } } } if (action != null && action.isEnabled()) { action.actionPerform(this); } }
protected void buttonClicked(@SuppressWarnings("unused") MouseEventDetails mouseEventDetails) { beforeActionPerformed(); if (action != null) { action.actionPerform(getActionEventTarget()); } if (hasSubscriptions(ClickEvent.class)) { publish(ClickEvent.class, new ClickEvent(this)); } afterActionPerformed(); }
@Override protected ShortcutListener attachShortcut(String actionId, KeyCombination keyCombination) { ShortcutListener shortcut = new ShortcutListenerDelegate(actionId, keyCombination.getKey().getCode(), KeyCombination.Modifier.codes(keyCombination.getModifiers()) ).withHandler((sender, target) -> { if (target == component) { Action action = getAction(actionId); if (action != null && action.isEnabled() && action.isVisible()) { action.actionPerform(WebAbstractActionsHolderComponent.this); } } }); component.addShortcutListener(shortcut); return shortcut; }
@Override protected ShortcutListener attachShortcut(String actionId, KeyCombination keyCombination) { ShortcutListener shortcut = new ShortcutListenerDelegate(actionId, keyCombination.getKey().getCode(), KeyCombination.Modifier.codes(keyCombination.getModifiers()) ).withHandler((sender, target) -> { if (sender == componentComposition) { Action action = getAction(actionId); if (action != null && action.isEnabled() && action.isVisible()) { action.actionPerform(WebAbstractDataGrid.this); } } }); componentComposition.addShortcutListener(shortcut); return shortcut; }
@Override protected ShortcutListener attachShortcut(String actionId, KeyCombination keyCombination) { ShortcutListener shortcut = new ShortcutListenerDelegate(actionId, keyCombination.getKey().getCode(), KeyCombination.Modifier.codes(keyCombination.getModifiers()) ).withHandler((sender, target) -> { if (sender == componentComposition) { Action action = getAction(actionId); if (action != null && action.isEnabled() && action.isVisible()) { action.actionPerform(WebTree.this); } } }); componentComposition.addShortcutListener(shortcut); return shortcut; }
protected void setContextMenuButtonAction(CubaButton button, Action action) { setContextMenuButtonIcon(button, showIconsForPopupMenuActions ? action.getIcon() : null); setContextMenuButtonCaption(button, action.getCaption(), action.getShortcutCombination()); button.setDescription(action.getDescription()); button.setEnabled(action.isEnabled()); button.setVisible(action.isVisible()); action.addPropertyChangeListener(actionPropertyChangeListener); button.setClickHandler(event -> { beforeContextMenuButtonHandlerPerformed(); action.actionPerform(WebAbstractActionsHolderComponent.this); }); }
protected void setPickerButtonAction(CubaButton button, Action action) { String description = action.getDescription(); if (description == null && action.getShortcutCombination() != null) { description = action.getShortcutCombination().format(); } if (description != null) { button.setDescription(description); } button.setEnabled(action.isEnabled()); button.setVisible(action.isVisible()); if (action.getIcon() != null) { setPickerButtonIcon(button, action.getIcon()); } AppUI ui = AppUI.getCurrent(); if (ui != null && ui.isTestMode()) { button.setCubaId(action.getId()); } action.addPropertyChangeListener(actionPropertyChangeListener); button.setClickHandler(event -> { this.focus(); action.actionPerform(this); }); }
protected void setPopupButtonAction(CubaButton button, Action action) { button.setCaption(action.getCaption()); String description = action.getDescription(); if (description == null && action.getShortcutCombination() != null) { description = action.getShortcutCombination().format(); } if (description != null) { button.setDescription(description); } button.setEnabled(action.isEnabled()); button.setVisible(action.isVisible()); if (showActionIcons) { setPopupButtonIcon(button, action.getIcon()); } else { setPopupButtonIcon(button, null); } action.addPropertyChangeListener(actionPropertyChangeListener); button.setClickHandler(mouseEventDetails -> { this.focus(); if (isAutoClose()) { this.component.setPopupVisible(false); } action.actionPerform(this); }); }
button.setClickHandler(mouseEventDetails -> { try { action.actionPerform(ui.getTopLevelWindow()); } finally { ui.removeWindow(window);