Example usage for org.jfree.data.time RegularTimePeriod peg

List of usage examples for org.jfree.data.time RegularTimePeriod peg

Introduction

In this page you can find the example usage for org.jfree.data.time RegularTimePeriod peg.

Prototype

public abstract void peg(Calendar calendar);

Source Link

Document

Recalculates the start date/time and end date/time for this time period relative to the supplied calendar (which incorporates a time zone).

Usage

From source file:org.jfree.data.time.TimeTableXYDataset.java

/**
 * Adds a new data item to the dataset and, if requested, sends a
 * {@link DatasetChangeEvent} to all registered listeners.
 *
 * @param period  the time period (<code>null</code> not permitted).
 * @param y  the value for this period (<code>null</code> permitted).
 * @param seriesName  the name of the series to add the value
 *                    (<code>null</code> not permitted).
 * @param notify  whether dataset listener are notified or not.
 *
 * @see #remove(TimePeriod, Comparable, boolean)
 */// www .j  av  a 2  s.co m
public void add(TimePeriod period, Number y, Comparable seriesName, boolean notify) {
    // here's a quirk - the API has been defined in terms of a plain
    // TimePeriod, which cannot make use of the timezone and locale
    // specified in the constructor...so we only do the time zone
    // pegging if the period is an instanceof RegularTimePeriod
    if (period instanceof RegularTimePeriod) {
        RegularTimePeriod p = (RegularTimePeriod) period;
        p.peg(this.workingCalendar);
    }
    this.values.addValue(y, period, seriesName);
    if (notify) {
        fireDatasetChanged();
    }
}