KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > houston > Status


1 /*
2 ** Houston - Status and Logging Toolkit
3 ** Copyright (c) 2001, 2002, 2003 by Gerald Bauer
4 **
5 ** This program is free software.
6 **
7 ** You may redistribute it and/or modify it under the terms of the GNU
8 ** Lesser General Public License as published by the Free Software Foundation.
9 ** Version 2.1 of the license should be included with this distribution in
10 ** the file LICENSE, as well as License.html. If the license is not
11 ** included with this distribution, you may find a copy at the FSF web
12 ** site at 'www.gnu.org' or 'www.fsf.org', or you may write to the
13 ** Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139 USA.
14 **
15 ** THIS SOFTWARE IS PROVIDED AS-IS WITHOUT WARRANTY OF ANY KIND,
16 ** NOT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY. THE AUTHOR
17 ** OF THIS SOFTWARE, ASSUMES _NO_ RESPONSIBILITY FOR ANY
18 ** CONSEQUENCE RESULTING FROM THE USE, MODIFICATION, OR
19 ** REDISTRIBUTION OF THIS SOFTWARE.
20 **
21 */

22
23 package houston;
24
25 import javax.swing.event.*;
26
27 public class Status
28 {
29    private static EventListenerList _listener = new EventListenerList();
30
31    public static int getNumOfErrors()
32    {
33       return 0;
34    }
35
36    public static void addListener( StatusListener l )
37    {
38       _listener.add( StatusListener.class, l );
39    }
40
41    public static void beginTracking() { }
42
43    public static void error( String JavaDoc msg )
44    {
45       StatusListener l[] = ( StatusListener[] ) _listener.getListeners( StatusListener.class );
46       for( int i = 0; i < l.length; i++ )
47          l[i].error( msg );
48    }
49
50    public static void fatal( String JavaDoc msg )
51    {
52       StatusListener l[] = ( StatusListener[] ) _listener.getListeners( StatusListener.class );
53       for( int i = 0; i < l.length; i++ )
54          l[i].fatal( msg );
55    }
56
57    public static void hint( String JavaDoc msg )
58    {
59       StatusListener l[] = ( StatusListener[] ) _listener.getListeners( StatusListener.class );
60       for( int i = 0; i < l.length; i++ )
61          l[i].hint( msg );
62    }
63
64    public static void info( int level, String JavaDoc msg )
65    {
66       StatusListener l[] = ( StatusListener[] ) _listener.getListeners( StatusListener.class );
67       for( int i = 0; i < l.length; i++ )
68          l[i].info( level, msg );
69    }
70
71    public static void info( String JavaDoc msg )
72    {
73       StatusListener l[] = ( StatusListener[] ) _listener.getListeners( StatusListener.class );
74       for( int i = 0; i < l.length; i++ )
75          l[i].info( msg );
76    }
77
78    public static void removeListener( StatusListener l )
79    {
80       _listener.remove( StatusListener.class, l );
81    }
82
83    public static void warning( String JavaDoc msg )
84    {
85       StatusListener l[] = ( StatusListener[] ) _listener.getListeners( StatusListener.class );
86       for( int i = 0; i < l.length; i++ )
87          l[i].warning( msg );
88    }
89 }
90
Popular Tags