1. /* ===========================================================
  2. * JFreeChart : a free chart library for the Java(tm) platform
  3. * ===========================================================
  4. *
  5. * (C) Copyright 2000-2004, 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 under the terms
  10. * of the GNU Lesser General Public License as published by the Free Software Foundation;
  11. * either version 2.1 of the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
  14. * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. * See the GNU Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public License along with this
  18. * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  19. * Boston, MA 02111-1307, USA.
  20. *
  21. * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
  22. * in the United States and other countries.]
  23. *
  24. * -----------------------
  25. * DatasetChangeEvent.java
  26. * -----------------------
  27. * (C) Copyright 2000-2004, by Object Refinery Limited.
  28. *
  29. * Original Author: David Gilbert (for Object Refinery Limited);
  30. * Contributor(s): -;
  31. *
  32. * $Id: DatasetChangeEvent.java,v 1.2 2004/10/05 16:26:05 mungady Exp $
  33. *
  34. * Changes (from 24-Aug-2001)
  35. * --------------------------
  36. * 24-Aug-2001 : Added standard source header. Fixed DOS encoding problem (DG);
  37. * 15-Oct-2001 : Move to new package (com.jrefinery.data.*) (DG);
  38. * 22-Oct-2001 : Renamed DataSource.java --> Dataset.java etc. (DG);
  39. * 11-Jun-2002 : Separated the event source from the dataset to cover the case where the dataset
  40. * is changed to null in the Plot class. Updated Javadocs (DG);
  41. * 04-Oct-2002 : Fixed errors reported by Checkstyle (DG);
  42. * 05-Oct-2004 : Minor Javadoc updates (DG);
  43. *
  44. */
  45. package org.jfree.data.general;
  46. /**
  47. * A change event that encapsulates information about a change to a dataset.
  48. */
  49. public class DatasetChangeEvent extends java.util.EventObject {
  50. /**
  51. * The dataset that generated the change event.
  52. */
  53. private Dataset dataset;
  54. /**
  55. * Constructs a new event. The source is either the dataset or the
  56. * {@link org.jfree.chart.plot.Plot} class. The dataset can be
  57. * <code>null</code> (in this case the source will be the
  58. * {@link org.jfree.chart.plot.Plot} class).
  59. *
  60. * @param source the source of the event.
  61. * @param dataset the dataset that generated the event (<code>null</code>
  62. * permitted).
  63. */
  64. public DatasetChangeEvent(Object source, Dataset dataset) {
  65. super(source);
  66. this.dataset = dataset;
  67. }
  68. /**
  69. * Returns the dataset that generated the event. Note that the dataset
  70. * may be <code>null</code> since adding a <code>null</code> dataset to a
  71. * plot will generated a change event.
  72. *
  73. * @return The dataset (possibly <code>null</code>).
  74. */
  75. public Dataset getDataset() {
  76. return this.dataset;
  77. }
  78. }