use of org.eclipse.nebula.widgets.nattable.hideshow.command.MultiColumnHideCommand in project nebula.widgets.nattable by eclipse.
the class CompositeFreezeLayerHideShowTest method testFreezeHideShowColumnBothRegions.
@Test
public void testFreezeHideShowColumnBothRegions() {
// freeze
this.compositeFreezeLayer.doCommand(new FreezeColumnCommand(this.compositeFreezeLayer, 1));
assertEquals(2, this.freezeLayer.getColumnCount());
assertEquals(0, this.freezeLayer.getRowCount());
assertEquals(1, this.freezeLayer.getBottomRightPosition().columnPosition);
assertEquals(-1, this.freezeLayer.getBottomRightPosition().rowPosition);
assertEquals(3, this.viewportLayer.getColumnCount());
assertEquals(5, this.viewportLayer.getRowCount());
assertEquals(2, this.viewportLayer.getMinimumOriginColumnPosition());
assertEquals(0, this.viewportLayer.getMinimumOriginRowPosition());
assertEquals(200, this.viewportLayer.getMinimumOrigin().getX());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getY());
// hide
this.compositeFreezeLayer.doCommand(new MultiColumnHideCommand(this.compositeFreezeLayer, new int[] { 0, 3 }));
assertEquals(1, this.freezeLayer.getColumnCount());
assertEquals(0, this.freezeLayer.getRowCount());
assertEquals(0, this.freezeLayer.getBottomRightPosition().columnPosition);
assertEquals(-1, this.freezeLayer.getBottomRightPosition().rowPosition);
assertEquals(2, this.viewportLayer.getColumnCount());
assertEquals(5, this.viewportLayer.getRowCount());
assertEquals(1, this.viewportLayer.getMinimumOriginColumnPosition());
assertEquals(0, this.viewportLayer.getMinimumOriginRowPosition());
assertEquals(100, this.viewportLayer.getMinimumOrigin().getX());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getY());
// show again
this.compositeFreezeLayer.doCommand(new ShowAllColumnsCommand());
assertEquals(2, this.freezeLayer.getColumnCount());
assertEquals(0, this.freezeLayer.getRowCount());
assertEquals(1, this.freezeLayer.getBottomRightPosition().columnPosition);
assertEquals(-1, this.freezeLayer.getBottomRightPosition().rowPosition);
assertEquals(3, this.viewportLayer.getColumnCount());
assertEquals(5, this.viewportLayer.getRowCount());
assertEquals(2, this.viewportLayer.getMinimumOriginColumnPosition());
assertEquals(0, this.viewportLayer.getMinimumOriginRowPosition());
assertEquals(200, this.viewportLayer.getMinimumOrigin().getX());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getY());
reset();
}
use of org.eclipse.nebula.widgets.nattable.hideshow.command.MultiColumnHideCommand in project nebula.widgets.nattable by eclipse.
the class CompositeFreezeLayerHideShowTest method testFreezeHideShowColumnBothRegionsAll.
@Test
public void testFreezeHideShowColumnBothRegionsAll() {
// freeze
this.compositeFreezeLayer.doCommand(new FreezeColumnCommand(this.compositeFreezeLayer, 1));
assertEquals(2, this.freezeLayer.getColumnCount());
assertEquals(0, this.freezeLayer.getRowCount());
assertEquals(1, this.freezeLayer.getBottomRightPosition().columnPosition);
assertEquals(-1, this.freezeLayer.getBottomRightPosition().rowPosition);
assertEquals(3, this.viewportLayer.getColumnCount());
assertEquals(5, this.viewportLayer.getRowCount());
assertEquals(2, this.viewportLayer.getMinimumOriginColumnPosition());
assertEquals(0, this.viewportLayer.getMinimumOriginRowPosition());
assertEquals(200, this.viewportLayer.getMinimumOrigin().getX());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getY());
// hide
this.compositeFreezeLayer.doCommand(new MultiColumnHideCommand(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(0, 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());
// show again
this.compositeFreezeLayer.doCommand(new ShowAllColumnsCommand());
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.MultiColumnHideCommand in project nebula.widgets.nattable by eclipse.
the class CompositeFreezeLayerHideShowTest method testFreezeHideShowColumnBothRegionsEdge.
@Test
public void testFreezeHideShowColumnBothRegionsEdge() {
// freeze
this.compositeFreezeLayer.doCommand(new FreezeColumnCommand(this.compositeFreezeLayer, 1));
assertEquals(2, this.freezeLayer.getColumnCount());
assertEquals(0, this.freezeLayer.getRowCount());
assertEquals(1, this.freezeLayer.getBottomRightPosition().columnPosition);
assertEquals(-1, this.freezeLayer.getBottomRightPosition().rowPosition);
assertEquals(3, this.viewportLayer.getColumnCount());
assertEquals(5, this.viewportLayer.getRowCount());
assertEquals(2, this.viewportLayer.getMinimumOriginColumnPosition());
assertEquals(0, this.viewportLayer.getMinimumOriginRowPosition());
assertEquals(200, this.viewportLayer.getMinimumOrigin().getX());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getY());
// hide
this.compositeFreezeLayer.doCommand(new MultiColumnHideCommand(this.compositeFreezeLayer, new int[] { 1, 2 }));
assertEquals(1, this.freezeLayer.getColumnCount());
assertEquals(0, this.freezeLayer.getRowCount());
assertEquals(0, this.freezeLayer.getBottomRightPosition().columnPosition);
assertEquals(-1, this.freezeLayer.getBottomRightPosition().rowPosition);
assertEquals(2, this.viewportLayer.getColumnCount());
assertEquals(5, this.viewportLayer.getRowCount());
assertEquals(1, this.viewportLayer.getMinimumOriginColumnPosition());
assertEquals(0, this.viewportLayer.getMinimumOriginRowPosition());
assertEquals(100, this.viewportLayer.getMinimumOrigin().getX());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getY());
// show again
this.compositeFreezeLayer.doCommand(new ShowAllColumnsCommand());
assertEquals(1, this.freezeLayer.getColumnCount());
assertEquals(0, this.freezeLayer.getRowCount());
assertEquals(0, this.freezeLayer.getBottomRightPosition().columnPosition);
assertEquals(-1, this.freezeLayer.getBottomRightPosition().rowPosition);
assertEquals(4, this.viewportLayer.getColumnCount());
assertEquals(5, this.viewportLayer.getRowCount());
assertEquals(1, this.viewportLayer.getMinimumOriginColumnPosition());
assertEquals(0, this.viewportLayer.getMinimumOriginRowPosition());
assertEquals(100, this.viewportLayer.getMinimumOrigin().getX());
assertEquals(0, this.viewportLayer.getMinimumOrigin().getY());
reset();
}
use of org.eclipse.nebula.widgets.nattable.hideshow.command.MultiColumnHideCommand in project nebula.widgets.nattable by eclipse.
the class HideSelectedColumnsTest method shouldHideSelectedColumn.
@Test
public void shouldHideSelectedColumn() {
// Select column to hide
new SelectColumnCommandHandler(this.selectionLayer).selectColumn(2, 0, false, false);
// Hide column
this.selectionLayer.doCommand(new MultiColumnHideCommand(this.selectionLayer, 2));
// The previously selected column should be hidden
Assert.assertTrue(this.columnHideShowLayer.isColumnIndexHidden(2));
Assert.assertEquals(4, this.selectionLayer.getColumnCount());
}
use of org.eclipse.nebula.widgets.nattable.hideshow.command.MultiColumnHideCommand in project nebula.widgets.nattable by eclipse.
the class ColumnChooserUtils method hideColumnEntries.
public static void hideColumnEntries(List<ColumnEntry> removedItems, ColumnHideShowLayer hideShowLayer) {
MultiColumnHideCommand hideCommand = new MultiColumnHideCommand(hideShowLayer, asIntArray(getColumnEntryPositions(removedItems)));
hideShowLayer.doCommand(hideCommand);
}
Aggregations