Package org.adempiere.webui.adwindow
Class GridView
java.lang.Object
org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
org.zkoss.zul.impl.XulElement
org.zkoss.zul.Layout
org.zkoss.zul.Vlayout
org.adempiere.webui.adwindow.GridView
- All Implemented Interfaces:
Serializable
,Cloneable
,EventListener
,IFieldEditorContainer
,StateChangeListener
,org.zkoss.zk.ui.Component
,org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>
,org.zkoss.zk.ui.ext.Scope
,org.zkoss.zk.ui.IdSpace
,org.zkoss.zk.ui.sys.ComponentCtrl
public class GridView
extends org.zkoss.zul.Vlayout
implements org.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>, org.zkoss.zk.ui.IdSpace, IFieldEditorContainer, StateChangeListener
Grid/List view implemented using the Grid component.
- Author:
- Low Heng Sin
- See Also:
-
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
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
Column
attribute to store initial/original column width valueprotected boolean
true if there are AD_Tab_Customization for GridTabstatic final org.zkoss.zk.ui.event.EventListener<? extends org.zkoss.zk.ui.event.Event>
Event listener for context menu on grid header
Freeze the current column when click "frozen" column and reset to default column when click "reset frozen"static final String
static final String
protected Checkbox
checkbox to select all row of current pagestatic final String
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
AFTER_CHILD_ADDED, AFTER_CHILD_REMOVED, 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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Activate GridView (make visible or GridTab have been refreshed)protected void
Auto hide empty columns (if auto hide empty column feature have been turned on)void
clear()
remove all componentsprotected void
Create data grid instancesvoid
Deactivate Grid View.void
dynamicDisplay
(int col) Validate display properties of fields of current rowprotected void
Echo ON_POST_SELECTED_ROW_CHANGED_EVENT after current row index has changedvoid
editorTraverse
(Callback<WEditor> editorTaverseCallback) Call editorTaverseCallback for all field editors.void
focus()
If current row is in edit mode, set focus to first field editorvoid
If current row is in edit mode, set focus to first writable field editor.void
focusToNextEditor
(WEditor ref) set focus to next field editor from refList of field display in grid mode.void
Init data gridvoid
Redraw grid viewboolean
Is in detail pane modeboolean
isInit()
Is data grid have been init with GridTabboolean
Is data grid in the process of refreshing data from GridTabboolean
protected void
Parent component change notification from ADTabpanel that own this GridView instance (Usually after movement between Header and DetailPane panel).
Re-position paging component.void
void
onEditCurrentRow
(org.zkoss.zk.ui.event.Event event) Edit current rowboolean
Handle enter key eventvoid
onEvent
(org.zkoss.zk.ui.event.Event event) void
Event after the current row index has changed.void
Refresh data grid (after switching from form view or column setup has change)void
reInit()
Re-Init GridView with cache gridTab.void
Scroll grid to the current focus rowvoid
setADWindowPanel
(AbstractADWindowContent winPanel) Set AD window content part that own this GridView instancevoid
setDetailPaneMode
(boolean detailPaneMode, GridTab gridTab) Turn on/off detail pane modevoid
setFocusToField
(String columnName) Set focus to fieldvoid
setPageSize
(int pageSize) set paging sizevoid
setWindowNo
(int windowNo) Set window novoid
stateChange
(StateChangeEvent event) State change eventvoid
Update current row index from modelMethods inherited from class org.zkoss.zul.Vlayout
getZclass
Methods inherited from class org.zkoss.zul.Layout
getSpacing, renderProperties, setSpacing
Methods inherited from class org.zkoss.zul.impl.XulElement
clone, 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, getAction, getClientAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, 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 class java.lang.Object
equals, 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.adempiere.webui.adwindow.IFieldEditorContainer
editorTraverse
Methods inherited from interface org.zkoss.zk.ui.ext.Scope
addScopeListener, getAttribute, hasAttribute, removeAttribute, removeScopeListener, setAttribute
-
Field Details
-
ZERO_PX_WIDTH
- See Also:
-
COLUMN_WIDTH_ORIGINAL
Column
attribute to store initial/original column width value- See Also:
-
selectAll
checkbox to select all row of current page -
isHasCustomizeData
protected boolean isHasCustomizeDatatrue if there are AD_Tab_Customization for GridTab -
ATTR_VALUE_MENU_ITEM_FROZEN
- See Also:
-
MENU_ITEM_FROZEN_LABEL
- See Also:
-
ATTR_VALUE_MENU_ITEM_RESET_FROZEN
- See Also:
-
MENU_ITEM_RESET_FROZEN_LABEL
- See Also:
-
ATTR_NAME_CONTEXT_MENU_COLUMN
- See Also:
-
ATTR_NAME_GRID_VIEW_CONTEXT_MENU_POPUP
- See Also:
-
listener
public static final org.zkoss.zk.ui.event.EventListener<? extends org.zkoss.zk.ui.event.Event> listenerEvent listener for context menu on grid header
Freeze the current column when click "frozen" column and reset to default column when click "reset frozen"
-
-
Constructor Details
-
GridView
public GridView()default constructor -
GridView
public GridView(int windowNo) - Parameters:
windowNo
-
-
-
Method Details
-
createListbox
protected void createListbox()Create data grid instances -
setDetailPaneMode
Turn on/off detail pane mode- Parameters:
detailPaneMode
-gridTab
-
-
isDetailPaneMode
public boolean isDetailPaneMode()Is in detail pane mode- Returns:
- true if it is in detail pane mode
-
init
Init data grid- Parameters:
gridTab
-
-
isInit
public boolean isInit()Is data grid have been init with GridTab- Returns:
- true if data grid have been init with GridTab
-
activate
Activate GridView (make visible or GridTab have been refreshed)- Parameters:
gridTab
-
-
refresh
Refresh data grid (after switching from form view or column setup has change)- Parameters:
gridTab
-
-
isRefreshing
public boolean isRefreshing()Is data grid in the process of refreshing data from GridTab- Returns:
- true if data grid is refreshing data from GridTab
-
updateListIndex
public void updateListIndex()Update current row index from model -
echoOnPostSelectedRowChanged
protected void echoOnPostSelectedRowChanged()Echo ON_POST_SELECTED_ROW_CHANGED_EVENT after current row index has changed -
setPageSize
public void setPageSize(int pageSize) set paging size- Parameters:
pageSize
-
-
clear
public void clear()remove all components -
autoHideEmptyColumns
protected void autoHideEmptyColumns()Auto hide empty columns (if auto hide empty column feature have been turned on) -
deactivate
public void deactivate()Deactivate Grid View. Stop editing if current row is in edit mode. -
onEvent
- Specified by:
onEvent
in interfaceorg.zkoss.zk.ui.event.EventListener<org.zkoss.zk.ui.event.Event>
- Throws:
Exception
-
onPostSelectedRowChanged
public void onPostSelectedRowChanged()Event after the current row index has changed. -
scrollToCurrentRow
public void scrollToCurrentRow()Scroll grid to the current focus row -
getListbox
- Returns:
- Grid
-
dynamicDisplay
public void dynamicDisplay(int col) Validate display properties of fields of current row- Parameters:
col
-
-
setWindowNo
public void setWindowNo(int windowNo) Set window no- Parameters:
windowNo
-
-
focus
public void focus()If current row is in edit mode, set focus to first field editor- Overrides:
focus
in classorg.zkoss.zk.ui.HtmlBasedComponent
-
onEnterKey
public boolean onEnterKey()Handle enter key event -
setFocusToField
Set focus to field- Parameters:
columnName
-
-
setADWindowPanel
Set AD window content part that own this GridView instance- Parameters:
winPanel
-
-
reInit
public void reInit()Re-Init GridView with cache gridTab. -
invalidateGridView
public void invalidateGridView()Redraw grid view -
getFields
List of field display in grid mode. If there is grid customization record. this list container only customize list.- Returns:
- GridField[]
-
onEditCurrentRow
public void onEditCurrentRow() -
onEditCurrentRow
public void onEditCurrentRow(org.zkoss.zk.ui.event.Event event) Edit current row- Parameters:
event
-
-
focusToFirstEditor
public void focusToFirstEditor()If current row is in edit mode, set focus to first writable field editor.- Specified by:
focusToFirstEditor
in interfaceIFieldEditorContainer
-
focusToNextEditor
Description copied from interface:IFieldEditorContainer
set focus to next field editor from ref- Specified by:
focusToNextEditor
in interfaceIFieldEditorContainer
-
stateChange
Description copied from interface:StateChangeListener
State change event- Specified by:
stateChange
in interfaceStateChangeListener
-
onADTabPanelParentChanged
protected void onADTabPanelParentChanged()Parent component change notification from ADTabpanel that own this GridView instance (Usually after movement between Header and DetailPane panel).
Re-position paging component. -
editorTraverse
Call editorTaverseCallback for all field editors.- Specified by:
editorTraverse
in interfaceIFieldEditorContainer
-
isShowCurrentRowIndicatorColumn
public boolean isShowCurrentRowIndicatorColumn()- Returns:
- true if current row indicator column is visible.
-