use of org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer in project nebula.widgets.nattable by eclipse.
the class GridLayerTest method initRowHeaderHeight.
@Test
public void initRowHeaderHeight() throws Exception {
GridLayer gridLayer = new GridLayerFixture();
gridLayer.doCommand(new InitializeClientAreaCommandFixture());
ILayer rowHeader = gridLayer.getRowHeaderLayer();
// Only visible rows are counted
Assert.assertEquals(100, rowHeader.getHeight());
Assert.assertEquals(40, rowHeader.getWidth());
}
use of org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer in project nebula.widgets.nattable by eclipse.
the class RowSizeConfigurationCommandTest method testSetSizeInColumnHeaderRegion.
@Test
public void testSetSizeInColumnHeaderRegion() {
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.COLUMN_HEADER, 50, false));
assertEquals(50, grid.getColumnHeaderLayer().getRowHeightByPosition(0));
assertEquals(20, grid.getBodyLayer().getRowHeightByPosition(0));
assertEquals(20, grid.getBodyLayer().getRowHeightByPosition(9));
}
use of org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer 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.grid.layer.GridLayer in project nebula.widgets.nattable by eclipse.
the class AutoResizeColumnsTest method shouldAutoResizeCorrectlyIfMultipleColumnsAreSelected.
/**
* Scenario: Multiple columns are selected but a non selected column is auto
* resized.
*/
@Test
public void shouldAutoResizeCorrectlyIfMultipleColumnsAreSelected() throws Exception {
GridLayer gridLayer = new DefaultGridLayer(RowDataListFixture.getList(), RowDataListFixture.getPropertyNames(), RowDataListFixture.getPropertyToLabelMap());
setClientAreaProvider(gridLayer);
// Resize grid column 1, 2
gridLayer.doCommand(new ColumnResizeCommand(gridLayer, 1, 10));
gridLayer.doCommand(new ColumnResizeCommand(gridLayer, 2, 10));
assertEquals(10, gridLayer.getColumnWidthByPosition(1));
assertEquals(10, gridLayer.getColumnWidthByPosition(2));
// Fully select columns 1, 2
SelectionLayer selectionLayer = ((DefaultBodyLayerStack) gridLayer.getBodyLayer()).getSelectionLayer();
selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 0, 0, false, false));
selectionLayer.doCommand(new SelectColumnCommand(selectionLayer, 1, 0, true, false));
assertEquals(2, selectionLayer.getFullySelectedColumnPositions().length);
// Resize grid column 5
gridLayer.doCommand(new ColumnResizeCommand(gridLayer, 5, 10));
assertEquals(10, gridLayer.getColumnWidthByPosition(5));
// Auto resize column 5
InitializeAutoResizeColumnsCommand command = new InitializeAutoResizeColumnsCommand(gridLayer, 5, this.configRegistry, this.gcFactory);
gridLayer.doCommand(command);
// Columns 1 and 2 should not be resized
assertEquals(10, gridLayer.getColumnWidthByPosition(1));
assertEquals(10, gridLayer.getColumnWidthByPosition(2));
assertTrue(gridLayer.getColumnWidthByPosition(5) > 10);
}
use of org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer 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));
}
Aggregations