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;
}
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);
}
}
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;
}
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;
}
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);
}
}
Aggregations