use of io.jmix.ui.action.Action 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());
}
use of io.jmix.ui.action.Action in project jmix by jmix-framework.
the class NotificationFacetImpl 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 Notification target action with id '%s'", actionId), owner.getId());
}
((BaseAction) action).addActionPerformedListener(e -> show());
}
use of io.jmix.ui.action.Action in project jmix by jmix-framework.
the class TreeImpl method createContextMenuItem.
protected AbstractDataGrid.ActionMenuItemWrapper createContextMenuItem(Action action) {
MenuItem menuItem = contextMenu.addItem(action.getCaption(), null);
menuItem.setStyleName("jmix-cm-item");
return new AbstractDataGrid.ActionMenuItemWrapper(menuItem, showIconsForPopupMenuActions, iconResolver) {
@Override
public void performAction(Action action) {
action.actionPerform(TreeImpl.this);
}
};
}
use of io.jmix.ui.action.Action in project jmix by jmix-framework.
the class TreeImpl method createShortcutsDelegate.
protected ShortcutsDelegate<ShortcutListener> createShortcutsDelegate() {
return new ShortcutsDelegate<ShortcutListener>() {
@Override
protected ShortcutListener attachShortcut(String actionId, KeyCombination keyCombination) {
ShortcutListener shortcut = new ShortcutListenerDelegate(actionId, keyCombination.getKey().getCode(), KeyCombination.Modifier.codes(keyCombination.getModifiers())).withHandler((sender, target) -> {
if (sender == componentComposition) {
Action action = getAction(actionId);
if (action != null && action.isEnabled() && action.isVisible()) {
action.actionPerform(TreeImpl.this);
}
}
});
componentComposition.addShortcutListener(shortcut);
return shortcut;
}
@Override
protected void detachShortcut(Action action, ShortcutListener shortcutDescriptor) {
componentComposition.removeShortcutListener(shortcutDescriptor);
}
@Override
protected Collection<Action> getActions() {
return TreeImpl.this.getActions();
}
};
}
use of io.jmix.ui.action.Action in project jmix by jmix-framework.
the class FilterLoader method loadActions.
@Override
protected void loadActions(ActionsHolder actionsHolder, Element element) {
Element actionsEl = element.element("actions");
if (actionsEl == null) {
return;
}
actionsHolder.removeAllActions();
for (Element actionEl : actionsEl.elements("action")) {
Action action = loadDeclarativeAction(actionsHolder, actionEl);
if (action instanceof FilterAction) {
((FilterAction) action).setFilter(resultComponent);
}
actionsHolder.addAction(action);
}
getComponentContext().addPostInitTask((context1, window) -> actionsHolder.getActions().forEach(Action::refreshState));
}
Aggregations