use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.
the class DefaultBodyLayerStackTest method setup.
@Before
public void setup() {
this.layerStack = new DefaultBodyLayerStack(new DataLayerFixture(10, 5, 100, 20));
this.layerStack.setClientAreaProvider(new IClientAreaProvider() {
@Override
public Rectangle getClientArea() {
return new Rectangle(0, 0, 2000, 250);
}
});
this.layerStack.doCommand(new ClientAreaResizeCommand(new Shell(Display.getDefault(), SWT.V_SCROLL | SWT.H_SCROLL)));
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.
the class ColumnReorderLayerTest method getStartXForReorderedColumn.
@Test
public void getStartXForReorderedColumn() throws Exception {
this.underlyingLayer = new DataLayerFixture();
this.columnReorderLayer = new ColumnReorderLayer(this.underlyingLayer);
// 0 1 2 3 4 - see DataLayerFixture
this.columnReorderLayer.reorderColumnPosition(0, 5);
// Index: 1 2 3 4 0 Width: 100 35 100 80 150
assertEquals(0, this.columnReorderLayer.getStartXOfColumnPosition(0));
assertEquals(100, this.columnReorderLayer.getStartXOfColumnPosition(1));
assertEquals(135, this.columnReorderLayer.getStartXOfColumnPosition(2));
assertEquals(235, this.columnReorderLayer.getStartXOfColumnPosition(3));
assertEquals(315, this.columnReorderLayer.getStartXOfColumnPosition(4));
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.
the class ColumnReorderLayerTest method canHandleColumnReorderCommand.
@Test
public void canHandleColumnReorderCommand() throws Exception {
ColumnReorderLayer reorderLayer = new ColumnReorderLayer(new DataLayerFixture());
ColumnReorderCommand reorderCommand = new ColumnReorderCommand(reorderLayer, 0, 2);
assertTrue(reorderLayer.doCommand(reorderCommand));
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.
the class ColumnReorderLayerTest method getWidthForReorderedColumns.
@Test
public void getWidthForReorderedColumns() throws Exception {
this.underlyingLayer = new DataLayerFixture();
this.columnReorderLayer = new ColumnReorderLayer(this.underlyingLayer);
// 0 1 2 3 4 - see DataLayerFixture
this.columnReorderLayer.reorderColumnPosition(0, 5);
// 1 2 3 4 0
Assert.assertEquals(100, this.columnReorderLayer.getColumnWidthByPosition(0));
Assert.assertEquals(35, this.columnReorderLayer.getColumnWidthByPosition(1));
Assert.assertEquals(100, this.columnReorderLayer.getColumnWidthByPosition(2));
Assert.assertEquals(80, this.columnReorderLayer.getColumnWidthByPosition(3));
Assert.assertEquals(150, this.columnReorderLayer.getColumnWidthByPosition(4));
}
use of org.eclipse.nebula.widgets.nattable.test.fixture.layer.DataLayerFixture in project nebula.widgets.nattable by eclipse.
the class ColumnReorderLayerTest method getWidthForMultipleColumnsReordering.
@SuppressWarnings("boxing")
@Test
public void getWidthForMultipleColumnsReordering() throws Exception {
this.underlyingLayer = new DataLayerFixture();
this.columnReorderLayer = new ColumnReorderLayer(this.underlyingLayer);
// 0 1 2 3 4 - see DataLayerFixture
this.columnReorderLayer.reorderMultipleColumnPositions(Arrays.asList(1, 2), 5);
// 0 3 4 1 2
assertEquals(150, this.columnReorderLayer.getColumnWidthByPosition(0));
assertEquals(100, this.columnReorderLayer.getColumnWidthByPosition(1));
assertEquals(80, this.columnReorderLayer.getColumnWidthByPosition(2));
assertEquals(100, this.columnReorderLayer.getColumnWidthByPosition(3));
assertEquals(35, this.columnReorderLayer.getColumnWidthByPosition(4));
}
Aggregations