Source for org.jfree.chart.event.ChartProgressEvent

   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
  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:  * ChartProgressEvent.java
  29:  * -----------------------
  30:  * (C) Copyright 2003, 2004, by Object Refinery Limited.
  31:  *
  32:  * Original Author:  David Gilbert (for Object Refinery Limited);
  33:  * Contributor(s):   -;
  34:  *
  35:  * $Id: ChartProgressEvent.java,v 1.3.2.1 2005/10/25 20:42:25 mungady Exp $
  36:  *
  37:  * Changes
  38:  * -------
  39:  * 14-Jan-2003 : Version 1 (DG);
  40:  *
  41:  */
  42: 
  43: package org.jfree.chart.event;
  44: 
  45: import org.jfree.chart.JFreeChart;
  46: 
  47: /**
  48:  * An event that contains information about the drawing progress of a chart.
  49:  *
  50:  */
  51: public class ChartProgressEvent extends java.util.EventObject {
  52: 
  53:     /** Indicates drawing has started. */
  54:     public static final int DRAWING_STARTED = 1;
  55: 
  56:     /** Indicates drawing has finished. */
  57:     public static final int DRAWING_FINISHED = 2;
  58: 
  59:     /** The type of event. */
  60:     private int type;
  61: 
  62:     /** The percentage of completion. */
  63:     private int percent;
  64: 
  65:     /** The chart that generated the event. */
  66:     private JFreeChart chart;
  67: 
  68:     /**
  69:      * Creates a new chart change event.
  70:      *
  71:      * @param source  the source of the event (could be the chart, a title, an 
  72:      *                axis etc.)
  73:      * @param chart  the chart that generated the event.
  74:      * @param type  the type of event.
  75:      * @param percent  the percentage of completion.
  76:      */
  77:     public ChartProgressEvent(Object source, JFreeChart chart, int type, 
  78:                               int percent) {
  79:         super(source);
  80:         this.chart = chart;
  81:         this.type = type;
  82:     }
  83: 
  84:     /**
  85:      * Returns the chart that generated the change event.
  86:      *
  87:      * @return The chart that generated the change event.
  88:      */
  89:     public JFreeChart getChart() {
  90:         return this.chart;
  91:     }
  92: 
  93:     /**
  94:      * Sets the chart that generated the change event.
  95:      *
  96:      * @param chart  the chart that generated the event.
  97:      */
  98:     public void setChart(JFreeChart chart) {
  99:         this.chart = chart;
 100:     }
 101: 
 102:     /**
 103:      * Returns the event type.
 104:      *
 105:      * @return The event type.
 106:      */
 107:     public int getType() {
 108:         return this.type;
 109:     }
 110: 
 111:     /**
 112:      * Sets the event type.
 113:      *
 114:      * @param type  the event type.
 115:      */
 116:     public void setType(int type) {
 117:         this.type = type;
 118:     }
 119: 
 120:     /**
 121:      * Returns the percentage complete.
 122:      *
 123:      * @return The percentage complete.
 124:      */
 125:     public int getPercent() {
 126:         return this.percent;
 127:     }
 128: 
 129:     /**
 130:      * Sets the percentage complete.
 131:      *
 132:      * @param percent  the percentage.
 133:      */
 134:     public void setPercent(int percent) {
 135:         this.percent = percent;
 136:     }
 137: 
 138: }