public class CellValueManager extends Object implements Serializable
| Modifier and Type | Field and Description |
|---|---|
protected Spreadsheet |
spreadsheet
The Spreadsheet this class is tied to.
|
| Constructor and Description |
|---|
CellValueManager(Spreadsheet spreadsheet)
Creates a new CellValueManager and ties it to the given Spreadsheet.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
cellDeleted(org.apache.poi.ss.usermodel.Cell cell)
Marks the given cell as deleted and notifies the evaluator
|
protected void |
cellUpdated(org.apache.poi.ss.usermodel.Cell cell)
Notifies evaluator and marks cell for update on next call to
updateMarkedCellValues() |
void |
clearCachedContent()
Clears all cached data.
|
void |
clearCacheForColumn(int indexColumn)
Clears data cache for the column at the given index
|
protected void |
clearCellCache(String cellKey)
Clears the cell with the given key from the cache
|
protected CellData |
createCellDataForCell(org.apache.poi.ss.usermodel.Cell cell) |
protected int |
getCellWidth(org.apache.poi.ss.usermodel.Cell cell)
Calculate cell width, accounting for merged cells (see #655)
|
protected org.apache.poi.ss.formula.ConditionalFormattingEvaluator |
getConditionalFormattingEvaluator() |
Spreadsheet.CellDeletionHandler |
getCustomCellDeletionHandler()
Gets the current CellDeletionHandler
|
Spreadsheet.CellValueHandler |
getCustomCellValueHandler()
Gets the current CellValueHandler
|
org.apache.poi.ss.usermodel.DataFormatter |
getDataFormatter() |
protected org.apache.poi.ss.usermodel.FormulaEvaluator |
getFormulaEvaluator()
Get the common
FormulaEvaluator instance from Spreadsheet |
String |
getOriginalCellValue(org.apache.poi.ss.usermodel.Cell cell) |
DecimalFormat |
getOriginalValueDecimalFormat() |
protected void |
loadCellData(int firstRow,
int firstColumn,
int lastRow,
int lastColumn)
Sends cell data to the client.
|
protected ArrayList<CellData> |
loadCellDataForRowAndColumnRange(int firstRow,
int firstColumn,
int lastRow,
int lastColumn)
Gets cell data for cells within the given bounds.
|
protected void |
markCellForRemove(org.apache.poi.ss.usermodel.Cell cell)
Marks the given cell for removal.
|
protected void |
markCellForUpdate(org.apache.poi.ss.usermodel.Cell cell)
Marks cell for update on next call to
updateMarkedCellValues() |
void |
onCellStyleWidthRatioUpdate(HashMap<Integer,Float> cellStyleWidthRatioMap)
Sets the cell style width ratio map
|
void |
onCellValueChange(int col,
int row,
String value)
Updates the cell value and type, causes a recalculation of all the values
in the cell.
|
void |
onDeleteSelectedCells()
Deletes the currently selected cells' values.
|
protected void |
parseValueIntoNumericCell(org.apache.poi.ss.usermodel.Cell cell,
String value)
Attempts to parse a numeric value from the given String and set it to the
given Cell.
|
protected void |
removeCell(int rowIndex,
int colIndex,
boolean clearRemovedCellStyle)
Removes an individual cell from the Spreadsheet and the underlying POI
model.
|
protected void |
removeCells(int firstRow,
int firstColumn,
int lastRow,
int lastColumn,
boolean clearRemovedCellStyle)
Removes all the cells within the given bounds from the Spreadsheet and
the underlying POI model.
|
protected void |
removeHyperlink(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.Sheet sheet)
Removes hyperlink from the given cell
|
void |
setCustomCellDeletionHandler(Spreadsheet.CellDeletionHandler customCellDeletionHandler)
Sets the current CellDeletionHandler
|
void |
setCustomCellValueHandler(Spreadsheet.CellValueHandler customCellValueHandler)
Sets the current CellValueHandler
|
void |
setDataFormatter(org.apache.poi.ss.usermodel.DataFormatter dataFormatter) |
protected void |
updateDeletedRowsInClientCache(int startRow,
int endRow)
Makes sure the next
Spreadsheet.updateMarkedCells() call will
clear all removed rows from client cache. |
protected void |
updateLocale(Locale locale) |
protected void |
updateMarkedCellValues()
Method for updating cells that are marked for update and formula cells.
|
protected void |
updateVisibleCellValues()
Method for updating the spreadsheet client side visible cells and cached
data correctly.
|
protected final Spreadsheet spreadsheet
public CellValueManager(Spreadsheet spreadsheet)
spreadsheet - Target Spreadsheetpublic void clearCachedContent()
public org.apache.poi.ss.usermodel.DataFormatter getDataFormatter()
public void setDataFormatter(org.apache.poi.ss.usermodel.DataFormatter dataFormatter)
public DecimalFormat getOriginalValueDecimalFormat()
protected void updateLocale(Locale locale)
protected org.apache.poi.ss.usermodel.FormulaEvaluator getFormulaEvaluator()
FormulaEvaluator instance from Spreadsheetprotected org.apache.poi.ss.formula.ConditionalFormattingEvaluator getConditionalFormattingEvaluator()
ConditionalFormattingEvaluator instance from
Spreadsheetprotected CellData createCellDataForCell(org.apache.poi.ss.usermodel.Cell cell)
public String getOriginalCellValue(org.apache.poi.ss.usermodel.Cell cell)
protected int getCellWidth(org.apache.poi.ss.usermodel.Cell cell)
cell - public Spreadsheet.CellValueHandler getCustomCellValueHandler()
public void setCustomCellValueHandler(Spreadsheet.CellValueHandler customCellValueHandler)
customCellValueHandler - the customCellValueHandler to setpublic Spreadsheet.CellDeletionHandler getCustomCellDeletionHandler()
public void setCustomCellDeletionHandler(Spreadsheet.CellDeletionHandler customCellDeletionHandler)
customCellDeletionHandler - the customCellDeletionHandler to setprotected void cellUpdated(org.apache.poi.ss.usermodel.Cell cell)
updateMarkedCellValues()cell - Cell to mark for updatesprotected void markCellForUpdate(org.apache.poi.ss.usermodel.Cell cell)
updateMarkedCellValues()cell - Cell to mark for updatesprotected void cellDeleted(org.apache.poi.ss.usermodel.Cell cell)
cell - Deleted cellprotected void markCellForRemove(org.apache.poi.ss.usermodel.Cell cell)
cell - Cell to mark for removalprotected void clearCellCache(String cellKey)
cellKey - Key of target cellpublic void onCellValueChange(int col,
int row,
String value)
Spreadsheet.CellValueHandler defined, then it is used.
Cells starting with "=" or "+" will be created/changed into FORMULA type.
Cells that are existing and are NUMERIC type will be parsed according to
their existing format, or if that fails, as Double.
Cells not containing any letters and containing at least one number will
be created/changed into NUMERIC type (formatting is not changed).
Existing Boolean cells will be parsed as Boolean.
For everything else and if any of the above fail, the cell will get the
STRING type and the value will just be a string, except empty values will
cause the cell type to be BLANK.col - Column index of target cell, 1-basedrow - Row index of target cell, 1-basedvalue - The new value to set to the target cell, formulas will start
with an extra "=" or "+"public void onDeleteSelectedCells()
protected void parseValueIntoNumericCell(org.apache.poi.ss.usermodel.Cell cell,
String value)
cell - Target Cellvalue - Source for parsing the valueprotected void loadCellData(int firstRow,
int firstColumn,
int lastRow,
int lastColumn)
firstRow - Starting row index, 1-basedfirstColumn - Starting column index, 1-basedlastRow - Ending row index, 1-basedlastColumn - Ending column index, 1-basedprotected ArrayList<CellData> loadCellDataForRowAndColumnRange(int firstRow, int firstColumn, int lastRow, int lastColumn)
firstRow - Starting row index, 1-basedfirstColumn - Starting column index, 1-basedlastRow - Ending row index, 1-basedlastColumn - Ending column index, 1-basedprotected void updateVisibleCellValues()
protected void updateMarkedCellValues()
protected void updateDeletedRowsInClientCache(int startRow,
int endRow)
Spreadsheet.updateMarkedCells() call will
clear all removed rows from client cache.startRow - Index of the starting row, 1-basedendRow - Index of the ending row, 1-basedprotected void removeCells(int firstRow,
int firstColumn,
int lastRow,
int lastColumn,
boolean clearRemovedCellStyle)
firstRow - Starting row index, 1-basedfirstColumn - Starting column index, 1-basedlastRow - Ending row index, 1-basedlastColumn - Ending column index, 1-basedclearRemovedCellStyle - true to also clear styles from the removed cellsprotected void removeCell(int rowIndex,
int colIndex,
boolean clearRemovedCellStyle)
rowIndex - Row index of target cell, 1-basedcolIndex - Column index of target cell, 1-basedclearRemovedCellStyle - true to also clear styles from the removed cellprotected void removeHyperlink(org.apache.poi.ss.usermodel.Cell cell,
org.apache.poi.ss.usermodel.Sheet sheet)
cell - Target cellsheet - Sheet the target cell belongs topublic void onCellStyleWidthRatioUpdate(HashMap<Integer,Float> cellStyleWidthRatioMap)
cellStyleWidthRatioMap - New mappublic void clearCacheForColumn(int indexColumn)
indexColumn - Index of target column, 1-basedCopyright © 2013–2026 Vaadin Ltd. All rights reserved.