Class CellValueCommand
- java.lang.Object
-
- com.vaadin.flow.component.spreadsheet.command.SpreadsheetCommand
-
- com.vaadin.flow.component.spreadsheet.command.CellValueCommand
-
- All Implemented Interfaces:
Command,ValueChangeCommand,Serializable
- Direct Known Subclasses:
CellShiftValuesCommand
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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected intselectedcellColprotected int[]selectedCellRangeprotected intselectedCellRowprotected 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 Instance Methods Concrete Methods Modifier and Type Method Description voidcaptureCellRangeValues(org.apache.poi.ss.util.CellRangeAddress... cellRanges)Capture values from cells defined in the given CellRangeAddress(es).voidcaptureCellValues(org.apache.poi.ss.util.CellReference... cellReferences)Capture values from cells defined in the given CellReference(s).voidclearValues()Clears all values captured by this command.voidexecute()Executes this command.protected org.apache.poi.ss.usermodel.CellgetCell(int r, int c)Returns the Cell at the given row and column.protected ObjectgetCellValue(int r, int c)Returns the current value of the cell at the given coordinates.protected ObjectgetCellValue(org.apache.poi.ss.usermodel.Cell cell)Returns the current value of the given Cellprotected ObjectgetCellValue(org.apache.poi.ss.util.CellReference cell)Returns the current value for the cell referenced by the given cell referenceSet<org.apache.poi.ss.util.CellReference>getChangedCells()Returns the cells that had their value(s) changed.org.apache.poi.ss.util.CellRangeAddressgetPaintedCellRange()The painted range that should be set when this command is run.org.apache.poi.ss.util.CellReferencegetSelectedCellReference()The selected cell that should be set when this command is run.protected ObjectupdateCellValue(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:CommandThe selected cell that should be set when this command is run. In case this command shouldn't change the selected cell,nullis returned.- Specified by:
getSelectedCellReferencein interfaceCommand- Returns:
- the selection or
null
-
getPaintedCellRange
public org.apache.poi.ss.util.CellRangeAddress getPaintedCellRange()
Description copied from interface:CommandThe painted range that should be set when this command is run. In case his command shouldn't set a painted range,nullis returned.- Specified by:
getPaintedCellRangein interfaceCommand- Returns:
- the painted range or
null
-
execute
public void execute()
Description copied from interface:CommandExecutes 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 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-basedc- 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-basedc- Column index, 0-based- Returns:
- Cell at the given coordinates, null if not found
-
getChangedCells
public Set<org.apache.poi.ss.util.CellReference> getChangedCells()
Description copied from interface:ValueChangeCommandReturns the cells that had their value(s) changed.- Specified by:
getChangedCellsin interfaceValueChangeCommand
-
-