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 / DbaDataLink.java < prev    next >
Encoding:
Java Source  |  1998-03-18  |  2.3 KB  |  83 lines

  1. /*
  2.  * DbaDataLink.java   1.0   12 Jan 1997
  3.  *
  4.  * Copyright (c) 1996 Krumel & Associates, Inc.  All Rights Reserved.
  5.  *
  6.  * This software is provided as is.  Krumel & Associates shall not be liable
  7.  * for any damages suffered by licensee as a result of using, modifying or
  8.  * distributing this software or its derivatives.
  9.  */
  10.  
  11. package symantec.itools.db.awt;
  12.  
  13. import symantec.itools.db.pro.*;
  14. import java.sql.SQLException ;
  15.  
  16. /**
  17.  * This helper class implements interfaces RecordLink and RecordSetLink.
  18.  * It is used by the DbaDataStore class to maintain a link to the current
  19.  * database record.
  20.  *
  21.  * @see symantec.itools.db.pro.RecordLink
  22.  * @see symantec.itools.db.pro.RecordSetLink
  23.  */
  24. class DbaDataLink implements RecordSetLink, RecordLink
  25. {
  26.     DbaDataStore    store;
  27.     int             recordNumber;
  28.     RelationView    rv;
  29.  
  30.     /**
  31.      * Constructs a DbaDataLink for the given DbaDataStore.
  32.      *
  33.      * @param s the data store using this object
  34.      */
  35.     public DbaDataLink(DbaDataStore s)
  36.     {
  37.         store = s;
  38.     }
  39.  
  40.     /**
  41.      * Called when this object is bound to a RelationView.
  42.      * <p>
  43.      * This is a method in the RecordLink and RecordSetLink interfaces.
  44.      *
  45.      * @see symantec.itools.db.pro.RecordLink#init
  46.      * @see symantec.itools.db.pro.RecordSetLink#init
  47.      */
  48.     public void init()
  49.     {
  50.         recordNumber = -1;
  51.     }
  52.  
  53.     /**
  54.      * This method is called when a RelationView's RecordSet is changed.
  55.      * <p>
  56.      * This is a method in the RecordSetLink interface.
  57.      *
  58.      * @param rv used to access the RelationView bound to this object
  59.      *
  60.      * @see symantec.itools.db.pro.RecordSetLink#notifyRecordSetChange
  61.      */
  62.     public void notifyRecordSetChange(RelationView rv) throws SQLException
  63.     {
  64.         store.resetRows();
  65.     }
  66.  
  67.     /**
  68.      * This method is called when the current Record in the RelationView is changed.
  69.      * <p>
  70.      * This is a method in the RecordLink interface.
  71.      *
  72.      * @param currentRec used to access the current record bound to this object
  73.      *
  74.      * @see symantec.itools.db.pro.RecordLink#notifyRecordChange
  75.      */
  76.     public void notifyRecordChange (Record currentRec) throws SQLException
  77.     {
  78.         if (currentRec != null)
  79.         {
  80.             store.notifyRecordChange();
  81.         }
  82.     }
  83. }