Class SpreadsheetWidget

java.lang.Object
com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Composite
com.vaadin.addon.spreadsheet.client.SpreadsheetWidget
All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.IsRenderable, com.google.gwt.user.client.ui.IsWidget, FormulaBarHandler, GroupingWidget.GroupingHandler, SheetHandler, SheetTabSheet.SheetTabSheetHandler, com.vaadin.client.Focusable

public class SpreadsheetWidget extends com.google.gwt.user.client.ui.Composite implements SheetHandler, FormulaBarHandler, SheetTabSheet.SheetTabSheetHandler, com.vaadin.client.Focusable
  • Field Details

  • Constructor Details

    • SpreadsheetWidget

      public SpreadsheetWidget()
  • Method Details

    • setHeight

      public void setHeight(String height)
      Overrides:
      setHeight in class com.google.gwt.user.client.ui.UIObject
    • setWidth

      public void setWidth(String width)
      Overrides:
      setWidth in class com.google.gwt.user.client.ui.UIObject
    • setLockFormatColumns

      public void setLockFormatColumns(boolean enabled)
      Enable or disable Formatting columns locking.
      Parameters:
      enabled - the new content. Can not be HTML.
    • setLockFormatRows

      public void setLockFormatRows(boolean enabled)
      Enable or disable Formatting rows locking.
      Parameters:
      enabled - the new content. Can not be HTML.
    • setInfoLabelValue

      public void setInfoLabelValue(String value)
      Sets the content of the info label.
      Parameters:
      value - the new content. Can not be HTML.
    • getInfoLabelValue

      public String getInfoLabelValue()
      Returns:
      current content of the info label.
    • getSheetWidget

      public SheetWidget getSheetWidget()
    • load

      public void load()
    • sheetUpdated

      public void sheetUpdated(String[] sheetNames, int sheetIndex, boolean clearScrollPosition)
    • widgetSizeChanged

      public void widgetSizeChanged()
    • clearSpreadsheet

      public void clearSpreadsheet(boolean removed)
      Clear all current sheet related data
    • loadSheet

      protected void loadSheet(int sheetIndex)
      Parameters:
      sheetIndex - 0-based index of the sheet to load
    • relayoutSheet

      public void relayoutSheet()
    • setSpreadsheetHandler

      public void setSpreadsheetHandler(SpreadsheetHandler spreadsheetHandler)
    • getSpreadsheetHandler

      public SpreadsheetHandler getSpreadsheetHandler()
    • setSheetContextMenuHandler

      public void setSheetContextMenuHandler(SpreadsheetWidget.SheetContextMenuHandler sheetContextMenuHandler)
    • hasCustomContextMenu

      public boolean hasCustomContextMenu()
      Specified by:
      hasCustomContextMenu in interface SheetHandler
    • showCellCustomComponents

      public void showCellCustomComponents(HashMap<String,com.google.gwt.user.client.ui.Widget> customWidgetMap)
    • addPopupButton

      public void addPopupButton(PopupButtonWidget widget)
    • removePopupButton

      public void removePopupButton(PopupButtonWidget popupButton)
    • updateFormulaBar

      public void updateFormulaBar(String possibleName, int col, int row)
    • invalidCellAddress

      public void invalidCellAddress()
    • focusSheet

      public void focusSheet()
    • getCustomEditorFactory

      public SpreadsheetCustomEditorFactory getCustomEditorFactory()
      Returns:
      the customEditorFactory
    • setCustomEditorFactory

      public void setCustomEditorFactory(SpreadsheetCustomEditorFactory customEditorFactory)
      Parameters:
      customEditorFactory - the customEditorFactory to set
    • loadSelectedCellEditor

      public void loadSelectedCellEditor()
      Called when the customEditorFactory might have a new editor for the currently selected cell.
    • addVisibleCellComment

      public void addVisibleCellComment(String key)
    • removeVisibleCellComment

      public void removeVisibleCellComment(String key)
    • updateMergedRegions

      public void updateMergedRegions(ArrayList<MergedRegion> mergedRegions)
    • onScrollViewChanged

      public void onScrollViewChanged(int firstRowIndex, int lastRowIndex, int firstColumnIndex, int lastColumnIndex)
      Specified by:
      onScrollViewChanged in interface SheetHandler
    • onLinkCellClick

      public void onLinkCellClick(int column, int row)
      Specified by:
      onLinkCellClick in interface SheetHandler
    • onCellRightClick

      public void onCellRightClick(com.google.gwt.dom.client.NativeEvent event, int column, int row)
      Description copied from interface: SheetHandler
      Called on right mouse button click on top of some cell.
      Specified by:
      onCellRightClick in interface SheetHandler
      column - 1-based
      row - 1-based
    • onRowHeaderRightClick

      public void onRowHeaderRightClick(com.google.gwt.dom.client.NativeEvent nativeEvent, int rowIndex)
      Description copied from interface: SheetHandler
      Called on right mouse button click on top of a row header
      Specified by:
      onRowHeaderRightClick in interface SheetHandler
      rowIndex - 1-based
    • onColumnHeaderRightClick

      public void onColumnHeaderRightClick(com.google.gwt.dom.client.NativeEvent nativeEvent, int columnIndex)
      Description copied from interface: SheetHandler
      Called on right mouse button click on top of a column header
      Specified by:
      onColumnHeaderRightClick in interface SheetHandler
      columnIndex - 1-based
    • onCellClick

      public void onCellClick(int column, int row, String value, boolean shiftKey, boolean metaOrCtrlKey, boolean updateToActionHandler)
      Specified by:
      onCellClick in interface SheetHandler
    • updateSelectedCellValues

      public void updateSelectedCellValues(int column, int row)
    • updateSelectedCellValues

      public void updateSelectedCellValues(int column, int row, String name)
    • onRowHeaderClick

      public void onRowHeaderClick(int row, boolean shiftPressed, boolean metaOrCrtlPressed)
      Specified by:
      onRowHeaderClick in interface SheetHandler
    • onColumnHeaderClick

      public void onColumnHeaderClick(int column, boolean shiftPressed, boolean metaOrCrtlPressed)
      Specified by:
      onColumnHeaderClick in interface SheetHandler
    • onRowHeaderDoubleClick

      public void onRowHeaderDoubleClick(int rowIndex)
      Specified by:
      onRowHeaderDoubleClick in interface SheetHandler
      Parameters:
      rowIndex - 1-based
    • onColumnHeaderResizeDoubleClick

      public void onColumnHeaderResizeDoubleClick(int columnIndex)
      Specified by:
      onColumnHeaderResizeDoubleClick in interface SheetHandler
      Parameters:
      columnIndex - 1-based
    • onSelectingCellsWithDrag

      public void onSelectingCellsWithDrag(int col, int row)
      Specified by:
      onSelectingCellsWithDrag in interface SheetHandler
    • onFinishedSelectingCellsWithDrag

      public void onFinishedSelectingCellsWithDrag(int col1, int col2, int row1, int row2)
      Specified by:
      onFinishedSelectingCellsWithDrag in interface SheetHandler
    • onCellDoubleClick

      public void onCellDoubleClick(int column, int row, String value)
      Specified by:
      onCellDoubleClick in interface SheetHandler
    • onCellInputBlur

      public void onCellInputBlur(String inputValue)
      Specified by:
      onCellInputBlur in interface SheetHandler
    • onCellInputFocus

      public void onCellInputFocus()
      Specified by:
      onCellInputFocus in interface SheetHandler
    • onCellInputCancel

      public void onCellInputCancel()
      Specified by:
      onCellInputCancel in interface SheetHandler
    • onCellInputEnter

      public void onCellInputEnter(String value, boolean shift)
      Specified by:
      onCellInputEnter in interface SheetHandler
    • onCellInputTab

      public void onCellInputTab(String value, boolean shift)
      Specified by:
      onCellInputTab in interface SheetHandler
    • onCellInputValueChange

      public void onCellInputValueChange(String value)
      Specified by:
      onCellInputValueChange in interface SheetHandler
    • onSheetKeyPress

      public void onSheetKeyPress(com.google.gwt.dom.client.NativeEvent event, String enteredCharacter)
      Specified by:
      onSheetKeyPress in interface SheetHandler
    • onAddressEntered

      public void onAddressEntered(String value)
      Specified by:
      onAddressEntered in interface FormulaBarHandler
    • onAddressFieldEsc

      public void onAddressFieldEsc()
      Specified by:
      onAddressFieldEsc in interface FormulaBarHandler
    • onSheetTabSelected

      public void onSheetTabSelected(int sheetIndex)
      Specified by:
      onSheetTabSelected in interface SheetTabSheet.SheetTabSheetHandler
    • onFirstTabIndexChange

      public void onFirstTabIndexChange(int firstVisibleTab)
      Specified by:
      onFirstTabIndexChange in interface SheetTabSheet.SheetTabSheetHandler
    • onSheetRename

      public void onSheetRename(int sheetIndex, String newName)
      Specified by:
      onSheetRename in interface SheetTabSheet.SheetTabSheetHandler
    • onNewSheetCreated

      public void onNewSheetCreated()
      Specified by:
      onNewSheetCreated in interface SheetTabSheet.SheetTabSheetHandler
    • onSheetRenameCancel

      public void onSheetRenameCancel()
      Specified by:
      onSheetRenameCancel in interface SheetTabSheet.SheetTabSheetHandler
    • onSheetTabSheetFocus

      public void onSheetTabSheetFocus()
      Specified by:
      onSheetTabSheetFocus in interface SheetTabSheet.SheetTabSheetHandler
    • getRowHeightsPX

      public int[] getRowHeightsPX()
      Specified by:
      getRowHeightsPX in interface SheetHandler
    • getMergedRegion

      public MergedRegion getMergedRegion(int column, int row)
      Description copied from interface: SheetHandler
      Returns the merged region that this cell belongs to.
      Specified by:
      getMergedRegion in interface SheetHandler
      Returns:
    • getMergedRegionStartingFrom

      public MergedRegion getMergedRegionStartingFrom(int column, int row)
      Description copied from interface: SheetHandler
      Params 1-based
      Specified by:
      getMergedRegionStartingFrom in interface SheetHandler
      Parameters:
      column - starting column of merged cell
      row - starting row of merged cell
      Returns:
    • onSelectionIncreasePainted

      public void onSelectionIncreasePainted(int c1, int c2, int r1, int r2)
      Specified by:
      onSelectionIncreasePainted in interface SheetHandler
    • onSelectionDecreasePainted

      public void onSelectionDecreasePainted(int colEdgeIndex, int rowEdgeIndex)
      Specified by:
      onSelectionDecreasePainted in interface SheetHandler
    • onFormulaFieldFocus

      public void onFormulaFieldFocus(String value)
      Description copied from interface: FormulaBarHandler
      Swap the cell data to the value if it is a formula.
      Specified by:
      onFormulaFieldFocus in interface FormulaBarHandler
    • onFormulaFieldBlur

      public void onFormulaFieldBlur(String value)
      Specified by:
      onFormulaFieldBlur in interface FormulaBarHandler
    • onFormulaEnter

      public void onFormulaEnter(String value)
      Specified by:
      onFormulaEnter in interface FormulaBarHandler
    • onFormulaTab

      public void onFormulaTab(String value, boolean focusSheet)
      Specified by:
      onFormulaTab in interface FormulaBarHandler
    • onFormulaEsc

      public void onFormulaEsc()
      Specified by:
      onFormulaEsc in interface FormulaBarHandler
    • onFormulaValueChange

      public void onFormulaValueChange(String value)
      Specified by:
      onFormulaValueChange in interface FormulaBarHandler
    • onRowsResized

      public void onRowsResized(Map<Integer,Float> newSizes)
      Description copied from interface: SheetHandler
      Map containing 1-based row indexes and new sizes as pt
      Specified by:
      onRowsResized in interface SheetHandler
    • onColumnsResized

      public void onColumnsResized(Map<Integer,Integer> newSizes)
      Description copied from interface: SheetHandler
      Map containing 1-based column indexes and new sizes as pt
      Specified by:
      onColumnsResized in interface SheetHandler
    • onRedoPress

      public void onRedoPress()
      Specified by:
      onRedoPress in interface SheetHandler
    • onUndoPress

      public void onUndoPress()
      Specified by:
      onUndoPress in interface SheetHandler
    • createRangeSelectionString

      protected String createRangeSelectionString(int col1, int col2, int row1, int row2)
    • createCellAddress

      public String createCellAddress(int column, int row)
      Specified by:
      createCellAddress in interface FormulaBarHandler
    • setRowBufferSize

      public void setRowBufferSize(int rowBufferSize)
    • setColumnBufferSize

      public void setColumnBufferSize(int columnBufferSize)
    • setRows

      public void setRows(int rows)
    • setCols

      public void setCols(int cols)
    • setColGroupingData

      public void setColGroupingData(List<GroupingData> data)
    • setRowGroupingData

      public void setRowGroupingData(List<GroupingData> data)
    • setRowH

      public void setRowH(float[] rowH)
    • setColW

      public void setColW(int[] colW)
    • setDefRowH

      public void setDefRowH(float defRowH)
    • setDefColW

      public void setDefColW(int defColW)
    • setVerticalScrollPositions

      public void setVerticalScrollPositions(int[] verticalScrollPositions)
    • setHorizontalScrollPositions

      public void setHorizontalScrollPositions(int[] horizontalScrollPositions)
    • setVerticalSplitPosition

      public void setVerticalSplitPosition(int verticalSplitPosition)
    • setHorizontalSplitPosition

      public void setHorizontalSplitPosition(int horizontalSplitPosition)
    • setCellStyleToCSSStyle

      public void setCellStyleToCSSStyle(HashMap<Integer,String> cellStyleToCSSStyle)
    • setRowIndexToStyleIndex

      public void setRowIndexToStyleIndex(HashMap<Integer,Integer> rowIndexToStyleIndex)
    • setColumnIndexToStyleIndex

      public void setColumnIndexToStyleIndex(HashMap<Integer,Integer> columnIndexToStyleIndex)
    • setLockedColumnIndexes

      public void setLockedColumnIndexes(Set<Integer> lockedColumnIndexes)
    • setLockedRowIndexes

      public void setLockedRowIndexes(Set<Integer> lockedRowIndexes)
    • setShiftedCellBorderStyles

      public void setShiftedCellBorderStyles(ArrayList<String> shiftedCellBorderStyles)
    • setHyperlinksTooltips

      public void setHyperlinksTooltips(HashMap<String,String> cellLinksMap)
    • setSheetProtected

      public void setSheetProtected(boolean sheetProtected)
    • isSheetProtected

      public boolean isSheetProtected()
      Specified by:
      isSheetProtected in interface SheetHandler
    • isColProtected

      public boolean isColProtected(int col)
      Specified by:
      isColProtected in interface SheetHandler
    • isRowProtected

      public boolean isRowProtected(int row)
      Specified by:
      isRowProtected in interface SheetHandler
    • setWorkbookProtected

      public void setWorkbookProtected(boolean workbookProtected)
    • setHiddenColumnIndexes

      public void setHiddenColumnIndexes(ArrayList<Integer> hiddenColumnIndexes)
    • setHiddenRowIndexes

      public void setHiddenRowIndexes(ArrayList<Integer> hiddenRowIndexes)
    • setCellComments

      public void setCellComments(HashMap<String,String> cellComments, HashMap<String,String> cellCommentAuthors)
    • setInvalidFormulaCells

      public void setInvalidFormulaCells(Set<String> invalidFormulaCells)
    • setInvalidFormulaErrorMessage

      public void setInvalidFormulaErrorMessage(String invalidFormulaMessage)
    • getCellStyleToCSSStyle

      public Map<Integer,String> getCellStyleToCSSStyle()
      Specified by:
      getCellStyleToCSSStyle in interface SheetHandler
    • getRowIndexToStyleIndex

      public Map<Integer,Integer> getRowIndexToStyleIndex()
      Specified by:
      getRowIndexToStyleIndex in interface SheetHandler
    • getColumnIndexToStyleIndex

      public Map<Integer,Integer> getColumnIndexToStyleIndex()
      Specified by:
      getColumnIndexToStyleIndex in interface SheetHandler
    • getRowHeight

      public float getRowHeight(int row)
      Description copied from interface: SheetHandler
      Height of a row in points (pt) including bottom border. Rows are indexed from 1 to getRows(). Returns 0 for hidden rows.
      Specified by:
      getRowHeight in interface SheetHandler
    • getColWidth

      public int getColWidth(int col)
      Description copied from interface: SheetHandler
      Width of a column in pixels including right border. Columns are indexed from 1 to getColumns(). Returns 0 for hidden columns.
      Specified by:
      getColWidth in interface SheetHandler
    • getColWidthActual

      public int getColWidthActual(int col)
      Description copied from interface: SheetHandler
      Returns 0 for hidden columns, otherwise same as SheetHandler.getColWidth(int) .
      Specified by:
      getColWidthActual in interface SheetHandler
      Parameters:
      col - 1-based
      Returns:
      width (px)
    • getColHeader

      public final String getColHeader(int col)
      Get column header for column indexed 1..
      Specified by:
      getColHeader in interface SheetHandler
    • getRowHeader

      public String getRowHeader(int row)
      Get row header for rows indexed 1..
      Specified by:
      getRowHeader in interface SheetHandler
    • getDefinedRows

      public int getDefinedRows()
      Description copied from interface: SheetHandler
      Number of defined rows in the spreadsheet
      Specified by:
      getDefinedRows in interface SheetHandler
    • getColWidths

      public int[] getColWidths()
      Specified by:
      getColWidths in interface SheetHandler
    • getDefaultRowHeight

      public float getDefaultRowHeight()
      Description copied from interface: SheetHandler
      default row height in points (?)
      Specified by:
      getDefaultRowHeight in interface SheetHandler
      Returns:
    • getRowBufferSize

      public int getRowBufferSize()
      Specified by:
      getRowBufferSize in interface SheetHandler
    • getColumnBufferSize

      public int getColumnBufferSize()
      Specified by:
      getColumnBufferSize in interface SheetHandler
    • getMaxColumns

      public int getMaxColumns()
      Description copied from interface: SheetHandler
      The maximum amount of columns that are visible
      Specified by:
      getMaxColumns in interface SheetHandler
      Returns:
    • getMaxRows

      public int getMaxRows()
      Description copied from interface: SheetHandler
      The maximum amount of rows that are visible
      Specified by:
      getMaxRows in interface SheetHandler
      Returns:
    • isColumnHidden

      public boolean isColumnHidden(int columnIndex)
      Specified by:
      isColumnHidden in interface SheetHandler
      Parameters:
      columnIndex - 1-based
      Returns:
      true if the column is hidden
    • isRowHidden

      public boolean isRowHidden(int rowIndex)
      Specified by:
      isRowHidden in interface SheetHandler
      Parameters:
      rowIndex - 1-based
      Returns:
      true if the row is hidden
    • canResizeColumn

      public boolean canResizeColumn()
      Specified by:
      canResizeColumn in interface SheetHandler
    • canResizeRow

      public boolean canResizeRow()
      Specified by:
      canResizeRow in interface SheetHandler
    • setDisplayGridlines

      public void setDisplayGridlines(boolean displayGridlines)
    • setDisplayRowColHeadings

      public void setDisplayRowColHeadings(boolean displayRowColHeadings)
    • refreshOverlayPositions

      public void refreshOverlayPositions()
    • updateBottomRightCellValues

      public void updateBottomRightCellValues(ArrayList<CellData> cellData)
    • updateTopLeftCellValues

      public void updateTopLeftCellValues(ArrayList<CellData> cellData)
    • updateTopRightCellValues

      public void updateTopRightCellValues(ArrayList<CellData> cellData)
    • updateBottomLeftCellValues

      public void updateBottomLeftCellValues(ArrayList<CellData> cellData)
    • cellValuesUpdated

      public void cellValuesUpdated(ArrayList<CellData> updatedCellData)
      This can contain values for any of the panes or values that are just in the client side cache, but the cell is not actually visible.
      Parameters:
      updatedCellData -
    • setCellStyleWidthRatios

      public void setCellStyleWidthRatios(HashMap<Integer,Float> cellStyleWidthRatioMap)
      Specified by:
      setCellStyleWidthRatios in interface SheetHandler
    • onSheetPaste

      public void onSheetPaste(String text)
      Description copied from interface: SheetHandler
      Called when user pastes something inside the sheet.
      Specified by:
      onSheetPaste in interface SheetHandler
      Parameters:
      text - the pasted content
    • clearSelectedCellsOnCut

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

      public Map<Integer,String> getConditionalFormattingStyles()
      Specified by:
      getConditionalFormattingStyles in interface SheetHandler
    • setConditionalFormattingStyles

      public void setConditionalFormattingStyles(HashMap<Integer,String> map)
    • selectCell

      public void selectCell(String name, int col, int row, String value, boolean formula, boolean locked, boolean initialSelection)
    • selectCellRange

      public void selectCellRange(String name, int selectedCellColumn, int selectedCellRow, int firstColumn, int lastColumn, int firstRow, int lastRow, boolean scroll)
    • refreshCellStyles

      public void refreshCellStyles()
    • isTouchMode

      public boolean isTouchMode()
      Specified by:
      isTouchMode in interface FormulaBarHandler
    • setTouchMode

      public void setTouchMode(boolean touchMode)
    • getFormulaBarWidget

      public FormulaBarWidget getFormulaBarWidget()
      Specified by:
      getFormulaBarWidget in interface SheetHandler
    • editCellComment

      public void editCellComment(int col, int row)
    • updateCellComment

      public void updateCellComment(String text, int col, int row)
      Specified by:
      updateCellComment in interface SheetHandler
    • selectAll

      public void selectAll()
      Specified by:
      selectAll in interface SheetHandler
    • focus

      public void focus()
      Specified by:
      focus in interface com.vaadin.client.Focusable
    • setCommsTrigger

      public void setCommsTrigger(SpreadsheetConnector.CommsTrigger commsTrigger)
    • setSheetFocused

      public void setSheetFocused(boolean focused)
      Specified by:
      setSheetFocused in interface FormulaBarHandler
    • setId

      public void setId(String connectorId)
    • getSheetNames

      public String[] getSheetNames()
      Specified by:
      getSheetNames in interface FormulaBarHandler
    • getActiveSheetName

      public String getActiveSheetName()
      Specified by:
      getActiveSheetName in interface FormulaBarHandler
    • setGroupingCollapsed

      public void setGroupingCollapsed(boolean isCols, int colIndex, boolean collapsed)
      Specified by:
      setGroupingCollapsed in interface GroupingWidget.GroupingHandler
    • levelHeaderClicked

      public void levelHeaderClicked(boolean cols, int level)
      Specified by:
      levelHeaderClicked in interface GroupingWidget.GroupingHandler
    • setColGroupingMax

      public void setColGroupingMax(int max)
    • setRowGroupingMax

      public void setRowGroupingMax(int max)
    • setColGroupingInversed

      public void setColGroupingInversed(boolean inversed)
    • setRowGroupingInversed

      public void setRowGroupingInversed(boolean inversed)
    • setNamedRanges

      public void setNamedRanges(List<String> namedRanges)
    • setHost

      public void setHost(com.google.gwt.dom.client.Element host, com.google.gwt.dom.client.Node renderRoot)