com.vaadin.flow.component.spreadsheet.command.
Class CellValueCommand
- java.lang.Object
-
- com.vaadin.flow.component.spreadsheet.command.SpreadsheetCommand
-
- com.vaadin.flow.component.spreadsheet.command.CellValueCommand
-
All Implemented Interfaces:
Direct Known Subclasses:
public class CellValueCommand extends SpreadsheetCommand implements ValueChangeCommand
Command for changing the value of one or more cells.
Since:
1.0
Author:
Vaadin Ltd.
See Also:
-
-
Field Summary
Fields Modifier and Type Field Description protected int
selectedcellCol
protected int[]
selectedCellRange
protected int
selectedCellRow
protected List<Object>
values
-
Fields inherited from class com.vaadin.flow.component.spreadsheet.command.SpreadsheetCommand
activeSheetIndex, spreadsheet
-
-
Constructor Summary
Constructors Constructor Description CellValueCommand(Spreadsheet spreadsheet)
Sets the currently selected cell of the spreadsheet as the selected cell and possible painted range for this command.
-
Method Summary
All Methods Modifier and Type Method Description void
captureCellRangeValues(org.apache.poi.ss.util.CellRangeAddress... cellRanges)
Capture values from cells defined in the given CellRangeAddress(es).
void
captureCellValues(org.apache.poi.ss.util.CellReference... cellReferences)
Capture values from cells defined in the given CellReference(s).
void
clearValues()
Clears all values captured by this command.
void
execute()
Executes this command.
protected org.apache.poi.ss.usermodel.Cell
getCell(int r, int c)
Returns the Cell at the given row and column.
protected Object
getCellValue(int r, int c)
Returns the current value of the cell at the given coordinates.
protected Object
getCellValue(org.apache.poi.ss.usermodel.Cell cell)
Returns the current value of the given Cell
protected Object
getCellValue(org.apache.poi.ss.util.CellReference cell)
Returns the current value for the cell referenced by the given cell reference
Set<org.apache.poi.ss.util.CellReference>
getChangedCells()
Returns the cells that had their value(s) changed.
org.apache.poi.ss.util.CellRangeAddress
getPaintedCellRange()
The painted range that should be set when this command is run.
org.apache.poi.ss.util.CellReference
getSelectedCellReference()
The selected cell that should be set when this command is run.
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.
-
Methods inherited from class com.vaadin.flow.component.spreadsheet.command.SpreadsheetCommand
getActiveSheetIndex, getSheet, setActiveSheetIndex
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.vaadin.flow.component.spreadsheet.command.Command
getActiveSheetIndex, setActiveSheetIndex
-
-
-
-
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 interfaceCommand
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 interfaceCommand
Returns:
the painted range or
null
-
execute
public void execute()
Description copied from interface:
Command
Executes this 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-basedcol
- Column index, 0-basedvalue
- Value to set to the cellcellsToUpdate
- 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 cellReturns:
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-basedc
- Column index, 0-basedReturns:
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 cellReturns:
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-basedc
- Column index, 0-basedReturns:
Cell at the given coordinates, null if not found
-
getChangedCells
public Set<org.apache.poi.ss.util.CellReference> getChangedCells()
Description copied from interface:
ValueChangeCommand
Returns the cells that had their value(s) changed.
Specified by:
getChangedCells
in interfaceValueChangeCommand
-
-