home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / VCafe / prosrc.bin / DataItemCursor.java < prev    next >
Encoding:
Java Source  |  1998-03-18  |  1.1 KB  |  52 lines

  1. package symantec.itools.db.beans.binding;
  2. import java.awt.Dimension;
  3. import java.util.Vector;
  4. import symantec.itools.db.beans.binding.databus.*;
  5.  
  6. public class DataItemCursor implements  DataCursor
  7. {   
  8.     private int position=0;
  9.     private Vector Elements=new Vector();
  10.   
  11.     public DataItemCursor()
  12.     {       
  13.     }
  14.     public DataItemCursor(int pos)
  15.     {
  16.         position=pos;
  17.     }
  18.     public DataItemCursor(Vector vect)
  19.     {
  20.         Elements=vect;
  21.     }
  22.     public DataItem getNextItem()
  23.     {
  24.        
  25.         if (position<Elements.size()-1)
  26.         {
  27.             position++;
  28.             return getCurrentItem();
  29.         }
  30.         return null;
  31.     }
  32.     
  33.     public DataItem getPreviousItem()
  34.     {
  35.         if (position>0)
  36.         {
  37.             position--;
  38.             return getCurrentItem();
  39.         }
  40.         return null;
  41.     }
  42.     public DataItem getCurrentItem()
  43.     {
  44.         if(Elements.size()>position)
  45.         return (DataItem)Elements.elementAt(position);
  46.         else return null;
  47.     }
  48.     public void reset()
  49.     {
  50.         position=0;
  51.     }
  52. }