use of org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate in project nebula.widgets.nattable by eclipse.
the class FreezeHandlerTest method shouldFreezeRowsAndColumnsBasedOnMultiSelection.
@Test
public void shouldFreezeRowsAndColumnsBasedOnMultiSelection() {
this.compositeFreezeLayer.doCommand(new SelectCellCommand(this.compositeFreezeLayer, 2, 2, false, false));
this.compositeFreezeLayer.doCommand(new SelectCellCommand(this.compositeFreezeLayer, 3, 3, true, false));
// Make sure selection layer processed command
assertEquals(4, this.selectionLayer.getSelectedCellPositions().length);
PositionCoordinate lastSelectedCell = this.selectionLayer.getLastSelectedCellPosition();
assertEquals(3, lastSelectedCell.columnPosition);
assertEquals(3, lastSelectedCell.rowPosition);
// This is what would happen if we selected to freeze from a selected
// cell
this.compositeFreezeLayer.doCommand(new FreezeSelectionCommand());
assertEquals(0, this.freezeLayer.getTopLeftPosition().columnPosition);
assertEquals(0, this.freezeLayer.getTopLeftPosition().rowPosition);
assertNotNull(this.freezeLayer.getBottomRightPosition());
assertEquals(1, this.freezeLayer.getBottomRightPosition().columnPosition);
assertEquals(1, this.freezeLayer.getBottomRightPosition().rowPosition);
// Check viewport origin
assertEquals(2, this.viewportLayer.getMinimumOriginColumnPosition());
assertEquals(2, this.viewportLayer.getMinimumOriginRowPosition());
}
use of org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate in project nebula.widgets.nattable by eclipse.
the class FreezeHandlerTest method shouldFreezeRowsAndColumnsBasedOnSelectionInclude.
@Test
public void shouldFreezeRowsAndColumnsBasedOnSelectionInclude() {
this.compositeFreezeLayer.doCommand(new SelectCellCommand(this.compositeFreezeLayer, 2, 2, false, false));
// Make sure selection layer processed command
final PositionCoordinate lastSelectedCell = this.selectionLayer.getLastSelectedCellPosition();
assertEquals(2, lastSelectedCell.columnPosition);
assertEquals(2, lastSelectedCell.rowPosition);
// This is what would happen if we selected to freeze from a selected
// cell
this.compositeFreezeLayer.doCommand(new FreezeSelectionCommand(false, false, true));
assertEquals(0, this.freezeLayer.getTopLeftPosition().columnPosition);
assertEquals(0, this.freezeLayer.getTopLeftPosition().rowPosition);
assertNotNull(this.freezeLayer.getBottomRightPosition());
assertEquals(2, this.freezeLayer.getBottomRightPosition().columnPosition);
assertEquals(2, this.freezeLayer.getBottomRightPosition().rowPosition);
// Check viewport origin
assertEquals(3, this.viewportLayer.getMinimumOriginColumnPosition());
assertEquals(3, this.viewportLayer.getMinimumOriginRowPosition());
}
use of org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate in project nebula.widgets.nattable by eclipse.
the class EditUtilsTest method testIsCellEditableWithoutSelection.
@Test
public void testIsCellEditableWithoutSelection() {
PositionCoordinate coord = new PositionCoordinate(this.selectionLayer, 0, 0);
assertFalse(EditUtils.isCellEditable(this.selectionLayer, this.natTable.getConfigRegistry(), coord));
}
use of org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate in project nebula.widgets.nattable by eclipse.
the class RowSelectionEditUtilsTest method testIsCellEditableWithoutSelectionEnableEditing.
@Test
public void testIsCellEditableWithoutSelectionEnableEditing() {
this.natTable.enableEditingOnAllCells();
PositionCoordinate coord = new PositionCoordinate(this.selectionLayer, 0, 0);
assertTrue(EditUtils.isCellEditable(this.selectionLayer, this.natTable.getConfigRegistry(), coord));
}
use of org.eclipse.nebula.widgets.nattable.coordinate.PositionCoordinate in project nebula.widgets.nattable by eclipse.
the class ColumnGroupHeaderLayerSelectionTest method shouldMoveAnchorOnDeselectWithCtrlWithPreserve.
@Test
public void shouldMoveAnchorOnDeselectWithCtrlWithPreserve() {
this.gridLayer.getBodyLayer().getSelectionLayer().setSelectionModel(new PreserveSelectionModel<>(this.gridLayer.getBodyLayer().getSelectionLayer(), this.dataProvider, new IRowIdAccessor<NumberValues>() {
@Override
public Serializable getRowId(NumberValues rowObject) {
return rowObject.getColumnOneNumber();
}
}));
this.gridLayer.doCommand(new ViewportSelectColumnGroupCommand(this.gridLayer, 2, 0, false, false));
this.gridLayer.doCommand(new ViewportSelectColumnGroupCommand(this.gridLayer, 6, 0, false, true));
assertTrue(this.gridLayer.getBodyLayer().getSelectionLayer().isColumnPositionFullySelected(0));
assertTrue(this.gridLayer.getBodyLayer().getSelectionLayer().isColumnPositionFullySelected(1));
assertTrue(this.gridLayer.getBodyLayer().getSelectionLayer().isColumnPositionFullySelected(2));
assertTrue(this.gridLayer.getBodyLayer().getSelectionLayer().isColumnPositionFullySelected(5));
assertTrue(this.gridLayer.getBodyLayer().getSelectionLayer().isColumnPositionFullySelected(6));
PositionCoordinate selectionAnchor = this.gridLayer.getBodyLayer().getSelectionLayer().getSelectionAnchor();
assertEquals(0, selectionAnchor.getRowPosition());
assertEquals(5, selectionAnchor.getColumnPosition());
this.gridLayer.doCommand(new ViewportSelectColumnGroupCommand(this.gridLayer, 6, 0, false, true));
assertTrue(this.gridLayer.getBodyLayer().getSelectionLayer().isColumnPositionFullySelected(0));
assertTrue(this.gridLayer.getBodyLayer().getSelectionLayer().isColumnPositionFullySelected(1));
assertTrue(this.gridLayer.getBodyLayer().getSelectionLayer().isColumnPositionFullySelected(2));
assertFalse(this.gridLayer.getBodyLayer().getSelectionLayer().isColumnPositionFullySelected(5));
assertFalse(this.gridLayer.getBodyLayer().getSelectionLayer().isColumnPositionFullySelected(6));
selectionAnchor = this.gridLayer.getBodyLayer().getSelectionLayer().getSelectionAnchor();
assertEquals(0, selectionAnchor.getRowPosition());
assertEquals(0, selectionAnchor.getColumnPosition());
}
Aggregations