use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.
the class MultiColumnResizeCommandTest method getColumnWidthWhenTheColumnPositionsHaveBeenConverted.
@Test
public void getColumnWidthWhenTheColumnPositionsHaveBeenConverted() {
DataLayerFixture dataLayer = new DataLayerFixture();
// Indexes re-ordered: 4 1 0 2 3
ColumnReorderLayer reorderLayerFixture = new ColumnReorderLayerFixture(dataLayer);
MultiColumnResizeCommand resizeCommand = new MultiColumnResizeCommand(reorderLayerFixture, new int[] { 1, 2 }, new int[] { 100, 150 });
reorderLayerFixture.doCommand(resizeCommand);
// As the Commands goes down the stack - positions might get converted
// to entirely different values.
assertEquals(-1, resizeCommand.getCommonColumnWidth());
assertEquals(-1, resizeCommand.getColumnWidth(5));
assertEquals(-1, resizeCommand.getColumnWidth(12));
assertEquals(100, resizeCommand.getColumnWidth(1));
assertEquals(150, resizeCommand.getColumnWidth(0));
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture 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));
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.
the class ColumnReorderLayerTest method commandPassedOnToParentIfCannotBeHandled.
@Test
public void commandPassedOnToParentIfCannotBeHandled() throws Exception {
ColumnReorderLayer reorderLayer = new ColumnReorderLayer(new DataLayerFixture());
assertFalse(reorderLayer.doCommand(new LayerCommandFixture()));
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.
the class RowReorderLayerTest method getHeightForMultipleRowsReordering.
@SuppressWarnings("boxing")
@Test
public void getHeightForMultipleRowsReordering() throws Exception {
this.underlyingLayer = new DataLayerFixture();
this.rowReorderLayer = new RowReorderLayer(this.underlyingLayer);
// 0 1 2 3 4 - see DataLayerFixture
this.rowReorderLayer.reorderMultipleRowPositions(Arrays.asList(1, 2), 7);
// 0 3 4 1 2
assertEquals(40, this.rowReorderLayer.getRowHeightByPosition(0));
assertEquals(40, this.rowReorderLayer.getRowHeightByPosition(1));
assertEquals(50, this.rowReorderLayer.getRowHeightByPosition(2));
assertEquals(40, this.rowReorderLayer.getRowHeightByPosition(3));
assertEquals(100, this.rowReorderLayer.getRowHeightByPosition(4));
assertEquals(70, this.rowReorderLayer.getRowHeightByPosition(5));
assertEquals(25, this.rowReorderLayer.getRowHeightByPosition(6));
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.
the class RowReorderLayerTest method getHeightForReorderedRows.
@Test
public void getHeightForReorderedRows() throws Exception {
this.underlyingLayer = new DataLayerFixture();
this.rowReorderLayer = new RowReorderLayer(this.underlyingLayer);
// 0 1 2 3 4 - see DataLayerFixture
this.rowReorderLayer.reorderRowPosition(0, 7);
// 1 2 3 4 0
Assert.assertEquals(70, this.rowReorderLayer.getRowHeightByPosition(0));
Assert.assertEquals(25, this.rowReorderLayer.getRowHeightByPosition(1));
Assert.assertEquals(40, this.rowReorderLayer.getRowHeightByPosition(2));
Assert.assertEquals(50, this.rowReorderLayer.getRowHeightByPosition(3));
Assert.assertEquals(40, this.rowReorderLayer.getRowHeightByPosition(4));
Assert.assertEquals(100, this.rowReorderLayer.getRowHeightByPosition(5));
Assert.assertEquals(40, this.rowReorderLayer.getRowHeightByPosition(6));
}
Aggregations