org.apache.jetspeed.portal.portlets.browser
Class DatabaseBrowserIterator

java.lang.Object
  extended byorg.apache.jetspeed.portal.portlets.browser.DatabaseBrowserIterator
All Implemented Interfaces:
BrowserIterator, java.util.Comparator, java.util.Iterator, java.io.Serializable

public class DatabaseBrowserIterator
extends java.lang.Object
implements BrowserIterator

A class for iterating over the window. The window constitutes the selection of rows being displayed to the user from the List storing all the ResultSet.

Version:
$Id: DatabaseBrowserIterator.java,v 1.11 2004/02/23 03:26:43 jford Exp $
Author:
David Sean Taylor
See Also:
Serialized Form

Constructor Summary
DatabaseBrowserIterator(java.util.List result, java.util.List columnTitles, java.util.List columnTypes, int pageSize)
          Constructor for the database browser iterator
 
Method Summary
 int compare(java.lang.Object obj1, java.lang.Object obj2)
           
 int getBottom()
          This method returns the last index of the row in the window displayed.
 java.util.List getResultSet()
          This method returns the result set.
 int getResultSetSize()
          This method returns the number of rows in the result set.
 java.util.List getResultSetTitleList()
          This method returns the List containg the column labels of the result set.
 java.util.List getResultSetTypesList()
          This method returns the List containg the column type names of the result set.
 int getTop()
          This method returns the index of the row to which the cursor is pointing at.
 int getWindowSize()
          This method returns the window size.
 boolean hasNext()
          Returns true if the iteration has more elements
 java.lang.Object next()
          Returns the next element in the iteration
 void remove()
          Logs as info - since remove operation is not supported by this Iterator.
 void setTop(int start)
          This method points the cursor to the index provided.
 void sort(java.lang.String columnName)
          This method sorts the result set according to the value of the column as specified by the parameter column name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

DatabaseBrowserIterator

public DatabaseBrowserIterator(java.util.List result,
                               java.util.List columnTitles,
                               java.util.List columnTypes,
                               int pageSize)
Constructor for the database browser iterator

Parameters:
result - The List containg all the rows from the resultSet.
columnTitles - The List containg all the columnLabels from a resultSet.
pageSize - The number of rows to be displayed in a window configured by the user.
Method Detail

getResultSet

public java.util.List getResultSet()
This method returns the result set.

Specified by:
getResultSet in interface BrowserIterator

getResultSetSize

public int getResultSetSize()
This method returns the number of rows in the result set.

Specified by:
getResultSetSize in interface BrowserIterator

getResultSetTitleList

public java.util.List getResultSetTitleList()
This method returns the List containg the column labels of the result set.

Specified by:
getResultSetTitleList in interface BrowserIterator

getResultSetTypesList

public java.util.List getResultSetTypesList()
This method returns the List containg the column type names of the result set.

Specified by:
getResultSetTypesList in interface BrowserIterator
See Also:
Types

getTop

public int getTop()
This method returns the index of the row to which the cursor is pointing at.

Specified by:
getTop in interface BrowserIterator

setTop

public void setTop(int start)
This method points the cursor to the index provided.

Specified by:
setTop in interface BrowserIterator
Parameters:
start - Index to which cursor should point to

getBottom

public int getBottom()
This method returns the last index of the row in the window displayed.

Specified by:
getBottom in interface BrowserIterator

getWindowSize

public int getWindowSize()
This method returns the window size.

Specified by:
getWindowSize in interface BrowserIterator

hasNext

public boolean hasNext()
Returns true if the iteration has more elements

Specified by:
hasNext in interface java.util.Iterator

next

public java.lang.Object next()
Returns the next element in the iteration

Specified by:
next in interface java.util.Iterator

remove

public void remove()
Logs as info - since remove operation is not supported by this Iterator.

Specified by:
remove in interface java.util.Iterator

sort

public void sort(java.lang.String columnName)
This method sorts the result set according to the value of the column as specified by the parameter column name. Changes the order of the result set vector.

Specified by:
sort in interface BrowserIterator

compare

public int compare(java.lang.Object obj1,
                   java.lang.Object obj2)
Specified by:
compare in interface java.util.Comparator


Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.