Interface IDBVirtualList<E extends IDBObj>

All Known Implementing Classes:
DBVirtualList

public interface IDBVirtualList<E extends IDBObj>
A interface represents a virtual list of search results. Note that this class must be used with DS4.0.
Version:
$Revision$, $Date$
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    getElementAt(int index)
    Fetchs data of a single list item Recommend to call getSize() before getElementAt() or getElements() since you'd better check if the index is out of bound first.
    int
    Gets the top of the buffer
    Retrieves and jumps to element in the given position.
    boolean
    getPage(int first)
    Get a page starting at "first" (although we may also fetch some preceding entries) Recommend to call getSize() before getElementAt() or getElements() since you'd better check if the index is out of bound first.
    boolean
    Called by application to scroll the list with initial letters.
    int
    Gets the virutal selected index
    int
    Retrieves the size of this virtual list.
    int
     
    int
    Returns current index.
    void
    processElements(int startidx, int endidx, IElementProcessor ep)
    Processes elements as soon as it arrives.
    void
    setPageSize(int size)
    Sets the paging size of this virtual list.
    void
    setSortKey(String sortKey)
    Sets the sort key
    void
    setSortKey(String[] sortKeys)
    Sets the sort key
  • Method Details

    • setPageSize

      void setPageSize(int size)
      Sets the paging size of this virtual list. The page size here is just a buffer size. A buffer is kept around that is three times as large as the number of visible entries. That way, you can scroll up/down several items(up to a page-full) without refetching entries from the directory.
      Parameters:
      size - the page size
    • setSortKey

      void setSortKey(String sortKey) throws EBaseException
      Sets the sort key
      Parameters:
      sortKey - the attribute to sort by
      Throws:
      EBaseException - failed to set
    • setSortKey

      void setSortKey(String[] sortKeys) throws EBaseException
      Sets the sort key
      Parameters:
      sortKeys - the attributes to sort by
      Throws:
      EBaseException - failed to set
    • getSize

      int getSize()
      Retrieves the size of this virtual list. Recommend to call getSize() before getElementAt() or getElements() since you'd better check if the index is out of bound first.
      Returns:
      current size in list
    • getSizeBeforeJumpTo

      int getSizeBeforeJumpTo()
      Returns current index.
      Returns:
      current index
    • getSizeAfterJumpTo

      int getSizeAfterJumpTo()
    • getCurrentIndex

      int getCurrentIndex()
    • getPage

      boolean getPage(int first)
      Get a page starting at "first" (although we may also fetch some preceding entries) Recommend to call getSize() before getElementAt() or getElements() since you'd better check if the index is out of bound first.
      Parameters:
      first - the index of the first entry of the page you want to fetch
    • getPage

      boolean getPage(String text)
      Called by application to scroll the list with initial letters. Consider text to be an initial substring of the attribute of the primary sorting key(the first one specified in the sort key array) of an entry. If no entries match, the one just before(or after, if none before) will be returned as mSelectedIndex
      Parameters:
      text - the prefix of the first entry of the page you want to fetch
    • getElementAt

      E getElementAt(int index)
      Fetchs data of a single list item Recommend to call getSize() before getElementAt() or getElements() since you'd better check if the index is out of bound first. If the index is out of range of the virtual list, an exception will be thrown and return null
      Parameters:
      index - the index of the element to fetch
    • getJumpToElementAt

      E getJumpToElementAt(int i)
      Retrieves and jumps to element in the given position.
      Parameters:
      i - position
      Returns:
      object
    • processElements

      void processElements(int startidx, int endidx, IElementProcessor ep) throws EBaseException
      Processes elements as soon as it arrives. It is more memory-efficient.
      Parameters:
      startidx - starting index
      endidx - ending index
      ep - object to call
      Throws:
      EBaseException - failed to process elements
    • getSelectedIndex

      int getSelectedIndex()
      Gets the virutal selected index
      Returns:
      selected index
    • getFirstIndex

      int getFirstIndex()
      Gets the top of the buffer
      Returns:
      first index