Example usage for org.jfree.data.xy IntervalXYDelegate IntervalXYDelegate

List of usage examples for org.jfree.data.xy IntervalXYDelegate IntervalXYDelegate

Introduction

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

Prototype

public IntervalXYDelegate(XYDataset dataset) 

Source Link

Document

Creates a new delegate that.

Usage

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

/**
 * Confirm that the equals method can distinguish all the required fields.
 *///  w w  w  .  j  av  a2s. c o m
@Test
public void testEquals() {
    XYSeries s1 = new XYSeries("Series");
    s1.add(1.2, 3.4);
    XYSeriesCollection c1 = new XYSeriesCollection();
    c1.addSeries(s1);
    IntervalXYDelegate d1 = new IntervalXYDelegate(c1);

    XYSeries s2 = new XYSeries("Series");
    XYSeriesCollection c2 = new XYSeriesCollection();
    s2.add(1.2, 3.4);
    c2.addSeries(s2);
    IntervalXYDelegate d2 = new IntervalXYDelegate(c2);

    assertTrue(d1.equals(d2));
    assertTrue(d2.equals(d1));

    d1.setAutoWidth(false);
    assertFalse(d1.equals(d2));
    d2.setAutoWidth(false);
    assertTrue(d1.equals(d2));

    d1.setIntervalPositionFactor(0.123);
    assertFalse(d1.equals(d2));
    d2.setIntervalPositionFactor(0.123);
    assertTrue(d1.equals(d2));

    d1.setFixedIntervalWidth(1.23);
    assertFalse(d1.equals(d2));
    d2.setFixedIntervalWidth(1.23);
    assertTrue(d1.equals(d2));
}

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

/**
 * Confirm that cloning works./*from  w w  w  . java  2  s. c o m*/
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    XYSeries s1 = new XYSeries("Series");
    s1.add(1.2, 3.4);
    XYSeriesCollection c1 = new XYSeriesCollection();
    c1.addSeries(s1);
    IntervalXYDelegate d1 = new IntervalXYDelegate(c1);
    IntervalXYDelegate d2 = (IntervalXYDelegate) d1.clone();
    assertTrue(d1 != d2);
    assertTrue(d1.getClass() == d2.getClass());
    assertTrue(d1.equals(d2));
}

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

/**
 * Serialize an instance, restore it, and check for equality.
 *///w  w  w  .  j a v a  2s .  co  m
@Test
public void testSerialization() {
    XYSeries s1 = new XYSeries("Series");
    s1.add(1.2, 3.4);
    XYSeriesCollection c1 = new XYSeriesCollection();
    c1.addSeries(s1);
    IntervalXYDelegate d1 = new IntervalXYDelegate(c1);
    IntervalXYDelegate d2 = (IntervalXYDelegate) TestUtilities.serialised(d1);
    assertEquals(d1, d2);
}

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

/**
 * Creates a new empty CategoryTableXYDataset.
 *//*w w w  . j  a v a2 s. co m*/
public CategoryTableXYDataset() {
    this.values = new DefaultKeyedValues2D(true);
    this.intervalDelegate = new IntervalXYDelegate(this);
    addChangeListener(this.intervalDelegate);
}

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

/**
 * Returns an independent copy of this dataset.
 *
 * @return A clone.//from ww w.  j ava2 s.  com
 *
 * @throws CloneNotSupportedException if there is some reason that cloning
 *     cannot be performed.
 */
@Override
public Object clone() throws CloneNotSupportedException {
    CategoryTableXYDataset clone = (CategoryTableXYDataset) super.clone();
    clone.values = (DefaultKeyedValues2D) this.values.clone();
    clone.intervalDelegate = new IntervalXYDelegate(clone);
    // need to configure the intervalDelegate to match the original
    clone.intervalDelegate.setFixedIntervalWidth(getIntervalWidth());
    clone.intervalDelegate.setAutoWidth(isAutoWidth());
    clone.intervalDelegate.setIntervalPositionFactor(getIntervalPositionFactor());
    return clone;
}

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

/**
 * Returns an independent copy of this dataset.
 *
 * @return A clone./*from www.j  ava  2s. c om*/
 *
 * @throws CloneNotSupportedException if there is some reason that cloning
 *     cannot be performed.
 */
@Override
public Object clone() throws CloneNotSupportedException {
    DefaultTableXYDataset clone = (DefaultTableXYDataset) super.clone();
    int seriesCount = this.data.size();
    clone.data = new java.util.ArrayList(seriesCount);
    for (int i = 0; i < seriesCount; i++) {
        XYSeries series = (XYSeries) this.data.get(i);
        clone.data.add(series.clone());
    }

    clone.intervalDelegate = new IntervalXYDelegate(clone);
    // need to configure the intervalDelegate to match the original
    clone.intervalDelegate.setFixedIntervalWidth(getIntervalWidth());
    clone.intervalDelegate.setAutoWidth(isAutoWidth());
    clone.intervalDelegate.setIntervalPositionFactor(getIntervalPositionFactor());
    clone.updateXPoints();
    return clone;
}