Search in sources :

Example 11 with EitherOrNode

use of org.eclipse.scout.rt.client.ui.form.fields.composer.node.EitherOrNode in project scout.rt by eclipse.

the class ComposerFieldTest method testImportEitherOrNode.

@Test
public void testImportEitherOrNode() throws Exception {
    // setup field data
    ComposerEitherOrNodeData eitherNodeData = new ComposerEitherOrNodeData();
    eitherNodeData.setBeginOfEitherOr(true);
    ComposerEitherOrNodeData orNodeData = new ComposerEitherOrNodeData();
    List<TreeNodeData> rootList = Arrays.<TreeNodeData>asList(eitherNodeData, orNodeData);
    m_fieldData.setRoots(rootList);
    // import
    m_composerField.importFormFieldData(m_fieldData, false);
    // verify import
    ITreeNode rootNode = m_composerField.getTree().getRootNode();
    assertEquals(2, rootNode.getChildNodeCount());
    // 
    ITreeNode eitherNode = rootNode.getChildNode(0);
    assertTrue(eitherNode instanceof EitherOrNode);
    assertTrue(((EitherOrNode) eitherNode).isBeginOfEitherOr());
    assertFalse(((EitherOrNode) eitherNode).isNegative());
    // 
    ITreeNode orNode = rootNode.getChildNode(1);
    assertTrue(orNode instanceof EitherOrNode);
    assertFalse(((EitherOrNode) orNode).isBeginOfEitherOr());
    assertFalse(((EitherOrNode) orNode).isNegative());
}
Also used : EitherOrNode(org.eclipse.scout.rt.client.ui.form.fields.composer.node.EitherOrNode) ITreeNode(org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode) TreeNodeData(org.eclipse.scout.rt.shared.data.form.fields.treefield.TreeNodeData) ComposerEitherOrNodeData(org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerEitherOrNodeData) Test(org.junit.Test)

Aggregations

EitherOrNode (org.eclipse.scout.rt.client.ui.form.fields.composer.node.EitherOrNode)11 ITreeNode (org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode)6 ArrayList (java.util.ArrayList)3 ComposerEitherOrNodeData (org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerEitherOrNodeData)3 TreeNodeData (org.eclipse.scout.rt.shared.data.form.fields.treefield.TreeNodeData)3 Test (org.junit.Test)3 AttributeNode (org.eclipse.scout.rt.client.ui.form.fields.composer.node.AttributeNode)2 EntityNode (org.eclipse.scout.rt.client.ui.form.fields.composer.node.EntityNode)2 Order (org.eclipse.scout.rt.platform.Order)2 ConfigOperation (org.eclipse.scout.rt.platform.annotations.ConfigOperation)2 IDataModelAttributeOp (org.eclipse.scout.rt.shared.data.model.IDataModelAttributeOp)2 Element (org.w3c.dom.Element)2 Iterator (java.util.Iterator)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 AttributePath (org.eclipse.scout.rt.shared.data.model.AttributePath)1 EntityPath (org.eclipse.scout.rt.shared.data.model.EntityPath)1 IDataModelAttribute (org.eclipse.scout.rt.shared.data.model.IDataModelAttribute)1 IDataModelEntity (org.eclipse.scout.rt.shared.data.model.IDataModelEntity)1