protected void setContextMenuButtonCaption(CubaButton button, String caption, KeyCombination shortcutCombination) { if (!Strings.isNullOrEmpty(caption) && shortcutCombination != null) { caption = caption + " (" + shortcutCombination.format() + ")"; } button.setCaption(caption); }
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()); } }
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; }
String caption = action.getCaption(); if (caption != null && component.getCaption() == null) { component.setCaption(caption);
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); }); }
reloginBtn.addStyleName("c-primary-action"); reloginBtn.addClickListener(event -> relogin()); reloginBtn.setCaption(messages.getMainMessage(Type.OK.getMsgKey()));