Class GridTableListModel

java.lang.Object
org.zkoss.zul.AbstractListModel<Object>
org.adempiere.webui.adwindow.GridTableListModel
All Implemented Interfaces:
Serializable, EventListener, TableModelListener, org.zkoss.zul.ext.Pageable, org.zkoss.zul.ext.Selectable<Object>, org.zkoss.zul.ext.Sortable<Object>, org.zkoss.zul.ListModel<Object>, org.zkoss.zul.PageableModel

public class GridTableListModel extends org.zkoss.zul.AbstractListModel<Object> implements TableModelListener, org.zkoss.zul.ext.Sortable<Object>
List model for GridTable
Author:
Low Heng Sin
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.zkoss.zul.AbstractListModel

    org.zkoss.zul.AbstractListModel.DefaultSelectionControl<E extends Object>
  • Field Summary

    Fields inherited from class org.zkoss.zul.AbstractListModel

    _selection

    Fields inherited from interface org.zkoss.zul.PageableModel

    INTERNAL_EVENT
  • Constructor Summary

    Constructors
    Constructor
    Description
    GridTableListModel(GridTable tableModel, int windowNo)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    getElementAt(int rowIndex)
     
    int
     
    int
    Get number of rows per page
    int
    Get total number of rows
     
    void
    setEditing(boolean b)
    Set editing to true/false.
    void
    setPage(int pg)
    set current page no ( starting from 0 )
    void
    setPageSize(int pgSize)
    Set number of rows per page
    void
    sort(Comparator<Object> cmpr, boolean ascending)
    Sort and fire ListDataEvent.CONTENTS_CHANGED event to notify UI component.
    void
    Handle TableModelEvent from GridTable.
    void
    updateComponent(int row)
    void
    updateComponent(int fromRow, int toRow)
    Request components that attached to this model to re-render a range of row.

    Methods inherited from class org.zkoss.zul.AbstractListModel

    addListDataListener, addPagingEventListener, addToSelection, clearSelection, clone, fireEvent, fireSelectionEvent, getActivePage, getPageCount, getSelection, getSelectionControl, isMultiple, isSelected, isSelectionEmpty, newEmptySelection, readSelection, removeAllSelection, removeFromSelection, removeListDataListener, removePagingEventListener, retainAllSelection, setActivePage, setMultiple, setSelection, setSelectionControl, writeSelection

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.zkoss.zul.ext.Sortable

    sort
  • Constructor Details

    • GridTableListModel

      public GridTableListModel(GridTable tableModel, int windowNo)
      Parameters:
      tableModel -
      windowNo -
  • Method Details

    • getElementAt

      public Object getElementAt(int rowIndex)
      Specified by:
      getElementAt in interface org.zkoss.zul.ListModel<Object>
      Parameters:
      rowIndex -
      See Also:
      • ListModel.getElementAt(int)
    • setPage

      public void setPage(int pg)
      set current page no ( starting from 0 )
      Parameters:
      pg -
    • getPage

      public int getPage()
      Returns:
      current page no ( starting from 0 )
    • setPageSize

      public void setPageSize(int pgSize)
      Set number of rows per page
      Specified by:
      setPageSize in interface org.zkoss.zul.ext.Pageable
      Overrides:
      setPageSize in class org.zkoss.zul.AbstractListModel<Object>
      Parameters:
      pgSize -
    • getPageSize

      public int getPageSize()
      Get number of rows per page
      Specified by:
      getPageSize in interface org.zkoss.zul.ext.Pageable
      Overrides:
      getPageSize in class org.zkoss.zul.AbstractListModel<Object>
      Returns:
      pageSize
    • getSize

      public int getSize()
      Get total number of rows
      Specified by:
      getSize in interface org.zkoss.zul.ListModel<Object>
      Returns:
      int
      See Also:
      • ListModel.getSize()
    • updateComponent

      public void updateComponent(int row)
      Parameters:
      row -
    • updateComponent

      public void updateComponent(int fromRow, int toRow)
      Request components that attached to this model to re-render a range of row. Fire ListDataEvent.CONTENTS_CHANGED event for fromRow to toRow.
      Parameters:
      fromRow -
      toRow -
    • sort

      public void sort(Comparator<Object> cmpr, boolean ascending)
      Sort and fire ListDataEvent.CONTENTS_CHANGED event to notify UI component.
      Specified by:
      sort in interface org.zkoss.zul.ext.Sortable<Object>
      Parameters:
      cmpr -
      ascending -
    • tableChanged

      public void tableChanged(TableModelEvent e)
      Handle TableModelEvent from GridTable.
      Specified by:
      tableChanged in interface TableModelListener
      Parameters:
      e -
      See Also:
    • setEditing

      public void setEditing(boolean b)
      Set editing to true/false. When editing is true, do not fire ListDataEvent.CONTENTS_CHANGED event.
      Parameters:
      b -
    • getSortDirection

      public String getSortDirection(Comparator<Object> cmpr)
      Specified by:
      getSortDirection in interface org.zkoss.zul.ext.Sortable<Object>