Search in sources :

Example 1 with ITreeData

use of org.eclipse.nebula.widgets.nattable.tree.ITreeData in project nebula.widgets.nattable by eclipse.

the class ConfigLabelProviderTest method testTreeLabels.

@Test
public void testTreeLabels() {
    SelectionLayer selectionLayer = new SelectionLayer(this.bodyDataLayer);
    TreeLayer treeLayer = new TreeLayer(selectionLayer, new TreeRowModel<Person>(new ITreeData<Person>() {

        @Override
        public String formatDataForDepth(int depth, Person object) {
            return null;
        }

        @Override
        public String formatDataForDepth(int depth, int index) {
            return null;
        }

        @Override
        public int getDepthOfData(Person object) {
            return 0;
        }

        @Override
        public int getDepthOfData(int index) {
            return 0;
        }

        @Override
        public Person getDataAtIndex(int index) {
            return null;
        }

        @Override
        public int indexOf(Person child) {
            return 0;
        }

        @Override
        public boolean hasChildren(Person object) {
            return false;
        }

        @Override
        public boolean hasChildren(int index) {
            return false;
        }

        @Override
        public List<Person> getChildren(Person object) {
            return null;
        }

        @Override
        public List<Person> getChildren(Person object, boolean fullDepth) {
            return null;
        }

        @Override
        public List<Person> getChildren(int index) {
            return null;
        }

        @Override
        public int getElementCount() {
            return 0;
        }

        @Override
        public boolean isValidIndex(int index) {
            return false;
        }
    }));
    Collection<String> labels = treeLayer.getProvidedLabels();
    assertEquals(16, labels.size());
    assertTrue(labels.contains(SelectionStyleLabels.SELECTION_ANCHOR_STYLE));
    assertTrue(labels.contains(SelectionStyleLabels.SELECTION_ANCHOR_GRID_LINE_STYLE));
    assertTrue(labels.contains(SelectionStyleLabels.COLUMN_FULLY_SELECTED_STYLE));
    assertTrue(labels.contains(SelectionStyleLabels.ROW_FULLY_SELECTED_STYLE));
    assertTrue(labels.contains(SelectionStyleLabels.FILL_HANDLE_CELL));
    assertTrue(labels.contains(SelectionStyleLabels.FILL_HANDLE_REGION));
    assertTrue(labels.contains(SelectionStyleLabels.COPY_BORDER_STYLE));
    assertTrue(labels.contains(TreeLayer.TREE_COLUMN_CELL));
    assertTrue(labels.contains(DefaultTreeLayerConfiguration.TREE_LEAF_CONFIG_TYPE));
    assertTrue(labels.contains(DefaultTreeLayerConfiguration.TREE_COLLAPSED_CONFIG_TYPE));
    assertTrue(labels.contains(DefaultTreeLayerConfiguration.TREE_EXPANDED_CONFIG_TYPE));
    assertTrue(labels.contains(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + "0"));
    assertTrue(labels.contains(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + "1"));
    assertTrue(labels.contains(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + "2"));
    assertTrue(labels.contains(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + "3"));
    assertTrue(labels.contains(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + "4"));
}
Also used : ITreeData(org.eclipse.nebula.widgets.nattable.tree.ITreeData) SelectionLayer(org.eclipse.nebula.widgets.nattable.selection.SelectionLayer) TreeLayer(org.eclipse.nebula.widgets.nattable.tree.TreeLayer) Person(org.eclipse.nebula.widgets.nattable.dataset.person.Person) Test(org.junit.Test)

Aggregations

Person (org.eclipse.nebula.widgets.nattable.dataset.person.Person)1 SelectionLayer (org.eclipse.nebula.widgets.nattable.selection.SelectionLayer)1 ITreeData (org.eclipse.nebula.widgets.nattable.tree.ITreeData)1 TreeLayer (org.eclipse.nebula.widgets.nattable.tree.TreeLayer)1 Test (org.junit.Test)1