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.beans.AbstractCategoryChart;
033import org.jfree.data.category.CategoryDataset;
034
035/**
036 * An event object that carries information about a mouse click on an item 
037 * in an {@link AbstractCategoryChart}.
038 */
039public class CategoryItemClickEvent extends EventObject {
040    
041    /** The dataset. */
042    private CategoryDataset dataset;
043    
044    /** The row key. */
045    private Comparable rowKey;
046    
047    /** The column key. */
048    private Comparable columnKey;
049    
050    /**
051     * Creates a new section click event.
052     * 
053     * @param source  the event source (typically the chart).
054     * @param dataset  the dataset.
055     * @param rowKey  the row key.
056     * @param columnKey  the column key.
057     */
058    public CategoryItemClickEvent(Object source, CategoryDataset dataset,
059            Comparable rowKey, Comparable columnKey) {
060        super(source);
061        this.dataset = dataset;
062        this.rowKey = rowKey;
063        this.columnKey = columnKey;
064    }
065    
066    /**
067     * Returns the dataset.
068     * 
069     * @return The dataset.
070     */
071    public CategoryDataset getDataset() {
072        return this.dataset;
073    }
074    
075    /**
076     * Returns the row key.
077     * 
078     * @return The row key.
079     */
080    public Comparable getRowKey() {
081        return this.rowKey;
082    }
083    
084    /**
085     * Returns the column key.
086     * 
087     * @return The column key.
088     */
089    public Comparable getColumnKey() {
090        return this.columnKey;
091    }
092    
093    /**
094     * Returns a string that represents the state of this instance (suitable
095     * for debugging purposes).
096     * 
097     * @return A string.
098     */
099    public String toString() {
100        return "CategoryItemClickEvent: rowKey=" + this.rowKey + ", columnKey="
101                + this.columnKey + ", dataset=" + this.dataset;
102    }
103
104}