Class SpreadsheetHandlerImpl

java.lang.Object
com.vaadin.flow.component.spreadsheet.SpreadsheetHandlerImpl
All Implemented Interfaces:
GroupingHandler, SpreadsheetHandler, SpreadsheetServerRpc

public class SpreadsheetHandlerImpl extends Object implements SpreadsheetServerRpc
Implementation of the Spreadsheet Server RPC interface.
  • Constructor Details

    • SpreadsheetHandlerImpl

      public SpreadsheetHandlerImpl(Spreadsheet spreadsheet)
  • Method Details

    • 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 interface SpreadsheetHandler
    • cellSelected

      public void cellSelected(int row, int column, boolean discardOldRangeSelection)
      Description copied from interface: SpreadsheetHandler
      Single cell selected inside sheet.
      Specified by:
      cellSelected in interface SpreadsheetHandler
    • sheetAddressChanged

      public void sheetAddressChanged(String value)
      Description copied from interface: SpreadsheetHandler
      Address field value changed.
      Specified by:
      sheetAddressChanged in interface SpreadsheetHandler
    • 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 interface SpreadsheetHandler
    • 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 interface SpreadsheetHandler
      Parameters:
      selectedCellRow -
      selectedCellColumn -
      row1 -
      col1 -
      row2 -
      col2 -
    • 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 interface SpreadsheetHandler
    • 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 interface SpreadsheetHandler
    • 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 interface SpreadsheetHandler
      Parameters:
      row - the row that was selected
      firstColumnIndex - 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 interface SpreadsheetHandler
      Parameters:
      row - the row that was selected
      firstColumnIndex - 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 interface SpreadsheetHandler
      Parameters:
      col - the column that was selected
      firstRowIndex - 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 interface SpreadsheetHandler
      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 interface SpreadsheetHandler
      Parameters:
      r1 - new selection top, 1-based
      c1 - new selection left, 1-based
      r2 - new selection bottom, 1-based
      c2 - 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 interface SpreadsheetHandler
      Parameters:
      r - topmost cell index where the clearing starts, 1-based
      c - leftmost cell index where the clearing starts, 1-based
    • cellValueEdited

      public void cellValueEdited(int row, int col, String value)
      Specified by:
      cellValueEdited in interface SpreadsheetHandler
    • sheetSelected

      public void sheetSelected(int tabIndex, int scrollLeft, int scrollTop)
      Specified by:
      sheetSelected in interface SpreadsheetHandler
      Parameters:
      tabIndex - 0-based
      scrollLeft -
      scrollTop -
    • sheetRenamed

      public void sheetRenamed(int sheetIndex, String sheetName)
      Specified by:
      sheetRenamed in interface SpreadsheetHandler
      Parameters:
      sheetIndex - 0-based
      sheetName -
    • sheetCreated

      public void sheetCreated(int scrollLeft, int scrollTop)
      Description copied from interface: SpreadsheetHandler
      Sheet is created as the last sheet
      Specified by:
      sheetCreated in interface SpreadsheetHandler
      Parameters:
      scrollLeft -
      scrollTop -
    • 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 interface SpreadsheetHandler
    • 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 interface SpreadsheetHandler
      Parameters:
      row - 1-based
      column - 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 interface SpreadsheetServerRpc
      Parameters:
      row - 1-based
      column - 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 interface SpreadsheetServerRpc
      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 interface SpreadsheetServerRpc
      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 interface SpreadsheetServerRpc
      Parameters:
      actionKey -
    • 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 interface SpreadsheetServerRpc
      Parameters:
      actionKey -
    • 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 interface SpreadsheetServerRpc
      Parameters:
      actionKey -
    • 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 interface SpreadsheetHandler
      Parameters:
      newRowSizes - row index and new size (converted pt)
      row1 -
      col1 -
      row2 -
      col2 -
    • 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 interface SpreadsheetHandler
      Parameters:
      newColumnSizes - column index and new size (px)
      row1 -
      col1 -
      row2 -
      col2 -
    • 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 interface SpreadsheetHandler
      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 interface SpreadsheetHandler
      Parameters:
      columnIndex - 1-based
    • onUndo

      public void onUndo()
      Description copied from interface: SpreadsheetHandler
      Client pressed undo ctrl/meta+z
      Specified by:
      onUndo in interface SpreadsheetHandler
    • onRedo

      public void onRedo()
      Description copied from interface: SpreadsheetHandler
      Client pressed redo ctrl/meta+y
      Specified by:
      onRedo in interface SpreadsheetHandler
    • setCellStyleWidthRatios

      public void setCellStyleWidthRatios(HashMap<Integer,Float> cellStyleWidthRatioMap)
      Specified by:
      setCellStyleWidthRatios in interface SpreadsheetHandler
    • 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 interface SpreadsheetServerRpc
    • protectedCellWriteAttempted

      public void protectedCellWriteAttempted()
      Description copied from interface: SpreadsheetHandler
      Client tried to modify protected cell
      Specified by:
      protectedCellWriteAttempted in interface SpreadsheetHandler
    • onPaste

      public void onPaste(String text)
      Description copied from interface: SpreadsheetHandler
      Client pasted text at current selection.
      Specified by:
      onPaste in interface SpreadsheetHandler
      Parameters:
      text -
    • clearSelectedCellsOnCut

      public void clearSelectedCellsOnCut()
      Description copied from interface: SpreadsheetHandler
      Called after successful cut operation; currently selected cells should be cleared
      Specified by:
      clearSelectedCellsOnCut in interface SpreadsheetHandler
    • updateCellComment

      public void updateCellComment(String text, int col, int row)
      Specified by:
      updateCellComment in interface SpreadsheetHandler
    • 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 interface GroupingHandler
    • levelHeaderClicked

      public void levelHeaderClicked(boolean isCols, int level)
      Specified by:
      levelHeaderClicked in interface GroupingHandler
    • onPopupButtonClick

      public void onPopupButtonClick(int row, int column)
    • onPopupClose

      public void onPopupClose(int row, int column)