Search in sources :

Example 1 with IAction

use of org.jowidgets.api.command.IAction in project jo-client-platform by jo-source.

the class BeanRelationTreeDetailImpl method addTableActions.

private void addTableActions(final IBeanRelationNodeModel<Object, Object> relationNode, final boolean hasDeleterAction, final IBeanTable<Object> table) {
    final IEntityLinkDescriptor link = getLinkDescriptor(relationNode);
    int addedActions = 0;
    if (link != null && link.getLinkCreatorService() != null) {
        final IAction linkCreatorAction = createLinkCreatorAction(relationNode, table, link);
        if (linkCreatorAction != null) {
            table.getCellPopMenu().addAction(linkCreatorAction);
            table.getTablePopupMenu().addAction(linkCreatorAction);
            addedActions++;
        }
    }
    if (hasCopyAction) {
        final IAction copyAction = createCopyAction(table);
        if (copyAction != null) {
            table.getCellPopMenu().addAction(copyAction);
            addedActions++;
        }
    }
    if (hasPasteAction && link != null && link.getLinkCreatorService() != null) {
        final IAction pasteLinkAction = createPasteLinkAction(relationNode, table, link);
        if (pasteLinkAction != null) {
            table.getCellPopMenu().addAction(pasteLinkAction);
            table.getTablePopupMenu().addAction(pasteLinkAction);
            addedActions++;
        }
    }
    if (addedActions >= 2) {
        table.getCellPopMenu().addSeparator();
    }
    if (link != null && link.getLinkDeleterService() != null) {
        final IAction linkDeleterAction = createLinkDeleterAction(relationNode, table, link);
        if (linkDeleterAction != null) {
            table.getCellPopMenu().addAction(linkDeleterAction);
        }
    }
    if (hasDeleterAction) {
        table.getCellPopMenu().addAction(createDeleterAction(table, relationNode));
    }
}
Also used : IAction(org.jowidgets.api.command.IAction) IEntityLinkDescriptor(org.jowidgets.cap.common.api.entity.IEntityLinkDescriptor) IBeanRelationTreeDetailBluePrint(org.jowidgets.cap.ui.api.widgets.IBeanRelationTreeDetailBluePrint) IBeanTableBluePrint(org.jowidgets.cap.ui.api.widgets.IBeanTableBluePrint)

Example 2 with IAction

use of org.jowidgets.api.command.IAction in project jo-client-platform by jo-source.

the class CapWorkbenchMenuFactoryImpl method dataMenu.

@Override
public IMenuModel dataMenu() {
    IMenuModel result = new MenuModel(Messages.getString("CapWorkbenchMenuFactoryImpl.data"));
    final IDataModelAction loadAction = CapWorkbenchActionsProvider.loadAction();
    boolean separator = false;
    if (loadAction != null) {
        result.addAction(loadAction);
        separator = true;
    }
    final IDataModelAction cancelAction = CapWorkbenchActionsProvider.cancelAction();
    if (cancelAction != null) {
        result.addAction(cancelAction);
        separator = true;
    }
    if (separator) {
        result.addSeparator();
        separator = false;
    }
    final IDataModelAction undoAction = CapWorkbenchActionsProvider.undoAction();
    if (undoAction != null) {
        result.addAction(undoAction);
        separator = true;
    }
    final IDataModelAction saveAction = CapWorkbenchActionsProvider.saveAction();
    if (saveAction != null) {
        result.addAction(saveAction);
        separator = true;
    }
    if (separator) {
        result.addSeparator();
    }
    final IAction refreshLookUpsAction = CapWorkbenchActionsProvider.refreshLookUpsAction();
    if (refreshLookUpsAction != null) {
        result.addAction(refreshLookUpsAction);
    }
    final int size = result.getChildren().size();
    if (size > 0) {
        final IMenuItemModel itemModel = result.getChildren().get(size - 1);
        if (itemModel instanceof ISeparatorItemModel) {
            result.removeItem(itemModel);
        }
    }
    // Modify with plugins
    for (final IWorkbenchMenuInterceptorPlugin plugin : PluginProvider.getPlugins(IWorkbenchMenuInterceptorPlugin.ID)) {
        result = plugin.getMenuInterceptor().dataMenuModel(result);
        if (result == null) {
            break;
        }
    }
    return result;
}
Also used : IMenuModel(org.jowidgets.api.model.item.IMenuModel) IAction(org.jowidgets.api.command.IAction) ISeparatorItemModel(org.jowidgets.api.model.item.ISeparatorItemModel) IMenuModel(org.jowidgets.api.model.item.IMenuModel) MenuModel(org.jowidgets.tools.model.item.MenuModel) IMenuItemModel(org.jowidgets.api.model.item.IMenuItemModel) IWorkbenchMenuInterceptorPlugin(org.jowidgets.cap.ui.api.plugin.IWorkbenchMenuInterceptorPlugin) IDataModelAction(org.jowidgets.cap.ui.api.command.IDataModelAction)

Example 3 with IAction

use of org.jowidgets.api.command.IAction in project jo-client-platform by jo-source.

the class CreatorActionBuilderImpl method decorateActionWithPlugins.

private IAction decorateActionWithPlugins(final IAction action) {
    IAction result = action;
    final IPluginProperties properties = PluginProperties.create(IServiceActionDecoratorPlugin.SERVICE_TYPE_PROPERTY_KEY, ICreatorService.class);
    final List<IServiceActionDecoratorPlugin> plugins = PluginProvider.getPlugins(IServiceActionDecoratorPlugin.ID, properties);
    for (final IServiceActionDecoratorPlugin plugin : plugins) {
        result = plugin.decorate(result, creatorService);
        if (result == null) {
            return null;
        }
    }
    return result;
}
Also used : IPluginProperties(org.jowidgets.plugin.api.IPluginProperties) IAction(org.jowidgets.api.command.IAction) IServiceActionDecoratorPlugin(org.jowidgets.cap.ui.api.plugin.IServiceActionDecoratorPlugin)

Example 4 with IAction

use of org.jowidgets.api.command.IAction in project jo-client-platform by jo-source.

the class DataModelActionBuilderImpl method build.

@Override
public IDataModelAction build() {
    actionBuilder.setCommand(new CommandWrapper(abstractDataModelCommand, enabledCheckers));
    final IAction action = actionBuilder.build();
    return new DataModelAction(action);
}
Also used : IAction(org.jowidgets.api.command.IAction) IDataModelAction(org.jowidgets.cap.ui.api.command.IDataModelAction)

Example 5 with IAction

use of org.jowidgets.api.command.IAction in project jo-client-platform by jo-source.

the class ExecutorActionBuilderImpl method decorateActionWithPlugins.

private IAction decorateActionWithPlugins(final IAction action) {
    IAction result = action;
    final IPluginProperties properties = PluginProperties.create(IServiceActionDecoratorPlugin.SERVICE_TYPE_PROPERTY_KEY, IExecutorService.class);
    final IExecutorService<?> executorService = (IExecutorService<?>) executor;
    final List<IServiceActionDecoratorPlugin> plugins = PluginProvider.getPlugins(IServiceActionDecoratorPlugin.ID, properties);
    for (final IServiceActionDecoratorPlugin plugin : plugins) {
        result = plugin.decorate(result, executorService);
        if (result == null) {
            return null;
        }
    }
    return result;
}
Also used : IPluginProperties(org.jowidgets.plugin.api.IPluginProperties) IAction(org.jowidgets.api.command.IAction) IExecutorService(org.jowidgets.cap.common.api.service.IExecutorService) IServiceActionDecoratorPlugin(org.jowidgets.cap.ui.api.plugin.IServiceActionDecoratorPlugin)

Aggregations

IAction (org.jowidgets.api.command.IAction)14 IServiceActionDecoratorPlugin (org.jowidgets.cap.ui.api.plugin.IServiceActionDecoratorPlugin)6 IPluginProperties (org.jowidgets.plugin.api.IPluginProperties)6 IMenuModel (org.jowidgets.api.model.item.IMenuModel)4 IToolBarModel (org.jowidgets.api.model.item.IToolBarModel)3 IDataModelAction (org.jowidgets.cap.ui.api.command.IDataModelAction)3 IActionItemModel (org.jowidgets.api.model.item.IActionItemModel)2 IMenuItemModel (org.jowidgets.api.model.item.IMenuItemModel)2 IEntityLinkDescriptor (org.jowidgets.cap.common.api.entity.IEntityLinkDescriptor)2 IWorkbenchMenuInterceptorPlugin (org.jowidgets.cap.ui.api.plugin.IWorkbenchMenuInterceptorPlugin)2 MenuModel (org.jowidgets.tools.model.item.MenuModel)2 LinkedList (java.util.LinkedList)1 ISeparatorItemModel (org.jowidgets.api.model.item.ISeparatorItemModel)1 IToolBarItemModel (org.jowidgets.api.model.item.IToolBarItemModel)1 IEntityService (org.jowidgets.cap.common.api.service.IEntityService)1 IExecutorService (org.jowidgets.cap.common.api.service.IExecutorService)1 IRefreshLookUpsActionBuilder (org.jowidgets.cap.ui.api.command.IRefreshLookUpsActionBuilder)1 IBeanRelationTreeDetailBluePrint (org.jowidgets.cap.ui.api.widgets.IBeanRelationTreeDetailBluePrint)1 IBeanTableBluePrint (org.jowidgets.cap.ui.api.widgets.IBeanTableBluePrint)1