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 / DataItemChangedEvent.java < prev    next >
Encoding:
Java Source  |  1998-03-18  |  1.7 KB  |  53 lines

  1. /*
  2.  * @(#DataItemChangedEvent.java
  3.  *
  4.  * Copyright (c) 1997 Symantec Corporation. All Rights Reserved.
  5.  *
  6.  */
  7.  
  8. //A DataItem sends one of these events to all DataItemChangedListeners that have registered on its
  9. //addDataItemChangedListener method, whenever its data is modified. The DataItemChangedEvent includes two fields:
  10.  
  11. //    - source -- the DataItem whose data changed
  12.  
  13. //    - changeType -- an indication of the type of modification, including value change, or size change (e.g. array size). The
  14. //    allowed values are:
  15.  
  16. //          DATA_SIZE_CHANGE
  17. //         Indicates that the size of a DataItem has changed, for example, that an ArrayAccess now has more or less data
  18.  
  19. //          DATA_VALUE_CHANGE
  20. //          Indicates that data has changed in value but that the navigational structure remained constant.
  21.  
  22. //          DATA_DELETED
  23. //          Indicates that the source DataItem is being deleted by its producer.
  24.  
  25. package symantec.itools.db.beans.binding.databus;
  26.  
  27.  
  28. public  class DataItemChangedEvent extends java.util.EventObject
  29. {
  30.     public static final int DATA_SIZE_CHANGE=0;
  31.     public static final int DATA_VALUE_CHANGE=1;
  32.     public static final int DATA_DELETED=2;
  33.  
  34.     int cT;
  35.  
  36.     //Constructs a DataItemChangedEvent of a given change type.
  37.     public  DataItemChangedEvent(int changeType, Object source) throws InvalidType
  38.     {
  39.         super(source);
  40.         if ((changeType < DATA_SIZE_CHANGE) || ( changeType > DATA_DELETED))
  41.             throw new InvalidType();
  42.          else
  43.             cT=changeType;
  44.     }
  45.  
  46.  
  47.  
  48.    //Returns the type of change that caused this event.
  49.     public  int getChangeType()
  50.     {
  51.         return cT;
  52.     }
  53. }