Class SheetWidget

java.lang.Object
com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Panel
com.vaadin.addon.spreadsheet.client.SheetWidget
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.HasWidgets, com.google.gwt.user.client.ui.HasWidgets.ForIsWidget, com.google.gwt.user.client.ui.IsWidget, Iterable<com.google.gwt.user.client.ui.Widget>

public class SheetWidget extends com.google.gwt.user.client.ui.Panel
  • Constructor Details

    • SheetWidget

      public SheetWidget(SheetHandler view, boolean touchMode)
  • Method Details

    • getCopyPasteHandler

      protected CopyPasteTextBox.CopyPasteHandler getCopyPasteHandler()
    • onAttach

      protected void onAttach()
      Overrides:
      onAttach in class com.google.gwt.user.client.ui.Widget
    • getSheetHandler

      public SheetHandler getSheetHandler()
    • getSheetJsniUtil

      protected SheetJsniUtil getSheetJsniUtil()
    • onUnload

      public void onUnload()
      Overrides:
      onUnload in class com.google.gwt.user.client.ui.Widget
    • requestCells

      protected void requestCells()
    • resetFromModel

      public void resetFromModel(int scrollLeft, int scrollTop)
      Set the model that stores the contents of the spreadsheet. Setting model redraws the sheet.
    • relayoutSheet

      public void relayoutSheet(boolean triggerRequest)
    • onWidgetResize

      public void onWidgetResize()
    • removeStyles

      public void removeStyles()
      For internal use. May be removed at a later time.
    • onSheetScroll

      protected void onSheetScroll(com.google.gwt.user.client.Event event)
    • onSheetMouseOverOrOut

      protected void onSheetMouseOverOrOut(com.google.gwt.user.client.Event event)
      This is using a delayed execution because we don't want to try to do stuff when it is unnecessary.
      Parameters:
      event -
    • onSheetMouseMove

      protected void onSheetMouseMove(com.google.gwt.user.client.Event event)
    • isEventInCustomEditorCell

      protected boolean isEventInCustomEditorCell(com.google.gwt.user.client.Event event)
    • getRealEventTargetCell

      protected Cell getRealEventTargetCell(int clientX, int clientY, Cell cell)
    • onSheetMouseDown

      protected void onSheetMouseDown(com.google.gwt.user.client.Event event)
      Parameters:
      event - The original event (that can be onClick or onTouchStart)
    • focusCustomEditor

      public void focusCustomEditor()
    • onMouseMoveWhenSelectingCells

      protected void onMouseMoveWhenSelectingCells(com.google.gwt.user.client.Event event)
    • stoppedSelectingCellsWithDrag

      protected void stoppedSelectingCellsWithDrag(com.google.gwt.user.client.Event event)
    • isEditingCell

      protected boolean isEditingCell()
    • isMouseButtonDownAndSelecting

      protected boolean isMouseButtonDownAndSelecting()
    • getCellData

      public CellData getCellData(int column, int row)
    • getCellValue

      public String getCellValue(int column, int row)
    • isCellLocked

      public boolean isCellLocked(int column, int row)
    • getCellFormulaValue

      public String getCellFormulaValue(int column, int row)
    • getOriginalCellValue

      public String getOriginalCellValue(int column, int row)
    • getRules

      public String getRules(com.google.gwt.dom.client.StyleElement stylesheet)
      Clears the rules starting from the given index
    • resetCellContents

      public void resetCellContents()
    • getInlineEditor

      public com.google.gwt.user.client.ui.TextBox getInlineEditor()
    • isSelectedCellCustomized

      public boolean isSelectedCellCustomized()
    • showCustomWidgets

      public void showCustomWidgets(HashMap<String,com.google.gwt.user.client.ui.Widget> newWidgetMap)
    • addSheetOverlay

      public void addSheetOverlay(String key, SheetOverlay overlay)
    • updateOverlayInfo

      public void updateOverlayInfo(String key, OverlayInfo overlayInfo)
    • removeSheetOverlay

      public void removeSheetOverlay(String key)
    • addMergedRegion

      public void addMergedRegion(MergedRegion region)
    • updateMergedRegionSize

      public void updateMergedRegionSize(MergedRegion region)
    • removeMergedRegion

      public void removeMergedRegion(MergedRegion region, int ruleIndex)
    • setCellLinks

      public void setCellLinks(HashMap<String,String> cellLinksMap)
    • setInvalidFormulaCells

      public void setInvalidFormulaCells(Set<String> newInvalidFormulaCells)
    • setCellComments

      public void setCellComments(HashMap<String,String> newCellCommentsMap, HashMap<String,String> newCellCommentAuthorsMap)
    • setCellCommentVisible

      public void setCellCommentVisible(boolean visible, String key)
    • refreshAlwaysVisibleCellCommentOverlays

      public void refreshAlwaysVisibleCellCommentOverlays()
    • refreshCurrentCellCommentOverlay

      public void refreshCurrentCellCommentOverlay()
    • refreshPopupButtonOverlays

      public void refreshPopupButtonOverlays()
    • onCellCommentFocus

      protected void onCellCommentFocus(CellComment cellComment)
    • updateBottomRightCellValues

      public void updateBottomRightCellValues(List<CellData> cellData2)
    • updateTopLeftCellValues

      public void updateTopLeftCellValues(List<CellData> cellData2)
    • updateTopRightCellValues

      public void updateTopRightCellValues(List<CellData> cellData2)
    • updateBottomLeftCellValues

      public void updateBottomLeftCellValues(List<CellData> cellData2)
    • cellValuesUpdated

      public void cellValuesUpdated(ArrayList<CellData> updatedCellData)
    • getRowHeights

      public int[] getRowHeights()
    • handleInputElementValueChange

      protected void handleInputElementValueChange(boolean update)
    • toKey

      public static final String toKey(int col, int row)
      Parameters:
      col - 1 based
      row - 1 based
      Returns:
    • toCssKey

      public static final String toCssKey(int col, int row)
    • clearAll

      public void clearAll(boolean removed)
      Clears the sheet. After this no headers or cells are visible.
      Parameters:
      removed - if the widget is completely removed from DOM after this
    • getSelectedCellKey

      public String getSelectedCellKey()
    • getSelectedCellColumn

      public int getSelectedCellColumn()
    • getSelectedCellRow

      public int getSelectedCellRow()
    • getSelectedCellLatestValue

      public String getSelectedCellLatestValue()
    • setSelectedCell

      public void setSelectedCell(int col, int row)
    • getSelectionLeftCol

      public int getSelectionLeftCol()
    • getSelectionRightCol

      public int getSelectionRightCol()
    • getSelectionTopRow

      public int getSelectionTopRow()
    • getSelectionBottomRow

      public int getSelectionBottomRow()
    • isCoherentSelection

      public boolean isCoherentSelection()
    • setCoherentSelection

      public void setCoherentSelection(boolean coherentSelection)
    • setSelectionRangeOutlineVisible

      public void setSelectionRangeOutlineVisible(boolean visible)
    • isSelectionRangeOutlineVisible

      public boolean isSelectionRangeOutlineVisible()
    • updateSelectionOutline

      public void updateSelectionOutline(int col1, int col2, int row1, int row2)
    • updateSelectedCellStyles

      public void updateSelectedCellStyles(int col1, int col2, int row1, int row2, boolean replace)
    • clearSelectedCellStyle

      public void clearSelectedCellStyle()
      Clears the light outline on the selected cell which is visible when the selection is not coherent.
    • clearCellRangeStyles

      public void clearCellRangeStyles()
      Clears the highlight (background) on selected cells and their corresponding headers.
    • clearPositionStyles

      protected void clearPositionStyles()
    • clearBasicCellStyles

      protected void clearBasicCellStyles()
    • clearShiftedBorderCellStyles

      protected void clearShiftedBorderCellStyles()
    • clearMergedCells

      protected void clearMergedCells()
    • clearCellCommentsAndInvalidFormulas

      protected void clearCellCommentsAndInvalidFormulas()
    • swapCellSelection

      public void swapCellSelection(int column, int row)
      swaps the selected cell to the new one, which is the selected cell after this call. the old cell is "highlighted" and the new one gets the selected cell outline (when selection range outline is hidden). takes care of swapping into a merged cell (highlights correct all cell headers).
      Parameters:
      column -
      row -
    • swapSelectedCellInsideSelection

      public void swapSelectedCellInsideSelection(int col, int row)
      Swaps the selected cell to the new one, which is the selected cell after this call. The old cell is "highlighted" and the new selected cell will be marked as selected. This method is different to swapCellSelection(int, int) because the selected cell should be inside the old selection, instead of adding a new cell into the selection. No need to modify highlighted headers.
      Parameters:
      col -
      row -
    • replaceAsSelectedCells

      public void replaceAsSelectedCells(int col1, int col2, int row1, int row2)
      Marks the given interval as selected (highlighted background), replaces old selected cells. Ignores the currently selected cell.
      Parameters:
      col1 -
      col2 -
      row1 -
      row2 -
    • replaceHeadersAsSelected

      public void replaceHeadersAsSelected(int row1, int row2, int col1, int col2)
      Replaces the currently marked selected headers (highlighted) with the given intervals.
      Parameters:
      row1 -
      row2 -
      col1 -
      col2 -
    • getSheetDisplayRange

      public int[] getSheetDisplayRange()
    • hasFrozenColumns

      public boolean hasFrozenColumns()
    • hasFrozenRows

      public boolean hasFrozenRows()
    • getLeftVisibleColumnIndex

      public int getLeftVisibleColumnIndex()
      Returns:
      the first column index that is completely visible on the left
    • getRightVisibleColumnIndex

      public int getRightVisibleColumnIndex()
    • getTopVisibleRowIndex

      public int getTopVisibleRowIndex()
      Returns:
      the first row index that is completely visible on the top
    • getBottomVisibleRowIndex

      public int getBottomVisibleRowIndex()
    • displayCustomCellEditor

      public void displayCustomCellEditor(com.google.gwt.user.client.ui.Widget customEditorWidget, boolean focusEditor)
    • displayCustomCellEditor

      public void displayCustomCellEditor(com.google.gwt.user.client.ui.Widget customEditorWidget, boolean focusEditor, Cell editorCell)
    • setShowCustomEditorOnFocus

      public void setShowCustomEditorOnFocus(boolean showCustomEditorOnFocus)
      Sets whether the custom editor should be displayed when the cell is focused.
      Parameters:
      showCustomEditorOnFocus - true if the custom editor should be displayed on focus, false otherwise
    • isShowCustomEditorOnFocus

      public boolean isShowCustomEditorOnFocus()
      Returns whether the custom editor should be displayed when the cell is focused.
      Returns:
      true if the custom editor should be displayed on focus, false otherwise
    • removeCustomCellEditor

      public void removeCustomCellEditor(String address, com.google.gwt.user.client.ui.Widget customEditorWidget)
      Removes the custom cell editor widget from the sheet.
      Parameters:
      address - the address of the cell for which the custom editor is removed
      customEditorWidget - the custom editor widget to be removed
    • removeCustomCellEditor

      public void removeCustomCellEditor()
      Removes the custom cell editor widget from the selected cell if it is currently displayed. If the custom editor is not displayed, this method does nothing.
    • startEditingCell

      public void startEditingCell(boolean focus, boolean recalculate, String value)
    • updateSelectedCellValue

      public void updateSelectedCellValue(String value)
    • updateInputValue

      public void updateInputValue(String value)
    • stopEditingCell

      public void stopEditingCell(boolean focusSheet)
    • focusSheet

      public void focusSheet()
    • focusSheet

      public void focusSheet(boolean doAsDeferred)
    • isSelectedCellRendered

      public boolean isSelectedCellRendered()
    • isSelectedCellCompletelyVisible

      public boolean isSelectedCellCompletelyVisible()
    • isSelectionAreaCompletelyVisible

      public boolean isSelectionAreaCompletelyVisible()
    • isCellRenderedInScrollPane

      public boolean isCellRenderedInScrollPane(int col, int row)
    • isFrozenCellRendered

      public boolean isFrozenCellRendered(int col, int row)
      Is the cell currently rendered in any of the frozen panes.
      Parameters:
      col -
      row -
      Returns:
    • isCellRenderedInTopLeftPane

      public boolean isCellRenderedInTopLeftPane(int col, int row)
      Is the cell currently rendered in top left pane.
      Parameters:
      col -
      row -
      Returns:
    • isCellRenderedInTopRightPane

      public boolean isCellRenderedInTopRightPane(int col, int row)
      Is the cell currently rendered in top right pane.
      Parameters:
      col -
      row -
      Returns:
    • isCellRenderedInBottomLeftPane

      public boolean isCellRenderedInBottomLeftPane(int col, int row)
      Is the cell currently rendered in bottom left pane.
      Parameters:
      col -
      row -
      Returns:
    • isCellRendered

      public boolean isCellRendered(int col, int row)
      Is the given cell currently rendered. Checks freeze panes too.
      Parameters:
      col -
      row -
      Returns:
    • isCellCompletelyVisible

      public boolean isCellCompletelyVisible(int col, int row)
      Is the given cell currently visible completely. Checks freeze panes too.
      Parameters:
      col -
      row -
      Returns:
    • isAreaCompletelyVisible

      public boolean isAreaCompletelyVisible(int col1, int col2, int row1, int row2)
    • scrollSelectedCellIntoView

      public void scrollSelectedCellIntoView()
    • scrollCellIntoView

      public void scrollCellIntoView(int col, int row)
      Scrolls the sheet to show the given cell, then triggers escalator for updating cells if necessary. This method does the isCellRenderedInScrollPane(int, int) in itself, so no need to do the check before calling this. Nothing is done if the cell is already visible. Scrolls one cell extra to all directions to cut the scrolls to half when using keyboard navigation.
      Parameters:
      col - 1-based
      row - 1-based
    • scrollSelectionAreaIntoView

      public void scrollSelectionAreaIntoView()
    • scrollAreaIntoView

      public void scrollAreaIntoView(int col1, int col2, int row1, int row2)
      Scrolls the sheet to show the given area, or as much of it as fits into the view.
      Parameters:
      col1 - 1-based
      col2 - 1-based
      row1 - 1-based
      row2 - 1-based
    • addShiftedCellBorderStyles

      public void addShiftedCellBorderStyles(List<String> styles)
    • removeShiftedCellBorderStyles

      public void removeShiftedCellBorderStyles()
    • getSheetScrollLeft

      public int getSheetScrollLeft()
    • getSheetScrollTop

      public int getSheetScrollTop()
    • setScrollPosition

      public void setScrollPosition(int scrollLeft, int scrollTop)
    • addPopupButton

      public void addPopupButton(PopupButtonWidget popupButton)
    • removePopupButton

      public void removePopupButton(PopupButtonWidget popupButton)
    • updatePopupButtonPosition

      public void updatePopupButtonPosition(PopupButtonWidget popupButton, int oldRow, int oldCol, int newRow, int newCol)
      PopupButtons should not change position (cell), but the popupButton's col and row values come after the popupButton has actually been added.
    • iterator

      public Iterator<com.google.gwt.user.client.ui.Widget> iterator()
    • getCustomWidgetIterator

      protected Collection<com.google.gwt.user.client.ui.Widget> getCustomWidgetIterator()
    • remove

      public boolean remove(com.google.gwt.user.client.ui.Widget child)
      Specified by:
      remove in interface com.google.gwt.user.client.ui.HasWidgets
      Specified by:
      remove in class com.google.gwt.user.client.ui.Panel
    • setDisplayGridlines

      public void setDisplayGridlines(boolean displayGridlines)
    • setDisplayRowColHeadings

      public void setDisplayRowColHeadings(boolean displayRowColHeadings)
    • setVerticalSplitPosition

      public void setVerticalSplitPosition(int verticalSplitPosition)
    • setHorizontalSplitPosition

      public void setHorizontalSplitPosition(int horizontalSplitPosition)
    • getBottomRightPane

      protected com.google.gwt.dom.client.Element getBottomRightPane()
    • getBottomLeftPane

      protected com.google.gwt.dom.client.Element getBottomLeftPane()
    • getTopRightPane

      protected com.google.gwt.dom.client.Element getTopRightPane()
    • getTopLeftPane

      protected com.google.gwt.dom.client.Element getTopLeftPane()
    • isSheetElement

      public boolean isSheetElement(com.google.gwt.dom.client.Element cast)
    • clearSelectedCellsOnCut

      public void clearSelectedCellsOnCut()
    • refreshCellStyles

      public void refreshCellStyles()
    • isTouchMode

      public boolean isTouchMode()
    • setTouchMode

      public void setTouchMode(boolean touchMode)
    • editCellComment

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

      public void commitComment(String text, int col, int row)
    • isSelectedCellPergentage

      public boolean isSelectedCellPergentage()
    • setFocused

      public void setFocused(boolean focused)
    • setColGroupingData

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

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

      public void setColGroupingMax(int max)
    • setRowGroupingMax

      public void setRowGroupingMax(int max)
    • setColGroupingInversed

      public void setColGroupingInversed(boolean inversed)
    • setRowGroupingInversed

      public void setRowGroupingInversed(boolean inversed)
    • setInvalidFormulaMessage

      public void setInvalidFormulaMessage(String invalidFormulaMessage)
    • setHost

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