home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-03-18 | 1.1 KB | 52 lines |
- package symantec.itools.db.beans.binding;
- import java.awt.Dimension;
- import java.util.Vector;
- import symantec.itools.db.beans.binding.databus.*;
-
- public class DataItemCursor implements DataCursor
- {
- private int position=0;
- private Vector Elements=new Vector();
-
- public DataItemCursor()
- {
- }
- public DataItemCursor(int pos)
- {
- position=pos;
- }
- public DataItemCursor(Vector vect)
- {
- Elements=vect;
- }
- public DataItem getNextItem()
- {
-
- if (position<Elements.size()-1)
- {
- position++;
- return getCurrentItem();
- }
- return null;
- }
-
- public DataItem getPreviousItem()
- {
- if (position>0)
- {
- position--;
- return getCurrentItem();
- }
- return null;
- }
- public DataItem getCurrentItem()
- {
- if(Elements.size()>position)
- return (DataItem)Elements.elementAt(position);
- else return null;
- }
- public void reset()
- {
- position=0;
- }
- }