use of io.jmix.ui.widget.JmixButton in project jmix by jmix-framework.
the class AbstractActionsHolderComponent method actionPropertyChanged.
protected void actionPropertyChanged(PropertyChangeEvent evt) {
Action action = (Action) evt.getSource();
JmixButton 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());
}
}
use of io.jmix.ui.widget.JmixButton in project jmix by jmix-framework.
the class AbstractTable method showCustomPopupActions.
@Override
public void showCustomPopupActions(List<Action> actions) {
VerticalLayout customContextMenu = new VerticalLayout();
customContextMenu.setMargin(false);
customContextMenu.setSpacing(false);
customContextMenu.setWidthUndefined();
customContextMenu.setStyleName("jmix-cm-container");
for (Action action : actions) {
JmixButton contextMenuButton = createContextMenuButton();
initContextMenuButton(contextMenuButton, action);
customContextMenu.addComponent(contextMenuButton);
}
if (customContextMenu.getComponentCount() > 0) {
component.showCustomPopup(customContextMenu);
component.setCustomPopupAutoClose(true);
}
}
use of io.jmix.ui.widget.JmixButton in project jmix by jmix-framework.
the class ValuePickerImpl method setDebugId.
@Override
public void setDebugId(@Nullable String id) {
super.setDebugId(id);
if (id != null && AppUI.getCurrent() != null) {
String debugId = getDebugId();
TestIdManager testIdManager = AppUI.getCurrent().getTestIdManager();
for (Action action : actions) {
JmixButton button = actionButtons.get(action);
if (button != null && Strings.isNullOrEmpty(button.getId())) {
button.setId(testIdManager.getTestId(debugId + "_" + action.getId()));
}
}
}
}
use of io.jmix.ui.widget.JmixButton in project jmix by jmix-framework.
the class ValuePickerImpl method actionPropertyChanged.
protected void actionPropertyChanged(PropertyChangeEvent evt) {
Action action = (Action) evt.getSource();
JmixButton button = actionButtons.get(action);
switch(evt.getPropertyName()) {
case Action.PROP_ICON:
setButtonIcon(button, action.getIcon());
break;
case Action.PROP_CAPTION:
button.setCaption(action.getCaption());
break;
case Action.PROP_DESCRIPTION:
button.setDescription(action.getDescription());
break;
case Action.PROP_ENABLED:
button.setEnabled(action.isEnabled());
break;
case Action.PROP_VISIBLE:
button.setVisible(action.isVisible());
break;
case ValuePickerAction.PROP_EDITABLE:
if (action instanceof ValuePickerAction) {
button.setVisible(((ValuePickerAction) action).isEditable());
}
break;
default:
// do nothing
break;
}
}
use of io.jmix.ui.widget.JmixButton in project jmix by jmix-framework.
the class PopupButtonImpl method createActionButton.
protected JmixButton createActionButton(Action action) {
JmixButton button = new JmixButton();
button.setWidth(100, Sizeable.Unit.PERCENTAGE);
button.setPrimaryStyleName(CONTEXT_MENU_BUTTON_STYLENAME);
setPopupButtonAction(button, action);
AppUI ui = AppUI.getCurrent();
if (ui != null) {
if (ui.isTestMode()) {
button.setJTestId(action.getId());
}
if (ui.isPerformanceTestMode()) {
String debugId = getDebugId();
if (debugId != null) {
TestIdManager testIdManager = ui.getTestIdManager();
button.setId(testIdManager.getTestId(debugId + "_" + action.getId()));
}
}
}
return button;
}
Aggregations