Package io.keikai.ui
Class Spreadsheet
java.lang.Object
org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.impl.XulElement
io.keikai.ui.Spreadsheet
- All Implemented Interfaces:
Serializable,Cloneable,org.zkoss.zk.ui.Component,org.zkoss.zk.ui.ext.AfterCompose,org.zkoss.zk.ui.ext.Scope,org.zkoss.zk.ui.sys.ComponentCtrl
public class Spreadsheet
extends org.zkoss.zul.impl.XulElement
implements Serializable, org.zkoss.zk.ui.ext.AfterCompose
Spreadsheet is a rich ZK Component to handle EXCEL like behavior, it reads
the data from a data model(
You can assign a Book by
To use Spreadsheet in .zul file, just use
An simplest example :
  ;<spreadsheet src= "/WEB-INF/xls/my.xls" maxrows="300" maxcolumns="80"
height="400px" width="90%" />
SBook) and interact with this model by
event.You can assign a Book by
setBook(Book) or just set the .xls file
location by setSrc(String). You can also set two attributes to
restrict max rows and columns to show on client side by
setMaxVisibleRows(int) and setMaxVisibleColumns(int). To use Spreadsheet in .zul file, just use
<spreadsheet/>
tag like any other ZK Components.An simplest example :
  ;<spreadsheet src= "/WEB-INF/xls/my.xls" maxrows="300" maxcolumns="80"
height="400px" width="90%" />
- Author:
- dennischen, jumperchen
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zk.ui.HtmlBasedComponent.ExtraCtrlNested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.AbstractComponent.Children, org.zkoss.zk.ui.AbstractComponent.ForwardInfo, org.zkoss.zk.ui.AbstractComponent.TargetInfo -
Field Summary
FieldsFields inherited from class org.zkoss.zk.ui.HtmlBasedComponent
_zclassFields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPEFields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, AFTER_CLONED, AFTER_PAGE_ATTACHED, AFTER_PAGE_DETACHED, AFTER_PARENT_CHANGED, CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToolbarButton(int index, ToolbarButton btn) Inserts the specified button at the specified position in the buttons list.booleanAdds toolbar button to the end of the buttons.voidvoidautoFitRowHeight(int row, int col) Adjust specified row's height of the currently-selected sheet according to the specified cell's content.voidclearClientCache(SSheet sheet) Call this method to clear client side cache for a Sheet and fine tune data loading speed.voidClear current Server ClipboardvoidClears the tracing.voiddisableUserAction(AuxAction action, boolean disabled) Sets theAuxActiondisabledvoidfocus()Retrieve client side spreadsheet focus.The cell focus and selection will keep at last status.voidfocusTo(int row, int column) Retrieve client side spreadhsheet focus, move cell focus to position (row,column) and also scroll the cell to into visible view.Return all selection rectangle only if onCellSelection event listener is registered.getBook()Returns the book model of this Spreadsheet.Return current cell(row,column) focus position.Internal used onlyReturn current Server ClipboardgetColumnPosition(SSheet sheet) getColumntitle(int index) Get Column title of given index, it returns column name depends on following condition
1.if there is a custom column title assign on this spreadsheet on index, then return custom value
2.if there is a custom column title assign on selected sheet on index, the return custom value
3.return default column String, for example index 0 become "A", index 9 become "J"Get the column titles Map object, modification of return object doesn't cause any update.intGets the default column width of the selected sheetintReturns the maximum visible number of columns of the currently selected sheet.intReturns the maximum visible number of rows of the currently selected sheet.Return current highlight rectangle.intGets the left head panel widthintReturns the max rendered cell sizeintReturns the maximum visible number of columns of this spreadsheet.intReturns the maximum visible number of rows of this spreadsheet.intintintGets the default row height of the selected sheetgetRowPosition(SSheet sheet) getRowtitle(int index) Get Row title of given index, it returns row name depends on following condition
1.if there is a custom row title assign on this spreadsheet on index, then return custom value
2.if there is a custom row title assign on selected sheet on index, the return custom value
3.return default row index+1 String, for example index 0 become "1", index 9 become "10"Get the row titles Map object, modification of the return object doesn't cause any update.getSBook()Returns the book model of this Spreadsheet.Gets the selected sheet, the default selected sheet is first sheet.Gets the selected sheet, the default selected sheet is first visible sheet.Return current selection rectangle only if onCellSelection event listener is registered.intgetSheetMaxVisibleColumns(SSheet sheet) Returns the max visible columns of the specified sheetintgetSheetMaxVisibleRows(SSheet sheet) Returns the max visible rows of the specified sheetgetSrc()Returns the src location of book model.Returns all toolbar buttons (read only).intGets the top head panel heightGets the user action manager, then you can register/override your custom action by callUserActionManager.registerHandler(String, String, UserActionHandler)booleaninsertBefore(org.zkoss.zk.ui.Component newChild, org.zkoss.zk.ui.Component refChild) voidbooleanReturns whether client cache disabled or notbooleanReturns whether to close dropdown menu on scroll; default to false.booleanReturns true if hide column head of this spread sheet; default to false.booleanReturns true if hide row head of this spread sheet; default to false.booleanReturns true if keep the cell selection box when lost focus; default to false.booleanReturns whether the component is in read-ony mode or not.booleanReturns whether show the add column button in sheetbar.booleanReturns whether show the add row button in sheetbar.booleanReturns whether to show ContextMenu or notbooleanReturns whether show formula barbooleanReturns whether show sheetbarbooleanReturns whether show ContextMenu in sheet tabbooleanReturns whether shows toolbarbooleanReturns whether to show zero values or notvoidmoveEditorFocus(String id, String name, String color, int row, int col) Add and move other editor's focusprotected SpreadsheetCtrlvoidNotifyChange the currently loaded area and freeze area if exists.voidNotifyChange the currently visible area and freeze area if exists.voidonPageAttached(org.zkoss.zk.ui.Page newpage, org.zkoss.zk.ui.Page oldpage) voidonPageDetached(org.zkoss.zk.ui.Page page) static Object[]parseLinkAddress(Book book, String linkAddress) voidRemove editor's focus on specified namebooleanremoveToolbarButton(int index) Removes the button at the specified position in this buttons list.booleanRemoves the first occurrence of the given button instance in the buttons list.booleanRemoves the first occurrence of the given button instance in the buttons list.booleanRemoves the first occurrence of the given key in the buttons list.protected voidrenderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) voidvoidservice(org.zkoss.zk.au.AuRequest request, boolean everError) Processes an AU request.voidsetAutofitColumnWidth(SSheet sheet, int column) AutoFit a single column width according to its data size.voidsetAutofitColumnWidth(SSheet sheet, int fromColumn, int toColumn) AutoFit multiple columns width according to each one's data size from thefromColumn to thetoColumn .voidSets the book data model of this spread sheet.voidsetCellFocus(CellRef focus) Sets the cell focus position.(this method doesn't focus the spreadsheet.) In general, if you set a cell focus, you also set the selection bysetSelection(AreaRef); And if you want to get the focus back to spreadsheet, callfocus()to retrieve focus.voidsetClientCacheDisabled(boolean clientCacheDisabled) Sets to disable client cache.voidsetClipboard(UserActionContext.Clipboard clipboard) Set current Server ClipboardvoidsetCloseDropdownOnScroll(boolean closeDropdownOnScroll) Sets whether to close dropdown menu on scroll.voidsetColumntitles(String titles) Sets the customized titles which split by ','.voidsetColumntitles(Map titles) Sets the customized titles of column header.voidsetColumnwidth(int columnWidth) Sets the default column width of the selected sheetvoidsetCtrlKeys(String ctrlKeys) voidsetDraggable(String draggable) Don't call this, the spreadsheet is not draggable.voidsetHidecolumnhead(boolean hide) Sets true to hide the column head of this spread sheet.voidsetHiderowhead(boolean hide) Sets true to hide the row head of this spread sheet.voidsetHighlight(AreaRef highlight) Sets the highlight rectangle or sets a null value to hide it.voidsetIgnoreAutoHeight(boolean b) Whether ignore row's autoHeight calculation.voidsetImporter(Importer importer) voidsetKeepCellSelection(boolean keep) Sets true to keep the cell selection box when lost focus.voidsetLeftheadwidth(int leftWidth) Sets the left head panel width, must large then 0.voidsetMaxRenderedCellSize(int maxRenderedCellSize) Sets the max rendered cell size.voidsetMaxVisibleColumns(int maxcols) Sets the maximum visible number of columns of this spreadsheet.voidsetMaxVisibleRows(int maxrows) Sets the maximum visible number of rows of this spreadsheet.voidsetPreloadColumnSize(int size) voidsetPreloadRowSize(int size) voidsetReadOnly(boolean readOnly) Sets whether to enable this component as read-only mode or not.voidsetRowheight(int rowHeight) Sets the default row height of the selected sheetvoidsetRowtitles(String titles) Sets the customized titles which split by ','.voidsetRowtitles(Map titles) Sets the customized titles of row header.voidSets the book data model of this spread sheet.voidsetSelectedSheet(String name) Sets the selected sheet by a namevoidsetSelection(AreaRef sel) Sets the selection rectangle.voidsetSelection(Set<AreaRef> selection) Sets the selection rectangle.voidsetSheetMaxVisibleColumns(SSheet sheet, int maxColumns) Sets the max visibles columns of the specified sheet.voidsetSheetMaxVisibleRows(SSheet sheet, int maxRows) Sets the max visible rows of the specified sheetvoidsetShowAddColumn(boolean showAddColumn) Sets whether show the add column button in sheetbar.voidsetShowAddRow(boolean showAddRow) Sets whether show the add row button in sheetbar.voidsetShowContextMenu(boolean showContextMenu) Sets whether show ContextMenu or notvoidsetShowFormulabar(boolean showFormulabar) Sets whether show formula bar or notvoidsetShowSheetbar(boolean showSheetbar) Sets whether show sheetbar or notvoidsetShowSheetTabContextMenu(boolean showSheetTabContextMenu) Sets whether show ContextMenu or notvoidsetShowToolbar(boolean showToolbar) Sets whether show toolbar or not Default: falsevoidSets the src location of the book data model to be imported into spreadsheet.voidsetTopheadheight(int topHeight) Sets the top head panel height, must large then 0.voidsetUserName(String name) Under collaboration edit mode, Spreadsheet renders multiple selection boxes in a sheet.voidsmartUpdate(String attr, Object value) voidsmartUpdate(String attr, Object value, boolean append) voidtraceDependents(Sheet sheet, CellRef cellRef) Trace the dependents of the reference.voidtracePrecedents(Sheet sheet, CellRef cellRef) Trace the precedent of the reference.Methods inherited from class org.zkoss.zul.impl.XulElement
clone, getContext, getCtrlKeys, getPopup, getPropertyAccess, getTooltip, setContext, setContext, setContextAttributes, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributesMethods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addSclass, evalCSSFlex, getAction, getClientAction, getDraggable, getDroppable, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZclass, getZindex, getZIndex, removeSclass, removeSclass, setAction, setClass, setClientAction, setDroppable, setFocus, setHeight, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectlyMethods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, destroyIndexCacheMap, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, disableHostChanged, enableBindingAnnotation, enableHostChanged, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getAutag, getCallback, getChildren, getClientAttribute, getClientDataAttribute, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getEventListenerMap, getEventListeners, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getForwards, getId, getIndexCacheMap, getLastChild, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, initIndexCacheMap, isChildable, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onParentChanged, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderPropertiesOnly, replace, response, response, service, sessionDidActivate, sessionWillPassivate, setAttribute, setAttribute, setAttribute, setAuService, setAutag, setClientAttribute, setClientDataAttribute, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setStubonly, setSubBindingAnnotationCount, setTemplate, setVisible, setVisibleDirectly, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
-
Field Details
-
INSTANCE_KEY
- See Also:
-
-
Constructor Details
-
Spreadsheet
public Spreadsheet()
-
-
Method Details
-
traceDependents
Trace the dependents of the reference.- Parameters:
sheet-cellRef-- Since:
- 5.6.0
-
tracePrecedents
Trace the precedent of the reference.- Parameters:
sheet-cellRef-- Since:
- 5.6.0
-
clearTrace
public void clearTrace()Clears the tracing.- Since:
- 5.6.0
-
getUserActionManager
Gets the user action manager, then you can register/override your custom action by callUserActionManager.registerHandler(String, String, UserActionHandler)- Returns:
UserActionManageror null if doesn't support to override- Since:
- 3.0.0
-
setCtrlKeys
- Overrides:
setCtrlKeysin classorg.zkoss.zul.impl.XulElement
-
setMaxRenderedCellSize
public void setMaxRenderedCellSize(int maxRenderedCellSize) Sets the max rendered cell size. When rendered cell size greater then this limit, client side will prune extra cells (DOM Element).- Parameters:
maxRenderedCellSize-
-
getMaxRenderedCellSize
public int getMaxRenderedCellSize()Returns the max rendered cell size- Returns:
- int maxRenderedCellSize
-
isClientCacheDisabled
public boolean isClientCacheDisabled()Returns whether client cache disabled or not- Returns:
-
isShowZeroValues
public boolean isShowZeroValues()Returns whether to show zero values or not -
setClientCacheDisabled
public void setClientCacheDisabled(boolean clientCacheDisabled) Sets to disable client cache. Default is false- Parameters:
clientCacheDisabled-
-
isCloseDropdownOnScroll
public boolean isCloseDropdownOnScroll()Returns whether to close dropdown menu on scroll; default to false.- Returns:
- boolean
- Since:
- 6.3.0
-
setCloseDropdownOnScroll
public void setCloseDropdownOnScroll(boolean closeDropdownOnScroll) Sets whether to close dropdown menu on scroll. Default is false.- Parameters:
closeDropdownOnScroll-- Since:
- 6.3.0
-
setDraggable
Don't call this, the spreadsheet is not draggable.- Overrides:
setDraggablein classorg.zkoss.zk.ui.HtmlBasedComponent- Throws:
UnsupportedOperationException- if this method is called.
-
getSBook
Returns the book model of this Spreadsheet. If you call this method at first time and the book has not assigned bysetSBook(SBook), this will create a new model depends on src;- Returns:
- the book model of this spreadsheet.
-
setSBook
Sets the book data model of this spread sheet.- Parameters:
book- the book data model.
-
getSelectedSSheet
Gets the selected sheet, the default selected sheet is first visible sheet.- Returns:
- #
SSheet
-
getSrc
Returns the src location of book model. This src is used by the specified importer to create the book data model of this spread sheet.- Returns:
- the src location
-
setSrc
Sets the src location of the book data model to be imported into spreadsheet. A specified importer (getImporter()) will use this src to create the book data model.- Parameters:
src- the book src location
-
setSelectedSheet
Sets the selected sheet by a name- Parameters:
name- the name of spreadsheet to be selected.
-
setPreloadRowSize
public void setPreloadRowSize(int size) -
getPreloadRowSize
public int getPreloadRowSize() -
setPreloadColumnSize
public void setPreloadColumnSize(int size) -
getPreloadColumnSize
public int getPreloadColumnSize() -
isHiderowhead
public boolean isHiderowhead()Returns true if hide row head of this spread sheet; default to false.- Returns:
- true if hide row head of this spread sheet; default to false.
-
setHiderowhead
public void setHiderowhead(boolean hide) Sets true to hide the row head of this spread sheet.- Parameters:
hide- true to hide the row head of this spread sheet.
-
isHidecolumnhead
public boolean isHidecolumnhead()Returns true if hide column head of this spread sheet; default to false.- Returns:
- true if hide column head of this spread sheet; default to false.
-
setHidecolumnhead
public void setHidecolumnhead(boolean hide) Sets true to hide the column head of this spread sheet.- Parameters:
hide- true to hide the row head of this spread sheet.
-
setColumntitles
Sets the customized titles of column header.- Parameters:
titles- a map for customized column titles, the key of column must be Integer object.
-
getColumntitles
Get the column titles Map object, modification of return object doesn't cause any update.- Returns:
- Map object of customized column names
-
setColumntitles
Sets the customized titles which split by ','. For example: "name,title,age" or "name,,age" , an empty string means use default column title. This method will split the input string to a Map with sequence index from 0, then callsetColumntitles(Map)
Note: this method will always invoke invalidate()- Parameters:
titles- the column titles
-
setRowtitles
Sets the customized titles of row header.- Parameters:
titles- map for customized column titles, the key of column must be Integer object.
-
getRowtitles
Get the row titles Map object, modification of the return object doesn't cause any update.- Returns:
- Map object of customized row names
-
setRowtitles
Sets the customized titles which split by ','. For example: "name,title,age" or "name,,age" , an empty string means use default row title. This method will split the input string to a Map with sequence index from 0, then callsetRowtitles(Map)
Note: this method will always invoke invalidate()- Parameters:
titles- the row titles
-
getRowheight
public int getRowheight()Gets the default row height of the selected sheet- Returns:
- default value depends on selected sheet
-
setRowheight
public void setRowheight(int rowHeight) Sets the default row height of the selected sheet- Parameters:
rowHeight- the row height
-
getColumnwidth
public int getColumnwidth()Gets the default column width of the selected sheet- Returns:
- default value depends on selected sheet
-
setColumnwidth
public void setColumnwidth(int columnWidth) Sets the default column width of the selected sheet- Parameters:
columnWidth- the default column width
-
getLeftheadwidth
public int getLeftheadwidth()Gets the left head panel width- Returns:
- default value is 36
-
setLeftheadwidth
public void setLeftheadwidth(int leftWidth) Sets the left head panel width, must large then 0.- Parameters:
leftWidth- leaf header width
-
getTopheadheight
public int getTopheadheight()Gets the top head panel height- Returns:
- default value is 20
-
setTopheadheight
public void setTopheadheight(int topHeight) Sets the top head panel height, must large then 0.- Parameters:
topHeight- top header height
-
setShowToolbar
public void setShowToolbar(boolean showToolbar) Sets whether show toolbar or not Default: false- Parameters:
showToolbar- true to show toolbar
-
isShowToolbar
public boolean isShowToolbar()Returns whether shows toolbar- Returns:
- boolean
-
setShowFormulabar
public void setShowFormulabar(boolean showFormulabar) Sets whether show formula bar or not- Parameters:
showFormulabar- true if want to show formula bar
-
isShowFormulabar
public boolean isShowFormulabar()Returns whether show formula bar -
setShowSheetbar
public void setShowSheetbar(boolean showSheetbar) Sets whether show sheetbar or not- Parameters:
showSheetbar- true if want to show sheet tab panel
-
isShowSheetbar
public boolean isShowSheetbar()Returns whether show sheetbar -
setShowContextMenu
public void setShowContextMenu(boolean showContextMenu) Sets whether show ContextMenu or not- Parameters:
showContextMenu-
-
isShowContextMenu
public boolean isShowContextMenu()Returns whether to show ContextMenu or not -
isShowSheetTabContextMenu
public boolean isShowSheetTabContextMenu()Returns whether show ContextMenu in sheet tab- Returns:
-
setShowSheetTabContextMenu
public void setShowSheetTabContextMenu(boolean showSheetTabContextMenu) Sets whether show ContextMenu or not- Parameters:
showSheetTabContextMenu-
-
renderProperties
- Overrides:
renderPropertiesin classorg.zkoss.zul.impl.XulElement- Throws:
IOException
-
getColumntitle
Get Column title of given index, it returns column name depends on following condition
1.if there is a custom column title assign on this spreadsheet on index, then return custom value
2.if there is a custom column title assign on selected sheet on index, the return custom value
3.return default column String, for example index 0 become "A", index 9 become "J"- Returns:
- column name
-
getRowtitle
Get Row title of given index, it returns row name depends on following condition
1.if there is a custom row title assign on this spreadsheet on index, then return custom value
2.if there is a custom row title assign on selected sheet on index, the return custom value
3.return default row index+1 String, for example index 0 become "1", index 9 become "10"- Parameters:
index- row index- Returns:
- row name
-
getSelection
Return current selection rectangle only if onCellSelection event listener is registered. The returned value is a clone copy of current selection status. Default Value:(0,0,0,0)- Returns:
- current selection (the last one if multiple)
-
getAllSelection
Return all selection rectangle only if onCellSelection event listener is registered. The returned value is a clone copy of current selection status.- Returns:
- all selection
- Since:
- 6.0.0
-
setSelection
Sets the selection rectangle. In general, if you set a selection, you must also set the focus bysetCellFocus(CellRef);. And, if you want to get the focus back to spreadsheet, callfocus()after set selection.- Parameters:
sel- the selection rect
-
setSelection
Sets the selection rectangle. In general, if you set a selection, you must also set the focus bysetCellFocus(CellRef);. And, if you want to get the focus back to spreadsheet, callfocus()after set selection.- Parameters:
selection- the multiple selection rect- Since:
- 6.0.0
-
getHighlight
Return current highlight rectangle. the returned value is a clone copy of current highlight status. Default Value: null- Returns:
- current highlight
-
setHighlight
Sets the highlight rectangle or sets a null value to hide it.- Parameters:
highlight- the highlight rect
-
setReadOnly
public void setReadOnly(boolean readOnly) Sets whether to enable this component as read-only mode or not. If true, the priority is higher than sheet's protection setting.- Parameters:
readOnly- true to be read only mode.- Since:
- 5.6.0
-
isReadOnly
public boolean isReadOnly()Returns whether the component is in read-ony mode or not. Default: false- Since:
- 5.6.0
-
getCellFocus
Return current cell(row,column) focus position. you can get the row byCellRef.getRow(), get the column byCellRef.getColumn(). The returned value is a copy of current focus status. Default Value:(0,0)- Returns:
- current focus
-
setCellFocus
Sets the cell focus position.(this method doesn't focus the spreadsheet.) In general, if you set a cell focus, you also set the selection bysetSelection(AreaRef); And if you want to get the focus back to spreadsheet, callfocus()to retrieve focus.- Parameters:
focus- the cell focus position
-
getRowPosition
-
getColumnPosition
-
getExtraCtrl
- Specified by:
getExtraCtrlin interfaceorg.zkoss.zk.ui.sys.ComponentCtrl- Overrides:
getExtraCtrlin classorg.zkoss.zk.ui.HtmlBasedComponent
-
newExtraCtrl
-
invalidate
public void invalidate()- Specified by:
invalidatein interfaceorg.zkoss.zk.ui.Component- Overrides:
invalidatein classorg.zkoss.zk.ui.AbstractComponent
-
focus
public void focus()Retrieve client side spreadsheet focus.The cell focus and selection will keep at last status. It is useful if you want get focus back to spreadsheet after do some outside processing, for example after user click a outside button or menu item.- Overrides:
focusin classorg.zkoss.zk.ui.HtmlBasedComponent
-
focusTo
public void focusTo(int row, int column) Retrieve client side spreadhsheet focus, move cell focus to position (row,column) and also scroll the cell to into visible view.- Parameters:
row- row of cell to movecolumn- column of cell to move
-
getSelectedSheetName
-
disableUserAction
Sets theAuxActiondisabled- Parameters:
action-disabled-
-
addToolbarButton
Adds toolbar button to the end of the buttons.- Parameters:
btn-- Returns:
- true if success.
- Since:
- 5.0.0
-
addToolbarButton
Inserts the specified button at the specified position in the buttons list. Shifts the button currently at that position (if any) and any subsequent buttons to the right (adds one to their indices).- Parameters:
index- index at which the specified element is to be insertedbtn-
-
removeToolbarButton
Removes the first occurrence of the given button instance in the buttons list.- Parameters:
btn-- Returns:
- Since:
- 5.0.0
-
removeToolbarButton
Removes the first occurrence of the given key in the buttons list.- Parameters:
key- the button's key- Returns:
- Since:
- 5.0.0
-
removeToolbarButton
Removes the first occurrence of the given button instance in the buttons list.- Parameters:
btn-- Returns:
- Since:
- 5.1.0
-
removeToolbarButton
public boolean removeToolbarButton(int index) Removes the button at the specified position in this buttons list.- Parameters:
index-- Returns:
-
getToolbarButtons
Returns all toolbar buttons (read only).- Returns:
- Since:
- 5.0.0
-
insertBefore
public boolean insertBefore(org.zkoss.zk.ui.Component newChild, org.zkoss.zk.ui.Component refChild) - Specified by:
insertBeforein interfaceorg.zkoss.zk.ui.Component- Overrides:
insertBeforein classorg.zkoss.zk.ui.AbstractComponent
-
removeEditorFocus
Remove editor's focus on specified name -
moveEditorFocus
Add and move other editor's focus -
setUserName
Under collaboration edit mode, Spreadsheet renders multiple selection boxes in a sheet. Each selection box shows its user name when you hover on it except your owned one.- Parameters:
name- a name that shows with a selection box on other Spreadsheet
-
service
public void service(org.zkoss.zk.au.AuRequest request, boolean everError) Processes an AU request. It is invoked internally.Default: in addition to what are handled by
HtmlBasedComponent.service(AuRequest, boolean), it also handles onChange.- Specified by:
servicein interfaceorg.zkoss.zk.ui.sys.ComponentCtrl- Overrides:
servicein classorg.zkoss.zk.ui.HtmlBasedComponent
-
smartUpdate
- Overrides:
smartUpdatein classorg.zkoss.zk.ui.AbstractComponent
-
smartUpdate
- Overrides:
smartUpdatein classorg.zkoss.zk.ui.AbstractComponent
-
response
- Overrides:
responsein classorg.zkoss.zk.ui.AbstractComponent
-
afterCompose
public void afterCompose()- Specified by:
afterComposein interfaceorg.zkoss.zk.ui.ext.AfterCompose
-
onPageAttached
public void onPageAttached(org.zkoss.zk.ui.Page newpage, org.zkoss.zk.ui.Page oldpage) - Specified by:
onPageAttachedin interfaceorg.zkoss.zk.ui.sys.ComponentCtrl- Overrides:
onPageAttachedin classorg.zkoss.zk.ui.AbstractComponent
-
onPageDetached
public void onPageDetached(org.zkoss.zk.ui.Page page) - Specified by:
onPageDetachedin interfaceorg.zkoss.zk.ui.sys.ComponentCtrl- Overrides:
onPageDetachedin classorg.zkoss.zk.ui.AbstractComponent
-
getBook
Returns the book model of this Spreadsheet. If you call this method at first time and the book has not assigned bysetBook(Book), this will create a new model depends on src;- Returns:
- the book model of this spread sheet.
-
setBook
Sets the book data model of this spread sheet.- Parameters:
book- the book data model.
-
setAutofitColumnWidth
AutoFit a single column width according to its data size. No resize when the whole column without any content.- Parameters:
sheet-column-- Since:
- 5.7.0
- See Also:
-
setAutofitColumnWidth
AutoFit multiple columns width according to each one's data size from thefromColumn to thetoColumn . No resize when the whole column has no content.
Note: be aware of that in different JDK vendor, version, or OS, theFontMetricscalculates a different width value of the same text, so the result on UI may look different when the server is running on these differences which are mentioned early.- Parameters:
sheet-fromColumn- the start column to autofit widthtoColumn- the end column to autofit width- Since:
- 5.7.0
-
autoFitRowHeight
public void autoFitRowHeight(int row, int col) Adjust specified row's height of the currently-selected sheet according to the specified cell's content. Since it calculates the height at client side, it takes effect only when the specified cell is rendered in a browser, but the resulting height is more accurate thanCellOperationUtil.getAutoFitHeight(Sheet, int, int). If the target cell is a merged cell, please specify its left-top corner cell.- Parameters:
row- index of rowcol- index of column- Since:
- 5.11.0
-
getSelectedSheet
Gets the selected sheet, the default selected sheet is first sheet.- Returns:
- #
Sheet
-
getMaxVisibleColumns
public int getMaxVisibleColumns()Returns the maximum visible number of columns of this spreadsheet. You can assign new numbers by callingsetMaxVisibleColumns(int).- Returns:
- the maximum visible number of columns
- Since:
- 3.0.0
-
getMaxVisibleRows
public int getMaxVisibleRows()Returns the maximum visible number of rows of this spreadsheet. You can assign new number by callingsetMaxVisibleRows(int).- Returns:
- the maximum visible number of rows of the currently selected sheet.
- Since:
- 3.0.0
-
getCurrentMaxVisibleColumns
public int getCurrentMaxVisibleColumns()Returns the maximum visible number of columns of the currently selected sheet.- Returns:
- Since:
- 3.8.1
-
getCurrentMaxVisibleRows
public int getCurrentMaxVisibleRows()Returns the maximum visible number of rows of the currently selected sheet.- Returns:
- Since:
- 3.8.1
-
setMaxVisibleColumns
public void setMaxVisibleColumns(int maxcols) Sets the maximum visible number of columns of this spreadsheet. For example, if you set this parameter to 40, it will allow showing only column 0 to column 39. the minimal value of max number of columns must large than 0. Since 3.8.1, if you set maximum visible number of columns to 0, it means you allow end user to adjust the visible number of columns.
Default : 0. (since 3.8.1)- Parameters:
maxcols- the maximum visible number of columns- Since:
- 3.0.0
-
setMaxVisibleRows
public void setMaxVisibleRows(int maxrows) Sets the maximum visible number of rows of this spreadsheet. For example, if you set this parameter to 40, it will allow showing only row 0 to 39. The minimal value of max number of rows must large than 0. Since 3.8.1, if you set maximum visible number of rows to 0, it means you allow end user to adjust the visible number of rows.
Default : 0. (since 3.8.1)- Parameters:
maxrows- the maximum visible number of rows- Since:
- 3.0.0
-
getImporter
Gets the importer that import the file in the specified src (getSrc()) toBookdata model. The default importer is excel importer.- Returns:
- the importer
-
setImporter
- Parameters:
importer- the importer to import a spreadsheet file from a document format (e.g. an Excel file) bysetSrc(String). The default importer isio.keikai.importer.XlsxImporter
-
clearClientCache
Call this method to clear client side cache for a Sheet and fine tune data loading speed. Note if the given sheet is the currently selected sheet, it will be ignored.- Parameters:
sheet- the sheet- Since:
- 3.7.0
-
getUndoableActionManager
-
isKeepCellSelection
public boolean isKeepCellSelection()Returns true if keep the cell selection box when lost focus; default to false.- Returns:
- true if keep the cell selection box when lost focus; default to false.
- Since:
- 3.8.1
-
setKeepCellSelection
public void setKeepCellSelection(boolean keep) Sets true to keep the cell selection box when lost focus.- Parameters:
keep- true to keep the cell selection box when lost focus.- Since:
- 3.8.1
-
getSheetMaxVisibleRows
Returns the max visible rows of the specified sheet- Parameters:
sheet-- Since:
- 3.8.1
-
getSheetMaxVisibleColumns
Returns the max visible columns of the specified sheet- Parameters:
sheet-- Since:
- 3.8.1
-
setSheetMaxVisibleRows
Sets the max visible rows of the specified sheet- Parameters:
sheet-- Since:
- 3.8.1
-
setSheetMaxVisibleColumns
Sets the max visibles columns of the specified sheet.- Parameters:
sheet-- Since:
- 3.8.1
-
setShowAddRow
public void setShowAddRow(boolean showAddRow) Sets whether show the add row button in sheetbar.- Parameters:
showAddRow- true if want to show add row button in sheetbar- Since:
- 3.8.1
-
isShowAddRow
public boolean isShowAddRow()Returns whether show the add row button in sheetbar.- Since:
- 3.8.1
-
setShowAddColumn
public void setShowAddColumn(boolean showAddColumn) Sets whether show the add column button in sheetbar.- Parameters:
showAddColumn- true if want to show add column button in sheetbar- Since:
- 3.8.1
-
isShowAddColumn
public boolean isShowAddColumn()Returns whether show the add column button in sheetbar.- Since:
- 3.8.1
-
parseLinkAddress
-
notifyLoadedAreaChange
public void notifyLoadedAreaChange()NotifyChange the currently loaded area and freeze area if exists.- Since:
- 3.8.3
-
notifyVisibleAreaChange
public void notifyVisibleAreaChange()NotifyChange the currently visible area and freeze area if exists.- Since:
- 3.8.3
-
setIgnoreAutoHeight
public void setIgnoreAutoHeight(boolean b) Whether ignore row's autoHeight calculation. Default to false. Calculating text height and doing row's autoHeight adjustment is an expensive operation. In application, if your cell height is fixed then you can set this flag to true to avoid Keikai Spreadsheet to calculate this information and thus speed up your application a bit. However, if you need Keikai Spreadsheet to calculate row's autoHeight, you have to keep it at false. Though not encouraged, note that whenever you set it from true to false, Spreadsheet will invalidate itself to gurantee the autocalculation works.- Parameters:
b-- Since:
- 3.8.3
-
getClipboard
Return current Server Clipboard- Returns:
- current Server Clipboard; null if no copy source.
- Since:
- 5.7.0
-
clearClipboard
public void clearClipboard()Clear current Server Clipboard- Since:
- 5.7.0
-
setClipboard
Set current Server Clipboard- Parameters:
clipboard-- Since:
- 5.7.0
-
getClientWidgets
Internal used only
-