Search in sources :

Example 6 with JmixButton

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());
    }
}
Also used : Action(io.jmix.ui.action.Action) JmixButton(io.jmix.ui.widget.JmixButton)

Example 7 with JmixButton

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);
    }
}
Also used : Action(io.jmix.ui.action.Action) BaseAction(io.jmix.ui.action.BaseAction) JmixButton(io.jmix.ui.widget.JmixButton)

Example 8 with JmixButton

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()));
            }
        }
    }
}
Also used : TestIdManager(io.jmix.ui.sys.TestIdManager) Action(io.jmix.ui.action.Action) ShortcutAction(com.vaadin.event.ShortcutAction) JmixButton(io.jmix.ui.widget.JmixButton)

Example 9 with JmixButton

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;
    }
}
Also used : Action(io.jmix.ui.action.Action) ShortcutAction(com.vaadin.event.ShortcutAction) JmixButton(io.jmix.ui.widget.JmixButton)

Example 10 with JmixButton

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;
}
Also used : TestIdManager(io.jmix.ui.sys.TestIdManager) JmixButton(io.jmix.ui.widget.JmixButton) AppUI(io.jmix.ui.AppUI)

Aggregations

JmixButton (io.jmix.ui.widget.JmixButton)11 Action (io.jmix.ui.action.Action)5 TestIdManager (io.jmix.ui.sys.TestIdManager)3 ShortcutAction (com.vaadin.event.ShortcutAction)2 CssLayout (com.vaadin.ui.CssLayout)1 DragSourceExtension (com.vaadin.ui.dnd.DragSourceExtension)1 PaletteButton (io.jmix.dashboardsui.component.impl.PaletteButton)1 AppUI (io.jmix.ui.AppUI)1 BaseAction (io.jmix.ui.action.BaseAction)1 ThemeConstants (io.jmix.ui.theme.ThemeConstants)1 UUID (java.util.UUID)1