Module org.controlsfx.controls
Class SpreadsheetViewSelectionModel
java.lang.Object
org.controlsfx.control.spreadsheet.SpreadsheetViewSelectionModel
This class provides basic support for common interaction on the
SpreadsheetView.
Due to the complexity induced by cell's span, it is not possible to give a
full access to selectionModel like in the TableView.-
Method Summary
Modifier and TypeMethodDescriptionfinal voidclearAndSelect(int row, SpreadsheetColumn column) Clears all selection, and then selects the cell at the given row/column intersection in theSpreadsheetView.final voidClears all selection, and then selects the givenSpreadsheetCell.voidClears the current selection and select the cell on the left of the current focused cell.voidClears the current selection and select the cell on the right of the current focused cell.final voidClears the selection model of all selected indices.final voidfocus(int row, SpreadsheetColumn column) Causes the cell at the given index to receive the focus.final TablePositionReturns the position of the cell that has current focus.final ObservableList<TablePosition>Returns a read-onlyObservableListrepresenting the currently selected cells in thisSpreadsheetView.Returns theSelectionModecurrently used.final voidselect(int row, SpreadsheetColumn column) Selects the cell at the given row/column intersection.final voidSelects all the possible cells.voidselectCells(List<Pair<Integer, Integer>> selectedCells) Selects discontinuous cells.voidselectCells(Pair<Integer, Integer>... selectedCells) Selects discontinuous cells.voidselectRange(int minRow, SpreadsheetColumn minColumn, int maxRow, SpreadsheetColumn maxColumn) Selects the cells in the range (minRow, minColumn) to (maxRow, maxColumn), inclusive.final voidsetSelectionMode(SelectionMode value) Specifies the selection mode to use in this selection model.
-
Method Details
-
clearAndSelect
Clears all selection, and then selects the cell at the given row/column intersection in theSpreadsheetView. This method does not consider sorting and filtering. If you want to select aSpreadsheetCellin a filtered/sorted grid, useclearAndSelect(org.controlsfx.control.spreadsheet.SpreadsheetCell)instead.- Parameters:
row- the row index to selectcolumn- the column to select
-
clearAndSelect
Clears all selection, and then selects the givenSpreadsheetCell. This method allow to select a cell no matter if the Grid is Filtered or sorted. Beware, this method can be time-consuming if lots of rows are present.- Parameters:
cell- the cell to select
-
select
Selects the cell at the given row/column intersection.- Parameters:
row- the row index to selectcolumn- the column to select
-
clearSelection
public final void clearSelection()Clears the selection model of all selected indices. -
getSelectedCells
Returns a read-onlyObservableListrepresenting the currently selected cells in thisSpreadsheetView.- Returns:
- a read-only ObservableList
-
selectAll
public final void selectAll()Selects all the possible cells. -
getFocusedCell
Returns the position of the cell that has current focus.- Returns:
- the position of the cell that has current focus
-
focus
Causes the cell at the given index to receive the focus.- Parameters:
row- the row index of the item to give focus tocolumn- the column of the item to give focus to. Can be null
-
setSelectionMode
Specifies the selection mode to use in this selection model. The selection mode specifies how many items in the underlying data model can be selected at any one time. By default, the selection mode isSelectionMode.MULTIPLE.- Parameters:
value- theSelectionModeto use
-
getSelectionMode
Returns theSelectionModecurrently used.- Returns:
- the
SelectionModecurrently used
-
selectCells
Selects discontinuous cells. ThePairmust contain the row index as key and the column index as value. This is useful when you want to select a great amount of cell because it will be more efficient than callingselect(int, org.controlsfx.control.spreadsheet.SpreadsheetColumn).- Parameters:
selectedCells- the cells to select
-
selectCells
Selects discontinuous cells. ThePairmust contain the row index as key and the column index as value. This is useful when you want to select a great amount of cell because it will be more efficient than callingselect(int, org.controlsfx.control.spreadsheet.SpreadsheetColumn).- Parameters:
selectedCells- the cells to select
-
selectRange
public void selectRange(int minRow, SpreadsheetColumn minColumn, int maxRow, SpreadsheetColumn maxColumn) Selects the cells in the range (minRow, minColumn) to (maxRow, maxColumn), inclusive.- Parameters:
minRow- the minimum row in the rangeminColumn- the minimum column in the rangemaxRow- the maximum row in the rangemaxColumn- the maximum column in the range
-
clearAndSelectLeftCell
public void clearAndSelectLeftCell()Clears the current selection and select the cell on the left of the current focused cell. If the cell is the first one on a row, the last cell of the preceding row is selected. -
clearAndSelectRightCell
public void clearAndSelectRightCell()Clears the current selection and select the cell on the right of the current focused cell. If the cell is the last one on a row, the first cell of the next row is selected.
-