Search in sources :

Example 1 with MultiRowHideCommand

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();
}
Also used : FreezeRowCommand(org.eclipse.nebula.widgets.nattable.freeze.command.FreezeRowCommand) MultiRowHideCommand(org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand) ShowAllRowsCommand(org.eclipse.nebula.widgets.nattable.hideshow.command.ShowAllRowsCommand) Test(org.junit.Test)

Example 2 with MultiRowHideCommand

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();
}
Also used : FreezeRowCommand(org.eclipse.nebula.widgets.nattable.freeze.command.FreezeRowCommand) MultiRowHideCommand(org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand) ShowAllRowsCommand(org.eclipse.nebula.widgets.nattable.hideshow.command.ShowAllRowsCommand) Test(org.junit.Test)

Example 3 with MultiRowHideCommand

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();
}
Also used : FreezeRowCommand(org.eclipse.nebula.widgets.nattable.freeze.command.FreezeRowCommand) MultiRowHideCommand(org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand) ShowAllRowsCommand(org.eclipse.nebula.widgets.nattable.hideshow.command.ShowAllRowsCommand) Test(org.junit.Test)

Example 4 with MultiRowHideCommand

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));
}
Also used : MultiRowHideCommand(org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand) Test(org.junit.Test)

Example 5 with MultiRowHideCommand

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());
}
Also used : RowInsertEvent(org.eclipse.nebula.widgets.nattable.layer.event.RowInsertEvent) MultiRowHideCommand(org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand) RowDeleteEvent(org.eclipse.nebula.widgets.nattable.layer.event.RowDeleteEvent) RowReorderCommand(org.eclipse.nebula.widgets.nattable.reorder.command.RowReorderCommand) Test(org.junit.Test)

Aggregations

MultiRowHideCommand (org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand)14 Test (org.junit.Test)12 FreezeRowCommand (org.eclipse.nebula.widgets.nattable.freeze.command.FreezeRowCommand)8 ShowAllRowsCommand (org.eclipse.nebula.widgets.nattable.hideshow.command.ShowAllRowsCommand)8 ArrayList (java.util.ArrayList)1 RowDeleteEvent (org.eclipse.nebula.widgets.nattable.layer.event.RowDeleteEvent)1 RowInsertEvent (org.eclipse.nebula.widgets.nattable.layer.event.RowInsertEvent)1 RowReorderCommand (org.eclipse.nebula.widgets.nattable.reorder.command.RowReorderCommand)1