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()); } }
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; }
setCaption(null); if (Objects.equals(this.action.getDescription(), getDescription())) { setDescription(null); String description = action.getDescription(); if (description == null && action.getShortcutCombination() != null) { description = action.getShortcutCombination().format(); setCaption(this.action.getCaption()); } else if (Action.PROP_DESCRIPTION.equals(evt.getPropertyName())) { setDescription(this.action.getDescription()); } else if (Action.PROP_ENABLED.equals(evt.getPropertyName())) { setEnabled(this.action.isEnabled());
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); }); }