View Javadoc

1   /*
2    * $Id: LibraryChangeEvent.java,v 1.3 2005/05/31 16:04:12 jlerner Exp $
3    *
4    * Copyright (c) 1999-2004, BBN Technologies, LLC.
5    * All rights reserved.
6    * http://www.daml.org/legal/opensource/bbn_license.html
7    */
8    
9   package com.bbn.swede.core.libraries;
10  
11  /***
12   * An event that represents a change with a library.
13   * 
14   * @author aperezlo
15   */
16  public class LibraryChangeEvent
17  {
18     /***
19      * Event type constant indicating that the contents of a library changed.
20      */
21     public static final int CHANGED = 1;
22     /***
23      * Event type constant indicating that a library was deleted.
24      */
25     public static final int DELETED = 2;
26     /***
27      * Event type constant indicating that a library was renamed.
28      */
29     public static final int RENAMED = 4;
30     /***
31      * Event type constant indicating that a library was refreshed.
32      */
33     public static final int REFRESHED = 8;
34     /***
35      * Event type constant indicating that a library was opened.
36      */
37     public static final int OPENED = 16;
38     /***
39      * Event type constant indicating that a library was closed.
40      */
41     public static final int CLOSED = 32;
42     
43     private ILibraryDescriptor _source;
44     private int _type;
45     
46     /***
47      * Creates a library change event.
48      * @param source the library that changed
49      * @param type the type of event that occurred.  Must be one of the change
50      *        constants <code>CHANGED</code>, <code>DELETED</code>, 
51      *        <code>RENAMED</code>, <code>REFRESHED</code>, <code>OPENED</code>,
52      *        or <code>CLOSED</code>.
53      */
54     public LibraryChangeEvent(ILibraryDescriptor source, int type)
55     {
56        _source = source;
57        _type = type;
58     }
59     
60     /***
61      * Retrieves the library the caused the event.
62      * @return the library
63      */
64     public ILibraryDescriptor getLibrary()
65     {
66        return _source;
67     }
68     /***
69      * Retrieves the type of the event.  This will be one of the change
70      *        constants <code>CHANGED</code>, <code>DELETED</code>, 
71      *        <code>RENAMED</code>, <code>REFRESHED</code>, <code>OPENED</code>,
72      *        or <code>CLOSED</code>.
73      * @return the type of the event
74      */
75     public int getType()
76     {
77        return _type;
78     }
79     
80  }