Search in sources :

Example 1 with LabelStack

use of org.eclipse.nebula.widgets.nattable.layer.LabelStack in project nebula.widgets.nattable by eclipse.

the class BlinkLayerTest method layerStackShouldUpdate.

@Test
public void layerStackShouldUpdate() throws Exception {
    // add label accumulator to DataLayer
    this.dataLayer.setConfigLabelAccumulator(new IConfigLabelAccumulator() {

        @Override
        public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) {
            configLabels.addLabel(TEST_LABEL);
        }
    });
    this.layerUnderTest.setBlinkDurationInMilis(100);
    this.dataList.get(0).setAsk_price(100);
    LabelStack blinkLabels = this.layerUnderTest.getConfigLabelsByPosition(6, 0);
    // Blink started
    assertEquals(2, blinkLabels.getLabels().size());
    assertEquals(BLINKING_LABEL, blinkLabels.getLabels().get(0));
    assertEquals(TEST_LABEL, blinkLabels.getLabels().get(1));
    // After 50 ms
    Thread.sleep(50);
    blinkLabels = this.layerUnderTest.getConfigLabelsByPosition(6, 0);
    assertEquals(2, blinkLabels.getLabels().size());
    // Wait for blink to elapse
    Thread.sleep(110);
    // run.
    while (this.display.readAndDispatch()) ;
    blinkLabels = this.layerUnderTest.getConfigLabelsByPosition(6, 0);
    assertEquals(1, blinkLabels.getLabels().size());
    assertEquals(TEST_LABEL, blinkLabels.getLabels().get(0));
}
Also used : LabelStack(org.eclipse.nebula.widgets.nattable.layer.LabelStack) IConfigLabelAccumulator(org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator) Test(org.junit.Test)

Example 2 with LabelStack

use of org.eclipse.nebula.widgets.nattable.layer.LabelStack in project nebula.widgets.nattable by eclipse.

the class HierarchicalTreeLayerTest method testConfigLabelsByPosition.

@Test
public void testConfigLabelsByPosition() {
    LabelStack stack = this.treeLayer.getConfigLabelsByPosition(0, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(HierarchicalTreeLayer.LEVEL_HEADER_CELL));
    stack = this.treeLayer.getConfigLabelsByPosition(1, 0);
    assertEquals(4, stack.getLabels().size());
    assertTrue(stack.hasLabel(TreeLayer.TREE_COLUMN_CELL));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + 0));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_EXPANDED_CONFIG_TYPE));
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 0));
    stack = this.treeLayer.getConfigLabelsByPosition(2, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 1));
    stack = this.treeLayer.getConfigLabelsByPosition(3, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(HierarchicalTreeLayer.LEVEL_HEADER_CELL));
    stack = this.treeLayer.getConfigLabelsByPosition(4, 0);
    assertEquals(4, stack.getLabels().size());
    assertTrue(stack.hasLabel(TreeLayer.TREE_COLUMN_CELL));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + 0));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_EXPANDED_CONFIG_TYPE));
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 2));
    stack = this.treeLayer.getConfigLabelsByPosition(5, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 3));
    stack = this.treeLayer.getConfigLabelsByPosition(6, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(HierarchicalTreeLayer.LEVEL_HEADER_CELL));
    stack = this.treeLayer.getConfigLabelsByPosition(7, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 4));
    stack = this.treeLayer.getConfigLabelsByPosition(8, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 5));
    this.treeLayer.setShowTreeLevelHeader(false);
    stack = this.treeLayer.getConfigLabelsByPosition(0, 0);
    assertEquals(4, stack.getLabels().size());
    assertTrue(stack.hasLabel(TreeLayer.TREE_COLUMN_CELL));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + 0));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_EXPANDED_CONFIG_TYPE));
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 0));
    stack = this.treeLayer.getConfigLabelsByPosition(1, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 1));
    stack = this.treeLayer.getConfigLabelsByPosition(2, 0);
    assertEquals(4, stack.getLabels().size());
    assertTrue(stack.hasLabel(TreeLayer.TREE_COLUMN_CELL));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + 0));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_EXPANDED_CONFIG_TYPE));
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 2));
    stack = this.treeLayer.getConfigLabelsByPosition(3, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 3));
    stack = this.treeLayer.getConfigLabelsByPosition(4, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 4));
    stack = this.treeLayer.getConfigLabelsByPosition(5, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 5));
}
Also used : LabelStack(org.eclipse.nebula.widgets.nattable.layer.LabelStack) Test(org.junit.Test)

Example 3 with LabelStack

use of org.eclipse.nebula.widgets.nattable.layer.LabelStack in project nebula.widgets.nattable by eclipse.

the class HierarchicalTreeLayerTest method testExpandCollapseConfigLabelsByPosition.

@Test
public void testExpandCollapseConfigLabelsByPosition() {
    LabelStack stack = this.treeLayer.getConfigLabelsByPosition(1, 0);
    assertEquals(4, stack.getLabels().size());
    assertTrue(stack.hasLabel(TreeLayer.TREE_COLUMN_CELL));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + 0));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_EXPANDED_CONFIG_TYPE));
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 0));
    // collapse first level - note that this is done by index
    this.treeLayer.expandOrCollapse(0, 0);
    stack = this.treeLayer.getConfigLabelsByPosition(1, 0);
    assertEquals(4, stack.getLabels().size());
    assertTrue(stack.hasLabel(TreeLayer.TREE_COLUMN_CELL));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + 0));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_COLLAPSED_CONFIG_TYPE));
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 0));
    // expand first level again
    this.treeLayer.expandOrCollapse(0, 0);
    stack = this.treeLayer.getConfigLabelsByPosition(4, 0);
    assertEquals(4, stack.getLabels().size());
    assertTrue(stack.hasLabel(TreeLayer.TREE_COLUMN_CELL));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + 0));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_EXPANDED_CONFIG_TYPE));
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 2));
    // collapse second level
    this.treeLayer.expandOrCollapse(2, 0);
    stack = this.treeLayer.getConfigLabelsByPosition(4, 0);
    assertEquals(4, stack.getLabels().size());
    assertTrue(stack.hasLabel(TreeLayer.TREE_COLUMN_CELL));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + 0));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_COLLAPSED_CONFIG_TYPE));
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 2));
    // expand second level again
    this.treeLayer.expandOrCollapse(2, 0);
    stack = this.treeLayer.getConfigLabelsByPosition(5, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 3));
    stack = this.treeLayer.getConfigLabelsByPosition(6, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(HierarchicalTreeLayer.LEVEL_HEADER_CELL));
    stack = this.treeLayer.getConfigLabelsByPosition(7, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 4));
    stack = this.treeLayer.getConfigLabelsByPosition(8, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 5));
    this.treeLayer.setShowTreeLevelHeader(false);
    stack = this.treeLayer.getConfigLabelsByPosition(0, 0);
    assertEquals(4, stack.getLabels().size());
    assertTrue(stack.hasLabel(TreeLayer.TREE_COLUMN_CELL));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + 0));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_EXPANDED_CONFIG_TYPE));
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 0));
    // collapse first level
    this.treeLayer.expandOrCollapse(0, 0);
    stack = this.treeLayer.getConfigLabelsByPosition(0, 0);
    assertEquals(4, stack.getLabels().size());
    assertTrue(stack.hasLabel(TreeLayer.TREE_COLUMN_CELL));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + 0));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_COLLAPSED_CONFIG_TYPE));
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 0));
    // expand first level again
    this.treeLayer.expandOrCollapse(0, 0);
    stack = this.treeLayer.getConfigLabelsByPosition(2, 0);
    assertEquals(4, stack.getLabels().size());
    assertTrue(stack.hasLabel(TreeLayer.TREE_COLUMN_CELL));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + 0));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_EXPANDED_CONFIG_TYPE));
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 2));
    // collapse second level
    this.treeLayer.expandOrCollapse(2, 0);
    stack = this.treeLayer.getConfigLabelsByPosition(2, 0);
    assertEquals(4, stack.getLabels().size());
    assertTrue(stack.hasLabel(TreeLayer.TREE_COLUMN_CELL));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + 0));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_COLLAPSED_CONFIG_TYPE));
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 2));
}
Also used : LabelStack(org.eclipse.nebula.widgets.nattable.layer.LabelStack) Test(org.junit.Test)

Example 4 with LabelStack

use of org.eclipse.nebula.widgets.nattable.layer.LabelStack in project nebula.widgets.nattable by eclipse.

the class HierarchicalTreeLayerTest method testExpandCollapseConfigLabelsByPositionForChildColumns.

@Test
public void testExpandCollapseConfigLabelsByPositionForChildColumns() {
    // collapse first level - note that this is done by index
    this.treeLayer.expandOrCollapse(0, 0);
    LabelStack stack = this.treeLayer.getConfigLabelsByPosition(1, 0);
    assertEquals(4, stack.getLabels().size());
    assertTrue(stack.hasLabel(TreeLayer.TREE_COLUMN_CELL));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + 0));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_COLLAPSED_CONFIG_TYPE));
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 0));
    stack = this.treeLayer.getConfigLabelsByPosition(2, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 1));
    stack = this.treeLayer.getConfigLabelsByPosition(3, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(HierarchicalTreeLayer.LEVEL_HEADER_CELL));
    stack = this.treeLayer.getConfigLabelsByPosition(4, 0);
    assertEquals(2, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 2));
    assertTrue(stack.hasLabel(HierarchicalTreeLayer.COLLAPSED_CHILD));
    stack = this.treeLayer.getConfigLabelsByPosition(5, 0);
    assertEquals(2, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 3));
    assertTrue(stack.hasLabel(HierarchicalTreeLayer.COLLAPSED_CHILD));
    stack = this.treeLayer.getConfigLabelsByPosition(6, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(HierarchicalTreeLayer.LEVEL_HEADER_CELL));
    stack = this.treeLayer.getConfigLabelsByPosition(7, 0);
    assertEquals(2, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 4));
    assertTrue(stack.hasLabel(HierarchicalTreeLayer.COLLAPSED_CHILD));
    stack = this.treeLayer.getConfigLabelsByPosition(8, 0);
    assertEquals(2, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 5));
    assertTrue(stack.hasLabel(HierarchicalTreeLayer.COLLAPSED_CHILD));
    // expand first level again
    this.treeLayer.expandOrCollapse(0, 0);
    // collapse second level
    this.treeLayer.expandOrCollapse(2, 0);
    stack = this.treeLayer.getConfigLabelsByPosition(0, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(HierarchicalTreeLayer.LEVEL_HEADER_CELL));
    stack = this.treeLayer.getConfigLabelsByPosition(1, 0);
    assertEquals(4, stack.getLabels().size());
    assertTrue(stack.hasLabel(TreeLayer.TREE_COLUMN_CELL));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + 0));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_EXPANDED_CONFIG_TYPE));
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 0));
    stack = this.treeLayer.getConfigLabelsByPosition(2, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 1));
    stack = this.treeLayer.getConfigLabelsByPosition(3, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(HierarchicalTreeLayer.LEVEL_HEADER_CELL));
    stack = this.treeLayer.getConfigLabelsByPosition(4, 0);
    assertEquals(4, stack.getLabels().size());
    assertTrue(stack.hasLabel(TreeLayer.TREE_COLUMN_CELL));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + 0));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_COLLAPSED_CONFIG_TYPE));
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 2));
    stack = this.treeLayer.getConfigLabelsByPosition(5, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 3));
    stack = this.treeLayer.getConfigLabelsByPosition(6, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(HierarchicalTreeLayer.LEVEL_HEADER_CELL));
    stack = this.treeLayer.getConfigLabelsByPosition(7, 0);
    assertEquals(2, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 4));
    assertTrue(stack.hasLabel(HierarchicalTreeLayer.COLLAPSED_CHILD));
    stack = this.treeLayer.getConfigLabelsByPosition(8, 0);
    assertEquals(2, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 5));
    assertTrue(stack.hasLabel(HierarchicalTreeLayer.COLLAPSED_CHILD));
    // expand second level again
    this.treeLayer.expandOrCollapse(2, 0);
    // disable handle collapsed children, collapse first level, check
    this.treeLayer.setHandleCollapsedChildren(false);
    // collapse first level
    this.treeLayer.expandOrCollapse(0, 0);
    stack = this.treeLayer.getConfigLabelsByPosition(0, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(HierarchicalTreeLayer.LEVEL_HEADER_CELL));
    stack = this.treeLayer.getConfigLabelsByPosition(1, 0);
    assertEquals(4, stack.getLabels().size());
    assertTrue(stack.hasLabel(TreeLayer.TREE_COLUMN_CELL));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + 0));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_COLLAPSED_CONFIG_TYPE));
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 0));
    stack = this.treeLayer.getConfigLabelsByPosition(2, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 1));
    stack = this.treeLayer.getConfigLabelsByPosition(3, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(HierarchicalTreeLayer.LEVEL_HEADER_CELL));
    stack = this.treeLayer.getConfigLabelsByPosition(4, 0);
    assertEquals(4, stack.getLabels().size());
    assertTrue(stack.hasLabel(TreeLayer.TREE_COLUMN_CELL));
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_DEPTH_CONFIG_TYPE + 0));
    // special situation
    // the parent is collapsed but we show the data of the child level
    // in that case we can not show the expand/collapse of the child,
    // because the parent is collapsed
    assertTrue(stack.hasLabel(DefaultTreeLayerConfiguration.TREE_LEAF_CONFIG_TYPE));
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 2));
    stack = this.treeLayer.getConfigLabelsByPosition(5, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 3));
    stack = this.treeLayer.getConfigLabelsByPosition(6, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(HierarchicalTreeLayer.LEVEL_HEADER_CELL));
    stack = this.treeLayer.getConfigLabelsByPosition(7, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 4));
    stack = this.treeLayer.getConfigLabelsByPosition(8, 0);
    assertEquals(1, stack.getLabels().size());
    assertTrue(stack.hasLabel(ColumnLabelAccumulator.COLUMN_LABEL_PREFIX + 5));
}
Also used : LabelStack(org.eclipse.nebula.widgets.nattable.layer.LabelStack) Test(org.junit.Test)

Example 5 with LabelStack

use of org.eclipse.nebula.widgets.nattable.layer.LabelStack in project nebula.widgets.nattable by eclipse.

the class ColumnGroupHeaderLayerTest method testConfigLabels.

@Test
public void testConfigLabels() {
    // check expanded column group
    LabelStack stack = this.columnGroupLayer.getConfigLabelsByPosition(0, 0);
    assertEquals(2, stack.getLabels().size());
    assertTrue(stack.hasLabel(GridRegion.COLUMN_GROUP_HEADER));
    assertTrue(stack.hasLabel(DefaultColumnGroupHeaderLayerConfiguration.GROUP_EXPANDED_CONFIG_TYPE));
    // check collapsed column group
    this.model.getColumnGroupByIndex(0).setCollapsed(true);
    stack = this.columnGroupLayer.getConfigLabelsByPosition(0, 0);
    assertEquals(2, stack.getLabels().size());
    assertTrue(stack.hasLabel(GridRegion.COLUMN_GROUP_HEADER));
    assertTrue(stack.hasLabel(DefaultColumnGroupHeaderLayerConfiguration.GROUP_COLLAPSED_CONFIG_TYPE));
    // check ungrouped
    stack = this.columnGroupLayer.getConfigLabelsByPosition(3, 0);
    assertEquals(0, stack.getLabels().size());
}
Also used : LabelStack(org.eclipse.nebula.widgets.nattable.layer.LabelStack) Test(org.junit.Test)

Aggregations

LabelStack (org.eclipse.nebula.widgets.nattable.layer.LabelStack)80 Test (org.junit.Test)30 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)14 ColumnHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.ColumnHeaderLayer)13 DataLayer (org.eclipse.nebula.widgets.nattable.layer.DataLayer)11 IDataProvider (org.eclipse.nebula.widgets.nattable.data.IDataProvider)10 DefaultColumnHeaderDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultColumnHeaderDataProvider)10 HashMap (java.util.HashMap)9 DefaultNatTableStyleConfiguration (org.eclipse.nebula.widgets.nattable.config.DefaultNatTableStyleConfiguration)9 RowHeaderLayer (org.eclipse.nebula.widgets.nattable.grid.layer.RowHeaderLayer)9 ILayer (org.eclipse.nebula.widgets.nattable.layer.ILayer)9 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)9 SelectionEvent (org.eclipse.swt.events.SelectionEvent)9 GridLayout (org.eclipse.swt.layout.GridLayout)9 Composite (org.eclipse.swt.widgets.Composite)9 AbstractRegistryConfiguration (org.eclipse.nebula.widgets.nattable.config.AbstractRegistryConfiguration)8 ConfigRegistry (org.eclipse.nebula.widgets.nattable.config.ConfigRegistry)8 IConfigRegistry (org.eclipse.nebula.widgets.nattable.config.IConfigRegistry)8 DefaultCornerDataProvider (org.eclipse.nebula.widgets.nattable.grid.data.DefaultCornerDataProvider)8 CornerLayer (org.eclipse.nebula.widgets.nattable.grid.layer.CornerLayer)8