org.zkoss.pivot
Class Pivottable

java.lang.Object
  extended by org.zkoss.zk.ui.AbstractComponent
      extended by org.zkoss.zk.ui.HtmlBasedComponent
          extended by org.zkoss.zul.impl.XulElement
              extended by org.zkoss.pivot.Pivottable
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, org.zkoss.zk.ui.api.HtmlBasedComponent, org.zkoss.zk.ui.Component, org.zkoss.zk.ui.ext.Scope, org.zkoss.zk.ui.sys.ComponentCtrl, org.zkoss.zul.ext.Pageable, org.zkoss.zul.impl.api.XulElement

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

Nested Class Summary
 
Nested classes/interfaces inherited from class org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zk.ui.HtmlBasedComponent.ExtraCtrl
 
Nested classes/interfaces inherited from class org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.AbstractComponent.Children
 
Field Summary
static java.lang.String COLUMN_TITLE
           
static java.lang.String DATA_TITLE
           
static java.lang.String ROW_TITLE
           
 
Fields inherited from class org.zkoss.zk.ui.HtmlBasedComponent
_zclass
 
Fields inherited from interface org.zkoss.zk.ui.Component
APPLICATION_SCOPE, COMPONENT_SCOPE, DESKTOP_SCOPE, PAGE_SCOPE, REQUEST_SCOPE, SESSION_SCOPE, SPACE_SCOPE
 
Fields inherited from interface org.zkoss.zk.ui.sys.ComponentCtrl
CE_BUSY_IGNORE, CE_DUPLICATE_IGNORE, CE_IMPORTANT, CE_NON_DEFERRABLE, CE_REPEAT_IGNORE
 
Constructor Summary
Pivottable()
           
 
Method Summary
 boolean addTitleCell(java.lang.String type, org.zkoss.zk.ui.Component component)
          Add component in title cells
 void beforeChildAdded(org.zkoss.zk.ui.Component newChild, org.zkoss.zk.ui.Component refChild)
           
 void clearCustomSizes()
          Clear custom sizes adjusted by user.
 java.lang.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.
 java.lang.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.
 java.lang.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 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 page Note: In server side, active page starts from 0.
 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.
 void setDataFieldOrient(java.lang.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 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(java.lang.String height)
           
 void setModel(PivotModel model)
          Sets the pivot model.
 void setPageSize(int size)
          Sets the items to show in each page
 void setPivotRenderer(PivotRenderer renderer)
          Sets the pivot renderer
 
Methods inherited from class org.zkoss.zul.impl.XulElement
getContext, getCtrlKeys, getPopup, getTooltip, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip
 
Methods inherited from class org.zkoss.zk.ui.HtmlBasedComponent
focus, getAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTooltiptext, getTop, getVflex, getWidth, getZindex, getZIndex, setAction, setClass, setDraggable, setDroppable, setFocus, setHeightDirectly, setHflex, setHflexDirectly, setLeft, setLeftDirectly, setRenderdefer, setSclass, setStyle, setTooltiptext, setTop, setTopDirectly, setVflex, setWidth, setWidthDirectly, setZclass, setZindex, setZIndex, setZIndexDirectly
 
Methods inherited from class org.zkoss.zk.ui.AbstractComponent
addAnnotation, addAnnotation, addClientEvent, addEventHandler, addEventListener, addForward, addForward, addForward, addForward, addMoved, addScopeListener, addSharedAnnotationMap, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildRemoved, beforeParentChanged, containsVariable, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableClientUpdate, equals, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, getAnnotations, getAttribute, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getChildren, getClientEvents, getDefaultMold, getDefinition, getDesktop, getEventHandler, getEventHandlerNames, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNamespace, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getStubonly, getUuid, getVariable, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasFellow, hasFellow, isInvalidated, isListenerAvailable, isVisible, newChildren, newExtraCtrl, onChildAdded, onPageAttached, onPageDetached, onWrongValue, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, removeScopeListener, render, render, render, renderIdSpace, response, response, setAttribute, setAttribute, setAttribute, setAuService, setDefinition, setDefinition, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setVariable, setVisible, setVisibleDirectly, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, unsetVariable, updateByClient, willPassivate, willPassivate, willSerialize, willSerialize
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.zkoss.zk.ui.api.HtmlBasedComponent
focus, getHeight, getLeft, getRenderdefer, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZindex, getZIndex, setDraggable, setDroppable, setFocus, setLeft, setRenderdefer, setSclass, setStyle, setTooltiptext, setTop, setWidth, setZclass, setZindex, setZIndex
 
Methods inherited from interface org.zkoss.zk.ui.Component
addEventListener, addForward, addForward, addForward, addForward, appendChild, applyProperties, containsVariable, detach, getAttribute, getAttribute, getAttributeOrFellow, getAttributes, getAttributes, getAuService, getChildren, getDefinition, getDesktop, getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, getFirstChild, getId, getLastChild, getListenerIterator, getMold, getNamespace, getNextSibling, getPage, getParent, getPreviousSibling, getRoot, getSpaceOwner, getStubonly, getUuid, getVariable, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttributeOrFellow, hasFellow, hasFellow, isInvalidated, isListenerAvailable, isVisible, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, setAttribute, setAttribute, setAuService, setId, setMold, setPage, setPageBefore, setParent, setStubonly, setVariable, setVisible, setWidgetAttribute, setWidgetClass, setWidgetListener, setWidgetOverride, unsetVariable
 
Methods inherited from interface org.zkoss.zk.ui.ext.Scope
addScopeListener, getAttribute, hasAttribute, removeAttribute, removeScopeListener, setAttribute
 

Field Detail

DATA_TITLE

public static final java.lang.String DATA_TITLE
See Also:
Constant Field Values

COLUMN_TITLE

public static final java.lang.String COLUMN_TITLE
See Also:
Constant Field Values

ROW_TITLE

public static final java.lang.String ROW_TITLE
See Also:
Constant Field Values
Constructor Detail

Pivottable

public Pivottable()
Method Detail

setHeight

public void setHeight(java.lang.String height)
Specified by:
setHeight in interface org.zkoss.zk.ui.api.HtmlBasedComponent
Overrides:
setHeight in class org.zkoss.zk.ui.HtmlBasedComponent

getPageSize

public int getPageSize()
Returns the number of items per page.

Default: 20.

Specified by:
getPageSize in interface org.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 interface org.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 interface org.zkoss.zul.ext.Pageable

getActivePage

public int getActivePage()
Returns the active page (starting from 0).

Specified by:
getActivePage in interface org.zkoss.zul.ext.Pageable

setActivePage

public void setActivePage(int pg)
                   throws org.zkoss.zk.ui.WrongValueException
Set the active page

Note: In server side, active page starts from 0. But in browser UI, it starts from 1

Specified by:
setActivePage in interface org.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(java.lang.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 interface org.zkoss.zk.ui.sys.ComponentCtrl
Overrides:
beforeChildAdded in class org.zkoss.zk.ui.AbstractComponent

onChildRemoved

public void onChildRemoved(org.zkoss.zk.ui.Component child)
Specified by:
onChildRemoved in interface org.zkoss.zk.ui.sys.ComponentCtrl
Overrides:
onChildRemoved in class org.zkoss.zk.ui.AbstractComponent

insertBefore

public boolean insertBefore(org.zkoss.zk.ui.Component newChild,
                            org.zkoss.zk.ui.Component refChild)
Specified by:
insertBefore in interface org.zkoss.zk.ui.Component
Overrides:
insertBefore in class org.zkoss.zk.ui.AbstractComponent

getDataFieldOrient

public java.lang.String getDataFieldOrient()
Return the value of data field orientation. Can only be column or row.


setDataFieldOrient

public void setDataFieldOrient(java.lang.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 either column or row. 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

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 java.lang.String getZclass()
Specified by:
getZclass in interface org.zkoss.zk.ui.api.HtmlBasedComponent
Overrides:
getZclass in class org.zkoss.zk.ui.HtmlBasedComponent

renderProperties

protected void renderProperties(org.zkoss.zk.ui.sys.ContentRenderer renderer)
                         throws java.io.IOException
Overrides:
renderProperties in class org.zkoss.zul.impl.XulElement
Throws:
java.io.IOException

clone

public java.lang.Object clone()
Specified by:
clone in interface org.zkoss.zk.ui.Component
Overrides:
clone in class org.zkoss.zul.impl.XulElement

sessionWillPassivate

public void sessionWillPassivate(org.zkoss.zk.ui.Page page)
Specified by:
sessionWillPassivate in interface org.zkoss.zk.ui.sys.ComponentCtrl
Overrides:
sessionWillPassivate in class org.zkoss.zk.ui.AbstractComponent

sessionDidActivate

public void sessionDidActivate(org.zkoss.zk.ui.Page page)
Specified by:
sessionDidActivate in interface org.zkoss.zk.ui.sys.ComponentCtrl
Overrides:
sessionDidActivate in class org.zkoss.zk.ui.AbstractComponent

isChildable

public boolean isChildable()
Overrides:
isChildable in class org.zkoss.zk.ui.AbstractComponent

service

public void service(org.zkoss.zk.au.AuRequest request,
                    boolean everError)
Specified by:
service in interface org.zkoss.zk.ui.sys.ComponentCtrl
Overrides:
service in class org.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 interface org.zkoss.zk.ui.Component
Overrides:
invalidate in class org.zkoss.zk.ui.AbstractComponent
Since:
2.0.2


Copyright © 2013. All Rights Reserved.