com.vaadin.flow.component.spreadsheet.
Class SpreadsheetHandlerImpl
- java.lang.Object
-
- com.vaadin.flow.component.spreadsheet.SpreadsheetHandlerImpl
-
All Implemented Interfaces:
public class SpreadsheetHandlerImpl extends Object implements SpreadsheetServerRpc
Implementation of the Spreadsheet Server RPC interface.
-
-
Constructor Summary
Constructors Constructor Description SpreadsheetHandlerImpl(Spreadsheet spreadsheet)
-
Method Summary
All Methods Modifier and Type Method Description void
actionOnColumnHeader(String actionKey)
The action was selected from context menu for the column header.
void
actionOnCurrentSelection(String actionKey)
The action was selected from context menu for the current selection.
void
actionOnRowHeader(String actionKey)
The action was selected from context menu for the row header.
void
cellAddedToSelectionAndSelected(int row, int column)
Single cell added to selection.
void
cellRangePainted(int selectedCellRow, int selectedCellColumn, int row1, int col1, int row2, int col2)
Cell range selected by painting
void
cellRangeSelected(int row1, int col1, int row2, int col2)
Cell range selected from scratch.
void
cellsAddedToRangeSelection(int row1, int col1, int row2, int col2)
Multiple cells added to previous range selection.
void
cellSelected(int row, int column, boolean discardOldRangeSelection)
Single cell selected inside sheet.
void
cellValueEdited(int row, int col, String value)
void
clearSelectedCellsOnCut()
Called after successful cut operation; currently selected cells should be cleared
void
columnAddedToSelection(int firstRowIndex, int column)
Complete column added to previous range selection.
void
columnHeaderContextMenuOpen(int columnIndex)
Context menu should be created for the column.
void
columnResized(Map<Integer,Integer> newColumnSizes, int row1, int col1, int row2, int col2)
Columns resized with drag and drop.
void
columnSelected(int col, int firstRowIndex)
Complete column selected.
void
contextMenuOpenOnSelection(int row, int column)
Context menu should be created for the appropriate selection.
void
deleteSelectedCells()
Delete the contents of the selected cells, do not remove style/formatting.
org.apache.poi.ss.usermodel.Cell
getOrCreateCell(org.apache.poi.ss.usermodel.Sheet sheet, int rowIdx, int colIdx)
void
levelHeaderClicked(boolean isCols, int level)
void
linkCellClicked(int row, int column)
A cell containing a hyperlink has been clicked.
void
onColumnAutofit(int columnIndex)
Column autofit with double click on the column header resizing area.
void
onConnectorInit()
Called when the client side connector has been initialized.
void
onPaste(String text)
Client pasted text at current selection.
void
onRedo()
Client pressed redo ctrl/meta+y
void
onRowAutofit(int rowIndex)
Row autofit with double click on the row header resizing area.
void
onSheetScroll(int firstRow, int firstColumn, int lastRow, int lastColumn)
These cells have become visible and possibly need the content, if has not been given previously or has not changed.
void
onUndo()
Client pressed undo ctrl/meta+z
void
protectedCellWriteAttempted()
Client tried to modify protected cell
void
rowAddedToRangeSelection(int row, int firstColumnIndex)
Complete row added to previous range selection.
void
rowHeaderContextMenuOpen(int rowIndex)
Context menu should be created for the row.
void
rowSelected(int row, int firstColumnIndex)
Complete row selected.
void
rowsResized(Map<Integer,Float> newRowSizes, int row1, int col1, int row2, int col2)
Rows resized with header drag and drop.
void
selectionDecreasePainted(int r, int c)
The existing selection has been painted inwards meaning that the painted selection cells should be cleared.
void
selectionIncreasePainted(int r1, int c1, int r2, int c2)
The new selection that was painted from the old.
void
setCellStyleWidthRatios(HashMap<Integer,Float> cellStyleWidthRatioMap)
void
setGroupingCollapsed(boolean isCols, int colIndex, boolean collapsed)
void
sheetAddressChanged(String value)
Address field value changed.
void
sheetCreated(int scrollLeft, int scrollTop)
Sheet is created as the last sheet
void
sheetRenamed(int sheetIndex, String sheetName)
void
sheetSelected(int tabIndex, int scrollLeft, int scrollTop)
void
updateCellComment(String text, int col, int row)
-
-
-
Constructor Detail
-
SpreadsheetHandlerImpl
public SpreadsheetHandlerImpl(Spreadsheet spreadsheet)
-
-
Method Detail
-
onSheetScroll
public void onSheetScroll(int firstRow, int firstColumn, int lastRow, int lastColumn)
Description copied from interface:
SpreadsheetHandler
These cells have become visible and possibly need the content, if has not been given previously or has not changed.
Specified by:
onSheetScroll
in interfaceSpreadsheetHandler
-
cellSelected
public void cellSelected(int row, int column, boolean discardOldRangeSelection)
Description copied from interface:
SpreadsheetHandler
Single cell selected inside sheet.
Specified by:
cellSelected
in interfaceSpreadsheetHandler
-
sheetAddressChanged
public void sheetAddressChanged(String value)
Description copied from interface:
SpreadsheetHandler
Address field value changed.
Specified by:
sheetAddressChanged
in interfaceSpreadsheetHandler
-
cellRangeSelected
public void cellRangeSelected(int row1, int col1, int row2, int col2)
Description copied from interface:
SpreadsheetHandler
Cell range selected from scratch. Actual selected cell not changed.
Specified by:
cellRangeSelected
in interfaceSpreadsheetHandler
-
cellRangePainted
public void cellRangePainted(int selectedCellRow, int selectedCellColumn, int row1, int col1, int row2, int col2)
Description copied from interface:
SpreadsheetHandler
Cell range selected by painting
Specified by:
cellRangePainted
in interfaceSpreadsheetHandler
-
cellAddedToSelectionAndSelected
public void cellAddedToSelectionAndSelected(int row, int column)
Description copied from interface:
SpreadsheetHandler
Single cell added to selection. Selection changed to this.
Specified by:
cellAddedToSelectionAndSelected
in interfaceSpreadsheetHandler
-
cellsAddedToRangeSelection
public void cellsAddedToRangeSelection(int row1, int col1, int row2, int col2)
Description copied from interface:
SpreadsheetHandler
Multiple cells added to previous range selection. Actual selected cell not changed.
Specified by:
cellsAddedToRangeSelection
in interfaceSpreadsheetHandler
-
rowSelected
public void rowSelected(int row, int firstColumnIndex)
Description copied from interface:
SpreadsheetHandler
Complete row selected. New selected cell is at firstColumnIndex:row.
Specified by:
rowSelected
in interfaceSpreadsheetHandler
Parameters:
row
- the row that was selectedfirstColumnIndex
- column index for the selected cell (left most visible)
-
rowAddedToRangeSelection
public void rowAddedToRangeSelection(int row, int firstColumnIndex)
Description copied from interface:
SpreadsheetHandler
Complete row added to previous range selection. New selected cell is at firstColumnIndex:row.
Specified by:
rowAddedToRangeSelection
in interfaceSpreadsheetHandler
Parameters:
row
- the row that was selectedfirstColumnIndex
- column index for the selected cell (left most visible)
-
columnSelected
public void columnSelected(int col, int firstRowIndex)
Description copied from interface:
SpreadsheetHandler
Complete column selected. New selected cell is at column:firstRowIndex.
Specified by:
columnSelected
in interfaceSpreadsheetHandler
Parameters:
col
- the column that was selectedfirstRowIndex
- row index for the selected cell (top most visible)
-
columnAddedToSelection
public void columnAddedToSelection(int firstRowIndex, int column)
Description copied from interface:
SpreadsheetHandler
Complete column added to previous range selection. New selected cell is at column:firstRowIndex.
Specified by:
columnAddedToSelection
in interfaceSpreadsheetHandler
Parameters:
firstRowIndex
- row index for the selected cell (top most)column
- the column that was selected
-
selectionIncreasePainted
public void selectionIncreasePainted(int r1, int c1, int r2, int c2)
Description copied from interface:
SpreadsheetHandler
The new selection that was painted from the old. Values and formulas should be painted to the new selection.
Specified by:
selectionIncreasePainted
in interfaceSpreadsheetHandler
Parameters:
r1
- new selection top, 1-basedc1
- new selection left, 1-basedr2
- new selection bottom, 1-basedc2
- new selection right, 1-based
-
selectionDecreasePainted
public void selectionDecreasePainted(int r, int c)
Description copied from interface:
SpreadsheetHandler
The existing selection has been painted inwards meaning that the painted selection cells should be cleared.
Specified by:
selectionDecreasePainted
in interfaceSpreadsheetHandler
Parameters:
r
- topmost cell index where the clearing starts, 1-basedc
- leftmost cell index where the clearing starts, 1-based
-
cellValueEdited
public void cellValueEdited(int row, int col, String value)
Specified by:
cellValueEdited
in interfaceSpreadsheetHandler
-
sheetSelected
public void sheetSelected(int tabIndex, int scrollLeft, int scrollTop)
Specified by:
sheetSelected
in interfaceSpreadsheetHandler
Parameters:
tabIndex
- 0-based
-
sheetRenamed
public void sheetRenamed(int sheetIndex, String sheetName)
Specified by:
sheetRenamed
in interfaceSpreadsheetHandler
Parameters:
sheetIndex
- 0-based
-
sheetCreated
public void sheetCreated(int scrollLeft, int scrollTop)
Description copied from interface:
SpreadsheetHandler
Sheet is created as the last sheet
Specified by:
sheetCreated
in interfaceSpreadsheetHandler
-
deleteSelectedCells
public void deleteSelectedCells()
Description copied from interface:
SpreadsheetHandler
Delete the contents of the selected cells, do not remove style/formatting.
Specified by:
deleteSelectedCells
in interfaceSpreadsheetHandler
-
linkCellClicked
public void linkCellClicked(int row, int column)
Description copied from interface:
SpreadsheetHandler
A cell containing a hyperlink has been clicked.
Specified by:
linkCellClicked
in interfaceSpreadsheetHandler
Parameters:
row
- 1-basedcolumn
- 1-based
-
contextMenuOpenOnSelection
public void contextMenuOpenOnSelection(int row, int column)
Description copied from interface:
SpreadsheetServerRpc
Context menu should be created for the appropriate selection.
Selection can change if the cell at the given indexes isn't included in the previous selection.
Specified by:
contextMenuOpenOnSelection
in interfaceSpreadsheetServerRpc
Parameters:
row
- 1-basedcolumn
- 1-based
-
rowHeaderContextMenuOpen
public void rowHeaderContextMenuOpen(int rowIndex)
Description copied from interface:
SpreadsheetServerRpc
Context menu should be created for the row.
Specified by:
rowHeaderContextMenuOpen
in interfaceSpreadsheetServerRpc
Parameters:
rowIndex
- 1-based
-
columnHeaderContextMenuOpen
public void columnHeaderContextMenuOpen(int columnIndex)
Description copied from interface:
SpreadsheetServerRpc
Context menu should be created for the column.
Specified by:
columnHeaderContextMenuOpen
in interfaceSpreadsheetServerRpc
Parameters:
columnIndex
- 1-based
-
actionOnCurrentSelection
public void actionOnCurrentSelection(String actionKey)
Description copied from interface:
SpreadsheetServerRpc
The action was selected from context menu for the current selection.
Specified by:
actionOnCurrentSelection
in interfaceSpreadsheetServerRpc
-
actionOnRowHeader
public void actionOnRowHeader(String actionKey)
Description copied from interface:
SpreadsheetServerRpc
The action was selected from context menu for the row header.
Specified by:
actionOnRowHeader
in interfaceSpreadsheetServerRpc
-
actionOnColumnHeader
public void actionOnColumnHeader(String actionKey)
Description copied from interface:
SpreadsheetServerRpc
The action was selected from context menu for the column header.
Specified by:
actionOnColumnHeader
in interfaceSpreadsheetServerRpc
-
rowsResized
public void rowsResized(Map<Integer,Float> newRowSizes, int row1, int col1, int row2, int col2)
Description copied from interface:
SpreadsheetHandler
Rows resized with header drag and drop. Indexes 1-based.
Specified by:
rowsResized
in interfaceSpreadsheetHandler
Parameters:
newRowSizes
- row index and new size (converted pt)
-
columnResized
public void columnResized(Map<Integer,Integer> newColumnSizes, int row1, int col1, int row2, int col2)
Description copied from interface:
SpreadsheetHandler
Columns resized with drag and drop. Indexes 1-based.
Specified by:
columnResized
in interfaceSpreadsheetHandler
Parameters:
newColumnSizes
- column index and new size (px)
-
onRowAutofit
public void onRowAutofit(int rowIndex)
Description copied from interface:
SpreadsheetHandler
Row autofit with double click on the row header resizing area.
Specified by:
onRowAutofit
in interfaceSpreadsheetHandler
Parameters:
rowIndex
- 1-based
-
onColumnAutofit
public void onColumnAutofit(int columnIndex)
Description copied from interface:
SpreadsheetHandler
Column autofit with double click on the column header resizing area.
Specified by:
onColumnAutofit
in interfaceSpreadsheetHandler
Parameters:
columnIndex
- 1-based
-
onUndo
public void onUndo()
Description copied from interface:
SpreadsheetHandler
Client pressed undo ctrl/meta+z
Specified by:
onUndo
in interfaceSpreadsheetHandler
-
onRedo
public void onRedo()
Description copied from interface:
SpreadsheetHandler
Client pressed redo ctrl/meta+y
Specified by:
onRedo
in interfaceSpreadsheetHandler
-
setCellStyleWidthRatios
public void setCellStyleWidthRatios(HashMap<Integer,Float> cellStyleWidthRatioMap)
Specified by:
setCellStyleWidthRatios
in interfaceSpreadsheetHandler
-
onConnectorInit
public void onConnectorInit()
Description copied from interface:
SpreadsheetServerRpc
Called when the client side connector has been initialized. This is for making sure that the non-state related stuff is cleared from server side when needed, because non state stuff is not resent to client when the component is attached again. Thus this marks that cached should be cleared etc.
Specified by:
onConnectorInit
in interfaceSpreadsheetServerRpc
-
protectedCellWriteAttempted
public void protectedCellWriteAttempted()
Description copied from interface:
SpreadsheetHandler
Client tried to modify protected cell
Specified by:
protectedCellWriteAttempted
in interfaceSpreadsheetHandler
-
onPaste
public void onPaste(String text)
Description copied from interface:
SpreadsheetHandler
Client pasted text at current selection.
Specified by:
onPaste
in interfaceSpreadsheetHandler
-
clearSelectedCellsOnCut
public void clearSelectedCellsOnCut()
Description copied from interface:
SpreadsheetHandler
Called after successful cut operation; currently selected cells should be cleared
Specified by:
clearSelectedCellsOnCut
in interfaceSpreadsheetHandler
-
updateCellComment
public void updateCellComment(String text, int col, int row)
Specified by:
updateCellComment
in interfaceSpreadsheetHandler
-
getOrCreateCell
public org.apache.poi.ss.usermodel.Cell getOrCreateCell(org.apache.poi.ss.usermodel.Sheet sheet, int rowIdx, int colIdx)
-
setGroupingCollapsed
public void setGroupingCollapsed(boolean isCols, int colIndex, boolean collapsed)
Specified by:
setGroupingCollapsed
in interfaceGroupingHandler
-
levelHeaderClicked
public void levelHeaderClicked(boolean isCols, int level)
Specified by:
levelHeaderClicked
in interfaceGroupingHandler
-
-