Search in sources :

Example 1 with PublicCloneable

use of org.jfree.util.PublicCloneable in project SIMVA-SoS by SESoS.

the class SlidingCategoryDataset method clone.

/**
 * Returns an independent copy of the dataset.  Note that:
 * <ul>
 * <li>the underlying dataset is only cloned if it implements the
 * {@link PublicCloneable} interface;</li>
 * <li>the listeners registered with this dataset are not carried over to
 * the cloned dataset.</li>
 * </ul>
 *
 * @return An independent copy of the dataset.
 *
 * @throws CloneNotSupportedException if the dataset cannot be cloned for
 *         any reason.
 */
@Override
public Object clone() throws CloneNotSupportedException {
    SlidingCategoryDataset clone = (SlidingCategoryDataset) super.clone();
    if (this.underlying instanceof PublicCloneable) {
        PublicCloneable pc = (PublicCloneable) this.underlying;
        clone.underlying = (CategoryDataset) pc.clone();
    }
    return clone;
}
Also used : PublicCloneable(org.jfree.util.PublicCloneable)

Example 2 with PublicCloneable

use of org.jfree.util.PublicCloneable in project SIMVA-SoS by SESoS.

the class SlidingGanttCategoryDataset method clone.

/**
 * Returns an independent copy of the dataset.  Note that:
 * <ul>
 * <li>the underlying dataset is only cloned if it implements the
 * {@link PublicCloneable} interface;</li>
 * <li>the listeners registered with this dataset are not carried over to
 * the cloned dataset.</li>
 * </ul>
 *
 * @return An independent copy of the dataset.
 *
 * @throws CloneNotSupportedException if the dataset cannot be cloned for
 *         any reason.
 */
@Override
public Object clone() throws CloneNotSupportedException {
    SlidingGanttCategoryDataset clone = (SlidingGanttCategoryDataset) super.clone();
    if (this.underlying instanceof PublicCloneable) {
        PublicCloneable pc = (PublicCloneable) this.underlying;
        clone.underlying = (GanttCategoryDataset) pc.clone();
    }
    return clone;
}
Also used : PublicCloneable(org.jfree.util.PublicCloneable)

Example 3 with PublicCloneable

use of org.jfree.util.PublicCloneable in project SIMVA-SoS by SESoS.

the class XYBarDataset method clone.

/**
 * Returns an independent copy of the dataset.  Note that:
 * <ul>
 * <li>the underlying dataset is only cloned if it implements the
 * {@link PublicCloneable} interface;</li>
 * <li>the listeners registered with this dataset are not carried over to
 * the cloned dataset.</li>
 * </ul>
 *
 * @return An independent copy of the dataset.
 *
 * @throws CloneNotSupportedException if the dataset cannot be cloned for
 *         any reason.
 */
@Override
public Object clone() throws CloneNotSupportedException {
    XYBarDataset clone = (XYBarDataset) super.clone();
    if (this.underlying instanceof PublicCloneable) {
        PublicCloneable pc = (PublicCloneable) this.underlying;
        clone.underlying = (XYDataset) pc.clone();
    }
    return clone;
}
Also used : PublicCloneable(org.jfree.util.PublicCloneable)

Example 4 with PublicCloneable

use of org.jfree.util.PublicCloneable in project SIMVA-SoS by SESoS.

the class MultipleXYSeriesLabelGenerator method clone.

/**
 * Returns an independent copy of the generator.
 *
 * @return A clone.
 *
 * @throws CloneNotSupportedException if cloning is not supported.
 */
@Override
public Object clone() throws CloneNotSupportedException {
    MultipleXYSeriesLabelGenerator clone = (MultipleXYSeriesLabelGenerator) super.clone();
    clone.seriesLabelLists = new HashMap();
    Set keys = this.seriesLabelLists.keySet();
    Iterator iterator = keys.iterator();
    while (iterator.hasNext()) {
        Object key = iterator.next();
        Object entry = this.seriesLabelLists.get(key);
        Object toAdd = entry;
        if (entry instanceof PublicCloneable) {
            PublicCloneable pc = (PublicCloneable) entry;
            toAdd = pc.clone();
        }
        clone.seriesLabelLists.put(key, toAdd);
    }
    return clone;
}
Also used : Set(java.util.Set) PublicCloneable(org.jfree.util.PublicCloneable) HashMap(java.util.HashMap) Iterator(java.util.Iterator)

Example 5 with PublicCloneable

use of org.jfree.util.PublicCloneable in project SIMVA-SoS by SESoS.

the class AbstractCategoryItemRenderer method clone.

/**
 * Returns an independent copy of the renderer.  The <code>plot</code>
 * reference is shallow copied.
 *
 * @return A clone.
 *
 * @throws CloneNotSupportedException  can be thrown if one of the objects
 *         belonging to the renderer does not support cloning (for example,
 *         an item label generator).
 */
@Override
public Object clone() throws CloneNotSupportedException {
    AbstractCategoryItemRenderer clone = (AbstractCategoryItemRenderer) super.clone();
    if (this.itemLabelGenerator != null) {
        if (this.itemLabelGenerator instanceof PublicCloneable) {
            PublicCloneable pc = (PublicCloneable) this.itemLabelGenerator;
            clone.itemLabelGenerator = (CategoryItemLabelGenerator) pc.clone();
        } else {
            throw new CloneNotSupportedException("ItemLabelGenerator not cloneable.");
        }
    }
    if (this.itemLabelGeneratorMap != null) {
        clone.itemLabelGeneratorMap = CloneUtils.cloneMapValues(this.itemLabelGeneratorMap);
    }
    if (this.baseItemLabelGenerator != null) {
        if (this.baseItemLabelGenerator instanceof PublicCloneable) {
            PublicCloneable pc = (PublicCloneable) this.baseItemLabelGenerator;
            clone.baseItemLabelGenerator = (CategoryItemLabelGenerator) pc.clone();
        } else {
            throw new CloneNotSupportedException("ItemLabelGenerator not cloneable.");
        }
    }
    if (this.toolTipGenerator != null) {
        if (this.toolTipGenerator instanceof PublicCloneable) {
            PublicCloneable pc = (PublicCloneable) this.toolTipGenerator;
            clone.toolTipGenerator = (CategoryToolTipGenerator) pc.clone();
        } else {
            throw new CloneNotSupportedException("Tool tip generator not cloneable.");
        }
    }
    if (this.toolTipGeneratorMap != null) {
        clone.toolTipGeneratorMap = CloneUtils.cloneMapValues(this.toolTipGeneratorMap);
    }
    if (this.baseToolTipGenerator != null) {
        if (this.baseToolTipGenerator instanceof PublicCloneable) {
            PublicCloneable pc = (PublicCloneable) this.baseToolTipGenerator;
            clone.baseToolTipGenerator = (CategoryToolTipGenerator) pc.clone();
        } else {
            throw new CloneNotSupportedException("Base tool tip generator not cloneable.");
        }
    }
    if (this.itemURLGenerator != null) {
        if (this.itemURLGenerator instanceof PublicCloneable) {
            PublicCloneable pc = (PublicCloneable) this.itemURLGenerator;
            clone.itemURLGenerator = (CategoryURLGenerator) pc.clone();
        } else {
            throw new CloneNotSupportedException("Item URL generator not cloneable.");
        }
    }
    if (this.itemURLGeneratorMap != null) {
        clone.itemURLGeneratorMap = CloneUtils.cloneMapValues(this.itemURLGeneratorMap);
    }
    if (this.baseItemURLGenerator != null) {
        if (this.baseItemURLGenerator instanceof PublicCloneable) {
            PublicCloneable pc = (PublicCloneable) this.baseItemURLGenerator;
            clone.baseItemURLGenerator = (CategoryURLGenerator) pc.clone();
        } else {
            throw new CloneNotSupportedException("Base item URL generator not cloneable.");
        }
    }
    if (this.legendItemLabelGenerator instanceof PublicCloneable) {
        clone.legendItemLabelGenerator = (CategorySeriesLabelGenerator) ObjectUtilities.clone(this.legendItemLabelGenerator);
    }
    if (this.legendItemToolTipGenerator instanceof PublicCloneable) {
        clone.legendItemToolTipGenerator = (CategorySeriesLabelGenerator) ObjectUtilities.clone(this.legendItemToolTipGenerator);
    }
    if (this.legendItemURLGenerator instanceof PublicCloneable) {
        clone.legendItemURLGenerator = (CategorySeriesLabelGenerator) ObjectUtilities.clone(this.legendItemURLGenerator);
    }
    return clone;
}
Also used : PublicCloneable(org.jfree.util.PublicCloneable)

Aggregations

PublicCloneable (org.jfree.util.PublicCloneable)18 BasicStroke (java.awt.BasicStroke)5 Test (org.junit.Test)4 Stroke (java.awt.Stroke)2 Paint (java.awt.Paint)1 Point (java.awt.Point)1 Rectangle2D (java.awt.geom.Rectangle2D)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 Set (java.util.Set)1 ValueAxis (org.jfree.chart.axis.ValueAxis)1 PolarItemRenderer (org.jfree.chart.renderer.PolarItemRenderer)1 XYDataset (org.jfree.data.xy.XYDataset)1