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.Pageable
Pivottable 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 String
COLUMN_TITLE
static String
DATA_TITLE
static String
ROW_TITLE
static String
SCROLL_POS
-
Constructor Summary
Constructors Constructor Description Pivottable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addTitleCell(String type, org.zkoss.zk.ui.Component component)
Add component in title cellsvoid
beforeChildAdded(org.zkoss.zk.ui.Component newChild, org.zkoss.zk.ui.Component refChild)
void
clearCustomSizes()
Clear custom sizes adjusted by user.Object
clone()
int
getActivePage()
Returns the active page (starting from 0).org.zkoss.zk.ui.Component
getColumnCell()
Return the component in column title cell.org.zkoss.zk.ui.Component
getDataCell()
Return the component in data title cell.String
getDataFieldOrient()
Return the value of data field orientation.PivotModel
getModel()
Returns pivot model.int
getPageCount()
Returns the number of pages.int
getPageSize()
Returns the number of items per page.PivotRenderer
getPivotRenderer()
Returns the pivot renderer.org.zkoss.zk.ui.Component
getRowCell()
Return the component in row title cell.int
getTotalSize()
Returns the total number of items.String
getZclass()
boolean
insertBefore(org.zkoss.zk.ui.Component newChild, org.zkoss.zk.ui.Component refChild)
void
invalidate()
Invalidates the pivottable, causing it to rerender.boolean
isAutowrap()
Gets whether auto wrap the content and adjust row height.boolean
isChildable()
boolean
isFrozenColumnHeaders()
see:setPageSize(int)
boolean
isGrandTotalForColumns()
Returns whether enables to show the grand total for columns.boolean
isGrandTotalForRows()
Returns whether enables to show the grand total for rows.void
onChildRemoved(org.zkoss.zk.ui.Component child)
void
onInitRender(org.zkoss.zk.ui.event.Event event)
Only internal use to prepare the rendering information from the pivot model.protected void
renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)
void
service(org.zkoss.zk.au.AuRequest request, boolean everError)
void
sessionDidActivate(org.zkoss.zk.ui.Page page)
void
sessionWillPassivate(org.zkoss.zk.ui.Page page)
void
setActivePage(int pg)
Set the active pagevoid
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.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.void
setFrozenColumnHeaders(boolean frozenColumnHeaders)
Enable frozen column headers.void
setGrandTotalForColumns(boolean grandTotalForColumns)
Sets whether enables to show the grand total for columns.void
setGrandTotalForRows(boolean grandTotalForRows)
Sets whether enables to show the grand total for rows.void
setHeight(String height)
void
setModel(PivotModel model)
Sets the pivot model.void
setPageSize(int size)
Sets the items to show in each pagevoid
setPivotRenderer(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:
setHeight
in classorg.zkoss.zk.ui.HtmlBasedComponent
-
getPageSize
public int getPageSize()
Returns the number of items per page.Default: 20.
- Specified by:
getPageSize
in interfaceorg.zkoss.zul.ext.Pageable
-
setPageSize
public void setPageSize(int size) throws org.zkoss.zk.ui.WrongValueException
Sets the items to show in each page- Specified by:
setPageSize
in 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:
getPageCount
in interfaceorg.zkoss.zul.ext.Pageable
-
getActivePage
public int getActivePage()
Returns the active page (starting from 0).- Specified by:
getActivePage
in interfaceorg.zkoss.zul.ext.Pageable
-
setActivePage
public void setActivePage(int pg) throws org.zkoss.zk.ui.WrongValueException
Set the active pageNote: In server side, active page starts from 0. But in browser UI, it starts from 1
- Specified by:
setActivePage
in 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:
beforeChildAdded
in interfaceorg.zkoss.zk.ui.sys.ComponentCtrl
- Overrides:
beforeChildAdded
in classorg.zkoss.zk.ui.AbstractComponent
-
onChildRemoved
public void onChildRemoved(org.zkoss.zk.ui.Component child)
- Specified by:
onChildRemoved
in interfaceorg.zkoss.zk.ui.sys.ComponentCtrl
- Overrides:
onChildRemoved
in classorg.zkoss.zk.ui.AbstractComponent
-
insertBefore
public boolean insertBefore(org.zkoss.zk.ui.Component newChild, org.zkoss.zk.ui.Component refChild)
- Specified by:
insertBefore
in interfaceorg.zkoss.zk.ui.Component
- Overrides:
insertBefore
in classorg.zkoss.zk.ui.AbstractComponent
-
getDataFieldOrient
public String getDataFieldOrient()
Return the value of data field orientation. Can only becolumn
orrow
.
-
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 eithercolumn
orrow
. 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:
getZclass
in classorg.zkoss.zk.ui.HtmlBasedComponent
-
renderProperties
protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer) throws IOException
- Overrides:
renderProperties
in classorg.zkoss.zul.impl.XulElement
- Throws:
IOException
-
clone
public Object clone()
- Specified by:
clone
in interfaceorg.zkoss.zk.ui.Component
- Overrides:
clone
in classorg.zkoss.zul.impl.XulElement
-
sessionWillPassivate
public void sessionWillPassivate(org.zkoss.zk.ui.Page page)
- Specified by:
sessionWillPassivate
in interfaceorg.zkoss.zk.ui.sys.ComponentCtrl
- Overrides:
sessionWillPassivate
in classorg.zkoss.zk.ui.AbstractComponent
-
sessionDidActivate
public void sessionDidActivate(org.zkoss.zk.ui.Page page)
- Specified by:
sessionDidActivate
in interfaceorg.zkoss.zk.ui.sys.ComponentCtrl
- Overrides:
sessionDidActivate
in classorg.zkoss.zk.ui.AbstractComponent
-
isChildable
public boolean isChildable()
- Overrides:
isChildable
in classorg.zkoss.zk.ui.AbstractComponent
-
service
public void service(org.zkoss.zk.au.AuRequest request, boolean everError)
- Specified by:
service
in interfaceorg.zkoss.zk.ui.sys.ComponentCtrl
- Overrides:
service
in 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:
invalidate
in interfaceorg.zkoss.zk.ui.Component
- Overrides:
invalidate
in classorg.zkoss.zk.ui.AbstractComponent
- Since:
- 2.0.2
-
-