Search in sources :

Example 1 with IEntityComponentRelationTreeViewPlugin

use of org.jowidgets.cap.ui.api.plugin.IEntityComponentRelationTreeViewPlugin in project jo-client-platform by jo-source.

the class EntityRelationTreeView method initialize.

void initialize(final IBeanTable<?> rootTable, final IBeanRelationTreeModel<?> parentModel, final IBeanRelationTreeMenuInterceptor treeMenuInterceptor, final Collection<IAction> linkCreatorActions) {
    if (!intialized) {
        final IContainer container = context.getContainer();
        container.setLayout(MigLayoutFactory.growingInnerCellLayout());
        final IBeanRelationTreeBluePrint<?> beanRelationTreeBp = CapUiToolkit.bluePrintFactory().beanRelationTree(parentModel);
        beanRelationTreeBp.setRootCreatorAction(rootTable.getDefaultCreatorAction());
        beanRelationTreeBp.addMenuInterceptor(treeMenuInterceptor);
        this.tree = container.add(beanRelationTreeBp, MigLayoutFactory.GROWING_CELL_CONSTRAINTS);
        final IBeanTableModel<?> rootTableModel = rootTable.getModel();
        final IPluginPropertiesBuilder propBuilder = PluginProperties.builder();
        propBuilder.add(IEntityComponentRelationTreeViewPlugin.BEAN_TYPE_PROPERTY_KEY, rootTableModel.getBeanType());
        propBuilder.add(IEntityComponentRelationTreeViewPlugin.ENTITIY_ID_PROPERTY_KEY, rootTableModel.getEntityId());
        final IPluginProperties pluginProperties = propBuilder.build();
        final List<IEntityComponentRelationTreeViewPlugin> plugins = PluginProvider.getPlugins(IEntityComponentRelationTreeViewPlugin.ID, pluginProperties);
        for (final IEntityComponentRelationTreeViewPlugin plugin : plugins) {
            plugin.onInitialize(pluginProperties, context, rootTable, tree, linkCreatorActions);
        }
        intialized = true;
    }
}
Also used : IPluginProperties(org.jowidgets.plugin.api.IPluginProperties) IEntityComponentRelationTreeViewPlugin(org.jowidgets.cap.ui.api.plugin.IEntityComponentRelationTreeViewPlugin) IPluginPropertiesBuilder(org.jowidgets.plugin.api.IPluginPropertiesBuilder) IContainer(org.jowidgets.api.widgets.IContainer)

Aggregations

IContainer (org.jowidgets.api.widgets.IContainer)1 IEntityComponentRelationTreeViewPlugin (org.jowidgets.cap.ui.api.plugin.IEntityComponentRelationTreeViewPlugin)1 IPluginProperties (org.jowidgets.plugin.api.IPluginProperties)1 IPluginPropertiesBuilder (org.jowidgets.plugin.api.IPluginPropertiesBuilder)1