001/* ======================================================
002 * Orson : a free chart beans library based on JFreeChart
003 * ======================================================
004 *
005 * (C) Copyright 2007, by Object Refinery Limited.
006 *
007 * Project Info:  not-yet-released
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
028package org.jfree.beans.events;
029
030import java.util.EventObject;
031
032import org.jfree.data.general.Dataset;
033
034/**
035 * An event object that carries information about a mouse click on a series
036 * in a legend.
037 */
038public class LegendClickEvent extends EventObject {
039    
040    /** A reference to the source dataset. */
041    private Dataset dataset;
042    
043    /** The series key. */
044    private Comparable key;
045    
046    /**
047     * Creates a new legend click event.
048     * 
049     * @param source  the event source.
050     * @param dataset  the dataset.
051     * @param key  the series key.
052     */
053    public LegendClickEvent(Object source, Dataset dataset, Comparable key) {
054        super(source);
055        this.dataset = dataset;
056        this.key = key;
057    }
058    
059    /**
060     * Returns the dataset.
061     * 
062     * @return The dataset.
063     */
064    public Dataset getDataset() {
065        return this.dataset;
066    }
067    
068    /**
069     * Returns the series key.
070     * 
071     * @return The series key.
072     */
073    public Comparable getSeriesKey() {
074        return this.key;
075    }
076    
077    /**
078     * Returns a string that represents the state of this instance (suitable
079     * for debugging purposes).
080     * 
081     * @return A string.
082     */
083    public String toString() {
084        return "LegendClickEvent: seriesKey=" + this.key 
085                + ", dataset=" + this.dataset;
086    }
087
088}