001 /* ===========================================================
002 * JFreeChart : a free chart library for the Java(tm) platform
003 * ===========================================================
004 *
005 * (C) Copyright 2000-2007, by Object Refinery Limited and Contributors.
006 *
007 * Project Info: http://www.jfree.org/jfreechart/index.html
008 *
009 * This library is free software; you can redistribute it and/or modify it
010 * under the terms of the GNU Lesser General Public License as published by
011 * the Free Software Foundation; either version 2.1 of the License, or
012 * (at your option) any later version.
013 *
014 * This library is distributed in the hope that it will be useful, but
015 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
016 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
017 * License for more details.
018 *
019 * You should have received a copy of the GNU Lesser General Public
020 * License along with this library; if not, write to the Free Software
021 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
022 * USA.
023 *
024 * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
025 * in the United States and other countries.]
026 *
027 * -----------------------
028 * ChartProgressEvent.java
029 * -----------------------
030 * (C) Copyright 2003-2007, by Object Refinery Limited.
031 *
032 * Original Author: David Gilbert (for Object Refinery Limited);
033 * Contributor(s): -;
034 *
035 * Changes
036 * -------
037 * 14-Jan-2003 : Version 1 (DG);
038 *
039 */
040
041 package org.jfree.chart.event;
042
043 import org.jfree.chart.JFreeChart;
044
045 /**
046 * An event that contains information about the drawing progress of a chart.
047 */
048 public class ChartProgressEvent extends java.util.EventObject {
049
050 /** Indicates drawing has started. */
051 public static final int DRAWING_STARTED = 1;
052
053 /** Indicates drawing has finished. */
054 public static final int DRAWING_FINISHED = 2;
055
056 /** The type of event. */
057 private int type;
058
059 /** The percentage of completion. */
060 private int percent;
061
062 /** The chart that generated the event. */
063 private JFreeChart chart;
064
065 /**
066 * Creates a new chart change event.
067 *
068 * @param source the source of the event (could be the chart, a title, an
069 * axis etc.)
070 * @param chart the chart that generated the event.
071 * @param type the type of event.
072 * @param percent the percentage of completion.
073 */
074 public ChartProgressEvent(Object source, JFreeChart chart, int type,
075 int percent) {
076 super(source);
077 this.chart = chart;
078 this.type = type;
079 }
080
081 /**
082 * Returns the chart that generated the change event.
083 *
084 * @return The chart that generated the change event.
085 */
086 public JFreeChart getChart() {
087 return this.chart;
088 }
089
090 /**
091 * Sets the chart that generated the change event.
092 *
093 * @param chart the chart that generated the event.
094 */
095 public void setChart(JFreeChart chart) {
096 this.chart = chart;
097 }
098
099 /**
100 * Returns the event type.
101 *
102 * @return The event type.
103 */
104 public int getType() {
105 return this.type;
106 }
107
108 /**
109 * Sets the event type.
110 *
111 * @param type the event type.
112 */
113 public void setType(int type) {
114 this.type = type;
115 }
116
117 /**
118 * Returns the percentage complete.
119 *
120 * @return The percentage complete.
121 */
122 public int getPercent() {
123 return this.percent;
124 }
125
126 /**
127 * Sets the percentage complete.
128 *
129 * @param percent the percentage.
130 */
131 public void setPercent(int percent) {
132 this.percent = percent;
133 }
134
135 }