View Javadoc

1   /* (c) Copyright 2003 Caleigo AB, All rights reserved. 
2    * 
3    * This library is free software; you can redistribute it and/or
4    * modify it under the terms of the GNU Lesser General Public
5    * License as published by the Free Software Foundation; either
6    * version 2.1 of the License, or (at your option) any later version.
7    * 
8    * This library is distributed in the hope that it will be useful,
9    * but WITHOUT ANY WARRANTY; without even the implied warranty of
10   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11   * Lesser General Public License for more details.
12   * 
13   * You should have received a copy of the GNU Lesser General Public
14   * License along with this library; if not, write to the Free Software
15   * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16   *  
17   */
18  
19  package org.caleigo.core.event;
20  
21  import org.caleigo.core.*;
22  
23  /*** Event for relaying changes of the structure or value content in Qualifier
24   * objects. This is equal to changes in what entities that the qualifier 
25   * addresses.
26   *
27   * @author  Dennis Zikovic
28   * @version 1.00
29   *
30   *//* 
31   *
32   * WHEN        WHO               WHY & WHAT
33   * -----------------------------------------------------------------------------
34   * 2001-10-23  Dennis Zikovic    Creation
35   */
36  public class QualifierEvent extends java.util.EventObject  
37  {
38      // Constants ---------------------------------------------------------------
39      public static final int STRUCTURE_CHANGED = 1;
40      public static final int CONTENT_CHANGED = 2;
41      
42      // Data members ------------------------------------------------------------
43      private int mEventType;
44      
45      // Constructors ------------------------------------------------------------
46      
47      /*** Creates new EntityCollectionEvent
48       */
49      public QualifierEvent(Qualifier sourceQualifier, int eventType) 
50      {
51          super(sourceQualifier);
52          mEventType = eventType;
53      }
54      
55      // Superclass overrides ----------------------------------------------------
56      public String toString()
57      {
58          String params = null;
59          switch(mEventType) 
60          {
61              case STRUCTURE_CHANGED: 
62                  params = "STRUCTURE_CHANGED"; 
63                  break;
64              case CONTENT_CHANGED: 
65                  params = "CONTENT_CHANGED"; 
66                  break;
67              default: 
68                  params = "UNKNOWN_TYPE"; 
69                  break;
70          }
71  	return getClass().getName()+"["+params+"] on Qualifier("+source.toString()+")";
72      }    
73      
74      // Access methods ----------------------------------------------------------
75      public Qualifier getSourceQualifier()
76      {
77          return (Qualifier)this.getSource();
78      }    
79      
80      public int getEventType()
81      {
82          return mEventType;
83      }    
84  }