use of org.jowidgets.cap.ui.api.attribute.IAttribute in project jo-client-platform by jo-source.
the class AttributesFactory method createAttributes.
List<IAttribute<Object>> createAttributes(final Collection<? extends IProperty> properties, final IAttributeCollectionModifier attributeCollectionModifier) {
Assert.paramNotNull(properties, "properties");
final List<IAttribute<Object>> result = new LinkedList<IAttribute<Object>>();
for (final IProperty property : properties) {
final AttributeBuilderImpl<Object> attributeBuilder = new AttributeBuilderImpl<Object>(property);
if (attributeCollectionModifier != null) {
final IAttribute<Object> attribute = applyCollectionModifier(property, attributeBuilder, attributeCollectionModifier);
if (attribute != null) {
result.add(attribute);
}
} else {
result.add(attributeBuilder.build());
}
}
return result;
}
use of org.jowidgets.cap.ui.api.attribute.IAttribute 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.cap.ui.api.attribute.IAttribute in project jo-client-platform by jo-source.
the class CreatorActionBuilderImpl method buildAction.
private IAction buildAction() {
final IBeanFormBluePrint<BEAN_TYPE> formBp = getBeanFormBp();
Collection<IAttribute<?>> attr = attributes;
if (attr == null && formBp != null) {
attr = formBp.getCreateModeAttributes();
}
final BeanCreatorCommand<BEAN_TYPE> command = new BeanCreatorCommand<BEAN_TYPE>(beanTypeId, beanType, beanPropertyValidators, model, attr, formBp, enabledCheckers, anySelection, creatorService, parentBeanKeysProvider, getDefaultValueProvider(attr), exceptionConverter, executionInterceptors, creatorInterceptors);
final IActionBuilder builder = getBuilder();
if (model instanceof IDataModelContextProvider) {
builder.setCommand(new DataModelContextCommandWrapper((IDataModelContextProvider) model, DataModelChangeType.SELECTION_CHANGE, command));
} else {
builder.setCommand((ICommand) command);
}
return builder.build();
}
use of org.jowidgets.cap.ui.api.attribute.IAttribute in project jo-client-platform by jo-source.
the class BeanLinkCreatorCommand method createDefaultBean.
private <BEAN_TYPE> IBeanProxy<BEAN_TYPE> createDefaultBean(final IBeanFormBluePrint<BEAN_TYPE> formBp, final Object beanTypeId, final Class<? extends BEAN_TYPE> beanType, final List<IBeanPropertyValidator<BEAN_TYPE>> validators) {
if (formBp != null) {
final HashMap<String, Object> defaultValues = new HashMap<String, Object>();
final LinkedList<String> properties = new LinkedList<String>();
final Collection<IAttribute<?>> attributes = formBp.getCreateModeAttributes();
final IAttributeSet attributeSet = AttributeSet.create(attributes);
for (final IAttribute<?> attribute : attributes) {
final String propertyName = attribute.getPropertyName();
properties.add(propertyName);
final Object defaultValue = attribute.getDefaultValue();
if (defaultValue != null) {
defaultValues.put(propertyName, defaultValue);
}
}
final List<IBeanPropertyValidator<BEAN_TYPE>> propertyValidators = createBeanPropertyValidators(attributes);
if (!EmptyCheck.isEmpty(validators)) {
propertyValidators.addAll(validators);
}
@SuppressWarnings("unchecked") final IBeanProxyFactory<BEAN_TYPE> proxyFactory = BeanProxyFactory.builder((Class<BEAN_TYPE>) beanType).setBeanTypeId(beanTypeId).setAttributes(attributeSet).setBeanPropertyValidators(propertyValidators).build();
return proxyFactory.createTransientProxy(defaultValues);
} else {
return null;
}
}
use of org.jowidgets.cap.ui.api.attribute.IAttribute in project jo-client-platform by jo-source.
the class BeanTabFolderModelImpl 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;
final IPluginPropertiesBuilder propBuilder = PluginToolkit.pluginPropertiesBuilder();
propBuilder.add(IAttributePlugin.ENTITIY_ID_PROPERTY_KEY, entityId);
propBuilder.add(IAttributePlugin.BEAN_TYPE_PROPERTY_KEY, beanType);
final IPluginProperties properties = propBuilder.build();
for (final IAttributePlugin plugin : PluginProvider.getPlugins(IAttributePlugin.ID, properties)) {
result = plugin.modifyAttributes(properties, result);
}
return result;
}
Aggregations