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-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:  * ChartProgressEvent.java
  29:  * -----------------------
  30:  * (C) Copyright 2003-2007, by Object Refinery Limited.
  31:  *
  32:  * Original Author:  David Gilbert (for Object Refinery Limited);
  33:  * Contributor(s):   -;
  34:  *
  35:  * Changes
  36:  * -------
  37:  * 14-Jan-2003 : Version 1 (DG);
  38:  *
  39:  */
  40: 
  41: package org.jfree.chart.event;
  42: 
  43: import org.jfree.chart.JFreeChart;
  44: 
  45: /**
  46:  * An event that contains information about the drawing progress of a chart.
  47:  */
  48: public class ChartProgressEvent extends java.util.EventObject {
  49: 
  50:     /** Indicates drawing has started. */
  51:     public static final int DRAWING_STARTED = 1;
  52: 
  53:     /** Indicates drawing has finished. */
  54:     public static final int DRAWING_FINISHED = 2;
  55: 
  56:     /** The type of event. */
  57:     private int type;
  58: 
  59:     /** The percentage of completion. */
  60:     private int percent;
  61: 
  62:     /** The chart that generated the event. */
  63:     private JFreeChart chart;
  64: 
  65:     /**
  66:      * Creates a new chart change event.
  67:      *
  68:      * @param source  the source of the event (could be the chart, a title, an 
  69:      *                axis etc.)
  70:      * @param chart  the chart that generated the event.
  71:      * @param type  the type of event.
  72:      * @param percent  the percentage of completion.
  73:      */
  74:     public ChartProgressEvent(Object source, JFreeChart chart, int type, 
  75:                               int percent) {
  76:         super(source);
  77:         this.chart = chart;
  78:         this.type = type;
  79:     }
  80: 
  81:     /**
  82:      * Returns the chart that generated the change event.
  83:      *
  84:      * @return The chart that generated the change event.
  85:      */
  86:     public JFreeChart getChart() {
  87:         return this.chart;
  88:     }
  89: 
  90:     /**
  91:      * Sets the chart that generated the change event.
  92:      *
  93:      * @param chart  the chart that generated the event.
  94:      */
  95:     public void setChart(JFreeChart chart) {
  96:         this.chart = chart;
  97:     }
  98: 
  99:     /**
 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: }