use of org.eclipse.nebula.widgets.nattable.layer.LabelStack in project nebula.widgets.nattable by eclipse.
the class BlinkLayerTest method shouldReturnTheBlinkConfigTypeWhenARowIsUpdated.
@Test
public void shouldReturnTheBlinkConfigTypeWhenARowIsUpdated() throws Exception {
this.layerUnderTest.setBlinkDurationInMilis(100);
this.dataList.get(0).setAsk_price(100);
LabelStack blinkLabels = this.layerUnderTest.getConfigLabelsByPosition(6, 0);
// Blink started
assertEquals(1, blinkLabels.getLabels().size());
assertEquals(BLINKING_LABEL, blinkLabels.getLabels().get(0));
// After 50 ms
Thread.sleep(50);
blinkLabels = this.layerUnderTest.getConfigLabelsByPosition(6, 0);
assertEquals(1, blinkLabels.getLabels().size());
// Wait for blink to elapse
Thread.sleep(110);
// run.
while (this.display.readAndDispatch()) ;
blinkLabels = this.layerUnderTest.getConfigLabelsByPosition(6, 0);
assertEquals(0, blinkLabels.getLabels().size());
}
use of org.eclipse.nebula.widgets.nattable.layer.LabelStack in project nebula.widgets.nattable by eclipse.
the class ResizeColumnHideShowLayerTest method testHiddenColumnsHaveSkipSearchLabel.
@Test
public void testHiddenColumnsHaveSkipSearchLabel() {
LabelStack labels = this.hideShowLayer.getConfigLabelsByPosition(1, 0);
assertTrue("LabelStack not empty", labels.getLabels().isEmpty());
this.hideShowLayer.hideColumnPositions(1, 4);
labels = this.hideShowLayer.getConfigLabelsByPosition(1, 0);
assertFalse("LabelStack not empty", labels.getLabels().isEmpty());
assertTrue("skip search label not contained", labels.hasLabel(ISearchStrategy.SKIP_SEARCH_RESULT_LABEL));
this.hideShowLayer.showAllColumns();
labels = this.hideShowLayer.getConfigLabelsByPosition(1, 0);
assertTrue("LabelStack not empty", labels.getLabels().isEmpty());
}
use of org.eclipse.nebula.widgets.nattable.layer.LabelStack in project nebula.widgets.nattable by eclipse.
the class ColumnGroupHeaderLayerTest method testConfigLabelsWithAccumulator.
@Test
public void testConfigLabelsWithAccumulator() {
// set config label accumulator
this.columnGroupLayer.setConfigLabelAccumulator(new IConfigLabelAccumulator() {
@Override
public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) {
if (columnPosition == 0 || columnPosition == 3) {
configLabels.addLabel("custom");
}
}
});
// check expanded column group
LabelStack stack = this.columnGroupLayer.getConfigLabelsByPosition(0, 0);
assertEquals(3, stack.getLabels().size());
assertTrue(stack.hasLabel(GridRegion.COLUMN_GROUP_HEADER));
assertTrue(stack.hasLabel("custom"));
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(3, stack.getLabels().size());
assertTrue(stack.hasLabel(GridRegion.COLUMN_GROUP_HEADER));
assertTrue(stack.hasLabel("custom"));
assertTrue(stack.hasLabel(DefaultColumnGroupHeaderLayerConfiguration.GROUP_COLLAPSED_CONFIG_TYPE));
// check ungrouped
stack = this.columnGroupLayer.getConfigLabelsByPosition(3, 0);
assertEquals(0, stack.getLabels().size());
}
use of org.eclipse.nebula.widgets.nattable.layer.LabelStack in project nebula.widgets.nattable by eclipse.
the class ColumnOverrideLabelAccumulatorTest method testRegisterOverridesCollection.
@Test
public void testRegisterOverridesCollection() {
this.labelAccumulator.registerColumnOverrides(0, TEST_LABEL1);
List<String> labels = new ArrayList<String>();
labels.add(TEST_LABEL2);
labels.add(TEST_LABEL3);
this.labelAccumulator.registerColumnOverrides(0, labels);
LabelStack configLabels = new LabelStack();
this.labelAccumulator.accumulateConfigLabels(configLabels, 0, 0);
Assert.assertEquals(3, configLabels.getLabels().size());
Assert.assertEquals(TEST_LABEL1, configLabels.getLabels().get(0));
Assert.assertEquals(TEST_LABEL2, configLabels.getLabels().get(1));
Assert.assertEquals(TEST_LABEL3, configLabels.getLabels().get(2));
}
use of org.eclipse.nebula.widgets.nattable.layer.LabelStack in project nebula.widgets.nattable by eclipse.
the class ColumnOverrideLabelAccumulatorTest method testRegisterOverridesEllipse.
@Test
public void testRegisterOverridesEllipse() {
this.labelAccumulator.registerColumnOverrides(0, TEST_LABEL1);
this.labelAccumulator.registerColumnOverrides(0, TEST_LABEL2, TEST_LABEL3);
LabelStack configLabels = new LabelStack();
this.labelAccumulator.accumulateConfigLabels(configLabels, 0, 0);
Assert.assertEquals(3, configLabels.getLabels().size());
Assert.assertEquals(TEST_LABEL1, configLabels.getLabels().get(0));
Assert.assertEquals(TEST_LABEL2, configLabels.getLabels().get(1));
Assert.assertEquals(TEST_LABEL3, configLabels.getLabels().get(2));
}
Aggregations