Search in sources :

Example 1 with SelectColumnCommandHandler

use of org.eclipse.nebula.widgets.nattable.selection.SelectColumnCommandHandler in project nebula.widgets.nattable by eclipse.

the class HideSelectedColumnsTest method shouldHideAllSelectedColumns.

@Test
public void shouldHideAllSelectedColumns() {
    // Select cells and columns
    new SelectColumnCommandHandler(this.selectionLayer).selectColumn(2, 0, false, true);
    this.selectionLayer.selectCell(1, 0, false, true);
    this.selectionLayer.selectCell(4, 4, false, true);
    // Hide selection
    this.selectionLayer.doCommand(new MultiColumnHideCommand(this.selectionLayer, new int[] { 2, 0, 4 }));
    // Previously selected columns should be hidden
    Assert.assertTrue(this.columnHideShowLayer.isColumnIndexHidden(2));
    Assert.assertTrue(this.columnHideShowLayer.isColumnIndexHidden(0));
    Assert.assertTrue(this.columnHideShowLayer.isColumnIndexHidden(4));
}
Also used : SelectColumnCommandHandler(org.eclipse.nebula.widgets.nattable.selection.SelectColumnCommandHandler) MultiColumnHideCommand(org.eclipse.nebula.widgets.nattable.hideshow.command.MultiColumnHideCommand) Test(org.junit.Test)

Example 2 with SelectColumnCommandHandler

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

Aggregations

MultiColumnHideCommand (org.eclipse.nebula.widgets.nattable.hideshow.command.MultiColumnHideCommand)2 SelectColumnCommandHandler (org.eclipse.nebula.widgets.nattable.selection.SelectColumnCommandHandler)2 Test (org.junit.Test)2