Package org.zkoss.pivot
Class Pivottable
- java.lang.Object
-
- org.zkoss.zk.ui.AbstractComponent
-
- org.zkoss.zk.ui.HtmlBasedComponent
-
- org.zkoss.zul.impl.XulElement
-
- org.zkoss.pivot.Pivottable
-
- All Implemented Interfaces:
Serializable,Cloneable,org.zkoss.zk.ui.Component,org.zkoss.zk.ui.ext.Scope,org.zkoss.zk.ui.sys.ComponentCtrl,org.zkoss.zul.ext.Pageable
public class Pivottable extends org.zkoss.zul.impl.XulElement implements org.zkoss.zul.ext.PageablePivottable component. The component takes a PivotModel to populate data.- Author:
- jumperchen / simonpai
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringCOLUMN_TITLEstatic StringDATA_TITLEstatic StringROW_TITLEstatic StringSCROLL_POS
-
Constructor Summary
Constructors Constructor Description Pivottable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddTitleCell(String type, org.zkoss.zk.ui.Component component)Add component in title cellsvoidbeforeChildAdded(org.zkoss.zk.ui.Component newChild, org.zkoss.zk.ui.Component refChild)voidclearCustomSizes()Clear custom sizes adjusted by user.Objectclone()intgetActivePage()Returns the active page (starting from 0).org.zkoss.zk.ui.ComponentgetColumnCell()Return the component in column title cell.org.zkoss.zk.ui.ComponentgetDataCell()Return the component in data title cell.StringgetDataFieldOrient()Return the value of data field orientation.PivotModelgetModel()Returns pivot model.intgetPageCount()Returns the number of pages.intgetPageSize()Returns the number of items per page.PivotRenderergetPivotRenderer()Returns the pivot renderer.org.zkoss.zk.ui.ComponentgetRowCell()Return the component in row title cell.intgetTotalSize()Returns the total number of items.StringgetZclass()booleaninsertBefore(org.zkoss.zk.ui.Component newChild, org.zkoss.zk.ui.Component refChild)voidinvalidate()Invalidates the pivottable, causing it to rerender.booleanisAutowrap()Gets whether auto wrap the content and adjust row height.booleanisChildable()booleanisFrozenColumnHeaders()see:setPageSize(int)booleanisGrandTotalForColumns()Returns whether enables to show the grand total for columns.booleanisGrandTotalForRows()Returns whether enables to show the grand total for rows.voidonChildRemoved(org.zkoss.zk.ui.Component child)voidonInitRender(org.zkoss.zk.ui.event.Event event)Only internal use to prepare the rendering information from the pivot model.protected voidrenderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)voidservice(org.zkoss.zk.au.AuRequest request, boolean everError)voidsessionDidActivate(org.zkoss.zk.ui.Page page)voidsessionWillPassivate(org.zkoss.zk.ui.Page page)voidsetActivePage(int pg)Set the active pagevoidsetAutowrap(boolean autowrap)Sets whether auto wrap the content and adjust row height Note: It is strongly recommended NOT to use autowrap if there are huge amount of cells in one page or the performance at client side might be horrible.voidsetDataFieldOrient(String orient)Set the orientation of data fields, which determines how data are arranged on the Pivottable when there are more than one data fields.voidsetFrozenColumnHeaders(boolean frozenColumnHeaders)Enable frozen column headers.voidsetGrandTotalForColumns(boolean grandTotalForColumns)Sets whether enables to show the grand total for columns.voidsetGrandTotalForRows(boolean grandTotalForRows)Sets whether enables to show the grand total for rows.voidsetHeight(String height)voidsetModel(PivotModel model)Sets the pivot model.voidsetPageSize(int size)Sets the items to show in each pagevoidsetPivotRenderer(PivotRenderer renderer)Sets the pivot renderer-
Methods inherited from class org.zkoss.zul.impl.XulElement
getContext, getCtrlKeys, getPopup, getPropertyAccess, getTooltip, setContext, setContext, setContextAttributes, setCtrlKeys, setPopup, setPopup, setPopupAttributes, setTooltip, setTooltip, setTooltipAttributes
-
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
addSclass, evalCSSFlex, focus, getAction, getClientAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZindex, getZIndex, removeSclass, removeSclass, setAction, setClass, setClientAction, setDraggable, setDroppable, setFocus, setHeight0, setHeightDirectly, setHflex, setHflex0, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTabindex, setTabindex, setTooltiptext, setTop, setTopDirectly, setVflex, setVflex0, setVflexDirectly, setWidth, setWidth0, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
-
Methods 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, 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, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onPageAttached, onPageDetached, onParentChanged, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, renderPropertiesOnly, replace, response, response, response, service, 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, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
-
-
-
-
Field Detail
-
SCROLL_POS
public static final String SCROLL_POS
- See Also:
- Constant Field Values
-
DATA_TITLE
public static final String DATA_TITLE
- See Also:
- Constant Field Values
-
COLUMN_TITLE
public static final String COLUMN_TITLE
- See Also:
- Constant Field Values
-
ROW_TITLE
public static final String ROW_TITLE
- See Also:
- Constant Field Values
-
-
Method Detail
-
setHeight
public void setHeight(String height)
- Overrides:
setHeightin classorg.zkoss.zk.ui.HtmlBasedComponent
-
getPageSize
public int getPageSize()
Returns the number of items per page.Default: 20.
- Specified by:
getPageSizein interfaceorg.zkoss.zul.ext.Pageable
-
setPageSize
public void setPageSize(int size) throws org.zkoss.zk.ui.WrongValueExceptionSets the items to show in each page- Specified by:
setPageSizein interfaceorg.zkoss.zul.ext.Pageable- Throws:
org.zkoss.zk.ui.WrongValueException
-
getTotalSize
public int getTotalSize()
Returns the total number of items.
-
getPageCount
public int getPageCount()
Returns the number of pages. Note: there is at least one page even no item at all.- Specified by:
getPageCountin interfaceorg.zkoss.zul.ext.Pageable
-
getActivePage
public int getActivePage()
Returns the active page (starting from 0).- Specified by:
getActivePagein interfaceorg.zkoss.zul.ext.Pageable
-
setActivePage
public void setActivePage(int pg) throws org.zkoss.zk.ui.WrongValueExceptionSet the active pageNote: In server side, active page starts from 0. But in browser UI, it starts from 1
- Specified by:
setActivePagein interfaceorg.zkoss.zul.ext.Pageable- Throws:
org.zkoss.zk.ui.WrongValueException
-
setGrandTotalForRows
public void setGrandTotalForRows(boolean grandTotalForRows)
Sets whether enables to show the grand total for rows.Default: true
-
isGrandTotalForRows
public boolean isGrandTotalForRows()
Returns whether enables to show the grand total for rows.Default: true.
-
setGrandTotalForColumns
public void setGrandTotalForColumns(boolean grandTotalForColumns)
Sets whether enables to show the grand total for columns.Default: true
-
isGrandTotalForColumns
public boolean isGrandTotalForColumns()
Returns whether enables to show the grand total for columns.Default: true.
-
addTitleCell
public boolean addTitleCell(String type, org.zkoss.zk.ui.Component component)
Add component in title cells- Parameters:
type-DATA_TITLE,COLUMN_TITLE,ROW_TITLE
-
getDataCell
public org.zkoss.zk.ui.Component getDataCell()
Return the component in data title cell.
-
getColumnCell
public org.zkoss.zk.ui.Component getColumnCell()
Return the component in column title cell.
-
getRowCell
public org.zkoss.zk.ui.Component getRowCell()
Return the component in row title cell.
-
beforeChildAdded
public void beforeChildAdded(org.zkoss.zk.ui.Component newChild, org.zkoss.zk.ui.Component refChild)- Specified by:
beforeChildAddedin interfaceorg.zkoss.zk.ui.sys.ComponentCtrl- Overrides:
beforeChildAddedin classorg.zkoss.zk.ui.AbstractComponent
-
onChildRemoved
public void onChildRemoved(org.zkoss.zk.ui.Component child)
- Specified by:
onChildRemovedin interfaceorg.zkoss.zk.ui.sys.ComponentCtrl- Overrides:
onChildRemovedin classorg.zkoss.zk.ui.AbstractComponent
-
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
-
getDataFieldOrient
public String getDataFieldOrient()
Return the value of data field orientation. Can only becolumnorrow.
-
setDataFieldOrient
public void setDataFieldOrient(String orient)
Set the orientation of data fields, which determines how data are arranged on the Pivottable when there are more than one data fields.- Parameters:
orient- accepts eithercolumnorrow. Throws an exception otherwise.
-
clearCustomSizes
public void clearCustomSizes()
Clear custom sizes adjusted by user.
-
getModel
public PivotModel getModel()
Returns pivot model.
-
setModel
public void setModel(PivotModel model)
Sets the pivot model.
-
setPivotRenderer
public void setPivotRenderer(PivotRenderer renderer)
Sets the pivot renderer
-
getPivotRenderer
public PivotRenderer getPivotRenderer()
Returns the pivot renderer.
-
setAutowrap
public void setAutowrap(boolean autowrap)
Sets whether auto wrap the content and adjust row height Note: It is strongly recommended NOT to use autowrap if there are huge amount of cells in one page or the performance at client side might be horrible.- Parameters:
autowrap-
-
isAutowrap
public boolean isAutowrap()
Gets whether auto wrap the content and adjust row height. Note: It is strongly recommended NOT to use autowrap if there are huge amount of cells in one page or the performance at client side might be horrible.- Returns:
- boolean
-
isFrozenColumnHeaders
public boolean isFrozenColumnHeaders()
see:setPageSize(int)- Returns:
- boolean
- Since:
- 2.5.0
-
setFrozenColumnHeaders
public void setFrozenColumnHeaders(boolean frozenColumnHeaders)
Enable frozen column headers. Useful in combination with a largersetPageSize(int)and fixed height/vflex.
IE not supported. Potential causes performance issues with larger column or row sizes.
Disabled by default.- Parameters:
frozenColumnHeaders-- Since:
- 2.5.0
-
onInitRender
public void onInitRender(org.zkoss.zk.ui.event.Event event)
Only internal use to prepare the rendering information from the pivot model.
-
getZclass
public String getZclass()
- Overrides:
getZclassin classorg.zkoss.zk.ui.HtmlBasedComponent
-
renderProperties
protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws IOException- Overrides:
renderPropertiesin classorg.zkoss.zul.impl.XulElement- Throws:
IOException
-
clone
public Object clone()
- Specified by:
clonein interfaceorg.zkoss.zk.ui.Component- Overrides:
clonein classorg.zkoss.zul.impl.XulElement
-
sessionWillPassivate
public void sessionWillPassivate(org.zkoss.zk.ui.Page page)
- Specified by:
sessionWillPassivatein interfaceorg.zkoss.zk.ui.sys.ComponentCtrl- Overrides:
sessionWillPassivatein classorg.zkoss.zk.ui.AbstractComponent
-
sessionDidActivate
public void sessionDidActivate(org.zkoss.zk.ui.Page page)
- Specified by:
sessionDidActivatein interfaceorg.zkoss.zk.ui.sys.ComponentCtrl- Overrides:
sessionDidActivatein classorg.zkoss.zk.ui.AbstractComponent
-
isChildable
public boolean isChildable()
- Overrides:
isChildablein classorg.zkoss.zk.ui.AbstractComponent
-
service
public void service(org.zkoss.zk.au.AuRequest request, boolean everError)- Specified by:
servicein interfaceorg.zkoss.zk.ui.sys.ComponentCtrl- Overrides:
servicein classorg.zkoss.zk.ui.HtmlBasedComponent
-
invalidate
public void invalidate()
Invalidates the pivottable, causing it to rerender. This method should be called after using Java API to manipulate the model associated with this pivottable. Otherwise, the view will not be updated. e.g. node.setOpen(true); pivottable.invalidate();- Specified by:
invalidatein interfaceorg.zkoss.zk.ui.Component- Overrides:
invalidatein classorg.zkoss.zk.ui.AbstractComponent- Since:
- 2.0.2
-
-