use of org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate in project nebula.widgets.nattable by eclipse.
the class SelectionLayerTest method testGetAnchorDoesNotDelegateToModel.
// Selection Anchor
@Test
public void testGetAnchorDoesNotDelegateToModel() {
PositionCoordinate existingAnchor = this.selectionLayer.selectionAnchor;
assertSame(existingAnchor, this.selectionLayer.getSelectionAnchor());
}
use of org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate in project nebula.widgets.nattable by eclipse.
the class SelectionLayerTest method testGetLastSelectedCellDoesNotDelegateToModel.
@Test
public void testGetLastSelectedCellDoesNotDelegateToModel() {
this.selectionLayer.selectAll();
PositionCoordinate existingSelectedCell = this.selectionLayer.lastSelectedCell;
assertSame(existingSelectedCell, this.selectionLayer.getLastSelectedCell());
}
use of org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate in project nebula.widgets.nattable by eclipse.
the class EditIntegrationTest method navigationWithTab.
@Test
public void navigationWithTab() throws Exception {
this.natTable.enableEditingOnAllCells();
this.natTable.doCommand(new SelectCellCommand(this.natTable, 1, 1, false, false));
// Edit cell
ILayerCell cell = this.natTable.getCellByPosition(1, 1);
this.natTable.doCommand(new EditCellCommand(this.natTable, this.natTable.getConfigRegistry(), cell));
// Press tab - 3 times
Text textControl = ((Text) this.natTable.getActiveCellEditor().getEditorControl());
textControl.notifyListeners(SWT.Traverse, SWTUtils.keyEvent(SWT.TAB));
this.natTable.notifyListeners(SWT.KeyDown, SWTUtils.keyEvent(SWT.TAB));
this.natTable.notifyListeners(SWT.KeyDown, SWTUtils.keyEvent(SWT.TAB));
this.natTable.notifyListeners(SWT.KeyDown, SWTUtils.keyEvent(SWT.TAB));
// Verify new cell selection
PositionCoordinate lastSelectedCellPosition = this.gridLayerStack.getBodyLayer().getSelectionLayer().getSelectionAnchor();
assertEquals(4, lastSelectedCellPosition.columnPosition);
assertEquals(0, lastSelectedCellPosition.rowPosition);
// Verify that no cell is being edited
assertNull(this.natTable.getActiveCellEditor());
assertNull(ActiveCellEditorRegistry.getActiveCellEditor());
}
use of org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate in project nebula.widgets.nattable by eclipse.
the class RegionSelectionTest method shouldSelectOtherRegion.
@Test
public void shouldSelectOtherRegion() {
this.selectionLayer.doCommand(new SelectRegionCommand(this.selectionLayer, 2, 3, 3, 3, false, false));
this.selectionLayer.doCommand(new SelectRegionCommand(this.selectionLayer, 1, 2, 2, 2, false, false));
PositionCoordinate[] cellPositions = this.selectionLayer.getSelectedCellPositions();
assertEquals(4, cellPositions.length);
Rectangle region = new Rectangle(1, 2, 2, 2);
assertTrue("not all cells in region selected", this.selectionLayer.allCellsSelectedInRegion(region));
region = new Rectangle(2, 3, 3, 3);
assertFalse("all cells selected", this.selectionLayer.allCellsSelectedInRegion(region));
assertEquals(1, this.selectionLayer.getSelectionAnchor().getColumnPosition());
assertEquals(2, this.selectionLayer.getSelectionAnchor().getRowPosition());
}
use of org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate in project nebula.widgets.nattable by eclipse.
the class RegionSelectionTest method shouldExtendSelectedRegionDownWithShift.
@Test
public void shouldExtendSelectedRegionDownWithShift() {
this.selectionLayer.doCommand(new SelectRegionCommand(this.selectionLayer, 2, 3, 3, 3, false, false));
this.selectionLayer.doCommand(new SelectRegionCommand(this.selectionLayer, 2, 7, 3, 2, true, false));
PositionCoordinate[] cellPositions = this.selectionLayer.getSelectedCellPositions();
assertEquals(18, cellPositions.length);
Rectangle region = new Rectangle(2, 3, 3, 6);
assertTrue("not all cells in region selected", this.selectionLayer.allCellsSelectedInRegion(region));
assertEquals(2, this.selectionLayer.getSelectionAnchor().getColumnPosition());
assertEquals(3, this.selectionLayer.getSelectionAnchor().getRowPosition());
}
Aggregations