use of org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate in project nebula.widgets.nattable by eclipse.
the class RegionSelectionTest method shouldUpdateSelectedRegionLeftWithShift.
@Test
public void shouldUpdateSelectedRegionLeftWithShift() {
this.selectionLayer.doCommand(new SelectRegionCommand(this.selectionLayer, 2, 3, 3, 3, false, false));
this.selectionLayer.doCommand(new SelectRegionCommand(this.selectionLayer, 0, 3, 2, 3, true, false));
PositionCoordinate[] cellPositions = this.selectionLayer.getSelectedCellPositions();
assertEquals(9, cellPositions.length);
Rectangle region = new Rectangle(0, 3, 3, 3);
assertTrue("not all cells in region selected", this.selectionLayer.allCellsSelectedInRegion(region));
assertEquals(2, this.selectionLayer.getSelectionAnchor().getColumnPosition());
assertEquals(3, this.selectionLayer.getSelectionAnchor().getRowPosition());
}
use of org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate in project nebula.widgets.nattable by eclipse.
the class RegionSelectionTest method shouldUpdateSelectedRegionUpWithShift.
@Test
public void shouldUpdateSelectedRegionUpWithShift() {
this.selectionLayer.doCommand(new SelectRegionCommand(this.selectionLayer, 2, 3, 3, 3, false, false));
this.selectionLayer.doCommand(new SelectRegionCommand(this.selectionLayer, 2, 0, 3, 1, true, false));
PositionCoordinate[] cellPositions = this.selectionLayer.getSelectedCellPositions();
assertEquals(12, cellPositions.length);
Rectangle region = new Rectangle(2, 0, 3, 3);
assertTrue("not all cells in region selected", this.selectionLayer.allCellsSelectedInRegion(region));
assertEquals(2, this.selectionLayer.getSelectionAnchor().getColumnPosition());
assertEquals(3, this.selectionLayer.getSelectionAnchor().getRowPosition());
}
use of org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate in project nebula.widgets.nattable by eclipse.
the class RegionSelectionTest method shouldExtendSelectedRegionRightWithShift.
@Test
public void shouldExtendSelectedRegionRightWithShift() {
this.selectionLayer.doCommand(new SelectRegionCommand(this.selectionLayer, 2, 3, 3, 3, false, false));
this.selectionLayer.doCommand(new SelectRegionCommand(this.selectionLayer, 6, 3, 2, 3, true, false));
PositionCoordinate[] cellPositions = this.selectionLayer.getSelectedCellPositions();
assertEquals(18, cellPositions.length);
Rectangle region = new Rectangle(2, 3, 6, 3);
assertTrue("not all cells in region selected", this.selectionLayer.allCellsSelectedInRegion(region));
assertEquals(2, this.selectionLayer.getSelectionAnchor().getColumnPosition());
assertEquals(3, this.selectionLayer.getSelectionAnchor().getRowPosition());
}
use of org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate in project nebula.widgets.nattable by eclipse.
the class RowSearchStrategyTest method shouldSearchAllBodyCellsForRowInSelection.
@Test
public void shouldSearchAllBodyCellsForRowInSelection() {
RowSearchStrategy rowStrategy = new RowSearchStrategy(new int[] { 2, 0, 4 }, this.configRegistry);
rowStrategy.setComparator(new CellValueAsStringComparator<>());
rowStrategy.setContextLayer(this.layer);
PositionCoordinate cell = rowStrategy.executeSearch("[2,2]");
assertEquals(2, cell.getColumnPosition());
assertEquals(2, cell.getRowPosition());
}
use of org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate in project nebula.widgets.nattable by eclipse.
the class SelectionSearchStrategyTest method shouldAccessWhatIsInSelection.
@Test
public void shouldAccessWhatIsInSelection() {
// Select range of cells
int startColumnPosition = 2;
int startRowPosition = 1;
final int lastColumn = 7;
final int lastRow = 5;
for (int columnPosition = startColumnPosition; columnPosition < lastColumn; columnPosition++) {
for (int rowPosition = startRowPosition; rowPosition < lastRow; rowPosition++) {
this.gridLayer.doCommand(new SelectCellCommand(this.gridLayer, columnPosition, rowPosition, false, true));
}
}
// We should get 20 Cells from the body
SelectionSearchStrategy selectionStrategy = new SelectionSearchStrategy(this.configRegistry);
selectionStrategy.setWrapSearch(true);
PositionCoordinate[] cellsToSearch = selectionStrategy.getSelectedCells(this.selectionLayer);
assertEquals(20, cellsToSearch.length);
}
Aggregations