KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jcckit > plot > PlotEvent


1 /*
2  * Copyright 2003-2004, Franz-Josef Elmer, All rights reserved
3  *
4  * This library is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as published by
6  * the Free Software Foundation; either version 2.1 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details
13  * (http://www.gnu.org/copyleft/lesser.html).
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19 package jcckit.plot;
20
21 /**
22  * A plot event signales some changes of a {@link Plot}.
23  * It has three attributes:
24  * <ul><li><b>source</b>: Indicates the <tt>Plot</tt> instance responsible
25  * for this event.
26  * <li><b>type</b>: The type of event.
27  * <li><b>message</b>: The message object. Its meaning depends on the
28  * type of event:
29  * <table border=1 cellpadding=5>
30  * <tr><th>Type</th><th>Meaning of the message object</th></tr>
31  * <tr><td>{@link PlotEventType#DATA_PLOT_CONNECTED},
32  * {@link PlotEventType#DATA_PLOT_DISCONNECTED}</td>
33  * <td>The {@link jcckit.data.DataPlot} (dis)connected with the
34  * {@link Plot} instance specified by the source.</td>
35  * <tr><td>{@link PlotEventType#DATA_PLOT_CHANGED}</td>
36  * <td>An <tt>Integer</tt> indicating the lowest index of
37  * those curves which have been changed.</td>
38  * <tr><td>{@link PlotEventType#DATA_CURVE_CHANGED}</td>
39  * <td>An <tt>Integer</tt> indicating the index of the curve
40  * which has been changed.</td>
41  * </table>
42  * </ul>
43  *
44  *
45  * @author Franz-Josef Elmer
46  */

47 public class PlotEvent {
48   private final Plot _source;
49   private final PlotEventType _type;
50   private final Object JavaDoc _message;
51
52   /**
53    * Creates a new event for the specified source, type, and message.
54    * @param source Plot causing this event.
55    * @param type Type of the event. Possible values are
56    * {@link PlotEventType#DATA_PLOT_CHANGED},
57    * {@link PlotEventType#DATA_CURVE_CHANGED},
58    * {@link PlotEventType#DATA_PLOT_CONNECTED}, and
59    * {@link PlotEventType#DATA_PLOT_DISCONNECTED}.
60    * @param message Message object. Can be <tt>null</tt>
61    */

62   public PlotEvent(Plot source, PlotEventType type, Object JavaDoc message) {
63     _source = source;
64     _type = type;
65     _message = message;
66   }
67
68   /** Returns the source of this event. */
69   public Plot getSource() {
70     return _source;
71   }
72
73   /**
74    * Returns the event type.
75    * @return either {@link PlotEventType#DATA_PLOT_CHANGED},
76    * {@link PlotEventType#DATA_CURVE_CHANGED},
77    * {@link PlotEventType#DATA_PLOT_CONNECTED}, or
78    * {@link PlotEventType#DATA_PLOT_DISCONNECTED}.
79    */

80   public PlotEventType getType() {
81     return _type;
82   }
83
84   /** Returns the message object. */
85   public Object JavaDoc getMessage() {
86     return _message;
87   }
88 }
89
Popular Tags