Frames | No Frames |
1: /* =========================================================== 2: * JFreeChart : a free chart library for the Java(tm) platform 3: * =========================================================== 4: * 5: * (C) Copyright 2000-2007, 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 20: * License along with this library; if not, write to the Free Software 21: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 22: * USA. 23: * 24: * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 25: * in the United States and other countries.] 26: * 27: * --------------------- 28: * ChartChangeEvent.java 29: * --------------------- 30: * (C) Copyright 2000-2007, by Object Refinery Limited. 31: * 32: * Original Author: David Gilbert (for Object Refinery Limited); 33: * Contributor(s): -; 34: * 35: * Changes (from 24-Aug-2001) 36: * -------------------------- 37: * 24-Aug-2001 : Added standard source header. Fixed DOS encoding problem (DG); 38: * 07-Nov-2001 : Updated header (DG); 39: * Change event type names (DG); 40: * 09-Oct-2002 : Fixed errors reported by Checkstyle (DG); 41: * 18-Feb-2005 : Changed the type from int to ChartChangeEventType (DG); 42: * 43: */ 44: 45: package org.jfree.chart.event; 46: 47: import java.util.EventObject; 48: 49: import org.jfree.chart.JFreeChart; 50: 51: /** 52: * A change event that encapsulates information about a change to a chart. 53: */ 54: public class ChartChangeEvent extends EventObject { 55: 56: /** The type of event. */ 57: private ChartChangeEventType type; 58: 59: /** The chart that generated the event. */ 60: private JFreeChart chart; 61: 62: /** 63: * Creates a new chart change event. 64: * 65: * @param source the source of the event (could be the chart, a title, 66: * an axis etc.) 67: */ 68: public ChartChangeEvent(Object source) { 69: this(source, null, ChartChangeEventType.GENERAL); 70: } 71: 72: /** 73: * Creates a new chart change event. 74: * 75: * @param source the source of the event (could be the chart, a title, an 76: * axis etc.) 77: * @param chart the chart that generated the event. 78: */ 79: public ChartChangeEvent(Object source, JFreeChart chart) { 80: this(source, chart, ChartChangeEventType.GENERAL); 81: } 82: 83: /** 84: * Creates a new chart change event. 85: * 86: * @param source the source of the event (could be the chart, a title, an 87: axis etc.) 88: * @param chart the chart that generated the event. 89: * @param type the type of event. 90: */ 91: public ChartChangeEvent(Object source, JFreeChart chart, 92: ChartChangeEventType type) { 93: super(source); 94: this.chart = chart; 95: this.type = type; 96: } 97: 98: /** 99: * Returns the chart that generated the change event. 100: * 101: * @return The chart that generated the change event. 102: */ 103: public JFreeChart getChart() { 104: return this.chart; 105: } 106: 107: /** 108: * Sets the chart that generated the change event. 109: * 110: * @param chart the chart that generated the event. 111: */ 112: public void setChart(JFreeChart chart) { 113: this.chart = chart; 114: } 115: 116: /** 117: * Returns the event type. 118: * 119: * @return The event type. 120: */ 121: public ChartChangeEventType getType() { 122: return this.type; 123: } 124: 125: /** 126: * Sets the event type. 127: * 128: * @param type the event type. 129: */ 130: public void setType(ChartChangeEventType type) { 131: this.type = type; 132: } 133: 134: }