use of org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand in project nebula.widgets.nattable by eclipse.
the class CompositeFreezeLayerHideShowTest method testFreezeHideShowRowBothRegionsFreezeAll.
@Test
public void testFreezeHideShowRowBothRegionsFreezeAll() {
// freeze
this.compositeFreezeLayer.doCommand(new FreezeRowCommand(this.compositeFreezeLayer, 1));
assertEquals(0, this.freezeLayer.getColumnCount());
assertEquals(2, this.freezeLayer.getRowCount());
assertEquals(-1, this.freezeLayer.getBottomRightPosition().columnPosition);
assertEquals(1, this.freezeLayer.getBottomRightPosition().rowPosition);
assertEquals(5, this.viewportLayer.getColumnCount());
assertEquals(3, this.viewportLayer.getRowCount());
assertEquals(0, this.viewportLayer.getMinimumOriginColumnPosition());
assertEquals(2, this.viewportLayer.getMinimumOriginRowPosition());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getX());
assertEquals(40, this.viewportLayer.getMinimumOrigin().getY());
// hide
this.compositeFreezeLayer.doCommand(new MultiRowHideCommand(this.compositeFreezeLayer, new int[] { 0, 1, 2 }));
assertEquals(0, this.freezeLayer.getColumnCount());
assertEquals(0, this.freezeLayer.getRowCount());
assertEquals(-1, this.freezeLayer.getBottomRightPosition().columnPosition);
assertEquals(-1, this.freezeLayer.getBottomRightPosition().rowPosition);
assertEquals(5, this.viewportLayer.getColumnCount());
assertEquals(2, this.viewportLayer.getRowCount());
assertEquals(0, this.viewportLayer.getMinimumOriginColumnPosition());
assertEquals(0, this.viewportLayer.getMinimumOriginRowPosition());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getX());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getY());
// show again
this.compositeFreezeLayer.doCommand(new ShowAllRowsCommand());
assertEquals(0, this.freezeLayer.getColumnCount());
assertEquals(0, this.freezeLayer.getRowCount());
assertEquals(-1, this.freezeLayer.getBottomRightPosition().columnPosition);
assertEquals(-1, this.freezeLayer.getBottomRightPosition().rowPosition);
assertEquals(5, this.viewportLayer.getColumnCount());
assertEquals(5, this.viewportLayer.getRowCount());
assertEquals(0, this.viewportLayer.getMinimumOriginColumnPosition());
assertEquals(0, this.viewportLayer.getMinimumOriginRowPosition());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getX());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getY());
reset();
}
use of org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand in project nebula.widgets.nattable by eclipse.
the class CompositeFreezeLayerHideShowTest method testFreezeHideShowRowAllFrozenRegion.
@Test
public void testFreezeHideShowRowAllFrozenRegion() {
// freeze
this.compositeFreezeLayer.doCommand(new FreezeRowCommand(this.compositeFreezeLayer, 1));
assertEquals(0, this.freezeLayer.getColumnCount());
assertEquals(2, this.freezeLayer.getRowCount());
assertEquals(-1, this.freezeLayer.getBottomRightPosition().columnPosition);
assertEquals(1, this.freezeLayer.getBottomRightPosition().rowPosition);
assertEquals(5, this.viewportLayer.getColumnCount());
assertEquals(3, this.viewportLayer.getRowCount());
assertEquals(0, this.viewportLayer.getMinimumOriginColumnPosition());
assertEquals(2, this.viewportLayer.getMinimumOriginRowPosition());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getX());
assertEquals(40, this.viewportLayer.getMinimumOrigin().getY());
// hide
this.compositeFreezeLayer.doCommand(new MultiRowHideCommand(this.compositeFreezeLayer, new int[] { 0, 1 }));
assertEquals(0, this.freezeLayer.getColumnCount());
assertEquals(0, this.freezeLayer.getRowCount());
assertEquals(-1, this.freezeLayer.getBottomRightPosition().columnPosition);
assertEquals(-1, this.freezeLayer.getBottomRightPosition().rowPosition);
assertEquals(5, this.viewportLayer.getColumnCount());
assertEquals(3, this.viewportLayer.getRowCount());
assertEquals(0, this.viewportLayer.getMinimumOriginColumnPosition());
assertEquals(0, this.viewportLayer.getMinimumOriginRowPosition());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getX());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getY());
// show again
this.compositeFreezeLayer.doCommand(new ShowAllRowsCommand());
assertEquals(0, this.freezeLayer.getColumnCount());
assertEquals(0, this.freezeLayer.getRowCount());
assertEquals(-1, this.freezeLayer.getBottomRightPosition().columnPosition);
assertEquals(-1, this.freezeLayer.getBottomRightPosition().rowPosition);
assertEquals(5, this.viewportLayer.getColumnCount());
assertEquals(5, this.viewportLayer.getRowCount());
assertEquals(0, this.viewportLayer.getMinimumOriginColumnPosition());
assertEquals(0, this.viewportLayer.getMinimumOriginRowPosition());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getX());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getY());
reset();
}
use of org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand in project nebula.widgets.nattable by eclipse.
the class HideSelectedRowsTest method shouldHideAllSelectedRows.
@Test
public void shouldHideAllSelectedRows() {
// Select cells and rows
new SelectRowCommandHandler(this.selectionLayer).selectRows(0, Arrays.asList(Integer.valueOf(2)), false, false, 2);
this.selectionLayer.selectCell(0, 1, false, true);
this.selectionLayer.selectCell(4, 4, false, true);
// Hide selection
this.selectionLayer.doCommand(new MultiRowHideCommand(this.selectionLayer, new int[] { 2, 0, 4 }));
// Previously selected rows should be hidden
Assert.assertTrue(this.rowHideShowLayer.isRowIndexHidden(2));
Assert.assertTrue(this.rowHideShowLayer.isRowIndexHidden(0));
Assert.assertTrue(this.rowHideShowLayer.isRowIndexHidden(4));
}
use of org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand in project nebula.widgets.nattable by eclipse.
the class HideSelectedRowsTest method shouldHideSelectedRow.
@Test
public void shouldHideSelectedRow() {
// Select row to hide
new SelectRowCommandHandler(this.selectionLayer).selectRows(0, Arrays.asList(Integer.valueOf(2)), false, false, 2);
// Hide row
this.selectionLayer.doCommand(new MultiRowHideCommand(this.selectionLayer, 2));
// The previously selected row should be hidden
Assert.assertTrue(this.rowHideShowLayer.isRowIndexHidden(2));
Assert.assertEquals(6, this.selectionLayer.getRowCount());
}
Aggregations