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

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     
    static final String
     
    static final String
     
    static final String
    Column attribute to store initial/original column width value
    protected boolean
    true if there are AD_Tab_Customization for GridTab
    static 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 page
    static 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

    Constructors
    Constructor
    Description
    default constructor
    GridView(int windowNo)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    activate(GridTab gridTab)
    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
    remove all components
    protected void
    Create data grid instances
    void
    Deactivate Grid View.
    void
    dynamicDisplay(int col)
    Validate display properties of fields of current row
    protected void
    Echo ON_POST_SELECTED_ROW_CHANGED_EVENT after current row index has changed
    void
    editorTraverse(Callback<WEditor> editorTaverseCallback)
    Call editorTaverseCallback for all field editors.
    void
    If current row is in edit mode, set focus to first field editor
    void
    If current row is in edit mode, set focus to first writable field editor.
    void
    set focus to next field editor from ref
    List of field display in grid mode.
     
    void
    init(GridTab gridTab)
    Init data grid
    void
    Redraw grid view
    boolean
    Is in detail pane mode
    boolean
    Is data grid have been init with GridTab
    boolean
    Is data grid in the process of refreshing data from GridTab
    boolean
     
    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 row
    boolean
    Handle enter key event
    void
    onEvent(org.zkoss.zk.ui.event.Event event)
     
    void
    Event after the current row index has changed.
    void
    refresh(GridTab gridTab)
    Refresh data grid (after switching from form view or column setup has change)
    void
    Re-Init GridView with cache gridTab.
    void
    Scroll grid to the current focus row
    void
    Set AD window content part that own this GridView instance
    void
    setDetailPaneMode(boolean detailPaneMode, GridTab gridTab)
    Turn on/off detail pane mode
    void
    setFocusToField(String columnName)
    Set focus to field
    void
    setPageSize(int pageSize)
    set paging size
    void
    setWindowNo(int windowNo)
    Set window no
    void
    State change event
    void
    Update current row index from model

    Methods 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

      public static final String ZERO_PX_WIDTH
      See Also:
    • COLUMN_WIDTH_ORIGINAL

      public static final String COLUMN_WIDTH_ORIGINAL
      Column attribute to store initial/original column width value
      See Also:
    • selectAll

      protected Checkbox selectAll
      checkbox to select all row of current page
    • isHasCustomizeData

      protected boolean isHasCustomizeData
      true if there are AD_Tab_Customization for GridTab
    • ATTR_VALUE_MENU_ITEM_FROZEN

      public static final String ATTR_VALUE_MENU_ITEM_FROZEN
      See Also:
    • ATTR_VALUE_MENU_ITEM_RESET_FROZEN

      public static final String ATTR_VALUE_MENU_ITEM_RESET_FROZEN
      See Also:
    • ATTR_NAME_CONTEXT_MENU_COLUMN

      public static final String ATTR_NAME_CONTEXT_MENU_COLUMN
      See Also:
    • ATTR_NAME_GRID_VIEW_CONTEXT_MENU_POPUP

      public static final String 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> listener
      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"
  • 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

      public void setDetailPaneMode(boolean detailPaneMode, GridTab gridTab)
      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

      public void init(GridTab gridTab)
      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

      public void activate(GridTab gridTab)
      Activate GridView (make visible or GridTab have been refreshed)
      Parameters:
      gridTab -
    • refresh

      public void refresh(GridTab gridTab)
      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

      public void onEvent(org.zkoss.zk.ui.event.Event event) throws Exception
      Specified by:
      onEvent in interface org.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

      public Grid 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 class org.zkoss.zk.ui.HtmlBasedComponent
    • onEnterKey

      public boolean onEnterKey()
      Handle enter key event
    • setFocusToField

      public void setFocusToField(String columnName)
      Set focus to field
      Parameters:
      columnName -
    • setADWindowPanel

      public void setADWindowPanel(AbstractADWindowContent winPanel)
      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

      public GridField[] 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 interface IFieldEditorContainer
    • focusToNextEditor

      public void focusToNextEditor(WEditor ref)
      Description copied from interface: IFieldEditorContainer
      set focus to next field editor from ref
      Specified by:
      focusToNextEditor in interface IFieldEditorContainer
    • stateChange

      public void stateChange(StateChangeEvent event)
      Description copied from interface: StateChangeListener
      State change event
      Specified by:
      stateChange in interface StateChangeListener
    • 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

      public void editorTraverse(Callback<WEditor> editorTaverseCallback)
      Call editorTaverseCallback for all field editors.
      Specified by:
      editorTraverse in interface IFieldEditorContainer
    • isShowCurrentRowIndicatorColumn

      public boolean isShowCurrentRowIndicatorColumn()
      Returns:
      true if current row indicator column is visible.