Class GridView

java.lang.Object
org.zkoss.zk.ui.AbstractComponent
org.zkoss.zk.ui.HtmlBasedComponent
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
  • 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, 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 field display in grid mode, in case user customize grid this list container only customize list.
     
    void
    init(GridTab gridTab)
    Init data grid
    void
    redraw grid view
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    protected void
    Parent component change notification from ADTabpanel that own this GridView instance (Usually after movement between Header and DetailPane panel).
    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)
     
    void
    setPageSize(int pageSize)
    set paging size
    void
    setWindowNo(int windowNo)
     
    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.zk.ui.HtmlBasedComponent

    addSclass, clone, evalCSSFlex, getAction, getDraggable, getDroppable, getExtraCtrl, getHeight, getHflex, getLeft, getPropertyAccess, getRenderdefer, getSclass, getStyle, getTabindex, getTabindexInteger, getTooltiptext, getTop, getVflex, getWidth, getZindex, getZIndex, removeSclass, removeSclass, service, setAction, setClass, 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, addAnnotation, addCallback, addClientEvent, addEventHandler, addEventListener, addEventListener, addForward, addForward, addForward, addForward, addMoved, addRedrawCallback, addScopeListener, addShadowRoot, addShadowRootBefore, addSharedEventHandlerMap, appendChild, applyProperties, beforeChildAdded, beforeChildRemoved, beforeParentChanged, detach, didActivate, didActivate, didDeserialize, didDeserialize, disableBindingAnnotation, disableClientUpdate, enableBindingAnnotation, getAnnotatedProperties, getAnnotatedPropertiesBy, getAnnotation, getAnnotation, getAnnotations, 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, getId, getLastChild, getListenerIterator, getMold, getNextSibling, getPage, getParent, getPreviousSibling, getRedrawCallback, getRoot, getShadowFellowIfAny, getShadowRoots, getShadowVariable, getShadowVariable, getShadowVariable0, getSpaceOwner, getSpecialRendererOutput, getStubonly, getSubBindingAnnotationCount, getTemplate, getTemplateNames, getUuid, getWidgetAttribute, getWidgetAttributeNames, getWidgetClass, getWidgetListener, getWidgetListenerNames, getWidgetOverride, getWidgetOverrideNames, hasAttribute, hasAttribute, hasAttribute, hasAttributeOrFellow, hasBindingAnnotation, hasFellow, hasFellow, hasSubBindingAnnotation, insertBefore, invalidate, invalidatePartial, isChildable, isInitialized, isInvalidated, isListenerAvailable, isVisible, onChildAdded, onChildRemoved, onPageAttached, onPageDetached, onWrongValue, query, queryAll, redraw, redrawChildren, removeAttribute, removeAttribute, removeAttribute, removeCallback, removeChild, removeEventListener, removeForward, removeForward, removeRedrawCallback, removeScopeListener, removeShadowRoot, render, render, render, 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, setWidgetAttribute, 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.sys.ComponentCtrl

    invalidatePartial

    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()
      Returns:
      true if it is in detail pane mode
    • init

      public void init(GridTab gridTab)
      Init data grid
      Parameters:
      gridTab -
    • isInit

      public boolean isInit()
      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()
      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)
      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)
      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 field display in grid mode, in case user customize grid 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.