@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 void actionPropertyChanged(PropertyChangeEvent evt) { Action action = (Action) evt.getSource(); CubaButton button = actionButtons.get(action); if (Action.PROP_ICON.equals(evt.getPropertyName())) { setContextMenuButtonIcon(button, showIconsForPopupMenuActions ? action.getIcon() : null); } else if (Action.PROP_CAPTION.equals(evt.getPropertyName())) { setContextMenuButtonCaption(button, action.getCaption(), action.getShortcutCombination()); } else if (Action.PROP_DESCRIPTION.equals(evt.getPropertyName())) { button.setDescription(action.getDescription()); } else if (Action.PROP_ENABLED.equals(evt.getPropertyName())) { button.setEnabled(action.isEnabled()); } else if (Action.PROP_VISIBLE.equals(evt.getPropertyName())) { button.setVisible(action.isVisible()); } }
protected void actionPropertyChanged(PropertyChangeEvent evt) { Action action = (Action) evt.getSource(); CubaButton button = actionButtons.get(action); if (Action.PROP_ICON.equals(evt.getPropertyName())) { setPickerButtonIcon(button, action.getIcon()); } else if (Action.PROP_CAPTION.equals(evt.getPropertyName())) { button.setCaption(action.getCaption()); } else if (Action.PROP_DESCRIPTION.equals(evt.getPropertyName())) { button.setDescription(action.getDescription()); } else if (Action.PROP_ENABLED.equals(evt.getPropertyName())) { button.setEnabled(action.isEnabled()); } else if (Action.PROP_VISIBLE.equals(evt.getPropertyName())) { button.setVisible(action.isVisible()); } else if (action instanceof PickerFieldAction && PickerFieldAction.PROP_EDITABLE.equals(evt.getPropertyName())) { button.setVisible(((PickerFieldAction) action).isEditable()); } }
protected void actionPropertyChanged(PropertyChangeEvent evt) { Action action = (Action) evt.getSource(); Button button = actionButtons.get(action); if (Action.PROP_ICON.equals(evt.getPropertyName())) { if (showActionIcons) { setPopupButtonIcon(button, action.getIcon()); } else { setPopupButtonIcon(button, null); } } else if (Action.PROP_CAPTION.equals(evt.getPropertyName())) { button.setCaption(action.getCaption()); } else if (Action.PROP_DESCRIPTION.equals(evt.getPropertyName())) { button.setDescription(action.getDescription()); } else if (Action.PROP_ENABLED.equals(evt.getPropertyName())) { button.setEnabled(action.isEnabled()); } else if (Action.PROP_VISIBLE.equals(evt.getPropertyName())) { button.setVisible(action.isVisible()); } }
menuItem.setEnabled(action.isEnabled()); menuItem.setVisible(action.isVisible()); setCaption(this.action.getCaption()); } else if (Action.PROP_ENABLED.equals(evt.getPropertyName())) { setEnabled(this.action.isEnabled()); } else if (Action.PROP_VISIBLE.equals(evt.getPropertyName())) { setVisible(this.action.isVisible());
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 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 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); } }
public CubaButton createButton(Action action) { CubaButton button = new CubaButton(); if (action instanceof DialogAction) { DialogAction.Type type = ((DialogAction) action).getType(); button.setCaption(messages.getMainMessage(type.getMsgKey())); String iconPath = icons.get(type.getIconKey()); button.setIcon(iconResolver.getIconResource(iconPath)); } button.setEnabled(action.isEnabled()); if (StringUtils.isNotEmpty(action.getCaption())) { button.setCaption(action.getCaption()); } if (StringUtils.isNotEmpty(action.getDescription())) { button.setDescription(action.getDescription()); } if (StringUtils.isNotEmpty(action.getIcon())) { button.setIcon(iconResolver.getIconResource(action.getIcon())); } return button; }
@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; }
component.setEnabled(action.isEnabled()); component.setVisible(action.isVisible()); setDescription(this.action.getDescription()); } else if (Action.PROP_ENABLED.equals(evt.getPropertyName())) { setEnabled(this.action.isEnabled()); } else if (Action.PROP_VISIBLE.equals(evt.getPropertyName())) { setVisible(this.action.isVisible());
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); }); }