use of org.eclipse.nebula.widgets.nattable.columnCategories.Node in project nebula.widgets.nattable by eclipse.
the class ColumnCategoriesModelTest method rootMustBeTheFirstNodeSet.
@Test
public void rootMustBeTheFirstNodeSet() throws Exception {
boolean caughtEx = false;
try {
ColumnCategoriesModel model = new ColumnCategoriesModel();
model.addCategory(new Node("1"), "1a");
} catch (Exception e) {
caughtEx = true;
}
assertTrue(caughtEx);
}
use of org.eclipse.nebula.widgets.nattable.columnCategories.Node in project nebula.widgets.nattable by eclipse.
the class TreeTest method findElements.
@Test
public void findElements() throws Exception {
Node found = this.tree.find(this.tree.getRootElement(), "b2");
Assert.assertNotNull(found);
Assert.assertEquals("b2", found.getData());
found = this.tree.find(this.tree.getRootElement(), "b3b");
Assert.assertNotNull(found);
}
use of org.eclipse.nebula.widgets.nattable.columnCategories.Node in project nebula.widgets.nattable by eclipse.
the class TreeTest method setup.
@Before
public void setup() {
this.tree = new Tree();
Node root = newNode("R");
this.tree.setRootElement(root);
root.addChild(newNode("a"));
Node b = newNode("b");
root.addChild(b);
b.addChild(newNode("b1"));
b.addChild(newNode("b2"));
Node b3 = newNode("b3");
b.addChild(b3);
b3.addChild(newNode("b3a"));
b3.addChild(newNode("b3b"));
root.addChild(newNode("c"));
}
use of org.eclipse.nebula.widgets.nattable.columnCategories.Node in project nebula.widgets.nattable by eclipse.
the class TreeTest method remove.
@Test
public void remove() throws Exception {
Node root = this.tree.getRootElement();
assertEquals(3, root.getNumberOfChildren());
assertTrue(this.tree.remove(root.getChildren().get(1).getData()));
assertEquals(2, root.getNumberOfChildren());
assertFalse(this.tree.remove("Non Existent Node"));
}
use of org.eclipse.nebula.widgets.nattable.columnCategories.Node in project nebula.widgets.nattable by eclipse.
the class ColumnCategoriesDialog method getColumnIndexesFromTreeNodes.
/**
* @return selected columns index(s) from the tree viewer
*/
private List<Integer> getColumnIndexesFromTreeNodes() {
Object[] nodes = ((TreeSelection) this.treeViewer.getSelection()).toArray();
List<Integer> indexes = new ArrayList<Integer>();
for (Object object : nodes) {
Node node = (Node) object;
if (Type.COLUMN == node.getType()) {
indexes.add(Integer.parseInt(node.getData()));
}
}
return indexes;
}
Aggregations