Search in sources :

Example 6 with TreeNodeData

use of org.eclipse.scout.rt.shared.data.form.fields.treefield.TreeNodeData 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

TreeNodeData (org.eclipse.scout.rt.shared.data.form.fields.treefield.TreeNodeData)6 ComposerEitherOrNodeData (org.eclipse.scout.rt.shared.data.form.fields.composer.ComposerEitherOrNodeData)4 ArrayList (java.util.ArrayList)3 ITreeNode (org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode)3 EitherOrNode (org.eclipse.scout.rt.client.ui.form.fields.composer.node.EitherOrNode)3 Test (org.junit.Test)3 List (java.util.List)1