use of org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack in project nebula.widgets.nattable by eclipse.
the class RowSizeConfigurationCommandTest method testSetSizeInBodyRegion.
@Test
public void testSetSizeInBodyRegion() {
GridLayer grid = new DummyGridLayerStack();
assertEquals(20, grid.getColumnHeaderLayer().getRowHeightByPosition(0));
assertEquals(20, grid.getBodyLayer().getRowHeightByPosition(0));
assertEquals(20, grid.getBodyLayer().getRowHeightByPosition(9));
grid.doCommand(new RowSizeConfigurationCommand(GridRegion.BODY, 50, false));
assertEquals(20, grid.getColumnHeaderLayer().getRowHeightByPosition(0));
assertEquals(50, grid.getBodyLayer().getRowHeightByPosition(0));
assertEquals(50, grid.getBodyLayer().getRowHeightByPosition(9));
}
use of org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack in project nebula.widgets.nattable by eclipse.
the class RowSizeResetCommandTest method testResetOnlyBody.
@Test
public void testResetOnlyBody() {
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(GridRegion.BODY));
assertEquals(50, dummyGridLayerStack.getColumnHeaderDataLayer().getRowHeightByPosition(0));
assertEquals(20, dummyGridLayerStack.getBodyDataLayer().getRowHeightByPosition(2));
}
use of org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack in project nebula.widgets.nattable by eclipse.
the class ColumnSizeConfigurationCommandTest method testSetSizeInColumnHeaderRegion.
@Test
public void testSetSizeInColumnHeaderRegion() {
GridLayer grid = new DummyGridLayerStack();
assertEquals(40, grid.getRowHeaderLayer().getColumnWidthByPosition(0));
assertEquals(100, grid.getBodyLayer().getColumnWidthByPosition(0));
assertEquals(100, grid.getBodyLayer().getColumnWidthByPosition(9));
grid.doCommand(new ColumnSizeConfigurationCommand(GridRegion.ROW_HEADER, 150, false));
assertEquals(150, grid.getRowHeaderLayer().getColumnWidthByPosition(0));
assertEquals(100, grid.getBodyLayer().getColumnWidthByPosition(0));
assertEquals(100, grid.getBodyLayer().getColumnWidthByPosition(9));
}
use of org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack in project nebula.widgets.nattable by eclipse.
the class ColumnSizeResetCommandTest method testResetOnlyBody.
@Test
public void testResetOnlyBody() {
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(GridRegion.BODY));
assertEquals(100, dummyGridLayerStack.getRowHeaderDataLayer().getColumnWidthByPosition(0));
assertEquals(100, dummyGridLayerStack.getBodyDataLayer().getColumnWidthByPosition(2));
}
use of org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack in project nebula.widgets.nattable by eclipse.
the class MultiColumnResizeCommandTest method testMultiResizeWithDownscaleOnSelection.
@Test
public void testMultiResizeWithDownscaleOnSelection() {
GridLayer gridLayer = new DummyGridLayerStack();
IDpiConverter dpiConverter = new AbstractDpiConverter() {
@Override
protected void readDpiFromDisplay() {
this.dpi = 120;
}
};
gridLayer.doCommand(new ConfigureScalingCommand(dpiConverter, dpiConverter));
setClientAreaProvider(gridLayer);
// select columns
gridLayer.doCommand(new SelectColumnCommand(gridLayer, 3, 1, false, false));
gridLayer.doCommand(new SelectColumnCommand(gridLayer, 4, 1, false, true));
gridLayer.doCommand(new SelectColumnCommand(gridLayer, 5, 1, false, true));
// scaling enabled, therefore default width of 100 pixels is up scaled
// to 125
assertEquals(125, gridLayer.getColumnWidthByPosition(2));
assertEquals(125, gridLayer.getColumnWidthByPosition(3));
assertEquals(125, gridLayer.getColumnWidthByPosition(4));
assertEquals(125, gridLayer.getColumnWidthByPosition(5));
assertEquals(125, gridLayer.getColumnWidthByPosition(6));
// resize one of the selected columns
ColumnResizeCommand columnResizeCommand = new ColumnResizeCommand(gridLayer, 3, 150, true);
gridLayer.doCommand(columnResizeCommand);
// command executed with down scaling enabled, therefore set width 150
// is first down scaled on setting the value and then up scaled to 150
// again on accessing the width
assertEquals(125, gridLayer.getColumnWidthByPosition(2));
assertEquals(150, gridLayer.getColumnWidthByPosition(3));
assertEquals(150, gridLayer.getColumnWidthByPosition(4));
assertEquals(150, gridLayer.getColumnWidthByPosition(5));
assertEquals(125, gridLayer.getColumnWidthByPosition(6));
}
Aggregations