Class SelectionHandler


  • public class SelectionHandler
    extends Object
    Class that handles finer details of cell selection inside the Spreadsheet.
    Author:
    Thomas Mattsson / Vaadin Ltd.
    • Method Detail

      • moveSelectionDown

        public void moveSelectionDown​(boolean discardSelection)
      • selectCellRange

        public void selectCellRange​(String name,
                                    int selectedCellColumn,
                                    int selectedCellRow,
                                    int firstColumn,
                                    int lastColumn,
                                    int firstRow,
                                    int lastRow,
                                    boolean scroll)
      • selectCell

        public void selectCell​(String name,
                               int col,
                               int row,
                               String value,
                               boolean formula,
                               boolean locked,
                               boolean initialSelection)
      • newSelectedCellSet

        public void newSelectedCellSet()
      • moveSelectionUp

        public void moveSelectionUp​(boolean discardSelection)
      • onCellSelectedWithKeyboard

        protected void onCellSelectedWithKeyboard​(int column,
                                                  int row,
                                                  String value,
                                                  MergedRegion region)
      • increaseHorizontalSelection

        public void increaseHorizontalSelection​(boolean right)
      • findDecreasingSelection

        protected MergedRegion findDecreasingSelection​(int topRow,
                                                       int bottomRow,
                                                       int leftColumn,
                                                       int rightColumn)
        Goes through the given selection and checks that the cells on the edges of the selection are not in "the beginning / middle / end" of a merged cell. Returns the correct decreased selection, after taking the merged cells into account. Parameters 1-based.
        Parameters:
        topRow -
        bottomRow -
        leftColumn -
        rightColumn -
        Returns:
        merged region
      • increaseVerticalSelection

        public void increaseVerticalSelection​(boolean down)
      • moveSelectionRight

        public void moveSelectionRight​(boolean discardSelection)
      • moveSelectionLeft

        public void moveSelectionLeft​(boolean discardSelection)
      • checkNewSelectionInMergedRegion

        protected void checkNewSelectionInMergedRegion​(int col,
                                                       int row)
        Same as checkSelectionInMergedRegion(int, int), but discards old selection in favor of the given cell.
        Parameters:
        col -
        row -
      • checkSelectionInMergedRegion

        protected void checkSelectionInMergedRegion​(int col,
                                                    int row)
        Same as checkNewSelectionInMergedRegion(int, int), but retains old selection in addition to the new cell.
      • clearBeforeMergeCells

        public void clearBeforeMergeCells()
      • setColBeforeMergedCell

        public void setColBeforeMergedCell​(int c)
      • setRowBeforeMergedCell

        public void setRowBeforeMergedCell​(int r)