Search in sources :

Example 11 with IDataModelEntity

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();
    }
}
Also used : IDataModelEntity(org.eclipse.scout.rt.shared.data.model.IDataModelEntity) Order(org.eclipse.scout.rt.platform.Order) ConfigOperation(org.eclipse.scout.rt.platform.annotations.ConfigOperation)

Example 12 with IDataModelEntity

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());
}
Also used : IDataModelEntity(org.eclipse.scout.rt.shared.data.model.IDataModelEntity) LinkedList(java.util.LinkedList) EntityNode(org.eclipse.scout.rt.client.ui.form.fields.composer.node.EntityNode) AttributePath(org.eclipse.scout.rt.shared.data.model.AttributePath) Order(org.eclipse.scout.rt.platform.Order) ConfigOperation(org.eclipse.scout.rt.platform.annotations.ConfigOperation)

Example 13 with IDataModelEntity

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);
}
Also used : IDataModelEntity(org.eclipse.scout.rt.shared.data.model.IDataModelEntity) TestDataModel(org.eclipse.scout.rt.shared.extension.data.model.fixture.TestDataModel) IExtensionRegistry(org.eclipse.scout.rt.shared.extension.IExtensionRegistry) Test(org.junit.Test)

Example 14 with IDataModelEntity

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);
}
Also used : IDataModelEntity(org.eclipse.scout.rt.shared.data.model.IDataModelEntity) TestDataModel(org.eclipse.scout.rt.shared.extension.data.model.fixture.TestDataModel) IExtensionRegistry(org.eclipse.scout.rt.shared.extension.IExtensionRegistry) Test(org.junit.Test)

Example 15 with IDataModelEntity

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);
}
Also used : IDataModelEntity(org.eclipse.scout.rt.shared.data.model.IDataModelEntity) TestDataModel(org.eclipse.scout.rt.shared.extension.data.model.fixture.TestDataModel) IExtensionRegistry(org.eclipse.scout.rt.shared.extension.IExtensionRegistry) Test(org.junit.Test)

Aggregations

IDataModelEntity (org.eclipse.scout.rt.shared.data.model.IDataModelEntity)15 EntityPath (org.eclipse.scout.rt.shared.data.model.EntityPath)5 TestDataModel (org.eclipse.scout.rt.shared.extension.data.model.fixture.TestDataModel)5 Test (org.junit.Test)5 Order (org.eclipse.scout.rt.platform.Order)4 ConfigOperation (org.eclipse.scout.rt.platform.annotations.ConfigOperation)4 IExtensionRegistry (org.eclipse.scout.rt.shared.extension.IExtensionRegistry)4 LinkedList (java.util.LinkedList)2 ITreeNode (org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode)2 EntityNode (org.eclipse.scout.rt.client.ui.form.fields.composer.node.EntityNode)2 ComposerEntityNodeData (org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerEntityNodeData)2 AttributePath (org.eclipse.scout.rt.shared.data.model.AttributePath)2 IDataModelAttribute (org.eclipse.scout.rt.shared.data.model.IDataModelAttribute)2 ArrayList (java.util.ArrayList)1 EitherOrNode (org.eclipse.scout.rt.client.ui.form.fields.composer.node.EitherOrNode)1 ProcessingException (org.eclipse.scout.rt.platform.exception.ProcessingException)1 ComposerAttributeNodeData (org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerAttributeNodeData)1 AbstractDataModelEntity (org.eclipse.scout.rt.shared.data.model.AbstractDataModelEntity)1 IDataModelAttributeOp (org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp)1 Element (org.w3c.dom.Element)1