Package org.eclipse.nebula.widgets.nattable.columnCategories

Examples of org.eclipse.nebula.widgets.nattable.columnCategories.Node


        this.hiddenEntries = hiddenEntries;
    }

    @Override
    public String getText(Object element) {
        Node node = (Node) element;
        switch (node.getType()) {
            case CATEGORY:
                return node.getData();
            case COLUMN:
                int index = Integer.parseInt(node.getData());
                ColumnEntry columnEntry = ColumnChooserUtils.find(
                        hiddenEntries, index);
                if (ObjectUtils.isNull(columnEntry)) {
                    System.err
                            .println("Column index " + index + " is present " + //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here


    private List<Integer> getColumnIndexesFromTreeNodes() {
        Object[] nodes = ((TreeSelection) 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;
    }
View Full Code Here

    @Before
    public void setup() {
        tree = new Tree();

        Node root = newNode("R");
        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"));
    }
View Full Code Here

                tree.toString());
    }

    @Test
    public void findParent() throws Exception {
        Node found = tree.find("c");
        Assert.assertNotNull(found);
        Assert.assertEquals("R", found.getParent().getData());

        found = tree.find("b3b");
        Assert.assertEquals("b3", found.getParent().getData());
    }
View Full Code Here

        Assert.assertEquals("b3", found.getParent().getData());
    }

    @Test
    public void findElements() throws Exception {
        Node found = tree.find(tree.getRootElement(), "b2");
        Assert.assertNotNull(found);
        Assert.assertEquals("b2", found.getData());

        found = tree.find(tree.getRootElement(), "b3b");
        Assert.assertNotNull(found);
    }
View Full Code Here

        Assert.assertNotNull(found);
    }

    @Test
    public void insertChild() throws Exception {
        Node a = tree.find("a");
        a.addChild(newNode("a1"));
        a.addChild(newNode("a2"));
        Assert.assertEquals(2, a.getNumberOfChildren());
        Assert.assertEquals("{UNKNOWN,a,[a1,a2]}", a.toString());

        a.insertChildAt(1, newNode("a11"));
        Assert.assertEquals(3, a.getNumberOfChildren());
        Assert.assertEquals("{UNKNOWN,a,[a1,a11,a2]}", a.toString());
    }
View Full Code Here

        Assert.assertEquals("{UNKNOWN,a,[a1,a11,a2]}", a.toString());
    }

    @Test
    public void remove() throws Exception {
        Node root = tree.getRootElement();
        assertEquals(3, root.getNumberOfChildren());

        assertTrue(tree.remove(root.getChildren().get(1).getData()));
        assertEquals(2, root.getNumberOfChildren());

        assertFalse(tree.remove("Non Existent Node"));
    }
View Full Code Here

        assertFalse(tree.remove("Non Existent Node"));
    }

    private Node newNode(String data) {
        return new Node(data);
    }
View Full Code Here

    @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);
    }
View Full Code Here

        labelProvider = new ColumnCategoriesLabelProvider(hiddenEntries);
    }

    @Test
    public void shouldReturnLabelForCategoriesFromTheModel() throws Exception {
        assertEquals(CATEGORY_B1_LABEL, labelProvider.getText(new Node(
                CATEGORY_B1_LABEL, Type.CATEGORY)));
        assertEquals(Messages.getString("Unknown"),
                labelProvider.getText(new Node("2")));
    }
View Full Code Here

TOP

Related Classes of org.eclipse.nebula.widgets.nattable.columnCategories.Node

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.