Example usage for org.jfree.data.general PieDataset addChangeListener

List of usage examples for org.jfree.data.general PieDataset addChangeListener

Introduction

In this page you can find the example usage for org.jfree.data.general PieDataset addChangeListener.

Prototype

public void addChangeListener(DatasetChangeListener listener);

Source Link

Document

Registers an object for notification of changes to the dataset.

Usage

From source file:net.sourceforge.processdash.ui.lib.chart.DiscPlot.java

public DiscPlot(PieDataset dataset) {
    super();//from  www .  j  a  va  2  s.  co m
    this.dataset = dataset;
    if (dataset != null) {
        dataset.addChangeListener(this);
    }
    this.interiorGap = DEFAULT_INTERIOR_GAP;
    this.discDistributor = new StandardDiscItemDistributor(dataset);
    this.discRenderer = new StandardDiscItemRenderer();

    this.labelGenerator = new StandardPieSectionLabelGenerator();
    this.labelFont = DEFAULT_LABEL_FONT;
    this.labelPaint = DEFAULT_LABEL_PAINT;

    this.toolTipGenerator = new StandardPieToolTipGenerator();
    this.urlGenerator = null;
}

From source file:net.sourceforge.processdash.ui.lib.chart.DiscPlot.java

/**
 * Sets the dataset and sends a {@link DatasetChangeEvent} to 'this'.
 *
 * @param dataset  the dataset (<code>null</code> permitted).
 * //  w  w  w  . ja  v  a  2 s.  c om
 * @see #getDataset()
 */
public void setDataset(PieDataset dataset) {
    // if there is an existing dataset, remove the plot from the list of
    // change listeners...
    PieDataset existing = this.dataset;
    if (existing != null) {
        existing.removeChangeListener(this);
    }

    // set the new dataset, and register the chart as a change listener...
    this.dataset = dataset;
    if (dataset != null) {
        setDatasetGroup(dataset.getGroup());
        dataset.addChangeListener(this);
    }

    // tell the item distributor about the change
    if (discDistributor != null) {
        discDistributor.setDataset(dataset);
    }

    // send a dataset change event to self...
    DatasetChangeEvent event = new DatasetChangeEvent(this, dataset);
    datasetChanged(event);
}