use of org.eclipse.nebula.widgets.nattable.layer.DataLayer 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);
}
});
}
use of org.eclipse.nebula.widgets.nattable.layer.DataLayer in project nebula.widgets.nattable by eclipse.
the class RowSizeResetCommandTest method testResetAllRegions.
@Test
public void testResetAllRegions() {
DummyGridLayerStack dummyGridLayerStack = new DummyGridLayerStack();
NatTable natTable = new NatTableFixture(dummyGridLayerStack);
assertEquals(20, dummyGridLayerStack.getColumnHeaderDataLayer().getRowHeightByPosition(0));
assertEquals(20, dummyGridLayerStack.getBodyDataLayer().getRowHeightByPosition(2));
((DataLayer) dummyGridLayerStack.getColumnHeaderDataLayer()).setRowHeightByPosition(0, 50);
((DataLayer) dummyGridLayerStack.getBodyDataLayer()).setRowHeightByPosition(2, 50);
assertEquals(50, dummyGridLayerStack.getColumnHeaderDataLayer().getRowHeightByPosition(0));
assertEquals(50, dummyGridLayerStack.getBodyDataLayer().getRowHeightByPosition(2));
natTable.doCommand(new RowHeightResetCommand());
assertEquals(20, dummyGridLayerStack.getColumnHeaderDataLayer().getRowHeightByPosition(0));
assertEquals(20, dummyGridLayerStack.getBodyDataLayer().getRowHeightByPosition(2));
}
use of org.eclipse.nebula.widgets.nattable.layer.DataLayer in project nebula.widgets.nattable by eclipse.
the class RowSizeResetCommandTest method setup.
@Before
public void setup() {
this.dataLayer = new DataLayer(new DummyBodyDataProvider(10, 10));
this.listener = new LayerListenerFixture();
this.dataLayer.addLayerListener(this.listener);
}
use of org.eclipse.nebula.widgets.nattable.layer.DataLayer in project nebula.widgets.nattable by eclipse.
the class ColumnSizeResetCommandTest method testResetAllRegions.
@Test
public void testResetAllRegions() {
DummyGridLayerStack dummyGridLayerStack = new DummyGridLayerStack();
NatTable natTable = new NatTableFixture(dummyGridLayerStack);
assertEquals(40, dummyGridLayerStack.getRowHeaderDataLayer().getColumnWidthByPosition(0));
assertEquals(100, dummyGridLayerStack.getBodyDataLayer().getColumnWidthByPosition(2));
((DataLayer) dummyGridLayerStack.getRowHeaderDataLayer()).setColumnWidthByPosition(0, 100);
((DataLayer) dummyGridLayerStack.getBodyDataLayer()).setColumnWidthByPosition(2, 50);
assertEquals(100, dummyGridLayerStack.getRowHeaderDataLayer().getColumnWidthByPosition(0));
assertEquals(50, dummyGridLayerStack.getBodyDataLayer().getColumnWidthByPosition(2));
natTable.doCommand(new ColumnWidthResetCommand());
assertEquals(40, dummyGridLayerStack.getRowHeaderDataLayer().getColumnWidthByPosition(0));
assertEquals(100, dummyGridLayerStack.getBodyDataLayer().getColumnWidthByPosition(2));
}
use of org.eclipse.nebula.widgets.nattable.layer.DataLayer in project nebula.widgets.nattable by eclipse.
the class ColumnReorderLayerTest method getConfigLabelsByPosition.
@Test
public void getConfigLabelsByPosition() throws Exception {
DataLayer underlyingLayer = new DataLayerFixture();
this.columnReorderLayer = new ColumnReorderLayer(underlyingLayer);
ColumnOverrideLabelAccumulator columnLabelAccumulator = new ColumnOverrideLabelAccumulator(underlyingLayer);
registerCellStyleAccumulators(underlyingLayer, columnLabelAccumulator);
columnLabelAccumulator.registerColumnOverrides(4, "INDEX_4_LABEL");
List<String> labelsForIndex4 = this.columnReorderLayer.getConfigLabelsByPosition(4, 0).getLabels();
assertEquals(2, labelsForIndex4.size());
assertEquals("INDEX_4_LABEL", labelsForIndex4.get(0));
assertEquals("EVEN_BODY", labelsForIndex4.get(1));
// 0 1 2 3 4 - see DataLayerFixture
this.columnReorderLayer.reorderColumnPosition(0, 5);
// Index: 1 2 3 4 0 Width: 100 35 100 80 150
labelsForIndex4 = this.columnReorderLayer.getConfigLabelsByPosition(3, 0).getLabels();
assertEquals(2, labelsForIndex4.size());
assertEquals("INDEX_4_LABEL", labelsForIndex4.get(0));
assertEquals("EVEN_BODY", labelsForIndex4.get(1));
}
Aggregations