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
Command for changing the value of one or more cells.
- Since:
- 1.0
- Author:
- Vaadin Ltd.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final intprotected final int[]protected final intFields inherited from class com.vaadin.flow.component.spreadsheet.command.SpreadsheetCommand
activeSheetIndex, spreadsheet -
Constructor Summary
ConstructorsConstructorDescriptionCellValueCommand(Spreadsheet spreadsheet) Sets the currently selected cell of the spreadsheet as the selected cell and possible painted range for this command. -
Method Summary
Modifier and TypeMethodDescriptionvoidcaptureCellRangeValues(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).voidClears 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>Returns the cells that had their value(s) changed.org.apache.poi.ss.util.CellRangeAddressThe painted range that should be set when this command is run.org.apache.poi.ss.util.CellReferenceThe 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, setActiveSheetIndexMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.spreadsheet.command.Command
getActiveSheetIndex, setActiveSheetIndex
-
Field Details
-
values
-
selectedCellRow
protected final int selectedCellRow -
selectedcellCol
protected final int selectedcellCol -
selectedCellRange
protected final int[] selectedCellRange
-
-
Constructor Details
-
CellValueCommand
Sets the currently selected cell of the spreadsheet as the selected cell and possible painted range for this command.- Parameters:
spreadsheet- Target spreadsheet
-
-
Method Details
-
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
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
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
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
Description copied from interface:ValueChangeCommandReturns the cells that had their value(s) changed.- Specified by:
getChangedCellsin interfaceValueChangeCommand
-