Search in sources :

Example 6 with LabelStack

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

the class ColumnOverrideLabelAccumulatorTest method testRegisterOverridesEllipseOnTop.

@Test
public void testRegisterOverridesEllipseOnTop() {
    this.labelAccumulator.registerColumnOverridesOnTop(0, TEST_LABEL1);
    this.labelAccumulator.registerColumnOverridesOnTop(0, TEST_LABEL2, TEST_LABEL3);
    LabelStack configLabels = new LabelStack();
    this.labelAccumulator.accumulateConfigLabels(configLabels, 0, 0);
    Assert.assertEquals(3, configLabels.getLabels().size());
    Assert.assertEquals(TEST_LABEL2, configLabels.getLabels().get(0));
    Assert.assertEquals(TEST_LABEL3, configLabels.getLabels().get(1));
    Assert.assertEquals(TEST_LABEL1, configLabels.getLabels().get(2));
}
Also used : LabelStack(org.eclipse.nebula.widgets.nattable.layer.LabelStack) Test(org.junit.Test)

Example 7 with LabelStack

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

the class ColumnOverrideLabelAccumulatorTest method testRegisterOverridesOnTop.

@Test
public void testRegisterOverridesOnTop() {
    this.labelAccumulator.registerColumnOverridesOnTop(0, TEST_LABEL1);
    this.labelAccumulator.registerColumnOverridesOnTop(0, TEST_LABEL2);
    LabelStack configLabels = new LabelStack();
    this.labelAccumulator.accumulateConfigLabels(configLabels, 0, 0);
    Assert.assertEquals(2, configLabels.getLabels().size());
    Assert.assertEquals(TEST_LABEL2, configLabels.getLabels().get(0));
    Assert.assertEquals(TEST_LABEL1, configLabels.getLabels().get(1));
}
Also used : LabelStack(org.eclipse.nebula.widgets.nattable.layer.LabelStack) Test(org.junit.Test)

Example 8 with LabelStack

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

the class ColumnOverrideLabelAccumulatorTest method testRegisterOverrides.

@Test
public void testRegisterOverrides() {
    this.labelAccumulator.registerColumnOverrides(0, TEST_LABEL1);
    this.labelAccumulator.registerColumnOverrides(0, TEST_LABEL2);
    LabelStack configLabels = new LabelStack();
    this.labelAccumulator.accumulateConfigLabels(configLabels, 0, 0);
    Assert.assertEquals(2, configLabels.getLabels().size());
    Assert.assertEquals(TEST_LABEL1, configLabels.getLabels().get(0));
    Assert.assertEquals(TEST_LABEL2, configLabels.getLabels().get(1));
}
Also used : LabelStack(org.eclipse.nebula.widgets.nattable.layer.LabelStack) Test(org.junit.Test)

Example 9 with LabelStack

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

the class RowSizeConfigurationCommandTest method setup.

@Before
public void setup() {
    this.dataLayer = new DataLayer(new DummyBodyDataProvider(4, 4));
    this.dataLayer.setConfigLabelAccumulator(new IConfigLabelAccumulator() {

        @Override
        public void accumulateConfigLabels(LabelStack configLabels, int columnPosition, int rowPosition) {
            configLabels.addLabel("ROW_" + rowPosition);
        }
    });
}
Also used : DummyBodyDataProvider(org.eclipse.nebula.widgets.nattable.grid.data.DummyBodyDataProvider) DataLayer(org.eclipse.nebula.widgets.nattable.layer.DataLayer) LabelStack(org.eclipse.nebula.widgets.nattable.layer.LabelStack) IConfigLabelAccumulator(org.eclipse.nebula.widgets.nattable.layer.cell.IConfigLabelAccumulator) Before(org.junit.Before)

Example 10 with LabelStack

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

the class SummaryRowIntegrationTest method defaultConfigLabelsAreAdded.

@Test
public void defaultConfigLabelsAreAdded() throws Exception {
    ColumnOverrideLabelAccumulator labelAcc = new ColumnOverrideLabelAccumulator(this.layerStackWithSummary);
    labelAcc.registerColumnOverrides(0, "myLabel");
    ((ViewportLayer) this.layerStackWithSummary).setConfigLabelAccumulator(labelAcc);
    LabelStack configLabels = this.natTable.getConfigLabelsByPosition(0, 4);
    List<String> labels = configLabels.getLabels();
    assertEquals(3, labels.size());
    assertEquals(SummaryRowLayer.DEFAULT_SUMMARY_COLUMN_CONFIG_LABEL_PREFIX + 0, labels.get(0));
    assertEquals(SummaryRowLayer.DEFAULT_SUMMARY_ROW_CONFIG_LABEL, labels.get(1));
    assertEquals("myLabel", labels.get(2));
}
Also used : LabelStack(org.eclipse.nebula.widgets.nattable.layer.LabelStack) ColumnOverrideLabelAccumulator(org.eclipse.nebula.widgets.nattable.layer.cell.ColumnOverrideLabelAccumulator) ViewportLayer(org.eclipse.nebula.widgets.nattable.viewport.ViewportLayer) 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