Package org.zkoss.pivot.ui
Class PivotFieldControl
java.lang.Object
org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.impl.XulElement
org.zkoss.zul.Div
org.zkoss.pivot.ui.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:
-
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
FieldsModifier and TypeFieldDescriptionprotected final Map<String,Calculator> protected booleanprotected Stringprotected PivotModelExtprotected static final Stringprotected static final Stringprotected org.zkoss.zul.Gridprotected static final Stringprotected org.zkoss.zul.Gridprotected static final Stringstatic final Stringprotected final org.zkoss.zk.ui.event.EventListenerprotected final org.zkoss.zul.RowRendererprotected final org.zkoss.zk.ui.event.EventListenerstatic final Stringstatic final StringThe horizon layout, where the field lists are arranged horizontally.static final StringThe square layout, where the field lists are arranged into a 2 by 2 square.static final StringThe vertical layout, where the field lists are arranged vertically.protected org.zkoss.zul.Menupopupprotected org.zkoss.zul.Menupopupprotected org.zkoss.zul.Menupopupprotected org.zkoss.zul.Menuitemprotected org.zkoss.zul.Menuitemprotected org.zkoss.zul.Menupopupprotected static final Stringprotected org.zkoss.zul.Gridprotected static final Stringprotected final org.zkoss.zk.ui.event.EventListenerprotected org.zkoss.zul.GridFields 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 TypeMethodDescriptionvoidprotected static final voidclearChildren(org.zkoss.zk.ui.Component c) protected StringOverride this method to provide a different zul template for the context menu on data fields.Override this method to provide the default label list.protected final Stringprotected final PivotField.TypegetFieldType(org.zkoss.zul.Grid grid) Return layout type.getModel()Return the pivot model associated with this controlprotected StringOverride this method to provide a different zul template for the context menu on row/column fields.protected StringOverride this method to provide a different zul template for the modal window for subtotal selection.getSubtotals(PivotField field) protected voidinitGrid(org.zkoss.zul.Grid grid) protected final booleanisDataField(org.zkoss.zul.Row row) booleanReturn true if in deferred update mode.protected final booleanisRowOrColumnField(org.zkoss.zul.Row row) protected final booleanisSortable(org.zkoss.zul.Row row) booleanReturn true if the PivotModel is up to date.protected voidvoidonClick$menuSortA(org.zkoss.zk.ui.event.Event event) voidonClick$menuSortZ(org.zkoss.zk.ui.event.Event event) voidonClick$menuSubtotal(org.zkoss.zk.ui.event.Event event) voidsetDeferredUpdate(boolean deferred) Set deferred update mode.voidSet layout type.voidsetModel(PivotModelExt model) Set pivot model associated with this control.voidsetSubtotals(PivotField field, Calculator[] selected) protected voidsortField(boolean ascending) voidReload underlying Grids from current model.protected voidsyncModel(org.zkoss.zul.Grid grid, PivotField.Type type) voidupdate()Update changes to PivotModel.protected voidupdatePivotFields(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, setTooltipAttributesMethods 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, 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, 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, willSerializeMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.zkoss.zk.ui.IdSpace
getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, hasFellow, hasFellowMethods inherited from interface org.zkoss.zk.ui.ext.Scope
addScopeListener, getAttribute, hasAttribute, removeAttribute, removeScopeListener, setAttribute
-
Field Details
-
_deferred
protected boolean _deferred -
_layout
-
_model
-
_calmap
-
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 -
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 -
LAYOUT_SQUARE
The square layout, where the field lists are arranged into a 2 by 2 square.- See Also:
-
LAYOUT_VERTICAL
The vertical layout, where the field lists are arranged vertically.- See Also:
-
LAYOUT_HORIZONTAL
The horizon layout, where the field lists are arranged horizontally.- See Also:
-
VIEW_URI
-
DATA_FIELD_MENU_URI
- See Also:
-
RC_FIELD_MENU_URI
- See Also:
-
SUBTOTAL_MODAL_URI
- See Also:
-
LABEL_RES_PREFIX
- See Also:
-
LABELS
-
DRAG_GROUP_KEY
- See Also:
-
DRAG_GROUP
- See Also:
-
CHECKMARK_URI
- See Also:
-
CHECKMARK_NULL_URI
- See Also:
-
-
Constructor Details
-
PivotFieldControl
public PivotFieldControl()
-
-
Method Details
-
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 callingupdate(). 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
-
isUpdated
public boolean isUpdated()Return true if the PivotModel is up to date. -
getLayout
Return layout type. -
setLayout
Set layout type. Default value isLAYOUT_SQUARE- Parameters:
layout-LAYOUT_SQUARE,LAYOUT_HORIZONTAL,LAYOUT_VERTICAL
-
getModel
Return the pivot model associated with this control -
setModel
Set pivot model associated with this control. An implementation ofPivotModelExtis required. -
syncModel
public void syncModel()Reload underlying Grids from current model. -
afterCompose
public void afterCompose()- Specified by:
afterComposein interfaceorg.zkoss.zk.ui.ext.AfterCompose
-
syncModel
-
loadLayout
protected void loadLayout() -
initGrid
protected void initGrid(org.zkoss.zul.Grid grid) -
sortField
protected void sortField(boolean ascending) -
getSubtotals
-
setSubtotals
-
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
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
Override this method to provide a different zul template for the modal window for subtotal selection. -
getLabels
-
getDefaultLabels
Override this method to provide the default label list. -
clearChildren
protected static final void clearChildren(org.zkoss.zk.ui.Component c) -
getFieldType
-
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
-