Search in sources :

Example 1 with ShowAllRowsCommand

use of org.eclipse.nebula.widgets.nattable.hideshow.command.ShowAllRowsCommand 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 ShowAllRowsCommand

use of org.eclipse.nebula.widgets.nattable.hideshow.command.ShowAllRowsCommand 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 ShowAllRowsCommand

use of org.eclipse.nebula.widgets.nattable.hideshow.command.ShowAllRowsCommand in project nebula.widgets.nattable by eclipse.

the class CompositeFreezeLayerHideShowTest method testFreezeHideShowRowViewportRegion.

@Test
public void testFreezeHideShowRowViewportRegion() {
    // 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 RowHideCommand(this.compositeFreezeLayer, 3));
    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(2, 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) ShowAllRowsCommand(org.eclipse.nebula.widgets.nattable.hideshow.command.ShowAllRowsCommand) RowHideCommand(org.eclipse.nebula.widgets.nattable.hideshow.command.RowHideCommand) MultiRowHideCommand(org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand) Test(org.junit.Test)

Example 4 with ShowAllRowsCommand

use of org.eclipse.nebula.widgets.nattable.hideshow.command.ShowAllRowsCommand in project nebula.widgets.nattable by eclipse.

the class CompositeFreezeLayerHideShowTest method testFreezeHideShowRowFrozenRegion.

// Row hide/show
@Test
public void testFreezeHideShowRowFrozenRegion() {
    // 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 RowHideCommand(this.compositeFreezeLayer, 0));
    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(3, 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(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) ShowAllRowsCommand(org.eclipse.nebula.widgets.nattable.hideshow.command.ShowAllRowsCommand) RowHideCommand(org.eclipse.nebula.widgets.nattable.hideshow.command.RowHideCommand) MultiRowHideCommand(org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand) Test(org.junit.Test)

Example 5 with ShowAllRowsCommand

use of org.eclipse.nebula.widgets.nattable.hideshow.command.ShowAllRowsCommand 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)

Aggregations

ShowAllRowsCommand (org.eclipse.nebula.widgets.nattable.hideshow.command.ShowAllRowsCommand)13 FreezeRowCommand (org.eclipse.nebula.widgets.nattable.freeze.command.FreezeRowCommand)12 MultiRowHideCommand (org.eclipse.nebula.widgets.nattable.hideshow.command.MultiRowHideCommand)12 Test (org.junit.Test)12 RowHideCommand (org.eclipse.nebula.widgets.nattable.hideshow.command.RowHideCommand)4 NatTable (org.eclipse.nebula.widgets.nattable.NatTable)1 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)1 SelectionEvent (org.eclipse.swt.events.SelectionEvent)1 Menu (org.eclipse.swt.widgets.Menu)1 MenuItem (org.eclipse.swt.widgets.MenuItem)1