use of org.eclipse.scout.rt.shared.data.model.IDataModelEntity in project scout.rt by eclipse.
the class AbstractComposerField method execResolveRootPathForTopLevelEntity.
/**
* see {@link #interceptResolveEntityPath(EntityNode)}
*/
@ConfigOperation
@Order(98)
protected void execResolveRootPathForTopLevelEntity(IDataModelEntity e, List<IDataModelEntity> lifeList) {
IDataModelEntity tmp = (e != null ? e.getParentEntity() : null);
while (tmp != null) {
lifeList.add(0, tmp);
tmp = tmp.getParentEntity();
}
}
use of org.eclipse.scout.rt.shared.data.model.IDataModelEntity in project scout.rt by eclipse.
the class AbstractComposerField method execResolveAttributePath.
/**
* see {@link #execResolveEntityPathForEntityExport(EntityNode)}, {@link AttributePath} for more details
* <p>
* The path in the composer tree is prefixed with
* {@link #interceptResolveRootPathForTopLevelAttribute(IDataModelAttribute, List)}
*/
@ConfigOperation
@Order(99)
protected AttributePath execResolveAttributePath(AttributeNode node) {
LinkedList<IDataModelEntity> list = new LinkedList<IDataModelEntity>();
if (node == null) {
return null;
}
EntityNode tmp = node.getAncestorNode(EntityNode.class);
while (tmp != null) {
if (tmp.getEntity() != null) {
list.add(0, tmp.getEntity());
}
// next
tmp = tmp.getAncestorNode(EntityNode.class);
}
if (list.size() > 0) {
interceptResolveRootPathForTopLevelEntity(list.get(0), list);
} else {
interceptResolveRootPathForTopLevelAttribute(node.getAttribute(), list);
}
return new AttributePath(list, node.getAttribute());
}
use of org.eclipse.scout.rt.shared.data.model.IDataModelEntity in project scout.rt by eclipse.
the class MoveDataModelEntitiyAndAttributeTest method testMoveTopLevelEntity.
@Test
public void testMoveTopLevelEntity() {
BEANS.get(IExtensionRegistry.class).registerMove(Top1Entity.class, 40);
TestDataModel dataModel = new TestDataModel();
assertDataModelElements(dataModel.getEntities(), Top2Entity.class, Top3Entity.class, Top1Entity.class);
assertDataModelElements(dataModel.getAttributes(), Top1Attribute.class, Top2Attribute.class, Top3Attribute.class);
IDataModelEntity entity = dataModel.getEntities().get(2);
assertDataModelElements(entity.getEntities(), Sub1Top1Entity.class, Sub2Top1Entity.class, Sub3Top1Entity.class);
assertDataModelElements(entity.getAttributes(), Sub1Top1Attribute.class, Sub2Top1Attribute.class, Sub3Top1Attribute.class);
}
use of org.eclipse.scout.rt.shared.data.model.IDataModelEntity in project scout.rt by eclipse.
the class MoveDataModelEntitiyAndAttributeTest method testMoveTopLevelAttribute.
@Test
public void testMoveTopLevelAttribute() {
BEANS.get(IExtensionRegistry.class).registerMove(Top1Attribute.class, 40);
TestDataModel dataModel = new TestDataModel();
assertDataModelElements(dataModel.getEntities(), Top1Entity.class, Top2Entity.class, Top3Entity.class);
assertDataModelElements(dataModel.getAttributes(), Top2Attribute.class, Top3Attribute.class, Top1Attribute.class);
IDataModelEntity entity = dataModel.getEntities().get(0);
assertDataModelElements(entity.getEntities(), Sub1Top1Entity.class, Sub2Top1Entity.class, Sub3Top1Entity.class);
assertDataModelElements(entity.getAttributes(), Sub1Top1Attribute.class, Sub2Top1Attribute.class, Sub3Top1Attribute.class);
}
use of org.eclipse.scout.rt.shared.data.model.IDataModelEntity in project scout.rt by eclipse.
the class MoveDataModelEntitiyAndAttributeTest method testMoveSubLevelEntity.
@Test
public void testMoveSubLevelEntity() {
BEANS.get(IExtensionRegistry.class).registerMove(Sub1Top1Entity.class, 40);
TestDataModel dataModel = new TestDataModel();
assertDataModelElements(dataModel.getEntities(), Top1Entity.class, Top2Entity.class, Top3Entity.class);
assertDataModelElements(dataModel.getAttributes(), Top1Attribute.class, Top2Attribute.class, Top3Attribute.class);
IDataModelEntity entity = dataModel.getEntities().get(0);
assertDataModelElements(entity.getEntities(), Sub2Top1Entity.class, Sub3Top1Entity.class, Sub1Top1Entity.class);
assertDataModelElements(entity.getAttributes(), Sub1Top1Attribute.class, Sub2Top1Attribute.class, Sub3Top1Attribute.class);
}
Aggregations