Search in sources :

Example 16 with BaseAction

use of io.jmix.ui.action.BaseAction in project jmix by jmix-framework.

the class StandardLookup method initActions.

protected void initActions(@SuppressWarnings("unused") InitEvent event) {
    Messages messages = getApplicationContext().getBean(Messages.class);
    Icons icons = getApplicationContext().getBean(Icons.class);
    BaseAction selectAction = (BaseAction) getWindowActionOptional(LOOKUP_SELECT_ACTION_ID).orElseGet(() -> addDefaultSelectAction(messages, icons));
    selectAction.addActionPerformedListener(this::select);
    BaseAction cancelAction = (BaseAction) getWindowActionOptional(LOOKUP_CANCEL_ACTION_ID).orElseGet(() -> addDefaultCancelAction(messages, icons));
    cancelAction.addActionPerformedListener(this::cancel);
}
Also used : Messages(io.jmix.core.Messages) Icons(io.jmix.ui.icon.Icons) BaseAction(io.jmix.ui.action.BaseAction)

Example 17 with BaseAction

use of io.jmix.ui.action.BaseAction in project jmix by jmix-framework.

the class StandardLookup method addDefaultCancelAction.

protected Action addDefaultCancelAction(Messages messages, Icons icons) {
    Action action = new BaseAction(LOOKUP_CANCEL_ACTION_ID).withCaption(messages.getMessage("actions.Cancel")).withIcon(icons.get(JmixIcon.LOOKUP_CANCEL));
    getWindow().addAction(action);
    return action;
}
Also used : Action(io.jmix.ui.action.Action) BaseAction(io.jmix.ui.action.BaseAction) BaseAction(io.jmix.ui.action.BaseAction)

Example 18 with BaseAction

use of io.jmix.ui.action.BaseAction in project jmix by jmix-framework.

the class AbstractScreenFacet method subscribeOnAction.

protected void subscribeOnAction(Frame owner) {
    Action action = ComponentsHelper.findAction(owner, actionId);
    if (!(action instanceof BaseAction)) {
        throw new GuiDevelopmentException(String.format("Unable to find Screen target action with id '%s'", actionId), owner.getId());
    }
    ((BaseAction) action).addActionPerformedListener(e -> show());
}
Also used : Action(io.jmix.ui.action.Action) BaseAction(io.jmix.ui.action.BaseAction) GuiDevelopmentException(io.jmix.ui.GuiDevelopmentException) BaseAction(io.jmix.ui.action.BaseAction)

Example 19 with BaseAction

use of io.jmix.ui.action.BaseAction in project jmix by jmix-framework.

the class RegionEditor method initEntityTree.

protected void initEntityTree() {
    entityTree.setSelectionMode(Tree.SelectionMode.MULTI);
    BaseAction doubleClickAction = new BaseAction("doubleClick").withHandler(event -> addProperty());
    doubleClickAction.addEnabledRule(this::isUpdatePermitted);
    entityTree.setItemClickAction(doubleClickAction);
    ListAction addPropertyAction = actions.create(ItemTrackingAction.class, "addItemAction").withHandler(event -> addProperty());
    addPropertyAction.addEnabledRule(this::isUpdatePermitted);
    entityTree.addAction(addPropertyAction);
    addItem.setAction(addPropertyAction);
}
Also used : ItemTrackingAction(io.jmix.ui.action.ItemTrackingAction) BaseAction(io.jmix.ui.action.BaseAction) ListAction(io.jmix.ui.action.ListAction)

Example 20 with BaseAction

use of io.jmix.ui.action.BaseAction in project jmix by jmix-framework.

the class MessageDialogFacetImpl method subscribeOnAction.

protected void subscribeOnAction(Frame owner) {
    Action action = ComponentsHelper.findAction(owner, actionId);
    if (!(action instanceof BaseAction)) {
        throw new GuiDevelopmentException(String.format("Unable to find Dialog target button with id '%s'", actionId), owner.getId());
    }
    ((BaseAction) action).addActionPerformedListener(e -> show());
}
Also used : Action(io.jmix.ui.action.Action) BaseAction(io.jmix.ui.action.BaseAction) GuiDevelopmentException(io.jmix.ui.GuiDevelopmentException) BaseAction(io.jmix.ui.action.BaseAction)

Aggregations

BaseAction (io.jmix.ui.action.BaseAction)49 Action (io.jmix.ui.action.Action)30 Autowired (org.springframework.beans.factory.annotation.Autowired)12 Icons (io.jmix.ui.icon.Icons)11 io.jmix.ui.screen (io.jmix.ui.screen)9 DialogAction (io.jmix.ui.action.DialogAction)8 Window (io.jmix.ui.component.Window)8 UiScreenProperties (io.jmix.ui.UiScreenProperties)7 io.jmix.ui.component (io.jmix.ui.component)7 JmixIcon (io.jmix.ui.icon.JmixIcon)7 GuiDevelopmentException (io.jmix.ui.GuiDevelopmentException)6 Notifications (io.jmix.ui.Notifications)6 Component (io.jmix.ui.component.Component)6 Collection (java.util.Collection)6 Messages (io.jmix.core.Messages)5 UiComponents (io.jmix.ui.UiComponents)5 Nullable (javax.annotation.Nullable)5 Strings (com.google.common.base.Strings)4 Dialogs (io.jmix.ui.Dialogs)4 ItemTrackingAction (io.jmix.ui.action.ItemTrackingAction)4