Class PivotFieldControl

  • 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.IdSpace, org.zkoss.zk.ui.sys.ComponentCtrl

    public class PivotFieldControl
    extends org.zkoss.zul.Div
    implements org.zkoss.zk.ui.IdSpace, org.zkoss.zk.ui.ext.AfterCompose
    A composite component which provides a built-in drag-n-drop based UI control for adding/removing pivot fields.
    Author:
    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, org.zkoss.zk.ui.AbstractComponent.ForwardInfo, org.zkoss.zk.ui.AbstractComponent.TargetInfo
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void afterCompose()  
      protected static void clearChildren​(org.zkoss.zk.ui.Component c)  
      protected String getDataFieldContextMenuURI()
      Override this method to provide a different zul template for the context menu on data fields.
      protected Map<String,​String> getDefaultLabels()
      Override this method to provide the default label list.
      protected String getDragGroup()  
      protected PivotField.Type getFieldType​(org.zkoss.zul.Grid grid)  
      protected Map<String,​Object> getLabels()  
      String getLayout()
      Return layout type.
      PivotModelExt getModel()
      Return the pivot model associated with this control
      protected String getRowColumnFieldContextMenuURI()
      Override this method to provide a different zul template for the context menu on row/column fields.
      protected String getSubtotalModalWindowURI()
      Override this method to provide a different zul template for the modal window for subtotal selection.
      Calculator[] getSubtotals​(PivotField field)  
      protected void initGrid​(org.zkoss.zul.Grid grid)  
      protected boolean isDataField​(org.zkoss.zul.Row row)  
      boolean isDeferredUpdate()
      Return true if in deferred update mode.
      protected boolean isRowOrColumnField​(org.zkoss.zul.Row row)  
      protected boolean isSortable​(org.zkoss.zul.Row row)  
      boolean isUpdated()
      Return true if the PivotModel is up to date.
      protected void loadLayout()  
      void onClick$menuSortA​(org.zkoss.zk.ui.event.Event event)  
      void onClick$menuSortZ​(org.zkoss.zk.ui.event.Event event)  
      void onClick$menuSubtotal​(org.zkoss.zk.ui.event.Event event)  
      void setDeferredUpdate​(boolean deferred)
      Set deferred update mode.
      void setLayout​(String layout)
      Set layout type.
      void setModel​(PivotModelExt model)
      Set pivot model associated with this control.
      void setSubtotals​(PivotField field, Calculator[] selected)  
      protected void sortField​(boolean ascending)  
      void syncModel()
      Reload underlying Grids from current model.
      protected void syncModel​(org.zkoss.zul.Grid grid, PivotField.Type type)  
      void update()
      Update changes to PivotModel.
      protected void updatePivotFields​(org.zkoss.zul.Grid grid, PivotField.Type type)  
      • Methods inherited from class org.zkoss.zul.impl.XulElement

        clone, getContext, getCtrlKeys, getPopup, getPropertyAccess, getTooltip, renderProperties, 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, getZclass, getZindex, getZIndex, removeSclass, removeSclass, service, setAction, setClass, setClientAction, setDraggable, 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, 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, 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, insertBefore, invalidate, isChildable, isDisabledHostChanged, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, 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, 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, smartUpdate, smartUpdate, smartUpdateWidgetListener, smartUpdateWidgetOverride, toString, updateByClient, updateSubBindingAnnotationCount, willPassivate, willPassivate, willSerialize, willSerialize
      • Methods inherited from interface org.zkoss.zk.ui.IdSpace

        getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, hasFellow, hasFellow
      • Methods inherited from interface org.zkoss.zk.ui.ext.Scope

        addScopeListener, getAttribute, hasAttribute, removeAttribute, removeScopeListener, setAttribute
    • Field Detail

      • _deferred

        protected boolean _deferred
      • _layout

        protected String _layout
      • ulist

        protected org.zkoss.zul.Grid ulist
      • clist

        protected org.zkoss.zul.Grid clist
      • rlist

        protected org.zkoss.zul.Grid rlist
      • dlist

        protected org.zkoss.zul.Grid dlist
      • menuRCF

        protected org.zkoss.zul.Menupopup menuRCF
      • menuDF

        protected org.zkoss.zul.Menupopup menuDF
      • menuSummary

        protected org.zkoss.zul.Menupopup menuSummary
      • menuFilterList

        protected org.zkoss.zul.Menupopup menuFilterList
      • menuSortA

        protected org.zkoss.zul.Menuitem menuSortA
      • menuSortZ

        protected org.zkoss.zul.Menuitem menuSortZ
      • SUMMARY_CLICK_LISTENER

        protected final org.zkoss.zk.ui.event.EventListener SUMMARY_CLICK_LISTENER
      • ITEM_DROP_LISTENER

        protected final org.zkoss.zk.ui.event.EventListener ITEM_DROP_LISTENER
      • FIELD_BTN_LISTENER

        protected final org.zkoss.zk.ui.event.EventListener FIELD_BTN_LISTENER
      • FIELD_RENDERER

        protected final org.zkoss.zul.RowRenderer FIELD_RENDERER
    • Constructor Detail

      • PivotFieldControl

        public PivotFieldControl()
    • Method Detail

      • setDeferredUpdate

        public void setDeferredUpdate​(boolean deferred)
        Set deferred update mode. When true, the PivotModel is not updated when dragging a field. The update can be performed manually by calling update(). Also, in deferred update mode, dragging fields will fire an event, so we have a chance to reflect the state on other components.
      • isDeferredUpdate

        public boolean isDeferredUpdate()
        Return true if in deferred update mode.
      • update

        public void update()
        Update changes to PivotModel.
      • updatePivotFields

        protected void updatePivotFields​(org.zkoss.zul.Grid grid,
                                         PivotField.Type type)
      • isUpdated

        public boolean isUpdated()
        Return true if the PivotModel is up to date.
      • getLayout

        public String getLayout()
        Return layout type.
      • getModel

        public PivotModelExt getModel()
        Return the pivot model associated with this control
      • setModel

        public void setModel​(PivotModelExt model)
        Set pivot model associated with this control. An implementation of PivotModelExt is required.
      • syncModel

        public void syncModel()
        Reload underlying Grids from current model.
      • afterCompose

        public void afterCompose()
        Specified by:
        afterCompose in interface org.zkoss.zk.ui.ext.AfterCompose
      • syncModel

        protected void syncModel​(org.zkoss.zul.Grid grid,
                                 PivotField.Type type)
      • loadLayout

        protected void loadLayout()
      • initGrid

        protected void initGrid​(org.zkoss.zul.Grid grid)
      • onClick$menuSortA

        public void onClick$menuSortA​(org.zkoss.zk.ui.event.Event event)
      • onClick$menuSortZ

        public void onClick$menuSortZ​(org.zkoss.zk.ui.event.Event event)
      • sortField

        protected void sortField​(boolean ascending)
      • onClick$menuSubtotal

        public void onClick$menuSubtotal​(org.zkoss.zk.ui.event.Event event)
                                  throws Exception
        Throws:
        Exception
      • getRowColumnFieldContextMenuURI

        protected String getRowColumnFieldContextMenuURI()
        Override this method to provide a different zul template for the context menu on row/column fields. The template should have a Menupopup as the root component, with id "menuRCF".
      • getDataFieldContextMenuURI

        protected String getDataFieldContextMenuURI()
        Override this method to provide a different zul template for the context menu on data fields. The template should have a Menupopup as the root component, with id "menuDF".
      • getSubtotalModalWindowURI

        protected String getSubtotalModalWindowURI()
        Override this method to provide a different zul template for the modal window for subtotal selection.
      • getDefaultLabels

        protected Map<String,​String> getDefaultLabels()
        Override this method to provide the default label list.
      • clearChildren

        protected static final void clearChildren​(org.zkoss.zk.ui.Component c)
      • getFieldType

        protected final PivotField.Type getFieldType​(org.zkoss.zul.Grid grid)
      • isDataField

        protected final boolean isDataField​(org.zkoss.zul.Row row)
      • isRowOrColumnField

        protected final boolean isRowOrColumnField​(org.zkoss.zul.Row row)
      • isSortable

        protected final boolean isSortable​(org.zkoss.zul.Row row)
      • getDragGroup

        protected final String getDragGroup()