Search in sources :

Example 6 with IAction

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

the class LinkDeleterActionBuilderImpl method decorateActionWithPlugins.

private IAction decorateActionWithPlugins(final IAction action) {
    IAction result = action;
    final IPluginProperties properties = PluginProperties.create(IServiceActionDecoratorPlugin.SERVICE_TYPE_PROPERTY_KEY, ILinkDeleterService.class);
    final List<IServiceActionDecoratorPlugin> plugins = PluginProvider.getPlugins(IServiceActionDecoratorPlugin.ID, properties);
    for (final IServiceActionDecoratorPlugin plugin : plugins) {
        result = plugin.decorate(result, deleterService);
        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 7 with IAction

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

the class PasteLinkActionBuilderImpl method decorateActionWithPlugins.

private IAction decorateActionWithPlugins(final IAction action) {
    IAction result = action;
    final IPluginProperties properties = PluginProperties.create(IServiceActionDecoratorPlugin.SERVICE_TYPE_PROPERTY_KEY, ILinkCreatorService.class);
    final List<IServiceActionDecoratorPlugin> plugins = PluginProvider.getPlugins(IServiceActionDecoratorPlugin.ID, properties);
    for (final IServiceActionDecoratorPlugin plugin : plugins) {
        result = plugin.decorate(result, linkCreatorService);
        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 8 with IAction

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

the class DeleterActionBuilder method decorateActionWithPlugins.

private IAction decorateActionWithPlugins(final IAction action) {
    IAction result = action;
    final IPluginProperties properties = PluginProperties.create(IServiceActionDecoratorPlugin.SERVICE_TYPE_PROPERTY_KEY, IDeleterService.class);
    final List<IServiceActionDecoratorPlugin> plugins = PluginProvider.getPlugins(IServiceActionDecoratorPlugin.ID, properties);
    for (final IServiceActionDecoratorPlugin plugin : plugins) {
        result = plugin.decorate(result, deleterService);
        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 9 with IAction

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

the class LinkCreatorActionBuilderImpl method decorateActionWithPlugins.

private IAction decorateActionWithPlugins(final IAction action) {
    IAction result = action;
    final IPluginProperties properties = PluginProperties.create(IServiceActionDecoratorPlugin.SERVICE_TYPE_PROPERTY_KEY, ILinkCreatorService.class);
    final List<IServiceActionDecoratorPlugin> plugins = PluginProvider.getPlugins(IServiceActionDecoratorPlugin.ID, properties);
    for (final IServiceActionDecoratorPlugin plugin : plugins) {
        result = plugin.decorate(result, linkCreatorService);
        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 10 with IAction

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

the class BeanRelationTreeImpl method createNodeMenus.

private IMenuModel createNodeMenus(final IBeanRelationNodeModel<Object, Object> relationNodeModel, final IMenuModel relationMenu, final IAction createAction) {
    final IMenuModel result = new MenuModel();
    boolean needSeparator = false;
    final IAction copyAction = createCopyAction(relationNodeModel);
    if (copyAction != null && createAction == null) {
        result.addAction(copyAction);
        needSeparator = true;
    }
    if (relationMenu.getChildren().size() > 0) {
        for (final IMenuItemModel item : relationMenu.getChildren()) {
            result.addItem(item);
            if (copyAction != null && createAction != null && item instanceof IActionItemModel) {
                final IAction action = ((IActionItemModel) item).getAction();
                if (NullCompatibleEquivalence.equals(createAction, action)) {
                    result.addAction(copyAction);
                }
            }
        }
        needSeparator = true;
    }
    final IEntityService entityService = ServiceProvider.getService(IEntityService.ID);
    if (entityService != null) {
        final Object childEntityId = relationNodeModel.getChildEntityId();
        if (relationNodeModel.getParentEntityId() != null && relationNodeModel.getParentBean() != null) {
            final List<IEntityLinkDescriptor> links = entityService.getEntityLinks(relationNodeModel.getParentEntityId());
            for (final IEntityLinkDescriptor link : links) {
                if (childEntityId.equals(link.getLinkedEntityId())) {
                    final IAction linkDeleterAction = createLinkDeleterAction(relationNodeModel, link);
                    if (linkDeleterAction != null) {
                        if (needSeparator) {
                            result.addSeparator();
                            needSeparator = false;
                        }
                        result.addAction(linkDeleterAction);
                    }
                }
            }
        }
        final IAction deleterAction = createDeleterAction(relationNodeModel);
        if (deleterAction != null) {
            if (needSeparator) {
                result.addSeparator();
                needSeparator = false;
            }
            result.addAction(deleterAction);
        }
    }
    if (menuInterceptor != null) {
        return menuInterceptor.nodeMenu(relationNodeModel, result);
    } else {
        return result;
    }
}
Also used : IMenuModel(org.jowidgets.api.model.item.IMenuModel) IAction(org.jowidgets.api.command.IAction) IEntityService(org.jowidgets.cap.common.api.service.IEntityService) IEntityLinkDescriptor(org.jowidgets.cap.common.api.entity.IEntityLinkDescriptor) IMenuModel(org.jowidgets.api.model.item.IMenuModel) MenuModel(org.jowidgets.tools.model.item.MenuModel) IMenuItemModel(org.jowidgets.api.model.item.IMenuItemModel) IActionItemModel(org.jowidgets.api.model.item.IActionItemModel)

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