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
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabledNested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
com.google.gwt.user.client.ui.HasWidgets.ForIsWidget -
Field Summary
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMergedRegion(MergedRegion region) voidaddPopupButton(PopupButtonWidget popupButton) voidaddSheetOverlay(String key, SheetOverlay overlay) voidaddShiftedCellBorderStyles(List<String> styles) voidcellValuesUpdated(ArrayList<CellData> updatedCellData) voidclearAll(boolean removed) Clears the sheet.protected voidprotected voidvoidClears the highlight (background) on selected cells and their corresponding headers.protected voidprotected voidvoidvoidClears the light outline on the selected cell which is visible when the selection is not coherent.protected voidvoidcommitComment(String text, int col, int row) voiddisplayCustomCellEditor(com.google.gwt.user.client.ui.Widget customEditorWidget, boolean focusEditor) voiddisplayCustomCellEditor(com.google.gwt.user.client.ui.Widget customEditorWidget, boolean focusEditor, Cell editorCell) voideditCellComment(int col, int row) voidvoidvoidfocusSheet(boolean doAsDeferred) protected com.google.gwt.dom.client.Elementprotected com.google.gwt.dom.client.ElementintgetCellData(int column, int row) getCellFormulaValue(int column, int row) getCellValue(int column, int row) protected CopyPasteTextBox.CopyPasteHandlerprotected Collection<com.google.gwt.user.client.ui.Widget>com.google.gwt.user.client.ui.TextBoxintgetOriginalCellValue(int column, int row) protected CellgetRealEventTargetCell(int clientX, int clientY, Cell cell) intint[]getRules(com.google.gwt.dom.client.StyleElement stylesheet) Clears the rules starting from the given indexintintintintintintint[]protected SheetJsniUtilintintprotected com.google.gwt.dom.client.Elementprotected com.google.gwt.dom.client.Elementintprotected voidhandleInputElementValueChange(boolean update) booleanbooleanbooleanisAreaCompletelyVisible(int col1, int col2, int row1, int row2) booleanisCellCompletelyVisible(int col, int row) Is the given cell currently visible completely.booleanisCellLocked(int column, int row) booleanisCellRendered(int col, int row) Is the given cell currently rendered.booleanisCellRenderedInBottomLeftPane(int col, int row) Is the cell currently rendered in bottom left pane.booleanisCellRenderedInScrollPane(int col, int row) booleanisCellRenderedInTopLeftPane(int col, int row) Is the cell currently rendered in top left pane.booleanisCellRenderedInTopRightPane(int col, int row) Is the cell currently rendered in top right pane.booleanprotected booleanprotected booleanisEventInCustomEditorCell(com.google.gwt.user.client.Event event) booleanisFrozenCellRendered(int col, int row) Is the cell currently rendered in any of the frozen panes.protected booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanisSheetElement(com.google.gwt.dom.client.Element cast) booleanReturns whether the custom editor should be displayed when the cell is focused.booleanIterator<com.google.gwt.user.client.ui.Widget>iterator()protected voidonAttach()protected voidonCellCommentFocus(CellComment cellComment) protected voidonMouseMoveWhenSelectingCells(com.google.gwt.user.client.Event event) protected voidonSheetMouseDown(com.google.gwt.user.client.Event event) protected voidonSheetMouseMove(com.google.gwt.user.client.Event event) protected voidonSheetMouseOverOrOut(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.protected voidonSheetScroll(com.google.gwt.user.client.Event event) voidonUnload()voidvoidvoidvoidvoidvoidrelayoutSheet(boolean triggerRequest) booleanremove(com.google.gwt.user.client.ui.Widget child) voidRemoves the custom cell editor widget from the selected cell if it is currently displayed.voidremoveCustomCellEditor(String address, com.google.gwt.user.client.ui.Widget customEditorWidget) Removes the custom cell editor widget from the sheet.voidremoveMergedRegion(MergedRegion region, int ruleIndex) voidremovePopupButton(PopupButtonWidget popupButton) voidremoveSheetOverlay(String key) voidvoidFor internal use.voidreplaceAsSelectedCells(int col1, int col2, int row1, int row2) Marks the given interval as selected (highlighted background), replaces old selected cells.voidreplaceHeadersAsSelected(int row1, int row2, int col1, int col2) Replaces the currently marked selected headers (highlighted) with the given intervals.protected voidvoidvoidresetFromModel(int scrollLeft, int scrollTop) Set the model that stores the contents of the spreadsheet.voidscrollAreaIntoView(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.voidscrollCellIntoView(int col, int row) Scrolls the sheet to show the given cell, then triggers escalator for updating cells if necessary.voidvoidvoidsetCellComments(HashMap<String, String> newCellCommentsMap, HashMap<String, String> newCellCommentAuthorsMap) voidsetCellCommentVisible(boolean visible, String key) voidsetCellLinks(HashMap<String, String> cellLinksMap) voidsetCoherentSelection(boolean coherentSelection) voidsetColGroupingData(List<GroupingData> data) voidsetColGroupingInversed(boolean inversed) voidsetColGroupingMax(int max) voidsetDisplayGridlines(boolean displayGridlines) voidsetDisplayRowColHeadings(boolean displayRowColHeadings) voidsetFocused(boolean focused) voidsetHorizontalSplitPosition(int horizontalSplitPosition) voidsetHost(com.google.gwt.dom.client.Element host, com.google.gwt.dom.client.Node renderRoot) voidsetInvalidFormulaCells(Set<String> newInvalidFormulaCells) voidsetInvalidFormulaMessage(String invalidFormulaMessage) voidsetRowGroupingData(List<GroupingData> data) voidsetRowGroupingInversed(boolean inversed) voidsetRowGroupingMax(int max) voidsetScrollPosition(int scrollLeft, int scrollTop) voidsetSelectedCell(int col, int row) voidsetSelectionRangeOutlineVisible(boolean visible) voidsetShowCustomEditorOnFocus(boolean showCustomEditorOnFocus) Sets whether the custom editor should be displayed when the cell is focused.voidsetTouchMode(boolean touchMode) voidsetVerticalSplitPosition(int verticalSplitPosition) voidshowCustomWidgets(HashMap<String, com.google.gwt.user.client.ui.Widget> newWidgetMap) voidstartEditingCell(boolean focus, boolean recalculate, String value) voidstopEditingCell(boolean focusSheet) protected voidstoppedSelectingCellsWithDrag(com.google.gwt.user.client.Event event) voidswapCellSelection(int column, int row) swaps the selected cell to the new one, which is the selected cell after this call.voidswapSelectedCellInsideSelection(int col, int row) Swaps the selected cell to the new one, which is the selected cell after this call.static final StringtoCssKey(int col, int row) static final StringtoKey(int col, int row) voidupdateBottomLeftCellValues(List<CellData> cellData2) voidupdateBottomRightCellValues(List<CellData> cellData2) voidupdateInputValue(String value) voidupdateMergedRegionSize(MergedRegion region) voidupdateOverlayInfo(String key, OverlayInfo overlayInfo) voidupdatePopupButtonPosition(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.voidupdateSelectedCellStyles(int col1, int col2, int row1, int row2, boolean replace) voidupdateSelectedCellValue(String value) voidupdateSelectionOutline(int col1, int col2, int row1, int row2) voidupdateTopLeftCellValues(List<CellData> cellData2) voidupdateTopRightCellValues(List<CellData> cellData2) Methods inherited from class com.google.gwt.user.client.ui.Panel
add, add, adopt, clear, doAttachChildren, doDetachChildren, orphan, removeMethods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onBrowserEvent, onDetach, onLoad, removeFromParent, setLayoutData, sinkEvents, unsinkEventsMethods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
SheetWidget
-
-
Method Details
-
getCopyPasteHandler
-
onAttach
protected void onAttach()- Overrides:
onAttachin classcom.google.gwt.user.client.ui.Widget
-
getSheetHandler
-
getSheetJsniUtil
-
onUnload
public void onUnload()- Overrides:
onUnloadin classcom.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
-
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
-
getCellValue
-
isCellLocked
public boolean isCellLocked(int column, int row) -
getCellFormulaValue
-
getOriginalCellValue
-
getRules
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
-
addSheetOverlay
-
updateOverlayInfo
-
removeSheetOverlay
-
addMergedRegion
-
updateMergedRegionSize
-
removeMergedRegion
-
setCellLinks
-
setInvalidFormulaCells
-
setCellComments
-
setCellCommentVisible
-
refreshAlwaysVisibleCellCommentOverlays
public void refreshAlwaysVisibleCellCommentOverlays() -
refreshCurrentCellCommentOverlay
public void refreshCurrentCellCommentOverlay() -
refreshPopupButtonOverlays
public void refreshPopupButtonOverlays() -
onCellCommentFocus
-
updateBottomRightCellValues
-
updateTopLeftCellValues
-
updateTopRightCellValues
-
updateBottomLeftCellValues
-
cellValuesUpdated
-
getRowHeights
public int[] getRowHeights() -
handleInputElementValueChange
protected void handleInputElementValueChange(boolean update) -
toKey
- Parameters:
col- 1 basedrow- 1 based- Returns:
-
toCssKey
-
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
-
getSelectedCellColumn
public int getSelectedCellColumn() -
getSelectedCellRow
public int getSelectedCellRow() -
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 toswapCellSelection(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 removedcustomEditorWidget- 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
-
updateSelectedCellValue
-
updateInputValue
-
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 theisCellRenderedInScrollPane(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-basedrow- 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-basedcol2- 1-basedrow1- 1-basedrow2- 1-based
-
addShiftedCellBorderStyles
-
removeShiftedCellBorderStyles
public void removeShiftedCellBorderStyles() -
getSheetScrollLeft
public int getSheetScrollLeft() -
getSheetScrollTop
public int getSheetScrollTop() -
setScrollPosition
public void setScrollPosition(int scrollLeft, int scrollTop) -
addPopupButton
-
removePopupButton
-
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
-
getCustomWidgetIterator
-
remove
public boolean remove(com.google.gwt.user.client.ui.Widget child) - Specified by:
removein interfacecom.google.gwt.user.client.ui.HasWidgets- Specified by:
removein classcom.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
-
isSelectedCellPergentage
public boolean isSelectedCellPergentage() -
setFocused
public void setFocused(boolean focused) -
setColGroupingData
-
setRowGroupingData
-
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
-
setHost
public void setHost(com.google.gwt.dom.client.Element host, com.google.gwt.dom.client.Node renderRoot)
-