001/* =========================================================== 002 * JFreeChart : a free chart library for the Java(tm) platform 003 * =========================================================== 004 * 005 * (C) Copyright 2000-present, by David Gilbert 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 * [Oracle and Java are registered trademarks of Oracle and/or its affiliates. 025 * Other names may be trademarks of their respective owners.] 026 * 027 * ----------------------- 028 * ChartProgressEvent.java 029 * ----------------------- 030 * (C) Copyright 2003-present, by David Gilbert. 031 * 032 * Original Author: David Gilbert; 033 * Contributor(s): -; 034 * 035 */ 036 037package org.jfree.chart.event; 038 039import org.jfree.chart.JFreeChart; 040 041/** 042 * An event that contains information about the drawing progress of a chart. 043 */ 044public class ChartProgressEvent extends java.util.EventObject { 045 046 /** Indicates drawing has started. */ 047 public static final int DRAWING_STARTED = 1; 048 049 /** Indicates drawing has finished. */ 050 public static final int DRAWING_FINISHED = 2; 051 052 /** The type of event. */ 053 private int type; 054 055 /** The percentage of completion. */ 056 private int percent; 057 058 /** The chart that generated the event. */ 059 private JFreeChart chart; 060 061 /** 062 * Creates a new chart change event. 063 * 064 * @param source the source of the event (could be the chart, a title, an 065 * axis etc.) 066 * @param chart the chart that generated the event. 067 * @param type the type of event. 068 * @param percent the percentage of completion. 069 */ 070 public ChartProgressEvent(Object source, JFreeChart chart, int type, 071 int percent) { 072 super(source); 073 this.chart = chart; 074 this.type = type; 075 this.percent = percent; 076 } 077 078 /** 079 * Returns the chart that generated the change event. 080 * 081 * @return The chart that generated the change event. 082 */ 083 public JFreeChart getChart() { 084 return this.chart; 085 } 086 087 /** 088 * Sets the chart that generated the change event. 089 * 090 * @param chart the chart that generated the event. 091 */ 092 public void setChart(JFreeChart chart) { 093 this.chart = chart; 094 } 095 096 /** 097 * Returns the event type. 098 * 099 * @return The event type. 100 */ 101 public int getType() { 102 return this.type; 103 } 104 105 /** 106 * Sets the event type. 107 * 108 * @param type the event type. 109 */ 110 public void setType(int type) { 111 this.type = type; 112 } 113 114 /** 115 * Returns the percentage complete. 116 * 117 * @return The percentage complete. 118 */ 119 public int getPercent() { 120 return this.percent; 121 } 122 123 /** 124 * Sets the percentage complete. 125 * 126 * @param percent the percentage. 127 */ 128 public void setPercent(int percent) { 129 this.percent = percent; 130 } 131 132}