Class CellValueCommand

    • Field Detail

      • selectedCellRow

        protected final int selectedCellRow
      • selectedcellCol

        protected final int selectedcellCol
      • selectedCellRange

        protected final int[] selectedCellRange
    • Constructor Detail

      • CellValueCommand

        public CellValueCommand​(Spreadsheet spreadsheet)
        Sets the currently selected cell of the spreadsheet as the selected cell and possible painted range for this command.
        Parameters:
        spreadsheet - Target spreadsheet
    • Method Detail

      • clearValues

        public void clearValues()
        Clears all values captured by this command.
      • captureCellValues

        public void captureCellValues​(org.apache.poi.ss.util.CellReference... cellReferences)
        Capture values from cells defined in the given CellReference(s).
        Parameters:
        cellReferences - cell references to process
      • captureCellRangeValues

        public void captureCellRangeValues​(org.apache.poi.ss.util.CellRangeAddress... cellRanges)
        Capture values from cells defined in the given CellRangeAddress(es).
        Parameters:
        cellRanges - cell ranges to process
      • getSelectedCellReference

        public org.apache.poi.ss.util.CellReference getSelectedCellReference()
        Description copied from interface: Command
        The selected cell that should be set when this command is run. In case this command shouldn't change the selected cell, null is returned.
        Specified by:
        getSelectedCellReference in interface Command
        Returns:
        the selection or null
      • getPaintedCellRange

        public org.apache.poi.ss.util.CellRangeAddress getPaintedCellRange()
        Description copied from interface: Command
        The painted range that should be set when this command is run. In case his command shouldn't set a painted range, null is returned.
        Specified by:
        getPaintedCellRange in interface Command
        Returns:
        the painted range or null
      • execute

        public void execute()
        Description copied from interface: Command
        Executes this command.
        Specified by:
        execute in interface Command
      • updateCellValue

        protected Object updateCellValue​(int row,
                                         int col,
                                         Object value,
                                         List<org.apache.poi.ss.usermodel.Cell> cellsToUpdate)
        Sets the given value to the cell at the given coordinates.
        Parameters:
        row - Row index, 0-based
        col - Column index, 0-based
        value - Value to set to the cell
        cellsToUpdate - List of cells that need updating at the end. If the cell value is modified, the cell is added to this list.
        Returns:
        Previous value of the cell or null if not available
      • getCellValue

        protected Object getCellValue​(org.apache.poi.ss.util.CellReference cell)
        Returns the current value for the cell referenced by the given cell reference
        Parameters:
        cell - Reference to the cell
        Returns:
        Current value of the cell or null if not available
      • getCellValue

        protected Object getCellValue​(int r,
                                      int c)
        Returns the current value of the cell at the given coordinates.
        Parameters:
        r - Row index, 0-based
        c - Column index, 0-based
        Returns:
        Current value of the cell or null if not available
      • getCellValue

        protected Object getCellValue​(org.apache.poi.ss.usermodel.Cell cell)
        Returns the current value of the given Cell
        Parameters:
        cell - Target cell
        Returns:
        Current value of the cell or null if not available
      • getCell

        protected org.apache.poi.ss.usermodel.Cell getCell​(int r,
                                                           int c)
        Returns the Cell at the given row and column.
        Parameters:
        r - Row index, 0-based
        c - Column index, 0-based
        Returns:
        Cell at the given coordinates, null if not found