use of org.eclipse.scout.rt.client.ui.basic.tree.ITree in project scout.rt by eclipse.
the class SmartFieldTest method testThrowingLookupCall.
@Test
public void testThrowingLookupCall() {
StyleField f = m_styleField;
f.setBrowseHierarchy(true);
((StyleLookupCall) f.getLookupCall()).allowLookup(false);
m_styleField.getUIFacade().openProposalChooserFromUI("Red", false, false);
waitForProposalResult(IProposalChooser.PROP_STATUS);
@SuppressWarnings("unchecked") TreeProposalChooser<Long> treeProposalChooser = ((TreeProposalChooser<Long>) f.getProposalChooser());
ITree tree = treeProposalChooser.getModel();
ITreeNode rootNode = tree.getRootNode();
assertEquals(0, rootNode.getChildNodes().size());
assertEquals(IStatus.ERROR, treeProposalChooser.getStatus().getSeverity());
}
use of org.eclipse.scout.rt.client.ui.basic.tree.ITree in project scout.rt by eclipse.
the class SmartFieldTest method testHierarchicalBrowse.
@Test
public void testHierarchicalBrowse() {
StyleField f = m_styleField;
f.setBrowseHierarchy(true);
m_styleField.getUIFacade().openProposalChooserFromUI("*", true, false);
waitForProposalResult(IProposalChooser.PROP_SEARCH_RESULT);
// single result
assertTrue(m_styleField.isProposalChooserRegistered());
assertEquals("*", 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());
}
use of org.eclipse.scout.rt.client.ui.basic.tree.ITree in project scout.rt by eclipse.
the class IncrementalTreeBuilderTest method testCreateParentMap_EmptyTree.
@Test
public void testCreateParentMap_EmptyTree() {
ITree tree = createTestTree();
Map<Long, ILookupRow<Long>> parentMap = new IncrementalTreeBuilder<Long>(null).createParentMap(tree);
assertTrue(parentMap.isEmpty());
}
use of org.eclipse.scout.rt.client.ui.basic.tree.ITree in project scout.rt by eclipse.
the class IncrementalTreeBuilderTest method testCreatePaths_Empty.
@Test
public void testCreatePaths_Empty() {
ITree tree = createTestTree();
IncrementalTreeBuilder<Long> builder = new IncrementalTreeBuilder<Long>(null);
ArrayList<ILookupRow<Long>> rows = new ArrayList<>();
List<List<ILookupRow<Long>>> paths = builder.createPaths(rows, tree);
assertTrue(paths.isEmpty());
}
use of org.eclipse.scout.rt.client.ui.basic.tree.ITree in project scout.rt by eclipse.
the class TreeBoxTest method testAutoSelectBehaviorExtended.
/**
* 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 (extended test). {@link AbstractTreeBox#getConfiguredAutoCheckChildNodes} returns true on the
* {@link AutoSelectTreeBox}. Bug 368107 - Check child nodes when parent node is checked
*/
@Test
public void testAutoSelectBehaviorExtended() throws Exception {
AutoSelectTreeBox treeBox = new AutoSelectTreeBox();
treeBox.initField();
ITree tree = treeBox.getTree();
// C-B
ITreeNode node = tree.findNode(9L);
assertNotNull(node);
tree.setNodeChecked(node, true);
Set<Long> valueSet = new HashSet<Long>(treeBox.getValue());
// parent node and 4 childs nodes selected
assertEquals(5, valueSet.size());
// and the selected ones are correct
// C-B
assertEquals(true, valueSet.contains(9L));
// C-B-A
assertEquals(true, valueSet.contains(11L));
// C-B-B
assertEquals(true, valueSet.contains(12L));
// C-B-C
assertEquals(true, valueSet.contains(13L));
// C-B-D
assertEquals(true, valueSet.contains(14L));
// deselected node C-B-B
// C-B-B
node = tree.findNode(12L);
assertNotNull(node);
tree.setNodeChecked(node, false);
valueSet = new HashSet<Long>(treeBox.getValue());
// parent node and all minus one childs nodes selected
assertEquals(4, valueSet.size());
// and the selected ones are correct
// C-B
assertEquals(true, valueSet.contains(9L));
// C-B-A
assertEquals(true, valueSet.contains(11L));
// C-B-C
assertEquals(true, valueSet.contains(13L));
// C-B-D
assertEquals(true, valueSet.contains(14L));
// deselected C-C node
// C-B
node = tree.findNode(9L);
assertNotNull(node);
tree.setNodeChecked(node, false);
// no nodes selected
Set<Long> values = treeBox.getValue();
assertTrue(CollectionUtility.isEmpty(values));
}
Aggregations