Search in sources :

Example 1 with IPluginPropertiesBuilder

use of org.jowidgets.plugin.api.IPluginPropertiesBuilder in project jo-client-platform by jo-source.

the class BeanDeleterCommand method getPluginDecoratedRenderer.

@SuppressWarnings({ "rawtypes", "unchecked" })
private IBeanProxyLabelRenderer<BEAN_TYPE> getPluginDecoratedRenderer(final Object entityId, final Class<?> beanType, final IBeanProxyLabelRenderer<BEAN_TYPE> renderer) {
    final IPluginPropertiesBuilder propertiesBuilder = PluginProperties.builder();
    propertiesBuilder.add(IBeanProxyLabelRendererPlugin.ENTITIY_ID_PROPERTY_KEY, entityId);
    propertiesBuilder.add(IBeanProxyLabelRendererPlugin.BEAN_TYPE_PROPERTY_KEY, beanType);
    final IPluginProperties properties = propertiesBuilder.build();
    IBeanProxyLabelRenderer result = renderer;
    for (final IBeanProxyLabelRendererPlugin plugin : PluginProvider.getPlugins(IBeanProxyLabelRendererPlugin.ID, properties)) {
        final IDecorator<IBeanProxyLabelRenderer<?>> decorator = plugin.getRendererDecorator(properties);
        if (decorator != null) {
            result = decorator.decorate(result);
        }
    }
    return result;
}
Also used : IBeanProxyLabelRendererPlugin(org.jowidgets.cap.ui.api.plugin.IBeanProxyLabelRendererPlugin) IPluginProperties(org.jowidgets.plugin.api.IPluginProperties) IPluginPropertiesBuilder(org.jowidgets.plugin.api.IPluginPropertiesBuilder) IBeanProxyLabelRenderer(org.jowidgets.cap.ui.api.bean.IBeanProxyLabelRenderer)

Example 2 with IPluginPropertiesBuilder

use of org.jowidgets.plugin.api.IPluginPropertiesBuilder in project jo-client-platform by jo-source.

the class BeanFormImpl method modifyBeanFormBpByPlugins.

private void modifyBeanFormBpByPlugins(final Object entityId, final Class<BEAN_TYPE> beanType, final IBeanFormBluePrint<BEAN_TYPE> beanFormBp) {
    final IPluginPropertiesBuilder propBuilder = PluginToolkit.pluginPropertiesBuilder();
    propBuilder.add(IBeanFormPlugin.ENTITIY_ID_PROPERTY_KEY, entityId);
    propBuilder.add(IBeanFormPlugin.BEAN_TYPE_PROPERTY_KEY, beanType);
    final IPluginProperties properties = propBuilder.build();
    for (final IBeanFormPlugin plugin : PluginProvider.getPlugins(IBeanFormPlugin.ID, properties)) {
        plugin.modifySetup(properties, beanFormBp);
    }
}
Also used : IPluginProperties(org.jowidgets.plugin.api.IPluginProperties) IPluginPropertiesBuilder(org.jowidgets.plugin.api.IPluginPropertiesBuilder) IBeanFormPlugin(org.jowidgets.cap.ui.api.plugin.IBeanFormPlugin)

Example 3 with IPluginPropertiesBuilder

use of org.jowidgets.plugin.api.IPluginPropertiesBuilder in project jo-client-platform by jo-source.

the class BeanTableModelImpl method createModifiedByPluginsAttributes.

private List<IAttribute<Object>> createModifiedByPluginsAttributes(final Object entityId, final Class<BEAN_TYPE> beanType, final List<IAttribute<Object>> attributes) {
    List<IAttribute<Object>> result = attributes;
    IPluginPropertiesBuilder propBuilder = PluginToolkit.pluginPropertiesBuilder();
    propBuilder.add(IAttributePlugin.ENTITIY_ID_PROPERTY_KEY, entityId);
    propBuilder.add(IAttributePlugin.BEAN_TYPE_PROPERTY_KEY, beanType);
    IPluginProperties properties = propBuilder.build();
    for (final IAttributePlugin plugin : PluginProvider.getPlugins(IAttributePlugin.ID, properties)) {
        result = plugin.modifyAttributes(properties, result);
    }
    propBuilder = PluginToolkit.pluginPropertiesBuilder();
    propBuilder.add(IBeanTableModelPlugin.ENTITIY_ID_PROPERTY_KEY, entityId);
    propBuilder.add(IBeanTableModelPlugin.BEAN_TYPE_PROPERTY_KEY, beanType);
    properties = propBuilder.build();
    for (final IBeanTableModelPlugin plugin : PluginProvider.getPlugins(IBeanTableModelPlugin.ID, properties)) {
        result = plugin.modifyTableAttributes(properties, result);
    }
    return result;
}
Also used : IPluginProperties(org.jowidgets.plugin.api.IPluginProperties) IPluginPropertiesBuilder(org.jowidgets.plugin.api.IPluginPropertiesBuilder) IAttributePlugin(org.jowidgets.cap.ui.api.plugin.IAttributePlugin) IAttribute(org.jowidgets.cap.ui.api.attribute.IAttribute) IBeanTableModelPlugin(org.jowidgets.cap.ui.api.plugin.IBeanTableModelPlugin)

Example 4 with IPluginPropertiesBuilder

use of org.jowidgets.plugin.api.IPluginPropertiesBuilder in project jo-client-platform by jo-source.

the class BeanDtoFilterImpl method acceptCustom.

private boolean acceptCustom(final IBeanDto beanDto, final ICustomFilter filter) {
    Assert.paramNotEmpty(filter.getFilterType(), "filter.getFilterType()");
    final IPluginPropertiesBuilder propertiesBuilder = PluginToolkit.pluginPropertiesBuilder();
    propertiesBuilder.add(IBeanDtoCustomFilterPlugin.FILTER_TYPE_PROPERTY_KEY, filter.getFilterType());
    final List<IBeanDtoCustomFilterPlugin> plugins;
    plugins = PluginProvider.getPlugins(IBeanDtoCustomFilterPlugin.ID, propertiesBuilder.build());
    if (plugins.size() == 0) {
        throw new IllegalStateException("No '" + IBeanDtoCustomFilterPlugin.class.getName() + "' implementation found for the filter type '" + filter.getFilterType() + "'");
    }
    for (final IBeanDtoCustomFilterPlugin plugin : plugins) {
        // plug in has to negate result itself if filter is inverted
        if (!plugin.accept(beanDto, filter)) {
            return false;
        }
    }
    return true;
}
Also used : IBeanDtoCustomFilterPlugin(org.jowidgets.cap.common.api.plugin.IBeanDtoCustomFilterPlugin) IPluginPropertiesBuilder(org.jowidgets.plugin.api.IPluginPropertiesBuilder)

Example 5 with IPluginPropertiesBuilder

use of org.jowidgets.plugin.api.IPluginPropertiesBuilder in project jo-client-platform by jo-source.

the class BeanRelationTreeModelBuilderImpl method modifyFromBeanModelPlugins.

@SuppressWarnings({ "rawtypes", "unchecked" })
private void modifyFromBeanModelPlugins() {
    final IPluginPropertiesBuilder propBuilder = PluginToolkit.pluginPropertiesBuilder();
    propBuilder.add(IBeanModelBuilderPlugin.ENTITIY_ID_PROPERTY_KEY, getEntityId());
    propBuilder.add(IBeanModelBuilderPlugin.BEAN_TYPE_PROPERTY_KEY, getBeanType());
    final IPluginProperties properties = propBuilder.build();
    for (final IBeanModelBuilderPlugin plugin : PluginProvider.getPlugins(IBeanModelBuilderPlugin.ID, properties)) {
        plugin.modify(this);
    }
}
Also used : IPluginProperties(org.jowidgets.plugin.api.IPluginProperties) IBeanModelBuilderPlugin(org.jowidgets.cap.ui.api.plugin.IBeanModelBuilderPlugin) IPluginPropertiesBuilder(org.jowidgets.plugin.api.IPluginPropertiesBuilder)

Aggregations

IPluginPropertiesBuilder (org.jowidgets.plugin.api.IPluginPropertiesBuilder)34 IPluginProperties (org.jowidgets.plugin.api.IPluginProperties)21 LinkedList (java.util.LinkedList)6 List (java.util.List)6 IAttributePlugin (org.jowidgets.cap.ui.api.plugin.IAttributePlugin)5 IBeanModelBuilderPlugin (org.jowidgets.cap.ui.api.plugin.IBeanModelBuilderPlugin)5 ArrayList (java.util.ArrayList)3 IAttribute (org.jowidgets.cap.ui.api.attribute.IAttribute)3 IContainer (org.jowidgets.api.widgets.IContainer)2 IBeanProxyLabelRenderer (org.jowidgets.cap.ui.api.bean.IBeanProxyLabelRenderer)2 IBeanProxyLabelRendererPlugin (org.jowidgets.cap.ui.api.plugin.IBeanProxyLabelRendererPlugin)2 IMenuModel (org.jowidgets.api.model.item.IMenuModel)1 IBeanDtoCustomFilterPlugin (org.jowidgets.cap.common.api.plugin.IBeanDtoCustomFilterPlugin)1 IServiceIdDecoratorPlugin (org.jowidgets.cap.service.api.plugin.IServiceIdDecoratorPlugin)1 ICustomFilterPredicateCreatorPlugin (org.jowidgets.cap.service.jpa.api.plugin.ICustomFilterPredicateCreatorPlugin)1 IBeanFormPlugin (org.jowidgets.cap.ui.api.plugin.IBeanFormPlugin)1 IBeanRelationTreeDetailPlugin (org.jowidgets.cap.ui.api.plugin.IBeanRelationTreeDetailPlugin)1 IBeanRelationTreePlugin (org.jowidgets.cap.ui.api.plugin.IBeanRelationTreePlugin)1 IBeanTableMenuContributionPlugin (org.jowidgets.cap.ui.api.plugin.IBeanTableMenuContributionPlugin)1 IBeanTableMenuInterceptorPlugin (org.jowidgets.cap.ui.api.plugin.IBeanTableMenuInterceptorPlugin)1