use of org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode in project scout.rt by eclipse.
the class AbstractPageWithNodesTest method testRenameChildPages.
@Test
public void testRenameChildPages() throws Exception {
IDesktop desktop = TestEnvironmentClientSession.get().getDesktop();
desktop.setAvailableOutlines(CollectionUtility.arrayList(new PageWithNodeOutline()));
desktop.setOutline(PageWithNodeOutline.class);
desktop.activateFirstPage();
AbstractPageWithNodes parentPage = (AbstractPageWithNodes) desktop.getOutline().getActivePage();
ITreeNode parentPageNode = desktop.getOutline().getSelectedNode();
ITreeNode childPageNode = parentPageNode.getChildNode(0);
assertEquals("Parent page", parentPageNode.getCell().getText());
assertEquals("Child page", childPageNode.getCell().getText());
// this is the childPages name in the table
assertEquals("Child page", parentPage.getTable().getRow(0).getCell(0).getText());
// update the child node's cell text
childPageNode.getCellForUpdate().setText("my new long text");
assertEquals("my new long text", childPageNode.getCell().getText());
// text must also be changed in the parent's table
assertEquals("my new long text", parentPage.getTable().getRow(0).getCell(0).getText());
// rename again
childPageNode.getCellForUpdate().setText("Child page");
assertEquals("Parent page", parentPageNode.getCell().getText());
assertEquals("Child page", childPageNode.getCell().getText());
assertEquals("Child page", parentPage.getTable().getRow(0).getCell(0).getText());
// rename on table, must be reflected to the tree
parentPage.getTable().getRow(0).getCellForUpdate(0).setText("my new long text");
assertEquals("my new long text", parentPage.getTable().getRow(0).getCell(0).getText());
assertEquals("Parent page", parentPageNode.getCell().getText());
assertEquals("my new long text", childPageNode.getCell().getText());
}
use of org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode in project scout.rt by eclipse.
the class OutlineTreeContextMenuTest method assertRowMenusExistOnTablePageNode.
private static void assertRowMenusExistOnTablePageNode(IOutline outline) throws Exception {
outline.selectFirstNode();
List<IMenu> requiredMenus = resolveMenusOfActiveTablePage(outline, PageWithTableRowMenu.class);
outline.selectNextChildNode();
ITreeNode selectedNode = outline.getSelectedNode();
List<IMenu> menus = selectedNode.getTree().getMenus();
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 testExportEitherOrNode.
@Test
public void testExportEitherOrNode() throws Exception {
// setup field
ITreeNode parentNode = m_composerField.getTree().getRootNode();
EitherOrNode eitherNode = m_composerField.addEitherNode(parentNode, false);
m_composerField.addAdditionalOrNode(eitherNode, false);
// export
m_composerField.exportFormFieldData(m_fieldData);
// verify export
assertEquals(2, m_fieldData.getRootCount());
//
TreeNodeData eitherNodeData = m_fieldData.getRoots().get(0);
assertTrue(eitherNodeData instanceof ComposerEitherOrNodeData);
assertTrue(((ComposerEitherOrNodeData) eitherNodeData).isBeginOfEitherOr());
assertFalse(((ComposerEitherOrNodeData) eitherNodeData).isNegative());
//
TreeNodeData orNodeData = m_fieldData.getRoots().get(1);
assertTrue(orNodeData instanceof ComposerEitherOrNodeData);
assertFalse(((ComposerEitherOrNodeData) orNodeData).isBeginOfEitherOr());
assertFalse(((ComposerEitherOrNodeData) orNodeData).isNegative());
}
use of org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode in project scout.rt by eclipse.
the class SmartFieldTest method testHierarchicalOpenProposal.
@Test
public void testHierarchicalOpenProposal() {
StyleField f = m_styleField;
f.setBrowseHierarchy(true);
f.setValue(10L);
f.getUIFacade().openProposalChooserFromUI("Red", false, true);
waitForProposalResult(IProposalChooser.PROP_SEARCH_RESULT);
// single result
assertTrue(m_styleField.isProposalChooserRegistered());
assertEquals("Red", m_styleField.getDisplayText());
// verifies tree is loaded containing a single node
@SuppressWarnings("unchecked") TreeProposalChooser<Long> treeProposalChooser = (TreeProposalChooser<Long>) f.getProposalChooser();
ITree tree = treeProposalChooser.getModel();
ITreeNode rootNode = tree.getRootNode();
assertEquals(5, rootNode.getChildNodes().size());
assertEquals("Red", rootNode.getChildNode(0).getCell().getText());
// current value should be selected
assertTrue(rootNode.getChildNode(0).isSelectedNode());
}
use of org.eclipse.scout.rt.client.ui.basic.tree.ITreeNode in project scout.rt by eclipse.
the class TreeBoxTest method testAutoSelectBehavior.
/**
* Select a parent node in a tree box with auto check child nodes activated, and check whether this node and all child
* nodes are selected. {@link AbstractTreeBox#getConfiguredAutoCheckChildNodes} returns true on the
* {@link AutoSelectTreeBox}. Bug 368107 - Check child nodes when parent node is checked
*/
@Test
public void testAutoSelectBehavior() throws Exception {
AutoSelectTreeBox treeBox = new AutoSelectTreeBox();
treeBox.initField();
ITree tree = treeBox.getTree();
// A
ITreeNode node = tree.findNode(1L);
assertNotNull(node);
tree.setNodeChecked(node, true);
Set<Long> valueSet = new HashSet<Long>(treeBox.getValue());
// parent node and 3 childs nodes selected
assertEquals(4, valueSet.size());
// and the selected ones are correct
// A
assertEquals(true, valueSet.contains(1L));
// A-A
assertEquals(true, valueSet.contains(5L));
// A-B
assertEquals(true, valueSet.contains(6L));
// A-C
assertEquals(true, valueSet.contains(7L));
}
Aggregations