KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jfree > chart > event > ChartChangeEvent


1 /* ===========================================================
2  * JFreeChart : a free chart library for the Java(tm) platform
3  * ===========================================================
4  *
5  * (C) Copyright 2000-2005, by Object Refinery Limited and Contributors.
6  *
7  * Project Info: http://www.jfree.org/jfreechart/index.html
8  *
9  * This library is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published by
11  * the Free Software Foundation; either version 2.1 of the License, or
12  * (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
16  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
17  * License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public License
20  * along with this library; if not, write to the Free Software Foundation,
21  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
22  *
23  * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
24  * in the United States and other countries.]
25  *
26  * ---------------------
27  * ChartChangeEvent.java
28  * ---------------------
29  * (C) Copyright 2000-2005, by Object Refinery Limited.
30  *
31  * Original Author: David Gilbert (for Object Refinery Limited);
32  * Contributor(s): -;
33  *
34  * $Id: ChartChangeEvent.java,v 1.3 2005/02/18 17:30:47 mungady Exp $
35  *
36  * Changes (from 24-Aug-2001)
37  * --------------------------
38  * 24-Aug-2001 : Added standard source header. Fixed DOS encoding problem (DG);
39  * 07-Nov-2001 : Updated header (DG);
40  * Change event type names (DG);
41  * 09-Oct-2002 : Fixed errors reported by Checkstyle (DG);
42  * 18-Feb-2005 : Changed the type from int to ChartChangeEventType (DG);
43  *
44  */

45
46 package org.jfree.chart.event;
47
48 import java.util.EventObject JavaDoc;
49
50 import org.jfree.chart.JFreeChart;
51
52 /**
53  * A change event that encapsulates information about a change to a chart.
54  */

55 public class ChartChangeEvent extends EventObject JavaDoc {
56
57     /** The type of event. */
58     private ChartChangeEventType type;
59
60     /** The chart that generated the event. */
61     private JFreeChart chart;
62
63     /**
64      * Creates a new chart change event.
65      *
66      * @param source the source of the event (could be the chart, a title,
67      * an axis etc.)
68      */

69     public ChartChangeEvent(Object JavaDoc source) {
70         this(source, null, ChartChangeEventType.GENERAL);
71     }
72
73     /**
74      * Creates a new chart change event.
75      *
76      * @param source the source of the event (could be the chart, a title, an
77      * axis etc.)
78      * @param chart the chart that generated the event.
79      */

80     public ChartChangeEvent(Object JavaDoc source, JFreeChart chart) {
81         this(source, chart, ChartChangeEventType.GENERAL);
82     }
83
84     /**
85      * Creates a new chart change event.
86      *
87      * @param source the source of the event (could be the chart, a title, an
88                       axis etc.)
89      * @param chart the chart that generated the event.
90      * @param type the type of event.
91      */

92     public ChartChangeEvent(Object JavaDoc source, JFreeChart chart,
93                             ChartChangeEventType type) {
94         super(source);
95         this.chart = chart;
96         this.type = type;
97     }
98
99     /**
100      * Returns the chart that generated the change event.
101      *
102      * @return The chart that generated the change event.
103      */

104     public JFreeChart getChart() {
105         return this.chart;
106     }
107
108     /**
109      * Sets the chart that generated the change event.
110      *
111      * @param chart the chart that generated the event.
112      */

113     public void setChart(JFreeChart chart) {
114         this.chart = chart;
115     }
116
117     /**
118      * Returns the event type.
119      *
120      * @return The event type.
121      */

122     public ChartChangeEventType getType() {
123         return this.type;
124     }
125
126     /**
127      * Sets the event type.
128      *
129      * @param type the event type.
130      */

131     public void setType(ChartChangeEventType type) {
132         this.type = type;
133     }
134
135 }
136
Popular Tags