Search in sources :

Example 21 with SelectColumnCommand

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

the class ColumnSelectionTest method shouldNotIncludeDeselectedCellsWithCtrlModifier.

@Test
public void shouldNotIncludeDeselectedCellsWithCtrlModifier() {
    // test a previous bug where single deselected cells where added to the
    // selection with following modifier selections
    // start from a clear selection state
    this.selectionLayer.clear();
    // select a single cell
    this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 2, 0, false, false));
    // deselect the cell again
    this.selectionLayer.doCommand(new SelectCellCommand(this.selectionLayer, 2, 0, false, true));
    // trigger selection of column 4 with ctrl
    this.selectionLayer.doCommand(new SelectColumnCommand(this.selectionLayer, 4, 0, false, true));
    assertEquals(4, this.selectionLayer.getSelectionAnchor().getColumnPosition());
    assertEquals(0, this.selectionLayer.getSelectionAnchor().getRowPosition());
    assertFalse("[2, 0] is selected", this.selectionLayer.isCellPositionSelected(2, 0));
    assertTrue("column 4 not fully selected", this.selectionLayer.isColumnPositionFullySelected(4));
}
Also used : SelectColumnCommand(org.eclipse.nebula.widgets.nattable.selection.command.SelectColumnCommand) SelectCellCommand(org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand) Test(org.junit.Test)

Aggregations

SelectColumnCommand (org.eclipse.nebula.widgets.nattable.selection.command.SelectColumnCommand)21 Test (org.junit.Test)21 SelectCellCommand (org.eclipse.nebula.widgets.nattable.selection.command.SelectCellCommand)4 GridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.GridLayer)3 AbstractDpiConverter (org.eclipse.nebula.widgets.nattable.layer.AbstractDpiConverter)3 IDpiConverter (org.eclipse.nebula.widgets.nattable.layer.IDpiConverter)3 ConfigureScalingCommand (org.eclipse.nebula.widgets.nattable.layer.command.ConfigureScalingCommand)3 DummyGridLayerStack (org.eclipse.nebula.widgets.nattable.layer.stack.DummyGridLayerStack)3 SelectRowsCommand (org.eclipse.nebula.widgets.nattable.selection.command.SelectRowsCommand)2 EventList (ca.odell.glazedlists.EventList)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)1 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)1 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)1 PositionCoordinate (org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate)1 DefaultGridLayer (org.eclipse.nebula.widgets.nattable.grid.layer.DefaultGridLayer)1 ColumnHeaderSelectionEvent (org.eclipse.nebula.widgets.nattable.grid.layer.event.ColumnHeaderSelectionEvent)1 ILayerCell (org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell)1 DefaultBodyLayerStack (org.eclipse.nebula.widgets.nattable.layer.stack.DefaultBodyLayerStack)1