KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejen > EjenEvent


1 //
2
// Ejen (code generation system)
3
// Copyright (C) 2001, 2002 François Wolff (ejen@noos.fr).
4
//
5
// This file is part of Ejen.
6
//
7
// Ejen is free software; you can redistribute it and/or modify
8
// it under the terms of the GNU General Public License as published by
9
// the Free Software Foundation; either version 2 of the License, or
10
// (at your option) any later version.
11
//
12
// Ejen is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
// GNU General Public License for more details.
16
//
17
// You should have received a copy of the GNU General Public License
18
// along with Ejen; if not, write to the Free Software
19
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
//
21
package org.ejen;
22
23 import java.util.EventObject JavaDoc;
24
25 /**
26  * Ejen event class.
27  * @author F. Wolff
28  * @version 1.0
29  * @see org.ejen.EjenListener
30  */

31 public class EjenEvent extends EventObject JavaDoc implements EjenConstants {
32     protected String JavaDoc _msg = null;
33     protected int _level = MSG_DEBUG;
34
35     /**
36      * Constructs a new EjenEvent object (with message set to null
37      * and level set to {@link org.ejen.EjenConstants#MSG_DEBUG}).
38      * @param source the object on which the Event initially occurred
39      * (may not be null).
40      */

41     public EjenEvent(Object JavaDoc source) {
42         this(source, null, MSG_DEBUG);
43     }
44
45     /**
46      * Constructs a new EjenEvent object (with message set to null).
47      * @param source the object on which the Event initially occurred
48      * (may not be null).
49      * @param level level of this EjenEvent (see {@link org.ejen.EjenConstants})
50      */

51     public EjenEvent(Object JavaDoc source, int level) {
52         this(source, null, level);
53     }
54
55     /**
56      * Constructs a new EjenEvent object (with level set to
57      * {@link org.ejen.EjenConstants#MSG_INFO}).
58      * @param source the object on which the Event initially occurred
59      * (may not be null).
60      * @param msg message associated to this EjenEvent.
61      */

62     public EjenEvent(Object JavaDoc source, String JavaDoc msg) {
63         this(source, msg, MSG_INFO);
64     }
65
66     /**
67      * Constructs a new EjenEvent object.
68      * @param source the object on which the Event initially occurred
69      * (may not be null).
70      * @param msg message associated to this EjenEvent.
71      * @param level level of this EjenEvent (see {@link org.ejen.EjenConstants})
72      */

73     public EjenEvent(Object JavaDoc source, String JavaDoc msg, int level) {
74         super(source);
75         _msg = msg;
76         _level = level;
77     }
78     
79     /**
80      * Returns this EjenEvent message.
81      * @return the message (may be null).
82      */

83     public String JavaDoc getMessage() {
84         return _msg;
85     }
86     
87     /**
88      * Returns this EjenEvent level.
89      * @return the level.
90      */

91     public int getLevel() {
92         return _level;
93     }
94     
95     /**
96      * Returns this EjenEvent message.
97      * @return the message (may be null).
98      */

99     public String JavaDoc toString() {
100         return _msg;
101     }
102 }
103
Popular Tags