Search in sources :

Example 1 with ImutableSingleBeanSelectionProvider

use of org.jowidgets.cap.ui.tools.bean.ImutableSingleBeanSelectionProvider in project jo-client-platform by jo-source.

the class BeanRelationTreeImpl method createLinkCreatorAction.

private IAction createLinkCreatorAction(final IBeanRelationNodeModel<Object, Object> relationNodeModel, final IEntityLinkDescriptor link) {
    if (!defaultLinkCreatorAction) {
        return null;
    }
    final ICapActionFactory actionFactory = CapUiToolkit.actionFactory();
    final IBeanSelectionProvider<Object> source = new ImutableSingleBeanSelectionProvider<Object>(relationNodeModel.getParentBean(), relationNodeModel.getParentEntityId(), relationNodeModel.getParentBeanTypeId(), relationNodeModel.getParentBeanType());
    try {
        if (link.getLinkCreatorService() != null) {
            ILinkCreatorActionBuilder<Object, Object, Object> builder = actionFactory.linkCreatorActionBuilder(source, link);
            builder.setLinkedModel(relationNodeModel);
            if (autoKeyBinding) {
                builder.setAccelerator(VirtualKey.N, Modifier.CTRL);
            } else {
                builder.setAccelerator(null);
            }
            if (menuInterceptor != null) {
                builder = menuInterceptor.linkCreatorActionBuilder(relationNodeModel, builder);
            }
            if (builder != null) {
                return builder.build();
            }
        }
    } catch (final Exception e) {
    }
    return null;
}
Also used : ImutableSingleBeanSelectionProvider(org.jowidgets.cap.ui.tools.bean.ImutableSingleBeanSelectionProvider) ICapActionFactory(org.jowidgets.cap.ui.api.command.ICapActionFactory)

Example 2 with ImutableSingleBeanSelectionProvider

use of org.jowidgets.cap.ui.tools.bean.ImutableSingleBeanSelectionProvider in project jo-client-platform by jo-source.

the class BeanRelationTreeImpl method createLinkDeleterAction.

private IAction createLinkDeleterAction(final IBeanRelationNodeModel<Object, Object> relationNodeModel, final IEntityLinkDescriptor link) {
    if (!defaultLinkDeleterAction) {
        return null;
    }
    final ICapActionFactory actionFactory = CapUiToolkit.actionFactory();
    final IBeanSelectionProvider<Object> source = new ImutableSingleBeanSelectionProvider<Object>(relationNodeModel.getParentBean(), relationNodeModel.getParentEntityId(), relationNodeModel.getParentBeanTypeId(), relationNodeModel.getParentBeanType());
    try {
        if (link.getLinkDeleterService() != null) {
            ILinkDeleterActionBuilder<Object, Object> builder = actionFactory.linkDeleterActionBuilder(source, relationNodeModel, link);
            builder.setLinkedMultiSelection(treeMultiSelection);
            if (autoKeyBinding) {
                builder.setAccelerator(VirtualKey.DELETE);
            } else {
                builder.setAccelerator(null);
            }
            if (menuInterceptor != null) {
                builder = menuInterceptor.linkDeleterActionBuilder(relationNodeModel, builder);
            }
            if (builder != null) {
                return builder.build();
            }
        }
    } catch (final Exception e) {
    }
    return null;
}
Also used : ImutableSingleBeanSelectionProvider(org.jowidgets.cap.ui.tools.bean.ImutableSingleBeanSelectionProvider) ICapActionFactory(org.jowidgets.cap.ui.api.command.ICapActionFactory)

Example 3 with ImutableSingleBeanSelectionProvider

use of org.jowidgets.cap.ui.tools.bean.ImutableSingleBeanSelectionProvider in project jo-client-platform by jo-source.

the class BeanRelationTreeImpl method createPasteLinkAction.

private IAction createPasteLinkAction(final IBeanRelationNodeModel<Object, Object> relationNodeModel, final IEntityLinkDescriptor link) {
    if (!defaultLinkPasteAction) {
        return null;
    }
    final ICapActionFactory actionFactory = CapUiToolkit.actionFactory();
    final IBeanSelectionProvider<Object> source = new ImutableSingleBeanSelectionProvider<Object>(relationNodeModel.getParentBean(), relationNodeModel.getParentEntityId(), relationNodeModel.getParentBeanTypeId(), relationNodeModel.getParentBeanType());
    try {
        if (link.getLinkCreatorService() != null) {
            IPasteLinkActionBuilder<Object, Object, Object> builder = actionFactory.pasteLinkActionBuilder(source, link, this);
            builder.setLinkedModel(relationNodeModel);
            if (!autoKeyBinding) {
                builder.setAccelerator(null);
            }
            if (menuInterceptor != null) {
                builder = menuInterceptor.pasteLinkActionBuilder(relationNodeModel, builder);
            }
            if (builder != null) {
                return builder.build();
            }
        }
    } catch (final Exception e) {
    }
    return null;
}
Also used : ImutableSingleBeanSelectionProvider(org.jowidgets.cap.ui.tools.bean.ImutableSingleBeanSelectionProvider) ICapActionFactory(org.jowidgets.cap.ui.api.command.ICapActionFactory)

Aggregations

ICapActionFactory (org.jowidgets.cap.ui.api.command.ICapActionFactory)3 ImutableSingleBeanSelectionProvider (org.jowidgets.cap.ui.tools.bean.ImutableSingleBeanSelectionProvider)3