use of org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand in project nebula.widgets.nattable by eclipse.
the class CompositeFreezeLayerHideShowTest method testFreezeHideShowRowAllViewportRegion.
@Test
public void testFreezeHideShowRowAllViewportRegion() {
// 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[] { 2, 3, 4 }));
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(0, 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());
// show again
this.compositeFreezeLayer.doCommand(new ShowAllRowsCommand());
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());
reset();
}
use of org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand in project nebula.widgets.nattable by eclipse.
the class CompositeFreezeLayerHideShowTest method testFreezeHideShowRowBothRegionsEdge.
@Test
public void testFreezeHideShowRowBothRegionsEdge() {
// 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[] { 1, 2 }));
assertEquals(0, this.freezeLayer.getColumnCount());
assertEquals(1, this.freezeLayer.getRowCount());
assertEquals(-1, this.freezeLayer.getBottomRightPosition().columnPosition);
assertEquals(0, this.freezeLayer.getBottomRightPosition().rowPosition);
assertEquals(5, this.viewportLayer.getColumnCount());
assertEquals(2, this.viewportLayer.getRowCount());
assertEquals(0, this.viewportLayer.getMinimumOriginColumnPosition());
assertEquals(1, this.viewportLayer.getMinimumOriginRowPosition());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getX());
assertEquals(20, this.viewportLayer.getMinimumOrigin().getY());
// show again
this.compositeFreezeLayer.doCommand(new ShowAllRowsCommand());
assertEquals(0, this.freezeLayer.getColumnCount());
assertEquals(1, this.freezeLayer.getRowCount());
assertEquals(-1, this.freezeLayer.getBottomRightPosition().columnPosition);
assertEquals(0, this.freezeLayer.getBottomRightPosition().rowPosition);
assertEquals(5, this.viewportLayer.getColumnCount());
assertEquals(4, this.viewportLayer.getRowCount());
assertEquals(0, this.viewportLayer.getMinimumOriginColumnPosition());
assertEquals(1, this.viewportLayer.getMinimumOriginRowPosition());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getX());
assertEquals(20, 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 testFreezeHideShowRowBothRegionsAll.
@Test
public void testFreezeHideShowRowBothRegionsAll() {
// 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, 3, 4 }));
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(0, 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 shouldAlsoHideRowWhichIsNotSelectedButHasAMouseOverIt.
@Test
public void shouldAlsoHideRowWhichIsNotSelectedButHasAMouseOverIt() {
this.selectionLayer.doCommand(new MultiRowHideCommand(this.selectionLayer, 2));
Assert.assertTrue(this.rowHideShowLayer.isRowIndexHidden(2));
}
use of org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand in project nebula.widgets.nattable by eclipse.
the class RowStructuralChangeEventIntegrationTest method shouldUpdateOnInsertAndDelete.
@Test
public void shouldUpdateOnInsertAndDelete() {
this.contents.add("six");
this.underlyingLayer.fireLayerEvent(new RowInsertEvent(this.underlyingLayer, 5));
this.viewportLayer.doCommand(new RowReorderCommand(this.viewportLayer, 3, 6));
this.viewportLayer.doCommand(new RowReorderCommand(this.viewportLayer, 3, 5));
this.viewportLayer.doCommand(new MultiRowHideCommand(this.viewportLayer, new int[] { 2, 3, 5 }));
assertEquals("[0, 1, 2, 5, 4, 3]", this.rowReorderLayer.getRowIndexOrder().toString());
assertEquals("[2, 3, 5]", this.rowHideShowLayer.getHiddenRowIndexes().toString());
this.contents.add(3, "test");
this.underlyingLayer.fireLayerEvent(new RowInsertEvent(this.underlyingLayer, 3));
assertEquals("[0, 1, 2, 3, 6, 5, 4]", this.rowReorderLayer.getRowIndexOrder().toString());
assertEquals("[2, 4, 6]", this.rowHideShowLayer.getHiddenRowIndexes().toString());
this.contents.remove(3);
this.underlyingLayer.fireLayerEvent(new RowDeleteEvent(this.underlyingLayer, 3));
assertEquals("[0, 1, 2, 5, 4, 3]", this.rowReorderLayer.getRowIndexOrder().toString());
assertEquals("[2, 3, 5]", this.rowHideShowLayer.getHiddenRowIndexes().toString());
}
Aggregations