    001    /* ===========================================================
    002     * JFreeChart : a free chart library for the Java(tm) platform
    003     * ===========================================================
    004     *
    005     * (C) Copyright 2000-2005, 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, 2004, by Object Refinery Limited.
    031     *
    032     * Original Author:  David Gilbert (for Object Refinery Limited);
    033     * Contributor(s):   -;
    034     *
    035     * $Id: ChartProgressEvent.java,v 1.3.2.1 2005/10/25 20:42:25 mungady Exp $
    036     *
    037     * Changes
    038     * -------
    039     * 14-Jan-2003 : Version 1 (DG);
    040     *
    041     */
    042
    043    package org.jfree.chart.event;
    044
    045    import org.jfree.chart.JFreeChart;
    046
    047    /**
    048     * An event that contains information about the drawing progress of a chart.
    049     *
    050     */
    051    public class ChartProgressEvent extends java.util.EventObject {
    052
    053        /** Indicates drawing has started. */
    054        public static final int DRAWING_STARTED = 1;
    055
    056        /** Indicates drawing has finished. */
    057        public static final int DRAWING_FINISHED = 2;
    058
    059        /** The type of event. */
    060        private int type;
    061
    062        /** The percentage of completion. */
    063        private int percent;
    064
    065        /** The chart that generated the event. */
    066        private JFreeChart chart;
    067
    068        /**
    069         * Creates a new chart change event.
    070         *
    071         * @param source  the source of the event (could be the chart, a title, an
    072         *                axis etc.)
    073         * @param chart  the chart that generated the event.
    074         * @param type  the type of event.
    075         * @param percent  the percentage of completion.
    076         */
    077        public ChartProgressEvent(Object source, JFreeChart chart, int type,
    078                                  int percent) {
    079            super(source);
    080            this.chart = chart;
    081            this.type = type;
    082        }
    083
    084        /**
    085         * Returns the chart that generated the change event.
    086         *
    087         * @return The chart that generated the change event.
    088         */
    089        public JFreeChart getChart() {
    090            return this.chart;
    091        }
    092
    093        /**
    094         * Sets the chart that generated the change event.
    095         *
    096         * @param chart  the chart that generated the event.
    097         */
    098        public void setChart(JFreeChart chart) {
    099            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    }