portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/browser DatabaseBrowserIterator.java
Date Mon, 05 Aug 2002 22:22:04 GMT
taylor      2002/08/05 15:22:04

  Modified:    src/java/org/apache/jetspeed/portal/portlets/browser
                        DatabaseBrowserIterator.java
  Log:
  Changed the data structure storing the result set from the database, from Vectors to ArrayLists
.
  
  Revision  Changes    Path
  1.7       +28 -28    jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/browser/DatabaseBrowserIterator.java
  
  Index: DatabaseBrowserIterator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/portal/portlets/browser/DatabaseBrowserIterator.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DatabaseBrowserIterator.java	19 Jul 2002 23:25:54 -0000	1.6
  +++ DatabaseBrowserIterator.java	5 Aug 2002 22:22:04 -0000	1.7
  @@ -57,14 +57,14 @@
   import org.apache.turbine.util.Log;
   import org.apache.jetspeed.portal.portlets.browser.BrowserIterator;
   
  -import java.util.Vector;
  +import java.util.ArrayList;
   import java.util.List;
   import java.util.Collections;
   import java.sql.Types;
   
   /**
    * A class for iterating over the window. The window constitutes the selection
  - * of rows being displayed to the user from the Vector storing all the ResultSet.
  + * of rows being displayed to the user from the List storing all the ResultSet.
    *
    * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
    * @version $Id$
  @@ -80,31 +80,31 @@
   
       int bottom = -1;
       int windowSize = -1;
  -    int rsVectorSize = -1;
  +    int rsListSize = -1;
   
       boolean ascendingOrder = true;
   
       String sortColumnName = null;
   
  -    Vector rsVector;
  -    Vector rsTitleVector;
  -    Vector rsTypeVector;
  +    ArrayList rsList;
  +    ArrayList rsTitleList;
  +    ArrayList rsTypeList;
   
       /**
        * Constructor for the database browser iterator
        *
  -     * @param result The Vector containg all the rows from the resultSet.
  -     * @param columnTitles The Vector containg all the columnLabels from a resultSet.
  +     * @param result The List containg all the rows from the resultSet.
  +     * @param columnTitles The List containg all the columnLabels from a resultSet.
        * @param pageSize The number of rows to be displayed in a window configured by the
user.
        */
  -    public DatabaseBrowserIterator(Vector result, Vector columnTitles,
  -                                   Vector columnTypes, int pageSize)
  +    public DatabaseBrowserIterator(List result, List columnTitles,
  +                                   List columnTypes, int pageSize)
       {
  -      this.rsVector = result;
  -      this.rsTitleVector= columnTitles;
  -      this.rsTypeVector = columnTypes;
  +      this.rsList = (ArrayList)result;
  +      this.rsTitleList= (ArrayList)columnTitles;
  +      this.rsTypeList = (ArrayList)columnTypes;
         this.windowSize = pageSize;
  -      this.rsVectorSize = result.size();
  +      this.rsListSize = result.size();
         setBottom();
       }
   
  @@ -114,7 +114,7 @@
        */
       public List getResultSet()
       {
  -        return rsVector;
  +        return rsList;
       }
   
       /**
  @@ -123,7 +123,7 @@
        */
       public int getResultSetSize()
       {
  -        return rsVectorSize;
  +        return rsListSize;
       }
   
       /**
  @@ -132,7 +132,7 @@
        */
       public List getResultSetTitleList()
       {
  -        return rsTitleVector;
  +        return rsTitleList;
       }
       /**
        * This method returns the List containg the column type names of the result set.
  @@ -141,7 +141,7 @@
        */
       public List getResultSetTypesList()
       {
  -        return rsTypeVector;
  +        return rsTypeList;
       }
   
       /**
  @@ -191,9 +191,9 @@
       private void setBottom()
       {
           bottom = top + windowSize;
  -        if( bottom > rsVectorSize )
  +        if( bottom > rsListSize )
           {
  -            bottom = rsVectorSize;
  +            bottom = rsListSize;
           }
       }
   
  @@ -202,7 +202,7 @@
        */
       public boolean hasNext()
       {
  -        if(index <= rsVectorSize && index < bottom)
  +        if(index <= rsListSize && index < bottom)
           {
               return true;
           }
  @@ -215,7 +215,7 @@
       public Object next()
       {
           index = index + 1;
  -        return rsVector.get(index - 1);
  +        return rsList.get(index - 1);
       }
   
       /**
  @@ -249,7 +249,7 @@
                   ascendingOrder= true;
                   sortColumnName = columnName;
               }
  -            Collections.sort( rsVector, this);
  +            Collections.sort( rsList, this);
           }
       }
   
  @@ -259,13 +259,13 @@
        */
       public int compare(Object obj1, Object obj2)
       {
  -        int idx = rsTitleVector.indexOf(sortColumnName);
  +        int idx = rsTitleList.indexOf(sortColumnName);
           int order = 0;
   
           if( idx != -1 )
           {
  -            Object col1 = ((Vector)obj1).get(idx);
  -            Object col2 = ((Vector)obj2).get(idx);
  +            Object col1 = ((ArrayList)obj1).get(idx);
  +            Object col2 = ((ArrayList)obj2).get(idx);
   
               if( (col1).equals(VELOCITY_NULL_ENTRY) )
               {
  @@ -284,7 +284,7 @@
               }
               else
               {
  -                int type = Integer.parseInt((String)rsTypeVector.get(idx));
  +                int type = Integer.parseInt((String)rsTypeList.get(idx));
                   switch (type)
                   {
   
  
  
  

--
To unsubscribe, e-mail:   <mailto:jetspeed-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-dev-help@jakarta.apache.org>


Mime
View raw message