use of org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode in project scout.rt by eclipse.
the class OutlineTreeContextMenuTest method assertEmptySpaceMenusExistOnTablePageParent.
private static void assertEmptySpaceMenusExistOnTablePageParent(IOutline outline) throws Exception {
outline.selectFirstNode();
ITreeNode selectedNode = outline.getSelectedNode();
List<IMenu> menus = selectedNode.getTree().getMenus();
List<IMenu> requiredMenus = resolveMenusOfActiveTablePage(outline, PageWithTableEmptySpaceMenu.class, PageWithTableEmptySpace2Menu.class);
assertTrue(OutlineTreeContextMenuNestedPageWithTablesTest.containsAllMenus(menus, requiredMenus));
assertEquals(OutlineTreeContextMenuNestedPageWithTablesTest.sizeMenuListWithoutSeparators(menus), requiredMenus.size());
}
use of org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode in project scout.rt by eclipse.
the class ComposerFieldTest method testImportEitherOrOrNode.
@Test
public void testImportEitherOrOrNode() throws Exception {
// setup field data
ComposerEitherOrNodeData eitherNodeData = new ComposerEitherOrNodeData();
eitherNodeData.setBeginOfEitherOr(true);
ComposerEitherOrNodeData or1NodeData = new ComposerEitherOrNodeData();
ComposerEitherOrNodeData or2NodeData = new ComposerEitherOrNodeData();
List<TreeNodeData> rootList = Arrays.<TreeNodeData>asList(eitherNodeData, or1NodeData, or2NodeData);
m_fieldData.setRoots(rootList);
// import
m_composerField.importFormFieldData(m_fieldData, false);
// verify import
ITreeNode rootNode = m_composerField.getTree().getRootNode();
assertEquals(3, rootNode.getChildNodeCount());
//
ITreeNode eitherNode = rootNode.getChildNode(0);
assertTrue(eitherNode instanceof EitherOrNode);
assertTrue(((EitherOrNode) eitherNode).isBeginOfEitherOr());
assertFalse(((EitherOrNode) eitherNode).isNegative());
//
ITreeNode or1Node = rootNode.getChildNode(1);
assertTrue(or1Node instanceof EitherOrNode);
assertFalse(((EitherOrNode) or1Node).isBeginOfEitherOr());
assertFalse(((EitherOrNode) or1Node).isNegative());
//
ITreeNode or2Node = rootNode.getChildNode(2);
assertTrue(or2Node instanceof EitherOrNode);
assertFalse(((EitherOrNode) or2Node).isBeginOfEitherOr());
assertFalse(((EitherOrNode) or2Node).isNegative());
}
use of org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode 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());
}
use of org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode in project scout.rt by eclipse.
the class AbstractDesktopTest method prepareMockDesktopWithOutline.
private void prepareMockDesktopWithOutline() {
ITreeNode node = Mockito.mock(ITreeNode.class);
Mockito.when(node.getChildNodes()).thenReturn(Collections.<ITreeNode>emptyList());
m_outline = Mockito.mock(IOutline.class);
Mockito.when(m_outline.getActivePage()).thenReturn(null);
Mockito.when(m_outline.getRootNode()).thenReturn(node);
Mockito.when(m_outline.createDisplayParentRunContext()).thenReturn(ClientRunContexts.copyCurrent().withOutline(m_outline, true));
m_desktop = new AbstractDesktop(false) {
@Override
public List<IOutline> getAvailableOutlines() {
return Collections.singletonList(m_outline);
}
};
}
use of org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode in project scout.rt by eclipse.
the class JsonTreeTest method testChildNodeDisposal.
@Test
public void testChildNodeDisposal() throws JSONException {
List<ITreeNode> nodes = new ArrayList<ITreeNode>();
nodes.add(new TreeNode());
nodes.add(new TreeNode());
nodes.add(new TreeNode());
TreeNode child0 = new TreeNode();
TreeNode child1 = new TreeNode();
ITree tree = createTree(nodes);
tree.addChildNode(nodes.get(0), child0);
tree.addChildNode(nodes.get(0), child1);
JsonTree<ITree> jsonTree = m_uiSession.createJsonAdapter(tree, null);
String child0Id = jsonTree.getOrCreateNodeId(child0);
assertNotNull(child0Id);
assertNotNull(jsonTree.optTreeNodeForNodeId(child0Id));
assertEquals(nodes.get(0), jsonTree.getParentNode(child0));
assertEquals(2, jsonTree.getChildNodes(nodes.get(0)).size());
tree.removeNode(child0);
JsonTestUtility.processBufferedEvents(m_uiSession);
assertNull(jsonTree.optNodeId(child0));
assertNull(jsonTree.optTreeNodeForNodeId(child0Id));
assertNull(jsonTree.getParentNode(child0));
assertEquals(1, jsonTree.getChildNodes(nodes.get(0)).size());
}
Aggregations