Class SpreadsheetViewSelectionModel


  • public class SpreadsheetViewSelectionModel
    extends Object
    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 Detail

      • clearAndSelect

        public final void clearAndSelect​(SpreadsheetCell cell)
        Clears all selection, and then selects the given SpreadsheetCell. 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

        public final void select​(int row,
                                 SpreadsheetColumn column)
        Selects the cell at the given row/column intersection.
        Parameters:
        row - the row index to select
        column - the column to select
      • clearSelection

        public final void clearSelection()
        Clears the selection model of all selected indices.
      • getSelectedCells

        public final ObservableList<TablePosition> getSelectedCells()
        Returns a read-only ObservableList representing the currently selected cells in this SpreadsheetView.
        Returns:
        a read-only ObservableList
      • selectAll

        public final void selectAll()
        Selects all the possible cells.
      • getFocusedCell

        public final TablePosition getFocusedCell()
        Returns the position of the cell that has current focus.
        Returns:
        the position of the cell that has current focus
      • focus

        public final void focus​(int row,
                                SpreadsheetColumn column)
        Causes the cell at the given index to receive the focus.
        Parameters:
        row - the row index of the item to give focus to
        column - the column of the item to give focus to. Can be null
      • setSelectionMode

        public final void setSelectionMode​(SelectionMode value)
        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 is SelectionMode.MULTIPLE.
        Parameters:
        value - the SelectionMode to use
      • getSelectionMode

        public SelectionMode getSelectionMode()
        Returns the SelectionMode currently used.
        Returns:
        the SelectionMode currently used
      • 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 range
        minColumn - the minimum column in the range
        maxRow - the maximum row in the range
        maxColumn - 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.