Example usage for org.jfree.data.xy XYSeries addChangeListener

List of usage examples for org.jfree.data.xy XYSeries addChangeListener

Introduction

In this page you can find the example usage for org.jfree.data.xy XYSeries addChangeListener.

Prototype

public void addChangeListener(SeriesChangeListener listener) 

Source Link

Document

Registers an object with this series, to receive notification whenever the series changes.

Usage

From source file:org.jfree.data.xy.XYSeriesCollection.java

/**
 * Constructs a dataset and populates it with a single series.
 *
 * @param series  the series (<code>null</code> ignored).
 *//* w  ww  . j  a v a 2s . com*/
public XYSeriesCollection(XYSeries series) {
    this.data = new java.util.ArrayList();
    this.intervalDelegate = new IntervalXYDelegate(this, false);
    addChangeListener(this.intervalDelegate);
    if (series != null) {
        this.data.add(series);
        series.addChangeListener(this);
        series.addVetoableChangeListener(this);
    }
}

From source file:org.jfree.data.xy.DefaultTableXYDataset.java

/**
 * Adds a series to the collection and sends a {@link DatasetChangeEvent}
 * to all registered listeners.  The series should be configured to NOT
 * allow duplicate x-values.//w w w  .  j  a  va2  s  .  c om
 *
 * @param series  the series (<code>null</code> not permitted).
 */
public void addSeries(XYSeries series) {
    ParamChecks.nullNotPermitted(series, "series");
    if (series.getAllowDuplicateXValues()) {
        throw new IllegalArgumentException("Cannot accept XYSeries that allow duplicate values. "
                + "Use XYSeries(seriesName, <sort>, false) constructor.");
    }
    updateXPoints(series);
    this.data.add(series);
    series.addChangeListener(this);
    fireDatasetChanged();
}

From source file:org.jfree.data.xy.XYSeriesCollection.java

/**
 * Adds a series to the collection and sends a {@link DatasetChangeEvent}
 * to all registered listeners./*  w  w  w. ja v  a 2  s . c o m*/
 *
 * @param series  the series (<code>null</code> not permitted).
 * 
 * @throws IllegalArgumentException if the key for the series is null or
 *     not unique within the dataset.
 */
public void addSeries(XYSeries series) {
    ParamChecks.nullNotPermitted(series, "series");
    if (getSeriesIndex(series.getKey()) >= 0) {
        throw new IllegalArgumentException(
                "This dataset already contains a series with the key " + series.getKey());
    }
    this.data.add(series);
    series.addChangeListener(this);
    series.addVetoableChangeListener(this);
    fireDatasetChanged();
}