use of org.jowidgets.cap.common.api.entity.IEntityApplicationNode in project jo-client-platform by jo-source.
the class EntityComponentNodesFactoryImpl method createNodeFromEntity.
private IComponentNodeModel createNodeFromEntity(final IEntityApplicationNode applicationNode) {
final IComponentNodeModelBuilder builder = new ComponentNodeModelBuilder();
final Object entityId = applicationNode.getEntityId();
String label = applicationNode.getLabel().get();
Object iconDescriptor = applicationNode.getIconDescriptor();
if (entityId == null) {
builder.setId(label);
} else {
// TODO MG the id of workbench parts should be an object
builder.setId(entityId.toString());
final IEntityService entityService = ServiceProvider.getService(IEntityService.ID);
final IBeanDtoDescriptor beanDtoDescriptor = entityService.getDescriptor(entityId);
if (beanDtoDescriptor != null) {
if (EmptyCheck.isEmpty(label)) {
label = beanDtoDescriptor.getLabelPlural().get();
}
if (iconDescriptor == null) {
iconDescriptor = beanDtoDescriptor.getIconDescriptor();
}
}
builder.setComponentFactory(CapUiToolkit.workbenchToolkit().entityComponentFactory().create(applicationNode));
}
builder.setLabel(label);
builder.setTooltip(applicationNode.getDescription().get());
if (iconDescriptor != null) {
builder.setIcon(ImageResolver.resolve(iconDescriptor));
}
for (final IEntityApplicationNode childNode : applicationNode.getChildren()) {
builder.addChild(createNodeFromEntity(childNode));
}
return builder.build();
}
use of org.jowidgets.cap.common.api.entity.IEntityApplicationNode in project jo-client-platform by jo-source.
the class EntityComponentNodesFactoryImpl method createNodes.
@Override
public List<IComponentNodeModel> createNodes(final IEntityApplicationService entityApplicationService) {
Assert.paramNotNull(entityApplicationService, "entityApplicationService");
final List<IComponentNodeModel> result = new LinkedList<IComponentNodeModel>();
Collection<IEntityApplicationNode> entities = entityApplicationService.getApplicationNodes();
for (final IEntityComponentNodesFactoryPlugin plugin : PluginProvider.getPlugins(IEntityComponentNodesFactoryPlugin.ID)) {
entities = plugin.modify(entities);
}
for (final IEntityApplicationNode entityNode : entities) {
result.add(createNodeFromEntity(entityNode));
}
return result;
}
Aggregations