org.zkoss.pivot.ui
Class PivotFieldControl

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.zul.Div
                  extended by org.zkoss.pivot.ui.PivotFieldControl
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.AfterCompose, org.zkoss.zk.ui.ext.Scope, org.zkoss.zk.ui.IdSpace, org.zkoss.zk.ui.sys.ComponentCtrl, org.zkoss.zul.api.Div, org.zkoss.zul.impl.api.XulElement

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
protected static class PivotFieldControl.PivotFieldControlChangeEvent
          The event that represents moving a field in PivotFieldControl.
 
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
protected  boolean _deferred
           
protected  java.lang.String _layout
           
protected  PivotModelExt _model
           
protected static java.lang.String CHECKMARK_URI
           
protected  org.zkoss.zul.Grid clist
           
protected  org.zkoss.zul.Grid dlist
           
protected static java.lang.String DRAG_GROUP
           
static java.lang.String DRAG_GROUP_KEY
           
protected  org.zkoss.zk.ui.event.EventListener FIELD_BTN_LISTENER
           
static java.lang.String FIELD_MENU_URI
           
protected  org.zkoss.zul.RowRenderer FIELD_RENDERER
           
protected  org.zkoss.zk.ui.event.EventListener ITEM_DROP_LISTENER
           
static java.lang.String LABEL_COLUMN_GRID
           
static java.lang.String LABEL_DATA_GRID
           
static java.lang.String LABEL_RES_PREFIX
           
static java.lang.String LABEL_ROW_GRID
           
static java.lang.String LABEL_SORT_ASCENDING
           
static java.lang.String LABEL_SORT_DESCENDING
           
static java.lang.String LABEL_UNUSED_GRID
           
static java.lang.String LAYOUT_HORIZONTAL
           
static java.lang.String LAYOUT_SQUARE
           
static java.lang.String LAYOUT_VERTICAL
           
protected  org.zkoss.zul.Menupopup menu
           
protected  org.zkoss.zul.Menupopup menuFilterList
           
protected  org.zkoss.zul.Menuitem menuSortA
           
protected  org.zkoss.zul.Menuitem menuSortZ
           
protected  org.zkoss.zul.Grid rlist
           
protected  org.zkoss.zul.Grid ulist
           
protected static java.util.Map<java.lang.String,java.lang.String> VIEW_URI
           
 
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
PivotFieldControl()
           
 
Method Summary
 void afterCompose()
           
protected  void beforeLayout(java.util.Map<java.lang.String,java.lang.Object> arg1, java.util.Map<java.lang.String,java.lang.Object> arg2)
          Override this method to modify the argument map passed into template zuls.
protected  java.lang.String getContextMenuURI()
          Override this method to provide a different zul template for the context menu.
protected  java.lang.String getDragGroup()
           
protected  PivotField.Type getFieldType(org.zkoss.zul.Grid grid)
           
 java.lang.String getLayout()
          Return layout type.
 PivotModelExt getModel()
          Return the pivot model associated with this control
protected  void initGrid(org.zkoss.zul.Grid grid)
           
 boolean isDeferredUpdate()
          Return true if in deferred update mode.
protected  boolean isSortable(org.zkoss.zul.Row row)
           
 boolean isUpdated()
          Return true if the PivotModel is up to date.
protected  void loadArg(java.util.Map<java.lang.String,java.lang.Object> arg, java.lang.String key, java.lang.Object defValue)
           
protected  void loadLayout()
           
 void onClick$menuSortA(org.zkoss.zk.ui.event.Event event)
           
 void onClick$menuSortZ(org.zkoss.zk.ui.event.Event event)
           
 void setDeferredUpdate(boolean deferred)
          Set deferred update mode.
 void setLayout(java.lang.String layout)
          Set layout type.
 void setModel(PivotModelExt model)
          Set pivot model associated with this control.
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 updatePivotModel(org.zkoss.zul.Grid grid, PivotField.Type type)
           
 
Methods inherited from class org.zkoss.zul.Div
getAlign, renderProperties, setAlign
 
Methods inherited from class org.zkoss.zul.impl.XulElement
clone, 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, getZclass, getZindex, getZIndex, service, setAction, setClass, setDraggable, setDroppable, setFocus, setHeight, 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, beforeChildAdded, 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, insertBefore, invalidate, isChildable, isInvalidated, isListenerAvailable, isVisible, newChildren, newExtraCtrl, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeChild, removeEventListener, removeForward, removeForward, removeScopeListener, render, render, render, renderIdSpace, response, response, sessionDidActivate, sessionWillPassivate, 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.IdSpace
getFellow, getFellow, getFellowIfAny, getFellowIfAny, getFellows, hasFellow, hasFellow
 
Methods inherited from interface org.zkoss.zk.ui.ext.Scope
addScopeListener, getAttribute, getAttribute, getAttributes, hasAttribute, hasAttribute, removeAttribute, removeAttribute, removeScopeListener, setAttribute, setAttribute
 
Methods inherited from interface org.zkoss.zul.impl.api.XulElement
getContext, getCtrlKeys, getPopup, getTooltip, setContext, setContext, setCtrlKeys, setPopup, setPopup, setTooltip, setTooltip
 
Methods inherited from interface org.zkoss.zk.ui.api.HtmlBasedComponent
focus, getHeight, getLeft, getRenderdefer, getSclass, getStyle, getTooltiptext, getTop, getWidth, getZclass, getZindex, getZIndex, setDraggable, setDroppable, setFocus, setHeight, 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, clone, 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, insertBefore, invalidate, 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
 

Field Detail

_deferred

protected boolean _deferred

_layout

protected java.lang.String _layout

_model

protected PivotModelExt _model

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

menu

protected org.zkoss.zul.Menupopup menu

menuFilterList

protected org.zkoss.zul.Menupopup menuFilterList

menuSortA

protected org.zkoss.zul.Menuitem menuSortA

menuSortZ

protected org.zkoss.zul.Menuitem menuSortZ

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

LABEL_RES_PREFIX

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

LAYOUT_SQUARE

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

LAYOUT_VERTICAL

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

LAYOUT_HORIZONTAL

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

VIEW_URI

protected static final java.util.Map<java.lang.String,java.lang.String> VIEW_URI

DRAG_GROUP_KEY

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

DRAG_GROUP

protected static final java.lang.String DRAG_GROUP
See Also:
Constant Field Values

FIELD_MENU_URI

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

CHECKMARK_URI

protected static final java.lang.String CHECKMARK_URI
See Also:
Constant Field Values

LABEL_ROW_GRID

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

LABEL_COLUMN_GRID

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

LABEL_DATA_GRID

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

LABEL_UNUSED_GRID

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

LABEL_SORT_ASCENDING

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

LABEL_SORT_DESCENDING

public static final java.lang.String LABEL_SORT_DESCENDING
See Also:
Constant Field Values
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.


updatePivotModel

protected void updatePivotModel(org.zkoss.zul.Grid grid,
                                PivotField.Type type)

isUpdated

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


getLayout

public java.lang.String getLayout()
Return layout type.


setLayout

public void setLayout(java.lang.String layout)
Set layout type.

Parameters:
layout - "square", "vertical", "horizontal"

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()

beforeLayout

protected void beforeLayout(java.util.Map<java.lang.String,java.lang.Object> arg1,
                            java.util.Map<java.lang.String,java.lang.Object> arg2)
Override this method to modify the argument map passed into template zuls.

Parameters:
arg1 - Map for creating field Grids from zul.
arg2 - Map for creating field's context menu from zul.

getContextMenuURI

protected java.lang.String getContextMenuURI()
Override this method to provide a different zul template for the context menu. The template should have a Menupopup as the root component, with id "menu".


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)

initGrid

protected void initGrid(org.zkoss.zul.Grid grid)

getFieldType

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

isSortable

protected boolean isSortable(org.zkoss.zul.Row row)

getDragGroup

protected java.lang.String getDragGroup()

loadArg

protected final void loadArg(java.util.Map<java.lang.String,java.lang.Object> arg,
                             java.lang.String key,
                             java.lang.Object defValue)


Copyright © 2012. All Rights Reserved.