Search in sources :

Example 1 with IBeanTableMenuContributionPlugin

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

the class BeanTableImpl method addMenusFromPlugins.

@SuppressWarnings({ "rawtypes", "unchecked" })
private void addMenusFromPlugins(final Class<BEAN_TYPE> beanType, final Object entityId, final IMenuModel menuModel, final IMenuModel cellMenuModel, final IMenuModel headerMenuModel) {
    final IPluginPropertiesBuilder propBuilder = PluginToolkit.pluginPropertiesBuilder();
    propBuilder.add(IBeanTableMenuContributionPlugin.ENTITIY_ID_PROPERTY_KEY, entityId);
    propBuilder.add(IBeanTableMenuContributionPlugin.BEAN_TYPE_PROPERTY_KEY, beanType);
    final IPluginProperties properties = propBuilder.build();
    final List<IBeanTableMenuContributionPlugin<?>> plugins = PluginProvider.getPlugins(IBeanTableMenuContributionPlugin.ID, properties);
    if (plugins != null) {
        for (final IBeanTableMenuContributionPlugin plugin : plugins) {
            final IMenuModel menu = plugin.getTableMenu(properties, this);
            if (menu != null) {
                menuModel.addItemsOfModel(menu);
            }
            final IMenuModel cellMenu = plugin.getCellMenu(properties, this);
            if (menu != null) {
                cellMenuModel.addItemsOfModel(cellMenu);
            }
            final IMenuModel headerMenu = plugin.getHeaderMenu(properties, this);
            if (menu != null) {
                headerMenuModel.addItemsOfModel(headerMenu);
            }
        }
    }
}
Also used : IPluginProperties(org.jowidgets.plugin.api.IPluginProperties) IMenuModel(org.jowidgets.api.model.item.IMenuModel) IPluginPropertiesBuilder(org.jowidgets.plugin.api.IPluginPropertiesBuilder) IBeanTableMenuContributionPlugin(org.jowidgets.cap.ui.api.plugin.IBeanTableMenuContributionPlugin)

Aggregations

IMenuModel (org.jowidgets.api.model.item.IMenuModel)1 IBeanTableMenuContributionPlugin (org.jowidgets.cap.ui.api.plugin.IBeanTableMenuContributionPlugin)1 IPluginProperties (org.jowidgets.plugin.api.IPluginProperties)1 IPluginPropertiesBuilder (org.jowidgets.plugin.api.IPluginPropertiesBuilder)1