Search in sources :

Example 1 with DefaultShadowGenerator

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

the class PiePlotTest method testEquals.

/**
 * Test the equals() method.
 */
@Test
public void testEquals() {
    PiePlot plot1 = new PiePlot();
    PiePlot plot2 = new PiePlot();
    assertTrue(plot1.equals(plot2));
    assertTrue(plot2.equals(plot1));
    // pieIndex...
    plot1.setPieIndex(99);
    assertFalse(plot1.equals(plot2));
    plot2.setPieIndex(99);
    assertTrue(plot1.equals(plot2));
    // interiorGap...
    plot1.setInteriorGap(0.15);
    assertFalse(plot1.equals(plot2));
    plot2.setInteriorGap(0.15);
    assertTrue(plot1.equals(plot2));
    // circular
    plot1.setCircular(!plot1.isCircular());
    assertFalse(plot1.equals(plot2));
    plot2.setCircular(false);
    assertTrue(plot1.equals(plot2));
    // startAngle
    plot1.setStartAngle(Math.PI);
    assertFalse(plot1.equals(plot2));
    plot2.setStartAngle(Math.PI);
    assertTrue(plot1.equals(plot2));
    // direction
    plot1.setDirection(Rotation.ANTICLOCKWISE);
    assertFalse(plot1.equals(plot2));
    plot2.setDirection(Rotation.ANTICLOCKWISE);
    assertTrue(plot1.equals(plot2));
    // ignoreZeroValues
    plot1.setIgnoreZeroValues(true);
    plot2.setIgnoreZeroValues(false);
    assertFalse(plot1.equals(plot2));
    plot2.setIgnoreZeroValues(true);
    assertTrue(plot1.equals(plot2));
    // ignoreNullValues
    plot1.setIgnoreNullValues(true);
    plot2.setIgnoreNullValues(false);
    assertFalse(plot1.equals(plot2));
    plot2.setIgnoreNullValues(true);
    assertTrue(plot1.equals(plot2));
    // sectionPaint
    plot1.setSectionPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.white));
    assertFalse(plot1.equals(plot2));
    plot2.setSectionPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.white));
    assertTrue(plot1.equals(plot2));
    // sectionPaintMap
    plot1.setSectionPaint("A", new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.white));
    assertFalse(plot1.equals(plot2));
    plot2.setSectionPaint("A", new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.white));
    assertTrue(plot1.equals(plot2));
    // baseSectionPaint
    plot1.setBaseSectionPaint(new GradientPaint(1.0f, 2.0f, Color.black, 3.0f, 4.0f, Color.white));
    assertFalse(plot1.equals(plot2));
    plot2.setBaseSectionPaint(new GradientPaint(1.0f, 2.0f, Color.black, 3.0f, 4.0f, Color.white));
    assertTrue(plot1.equals(plot2));
    // sectionOutlinesVisible
    plot1.setSectionOutlinesVisible(false);
    assertFalse(plot1.equals(plot2));
    plot2.setSectionOutlinesVisible(false);
    assertTrue(plot1.equals(plot2));
    // sectionOutlinePaint
    plot1.setSectionOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.cyan, 3.0f, 4.0f, Color.white));
    assertFalse(plot1.equals(plot2));
    plot2.setSectionOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.cyan, 3.0f, 4.0f, Color.white));
    assertTrue(plot1.equals(plot2));
    // sectionOutlinePaintList
    plot1.setSectionOutlinePaint("A", new GradientPaint(1.0f, 2.0f, Color.green, 3.0f, 4.0f, Color.white));
    assertFalse(plot1.equals(plot2));
    plot2.setSectionOutlinePaint("A", new GradientPaint(1.0f, 2.0f, Color.green, 3.0f, 4.0f, Color.white));
    assertTrue(plot1.equals(plot2));
    // baseSectionOutlinePaint
    plot1.setBaseSectionOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.gray, 3.0f, 4.0f, Color.white));
    assertFalse(plot1.equals(plot2));
    plot2.setBaseSectionOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.gray, 3.0f, 4.0f, Color.white));
    assertTrue(plot1.equals(plot2));
    // sectionOutlineStroke
    plot1.setSectionOutlineStroke(new BasicStroke(1.0f));
    assertFalse(plot1.equals(plot2));
    plot2.setSectionOutlineStroke(new BasicStroke(1.0f));
    assertTrue(plot1.equals(plot2));
    // sectionOutlineStrokeList
    plot1.setSectionOutlineStroke("A", new BasicStroke(1.0f));
    assertFalse(plot1.equals(plot2));
    plot2.setSectionOutlineStroke("A", new BasicStroke(1.0f));
    assertTrue(plot1.equals(plot2));
    // baseSectionOutlineStroke
    plot1.setBaseSectionOutlineStroke(new BasicStroke(1.0f));
    assertFalse(plot1.equals(plot2));
    plot2.setBaseSectionOutlineStroke(new BasicStroke(1.0f));
    assertTrue(plot1.equals(plot2));
    // shadowPaint
    plot1.setShadowPaint(new GradientPaint(1.0f, 2.0f, Color.orange, 3.0f, 4.0f, Color.white));
    assertFalse(plot1.equals(plot2));
    plot2.setShadowPaint(new GradientPaint(1.0f, 2.0f, Color.orange, 3.0f, 4.0f, Color.white));
    assertTrue(plot1.equals(plot2));
    // shadowXOffset
    plot1.setShadowXOffset(4.4);
    assertFalse(plot1.equals(plot2));
    plot2.setShadowXOffset(4.4);
    assertTrue(plot1.equals(plot2));
    // shadowYOffset
    plot1.setShadowYOffset(4.4);
    assertFalse(plot1.equals(plot2));
    plot2.setShadowYOffset(4.4);
    assertTrue(plot1.equals(plot2));
    // labelFont
    plot1.setLabelFont(new Font("Serif", Font.PLAIN, 18));
    assertFalse(plot1.equals(plot2));
    plot2.setLabelFont(new Font("Serif", Font.PLAIN, 18));
    assertTrue(plot1.equals(plot2));
    // labelPaint
    plot1.setLabelPaint(new GradientPaint(1.0f, 2.0f, Color.darkGray, 3.0f, 4.0f, Color.white));
    assertFalse(plot1.equals(plot2));
    plot2.setLabelPaint(new GradientPaint(1.0f, 2.0f, Color.darkGray, 3.0f, 4.0f, Color.white));
    assertTrue(plot1.equals(plot2));
    // labelBackgroundPaint
    plot1.setLabelBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.white));
    assertFalse(plot1.equals(plot2));
    plot2.setLabelBackgroundPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.white));
    assertTrue(plot1.equals(plot2));
    // labelOutlinePaint
    plot1.setLabelOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.white));
    assertFalse(plot1.equals(plot2));
    plot2.setLabelOutlinePaint(new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.white));
    assertTrue(plot1.equals(plot2));
    // labelOutlineStroke
    Stroke s = new BasicStroke(1.1f);
    plot1.setLabelOutlineStroke(s);
    assertFalse(plot1.equals(plot2));
    plot2.setLabelOutlineStroke(s);
    assertTrue(plot1.equals(plot2));
    // labelShadowPaint
    plot1.setLabelShadowPaint(new GradientPaint(1.0f, 2.0f, Color.yellow, 3.0f, 4.0f, Color.white));
    assertFalse(plot1.equals(plot2));
    plot2.setLabelShadowPaint(new GradientPaint(1.0f, 2.0f, Color.yellow, 3.0f, 4.0f, Color.white));
    assertTrue(plot1.equals(plot2));
    // explodePercentages
    plot1.setExplodePercent("A", 0.33);
    assertFalse(plot1.equals(plot2));
    plot2.setExplodePercent("A", 0.33);
    assertTrue(plot1.equals(plot2));
    // labelGenerator
    plot1.setLabelGenerator(new StandardPieSectionLabelGenerator("{2}{1}{0}"));
    assertFalse(plot1.equals(plot2));
    plot2.setLabelGenerator(new StandardPieSectionLabelGenerator("{2}{1}{0}"));
    assertTrue(plot1.equals(plot2));
    // labelFont
    Font f = new Font("SansSerif", Font.PLAIN, 20);
    plot1.setLabelFont(f);
    assertFalse(plot1.equals(plot2));
    plot2.setLabelFont(f);
    assertTrue(plot1.equals(plot2));
    // labelPaint
    plot1.setLabelPaint(new GradientPaint(1.0f, 2.0f, Color.magenta, 3.0f, 4.0f, Color.white));
    assertFalse(plot1.equals(plot2));
    plot2.setLabelPaint(new GradientPaint(1.0f, 2.0f, Color.magenta, 3.0f, 4.0f, Color.white));
    assertTrue(plot1.equals(plot2));
    // maximumLabelWidth
    plot1.setMaximumLabelWidth(0.33);
    assertFalse(plot1.equals(plot2));
    plot2.setMaximumLabelWidth(0.33);
    assertTrue(plot1.equals(plot2));
    // labelGap
    plot1.setLabelGap(0.11);
    assertFalse(plot1.equals(plot2));
    plot2.setLabelGap(0.11);
    assertTrue(plot1.equals(plot2));
    // links visible
    plot1.setLabelLinksVisible(false);
    assertFalse(plot1.equals(plot2));
    plot2.setLabelLinksVisible(false);
    assertTrue(plot1.equals(plot2));
    plot1.setLabelLinkStyle(PieLabelLinkStyle.QUAD_CURVE);
    assertFalse(plot1.equals(plot2));
    plot2.setLabelLinkStyle(PieLabelLinkStyle.QUAD_CURVE);
    assertTrue(plot1.equals(plot2));
    // linkMargin
    plot1.setLabelLinkMargin(0.11);
    assertFalse(plot1.equals(plot2));
    plot2.setLabelLinkMargin(0.11);
    assertTrue(plot1.equals(plot2));
    // labelLinkPaint
    plot1.setLabelLinkPaint(new GradientPaint(1.0f, 2.0f, Color.magenta, 3.0f, 4.0f, Color.white));
    assertFalse(plot1.equals(plot2));
    plot2.setLabelLinkPaint(new GradientPaint(1.0f, 2.0f, Color.magenta, 3.0f, 4.0f, Color.white));
    assertTrue(plot1.equals(plot2));
    // labelLinkStroke
    plot1.setLabelLinkStroke(new BasicStroke(1.0f));
    assertFalse(plot1.equals(plot2));
    plot2.setLabelLinkStroke(new BasicStroke(1.0f));
    assertTrue(plot1.equals(plot2));
    // toolTipGenerator
    plot1.setToolTipGenerator(new StandardPieToolTipGenerator("{2}{1}{0}"));
    assertFalse(plot1.equals(plot2));
    plot2.setToolTipGenerator(new StandardPieToolTipGenerator("{2}{1}{0}"));
    assertTrue(plot1.equals(plot2));
    // urlGenerator
    plot1.setURLGenerator(new StandardPieURLGenerator("xx"));
    assertFalse(plot1.equals(plot2));
    plot2.setURLGenerator(new StandardPieURLGenerator("xx"));
    assertTrue(plot1.equals(plot2));
    // minimumArcAngleToDraw
    plot1.setMinimumArcAngleToDraw(1.0);
    assertFalse(plot1.equals(plot2));
    plot2.setMinimumArcAngleToDraw(1.0);
    assertTrue(plot1.equals(plot2));
    // legendItemShape
    plot1.setLegendItemShape(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
    assertFalse(plot1.equals(plot2));
    plot2.setLegendItemShape(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0));
    assertTrue(plot1.equals(plot2));
    // legendLabelGenerator
    plot1.setLegendLabelGenerator(new StandardPieSectionLabelGenerator("{0} --> {1}"));
    assertFalse(plot1.equals(plot2));
    plot2.setLegendLabelGenerator(new StandardPieSectionLabelGenerator("{0} --> {1}"));
    assertTrue(plot1.equals(plot2));
    // legendLabelToolTipGenerator
    plot1.setLegendLabelToolTipGenerator(new StandardPieSectionLabelGenerator("{0} is {1}"));
    assertFalse(plot1.equals(plot2));
    plot2.setLegendLabelToolTipGenerator(new StandardPieSectionLabelGenerator("{0} is {1}"));
    assertTrue(plot1.equals(plot2));
    // legendLabelURLGenerator
    plot1.setLegendLabelURLGenerator(new StandardPieURLGenerator("index.html"));
    assertFalse(plot1.equals(plot2));
    plot2.setLegendLabelURLGenerator(new StandardPieURLGenerator("index.html"));
    assertTrue(plot1.equals(plot2));
    // autoPopulateSectionPaint
    plot1.setAutoPopulateSectionPaint(false);
    assertFalse(plot1.equals(plot2));
    plot2.setAutoPopulateSectionPaint(false);
    assertTrue(plot1.equals(plot2));
    // autoPopulateSectionOutlinePaint
    plot1.setAutoPopulateSectionOutlinePaint(true);
    assertFalse(plot1.equals(plot2));
    plot2.setAutoPopulateSectionOutlinePaint(true);
    assertTrue(plot1.equals(plot2));
    // autoPopulateSectionOutlineStroke
    plot1.setAutoPopulateSectionOutlineStroke(true);
    assertFalse(plot1.equals(plot2));
    plot2.setAutoPopulateSectionOutlineStroke(true);
    assertTrue(plot1.equals(plot2));
    // shadowGenerator
    plot1.setShadowGenerator(new DefaultShadowGenerator(5, Color.gray, 0.6f, 4, -Math.PI / 4));
    assertFalse(plot1.equals(plot2));
    plot2.setShadowGenerator(new DefaultShadowGenerator(5, Color.gray, 0.6f, 4, -Math.PI / 4));
    assertTrue(plot1.equals(plot2));
    plot1.setShadowGenerator(null);
    assertFalse(plot1.equals(plot2));
    plot2.setShadowGenerator(null);
    assertTrue(plot1.equals(plot2));
}
Also used : BasicStroke(java.awt.BasicStroke) StandardPieURLGenerator(org.jfree.chart.urls.StandardPieURLGenerator) Stroke(java.awt.Stroke) BasicStroke(java.awt.BasicStroke) StandardPieToolTipGenerator(org.jfree.chart.labels.StandardPieToolTipGenerator) Rectangle2D(java.awt.geom.Rectangle2D) GradientPaint(java.awt.GradientPaint) StandardPieSectionLabelGenerator(org.jfree.chart.labels.StandardPieSectionLabelGenerator) DefaultShadowGenerator(org.jfree.chart.util.DefaultShadowGenerator) Font(java.awt.Font) Test(org.junit.Test)

Example 2 with DefaultShadowGenerator

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

the class CategoryPlotTest method testEquals.

/**
 * Test that the equals() method differentiates all the required fields.
 */
@Test
public void testEquals() {
    CategoryPlot plot1 = new CategoryPlot();
    CategoryPlot plot2 = new CategoryPlot();
    assertTrue(plot1.equals(plot2));
    assertTrue(plot2.equals(plot1));
    // orientation...
    plot1.setOrientation(PlotOrientation.HORIZONTAL);
    assertFalse(plot1.equals(plot2));
    plot2.setOrientation(PlotOrientation.HORIZONTAL);
    assertTrue(plot1.equals(plot2));
    // axisOffset...
    plot1.setAxisOffset(new RectangleInsets(0.05, 0.05, 0.05, 0.05));
    assertFalse(plot1.equals(plot2));
    plot2.setAxisOffset(new RectangleInsets(0.05, 0.05, 0.05, 0.05));
    assertTrue(plot1.equals(plot2));
    // domainAxis - no longer a separate field but test anyway...
    plot1.setDomainAxis(new CategoryAxis("Category Axis"));
    assertFalse(plot1.equals(plot2));
    plot2.setDomainAxis(new CategoryAxis("Category Axis"));
    assertTrue(plot1.equals(plot2));
    // domainAxes...
    plot1.setDomainAxis(11, new CategoryAxis("Secondary Axis"));
    assertFalse(plot1.equals(plot2));
    plot2.setDomainAxis(11, new CategoryAxis("Secondary Axis"));
    assertTrue(plot1.equals(plot2));
    // domainAxisLocation - no longer a separate field but test anyway...
    plot1.setDomainAxisLocation(AxisLocation.TOP_OR_RIGHT);
    assertFalse(plot1.equals(plot2));
    plot2.setDomainAxisLocation(AxisLocation.TOP_OR_RIGHT);
    assertTrue(plot1.equals(plot2));
    // domainAxisLocations...
    plot1.setDomainAxisLocation(11, AxisLocation.TOP_OR_RIGHT);
    assertFalse(plot1.equals(plot2));
    plot2.setDomainAxisLocation(11, AxisLocation.TOP_OR_RIGHT);
    assertTrue(plot1.equals(plot2));
    // draw shared domain axis...
    plot1.setDrawSharedDomainAxis(!plot1.getDrawSharedDomainAxis());
    assertFalse(plot1.equals(plot2));
    plot2.setDrawSharedDomainAxis(!plot2.getDrawSharedDomainAxis());
    assertTrue(plot1.equals(plot2));
    // rangeAxis - no longer a separate field but test anyway...
    plot1.setRangeAxis(new NumberAxis("Range Axis"));
    assertFalse(plot1.equals(plot2));
    plot2.setRangeAxis(new NumberAxis("Range Axis"));
    assertTrue(plot1.equals(plot2));
    // rangeAxes...
    plot1.setRangeAxis(11, new NumberAxis("Secondary Range Axis"));
    assertFalse(plot1.equals(plot2));
    plot2.setRangeAxis(11, new NumberAxis("Secondary Range Axis"));
    assertTrue(plot1.equals(plot2));
    // rangeAxisLocation - no longer a separate field but test anyway...
    plot1.setRangeAxisLocation(AxisLocation.TOP_OR_RIGHT);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeAxisLocation(AxisLocation.TOP_OR_RIGHT);
    assertTrue(plot1.equals(plot2));
    // rangeAxisLocations...
    plot1.setRangeAxisLocation(11, AxisLocation.TOP_OR_RIGHT);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeAxisLocation(11, AxisLocation.TOP_OR_RIGHT);
    assertTrue(plot1.equals(plot2));
    // datasetToDomainAxisMap...
    plot1.mapDatasetToDomainAxis(11, 11);
    assertFalse(plot1.equals(plot2));
    plot2.mapDatasetToDomainAxis(11, 11);
    assertTrue(plot1.equals(plot2));
    // datasetToRangeAxisMap...
    plot1.mapDatasetToRangeAxis(11, 11);
    assertFalse(plot1.equals(plot2));
    plot2.mapDatasetToRangeAxis(11, 11);
    assertTrue(plot1.equals(plot2));
    // renderer - no longer a separate field but test anyway...
    plot1.setRenderer(new AreaRenderer());
    assertFalse(plot1.equals(plot2));
    plot2.setRenderer(new AreaRenderer());
    assertTrue(plot1.equals(plot2));
    // renderers...
    plot1.setRenderer(11, new AreaRenderer());
    assertFalse(plot1.equals(plot2));
    plot2.setRenderer(11, new AreaRenderer());
    assertTrue(plot1.equals(plot2));
    // rendering order...
    plot1.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    assertFalse(plot1.equals(plot2));
    plot2.setDatasetRenderingOrder(DatasetRenderingOrder.FORWARD);
    assertTrue(plot1.equals(plot2));
    // columnRenderingOrder...
    plot1.setColumnRenderingOrder(SortOrder.DESCENDING);
    assertFalse(plot1.equals(plot2));
    plot2.setColumnRenderingOrder(SortOrder.DESCENDING);
    assertTrue(plot1.equals(plot2));
    // rowRenderingOrder...
    plot1.setRowRenderingOrder(SortOrder.DESCENDING);
    assertFalse(plot1.equals(plot2));
    plot2.setRowRenderingOrder(SortOrder.DESCENDING);
    assertTrue(plot1.equals(plot2));
    // domainGridlinesVisible
    plot1.setDomainGridlinesVisible(true);
    assertFalse(plot1.equals(plot2));
    plot2.setDomainGridlinesVisible(true);
    assertTrue(plot1.equals(plot2));
    // domainGridlinePosition
    plot1.setDomainGridlinePosition(CategoryAnchor.END);
    assertFalse(plot1.equals(plot2));
    plot2.setDomainGridlinePosition(CategoryAnchor.END);
    assertTrue(plot1.equals(plot2));
    // domainGridlineStroke
    Stroke stroke = new BasicStroke(2.0f);
    plot1.setDomainGridlineStroke(stroke);
    assertFalse(plot1.equals(plot2));
    plot2.setDomainGridlineStroke(stroke);
    assertTrue(plot1.equals(plot2));
    // domainGridlinePaint
    plot1.setDomainGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.yellow));
    assertFalse(plot1.equals(plot2));
    plot2.setDomainGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.yellow));
    assertTrue(plot1.equals(plot2));
    // rangeGridlinesVisible
    plot1.setRangeGridlinesVisible(false);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeGridlinesVisible(false);
    assertTrue(plot1.equals(plot2));
    // rangeGridlineStroke
    plot1.setRangeGridlineStroke(stroke);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeGridlineStroke(stroke);
    assertTrue(plot1.equals(plot2));
    // rangeGridlinePaint
    plot1.setRangeGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.green, 3.0f, 4.0f, Color.yellow));
    assertFalse(plot1.equals(plot2));
    plot2.setRangeGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.green, 3.0f, 4.0f, Color.yellow));
    assertTrue(plot1.equals(plot2));
    // anchorValue
    plot1.setAnchorValue(100.0);
    assertFalse(plot1.equals(plot2));
    plot2.setAnchorValue(100.0);
    assertTrue(plot1.equals(plot2));
    // rangeCrosshairVisible
    plot1.setRangeCrosshairVisible(true);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeCrosshairVisible(true);
    assertTrue(plot1.equals(plot2));
    // rangeCrosshairValue
    plot1.setRangeCrosshairValue(100.0);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeCrosshairValue(100.0);
    assertTrue(plot1.equals(plot2));
    // rangeCrosshairStroke
    plot1.setRangeCrosshairStroke(stroke);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeCrosshairStroke(stroke);
    assertTrue(plot1.equals(plot2));
    // rangeCrosshairPaint
    plot1.setRangeCrosshairPaint(new GradientPaint(1.0f, 2.0f, Color.white, 3.0f, 4.0f, Color.yellow));
    assertFalse(plot1.equals(plot2));
    plot2.setRangeCrosshairPaint(new GradientPaint(1.0f, 2.0f, Color.white, 3.0f, 4.0f, Color.yellow));
    assertTrue(plot1.equals(plot2));
    // rangeCrosshairLockedOnData
    plot1.setRangeCrosshairLockedOnData(false);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeCrosshairLockedOnData(false);
    assertTrue(plot1.equals(plot2));
    // foreground domain markers
    plot1.addDomainMarker(new CategoryMarker("C1"), Layer.FOREGROUND);
    assertFalse(plot1.equals(plot2));
    plot2.addDomainMarker(new CategoryMarker("C1"), Layer.FOREGROUND);
    assertTrue(plot1.equals(plot2));
    // background domain markers
    plot1.addDomainMarker(new CategoryMarker("C2"), Layer.BACKGROUND);
    assertFalse(plot1.equals(plot2));
    plot2.addDomainMarker(new CategoryMarker("C2"), Layer.BACKGROUND);
    assertTrue(plot1.equals(plot2));
    // range markers - no longer separate fields but test anyway...
    plot1.addRangeMarker(new ValueMarker(4.0), Layer.FOREGROUND);
    assertFalse(plot1.equals(plot2));
    plot2.addRangeMarker(new ValueMarker(4.0), Layer.FOREGROUND);
    assertTrue(plot1.equals(plot2));
    plot1.addRangeMarker(new ValueMarker(5.0), Layer.BACKGROUND);
    assertFalse(plot1.equals(plot2));
    plot2.addRangeMarker(new ValueMarker(5.0), Layer.BACKGROUND);
    assertTrue(plot1.equals(plot2));
    // foreground range markers...
    plot1.addRangeMarker(1, new ValueMarker(4.0), Layer.FOREGROUND);
    assertFalse(plot1.equals(plot2));
    plot2.addRangeMarker(1, new ValueMarker(4.0), Layer.FOREGROUND);
    assertTrue(plot1.equals(plot2));
    // background range markers...
    plot1.addRangeMarker(1, new ValueMarker(5.0), Layer.BACKGROUND);
    assertFalse(plot1.equals(plot2));
    plot2.addRangeMarker(1, new ValueMarker(5.0), Layer.BACKGROUND);
    assertTrue(plot1.equals(plot2));
    // annotations
    plot1.addAnnotation(new CategoryTextAnnotation("Text", "Category", 43.0));
    assertFalse(plot1.equals(plot2));
    plot2.addAnnotation(new CategoryTextAnnotation("Text", "Category", 43.0));
    assertTrue(plot1.equals(plot2));
    // weight
    plot1.setWeight(3);
    assertFalse(plot1.equals(plot2));
    plot2.setWeight(3);
    assertTrue(plot1.equals(plot2));
    // fixed domain axis space...
    plot1.setFixedDomainAxisSpace(new AxisSpace());
    assertFalse(plot1.equals(plot2));
    plot2.setFixedDomainAxisSpace(new AxisSpace());
    assertTrue(plot1.equals(plot2));
    // fixed range axis space...
    plot1.setFixedRangeAxisSpace(new AxisSpace());
    assertFalse(plot1.equals(plot2));
    plot2.setFixedRangeAxisSpace(new AxisSpace());
    assertTrue(plot1.equals(plot2));
    // fixed legend items
    plot1.setFixedLegendItems(new LegendItemCollection());
    assertFalse(plot1.equals(plot2));
    plot2.setFixedLegendItems(new LegendItemCollection());
    assertTrue(plot1.equals(plot2));
    // crosshairDatasetIndex
    plot1.setCrosshairDatasetIndex(99);
    assertFalse(plot1.equals(plot2));
    plot2.setCrosshairDatasetIndex(99);
    assertTrue(plot1.equals(plot2));
    // domainCrosshairColumnKey
    plot1.setDomainCrosshairColumnKey("A");
    assertFalse(plot1.equals(plot2));
    plot2.setDomainCrosshairColumnKey("A");
    assertTrue(plot1.equals(plot2));
    // domainCrosshairRowKey
    plot1.setDomainCrosshairRowKey("B");
    assertFalse(plot1.equals(plot2));
    plot2.setDomainCrosshairRowKey("B");
    assertTrue(plot1.equals(plot2));
    // domainCrosshairVisible
    plot1.setDomainCrosshairVisible(true);
    assertFalse(plot1.equals(plot2));
    plot2.setDomainCrosshairVisible(true);
    assertTrue(plot1.equals(plot2));
    // domainCrosshairPaint
    plot1.setDomainCrosshairPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    assertFalse(plot1.equals(plot2));
    plot2.setDomainCrosshairPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    assertTrue(plot1.equals(plot2));
    // domainCrosshairStroke
    plot1.setDomainCrosshairStroke(new BasicStroke(1.23f));
    assertFalse(plot1.equals(plot2));
    plot2.setDomainCrosshairStroke(new BasicStroke(1.23f));
    assertTrue(plot1.equals(plot2));
    plot1.setRangeMinorGridlinesVisible(true);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeMinorGridlinesVisible(true);
    assertTrue(plot1.equals(plot2));
    plot1.setRangeMinorGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    assertFalse(plot1.equals(plot2));
    plot2.setRangeMinorGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    assertTrue(plot1.equals(plot2));
    plot1.setRangeMinorGridlineStroke(new BasicStroke(1.23f));
    assertFalse(plot1.equals(plot2));
    plot2.setRangeMinorGridlineStroke(new BasicStroke(1.23f));
    assertTrue(plot1.equals(plot2));
    plot1.setRangeZeroBaselineVisible(!plot1.isRangeZeroBaselineVisible());
    assertFalse(plot1.equals(plot2));
    plot2.setRangeZeroBaselineVisible(!plot2.isRangeZeroBaselineVisible());
    assertTrue(plot1.equals(plot2));
    plot1.setRangeZeroBaselinePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    assertFalse(plot1.equals(plot2));
    plot2.setRangeZeroBaselinePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    assertTrue(plot1.equals(plot2));
    plot1.setRangeZeroBaselineStroke(new BasicStroke(1.23f));
    assertFalse(plot1.equals(plot2));
    plot2.setRangeZeroBaselineStroke(new BasicStroke(1.23f));
    assertTrue(plot1.equals(plot2));
    // shadowGenerator
    plot1.setShadowGenerator(new DefaultShadowGenerator(5, Color.gray, 0.6f, 4, -Math.PI / 4));
    assertFalse(plot1.equals(plot2));
    plot2.setShadowGenerator(new DefaultShadowGenerator(5, Color.gray, 0.6f, 4, -Math.PI / 4));
    assertTrue(plot1.equals(plot2));
    plot1.setShadowGenerator(null);
    assertFalse(plot1.equals(plot2));
    plot2.setShadowGenerator(null);
    assertTrue(plot1.equals(plot2));
}
Also used : BasicStroke(java.awt.BasicStroke) Stroke(java.awt.Stroke) BasicStroke(java.awt.BasicStroke) NumberAxis(org.jfree.chart.axis.NumberAxis) AreaRenderer(org.jfree.chart.renderer.category.AreaRenderer) LegendItemCollection(org.jfree.chart.LegendItemCollection) GradientPaint(java.awt.GradientPaint) DefaultShadowGenerator(org.jfree.chart.util.DefaultShadowGenerator) CategoryAxis(org.jfree.chart.axis.CategoryAxis) RectangleInsets(org.jfree.ui.RectangleInsets) AxisSpace(org.jfree.chart.axis.AxisSpace) CategoryTextAnnotation(org.jfree.chart.annotations.CategoryTextAnnotation) Test(org.junit.Test)

Example 3 with DefaultShadowGenerator

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

the class XYPlotTest method testEquals.

/**
 * Some checks for the equals() method.
 */
@Test
public void testEquals() {
    XYPlot plot1 = new XYPlot();
    XYPlot plot2 = new XYPlot();
    assertTrue(plot1.equals(plot2));
    // orientation...
    plot1.setOrientation(PlotOrientation.HORIZONTAL);
    assertFalse(plot1.equals(plot2));
    plot2.setOrientation(PlotOrientation.HORIZONTAL);
    assertTrue(plot1.equals(plot2));
    // axisOffset...
    plot1.setAxisOffset(new RectangleInsets(0.05, 0.05, 0.05, 0.05));
    assertFalse(plot1.equals(plot2));
    plot2.setAxisOffset(new RectangleInsets(0.05, 0.05, 0.05, 0.05));
    assertTrue(plot1.equals(plot2));
    // domainAxis...
    plot1.setDomainAxis(new NumberAxis("Domain Axis"));
    assertFalse(plot1.equals(plot2));
    plot2.setDomainAxis(new NumberAxis("Domain Axis"));
    assertTrue(plot1.equals(plot2));
    // domainAxisLocation...
    plot1.setDomainAxisLocation(AxisLocation.TOP_OR_RIGHT);
    assertFalse(plot1.equals(plot2));
    plot2.setDomainAxisLocation(AxisLocation.TOP_OR_RIGHT);
    assertTrue(plot1.equals(plot2));
    // secondary DomainAxes...
    plot1.setDomainAxis(11, new NumberAxis("Secondary Domain Axis"));
    assertFalse(plot1.equals(plot2));
    plot2.setDomainAxis(11, new NumberAxis("Secondary Domain Axis"));
    assertTrue(plot1.equals(plot2));
    // secondary DomainAxisLocations...
    plot1.setDomainAxisLocation(11, AxisLocation.TOP_OR_RIGHT);
    assertFalse(plot1.equals(plot2));
    plot2.setDomainAxisLocation(11, AxisLocation.TOP_OR_RIGHT);
    assertTrue(plot1.equals(plot2));
    // rangeAxis...
    plot1.setRangeAxis(new NumberAxis("Range Axis"));
    assertFalse(plot1.equals(plot2));
    plot2.setRangeAxis(new NumberAxis("Range Axis"));
    assertTrue(plot1.equals(plot2));
    // rangeAxisLocation...
    plot1.setRangeAxisLocation(AxisLocation.TOP_OR_RIGHT);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeAxisLocation(AxisLocation.TOP_OR_RIGHT);
    assertTrue(plot1.equals(plot2));
    // secondary RangeAxes...
    plot1.setRangeAxis(11, new NumberAxis("Secondary Range Axis"));
    assertFalse(plot1.equals(plot2));
    plot2.setRangeAxis(11, new NumberAxis("Secondary Range Axis"));
    assertTrue(plot1.equals(plot2));
    // secondary RangeAxisLocations...
    plot1.setRangeAxisLocation(11, AxisLocation.TOP_OR_RIGHT);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeAxisLocation(11, AxisLocation.TOP_OR_RIGHT);
    assertTrue(plot1.equals(plot2));
    // secondary DatasetDomainAxisMap...
    plot1.mapDatasetToDomainAxis(11, 11);
    assertFalse(plot1.equals(plot2));
    plot2.mapDatasetToDomainAxis(11, 11);
    assertTrue(plot1.equals(plot2));
    // secondaryDatasetRangeAxisMap...
    plot1.mapDatasetToRangeAxis(11, 11);
    assertFalse(plot1.equals(plot2));
    plot2.mapDatasetToRangeAxis(11, 11);
    assertTrue(plot1.equals(plot2));
    // renderer
    plot1.setRenderer(new DefaultXYItemRenderer());
    assertFalse(plot1.equals(plot2));
    plot2.setRenderer(new DefaultXYItemRenderer());
    assertTrue(plot1.equals(plot2));
    // secondary renderers
    plot1.setRenderer(11, new DefaultXYItemRenderer());
    assertFalse(plot1.equals(plot2));
    plot2.setRenderer(11, new DefaultXYItemRenderer());
    assertTrue(plot1.equals(plot2));
    // domainGridlinesVisible
    plot1.setDomainGridlinesVisible(false);
    assertFalse(plot1.equals(plot2));
    plot2.setDomainGridlinesVisible(false);
    assertTrue(plot1.equals(plot2));
    // domainGridlineStroke
    Stroke stroke = new BasicStroke(2.0f);
    plot1.setDomainGridlineStroke(stroke);
    assertFalse(plot1.equals(plot2));
    plot2.setDomainGridlineStroke(stroke);
    assertTrue(plot1.equals(plot2));
    // domainGridlinePaint
    plot1.setDomainGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertFalse(plot1.equals(plot2));
    plot2.setDomainGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.blue, 3.0f, 4.0f, Color.red));
    assertTrue(plot1.equals(plot2));
    // rangeGridlinesVisible
    plot1.setRangeGridlinesVisible(false);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeGridlinesVisible(false);
    assertTrue(plot1.equals(plot2));
    // rangeGridlineStroke
    plot1.setRangeGridlineStroke(stroke);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeGridlineStroke(stroke);
    assertTrue(plot1.equals(plot2));
    // rangeGridlinePaint
    plot1.setRangeGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.green, 3.0f, 4.0f, Color.red));
    assertFalse(plot1.equals(plot2));
    plot2.setRangeGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.green, 3.0f, 4.0f, Color.red));
    assertTrue(plot1.equals(plot2));
    // rangeZeroBaselineVisible
    plot1.setRangeZeroBaselineVisible(true);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeZeroBaselineVisible(true);
    assertTrue(plot1.equals(plot2));
    // rangeZeroBaselineStroke
    plot1.setRangeZeroBaselineStroke(stroke);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeZeroBaselineStroke(stroke);
    assertTrue(plot1.equals(plot2));
    // rangeZeroBaselinePaint
    plot1.setRangeZeroBaselinePaint(new GradientPaint(1.0f, 2.0f, Color.white, 3.0f, 4.0f, Color.red));
    assertFalse(plot1.equals(plot2));
    plot2.setRangeZeroBaselinePaint(new GradientPaint(1.0f, 2.0f, Color.white, 3.0f, 4.0f, Color.red));
    assertTrue(plot1.equals(plot2));
    // rangeCrosshairVisible
    plot1.setRangeCrosshairVisible(true);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeCrosshairVisible(true);
    assertTrue(plot1.equals(plot2));
    // rangeCrosshairValue
    plot1.setRangeCrosshairValue(100.0);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeCrosshairValue(100.0);
    assertTrue(plot1.equals(plot2));
    // rangeCrosshairStroke
    plot1.setRangeCrosshairStroke(stroke);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeCrosshairStroke(stroke);
    assertTrue(plot1.equals(plot2));
    // rangeCrosshairPaint
    plot1.setRangeCrosshairPaint(new GradientPaint(1.0f, 2.0f, Color.pink, 3.0f, 4.0f, Color.red));
    assertFalse(plot1.equals(plot2));
    plot2.setRangeCrosshairPaint(new GradientPaint(1.0f, 2.0f, Color.pink, 3.0f, 4.0f, Color.red));
    assertTrue(plot1.equals(plot2));
    // rangeCrosshairLockedOnData
    plot1.setRangeCrosshairLockedOnData(false);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeCrosshairLockedOnData(false);
    assertTrue(plot1.equals(plot2));
    // range markers
    plot1.addRangeMarker(new ValueMarker(4.0));
    assertFalse(plot1.equals(plot2));
    plot2.addRangeMarker(new ValueMarker(4.0));
    assertTrue(plot1.equals(plot2));
    // secondary range markers
    plot1.addRangeMarker(1, new ValueMarker(4.0), Layer.FOREGROUND);
    assertFalse(plot1.equals(plot2));
    plot2.addRangeMarker(1, new ValueMarker(4.0), Layer.FOREGROUND);
    assertTrue(plot1.equals(plot2));
    plot1.addRangeMarker(1, new ValueMarker(99.0), Layer.BACKGROUND);
    assertFalse(plot1.equals(plot2));
    plot2.addRangeMarker(1, new ValueMarker(99.0), Layer.BACKGROUND);
    assertTrue(plot1.equals(plot2));
    // fixed legend items
    plot1.setFixedLegendItems(new LegendItemCollection());
    assertFalse(plot1.equals(plot2));
    plot2.setFixedLegendItems(new LegendItemCollection());
    assertTrue(plot1.equals(plot2));
    // weight
    plot1.setWeight(3);
    assertFalse(plot1.equals(plot2));
    plot2.setWeight(3);
    assertTrue(plot1.equals(plot2));
    // quadrant origin
    plot1.setQuadrantOrigin(new Point2D.Double(12.3, 45.6));
    assertFalse(plot1.equals(plot2));
    plot2.setQuadrantOrigin(new Point2D.Double(12.3, 45.6));
    assertTrue(plot1.equals(plot2));
    // quadrant paint
    plot1.setQuadrantPaint(0, new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    assertFalse(plot1.equals(plot2));
    plot2.setQuadrantPaint(0, new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    assertTrue(plot1.equals(plot2));
    plot1.setQuadrantPaint(1, new GradientPaint(2.0f, 3.0f, Color.red, 4.0f, 5.0f, Color.blue));
    assertFalse(plot1.equals(plot2));
    plot2.setQuadrantPaint(1, new GradientPaint(2.0f, 3.0f, Color.red, 4.0f, 5.0f, Color.blue));
    assertTrue(plot1.equals(plot2));
    plot1.setQuadrantPaint(2, new GradientPaint(3.0f, 4.0f, Color.red, 5.0f, 6.0f, Color.blue));
    assertFalse(plot1.equals(plot2));
    plot2.setQuadrantPaint(2, new GradientPaint(3.0f, 4.0f, Color.red, 5.0f, 6.0f, Color.blue));
    assertTrue(plot1.equals(plot2));
    plot1.setQuadrantPaint(3, new GradientPaint(4.0f, 5.0f, Color.red, 6.0f, 7.0f, Color.blue));
    assertFalse(plot1.equals(plot2));
    plot2.setQuadrantPaint(3, new GradientPaint(4.0f, 5.0f, Color.red, 6.0f, 7.0f, Color.blue));
    assertTrue(plot1.equals(plot2));
    plot1.setDomainTickBandPaint(Color.red);
    assertFalse(plot1.equals(plot2));
    plot2.setDomainTickBandPaint(Color.red);
    assertTrue(plot1.equals(plot2));
    plot1.setRangeTickBandPaint(Color.blue);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeTickBandPaint(Color.blue);
    assertTrue(plot1.equals(plot2));
    plot1.setDomainMinorGridlinesVisible(true);
    assertFalse(plot1.equals(plot2));
    plot2.setDomainMinorGridlinesVisible(true);
    assertTrue(plot1.equals(plot2));
    plot1.setDomainMinorGridlinePaint(Color.red);
    assertFalse(plot1.equals(plot2));
    plot2.setDomainMinorGridlinePaint(Color.red);
    assertTrue(plot1.equals(plot2));
    plot1.setDomainGridlineStroke(new BasicStroke(1.1f));
    assertFalse(plot1.equals(plot2));
    plot2.setDomainGridlineStroke(new BasicStroke(1.1f));
    assertTrue(plot1.equals(plot2));
    plot1.setRangeMinorGridlinesVisible(true);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeMinorGridlinesVisible(true);
    assertTrue(plot1.equals(plot2));
    plot1.setRangeMinorGridlinePaint(Color.blue);
    assertFalse(plot1.equals(plot2));
    plot2.setRangeMinorGridlinePaint(Color.blue);
    assertTrue(plot1.equals(plot2));
    plot1.setRangeMinorGridlineStroke(new BasicStroke(1.23f));
    assertFalse(plot1.equals(plot2));
    plot2.setRangeMinorGridlineStroke(new BasicStroke(1.23f));
    assertTrue(plot1.equals(plot2));
    List axisIndices = Arrays.asList(new Integer[] { new Integer(0), new Integer(1) });
    plot1.mapDatasetToDomainAxes(0, axisIndices);
    assertFalse(plot1.equals(plot2));
    plot2.mapDatasetToDomainAxes(0, axisIndices);
    assertTrue(plot1.equals(plot2));
    plot1.mapDatasetToRangeAxes(0, axisIndices);
    assertFalse(plot1.equals(plot2));
    plot2.mapDatasetToRangeAxes(0, axisIndices);
    assertTrue(plot1.equals(plot2));
    // shadowGenerator
    plot1.setShadowGenerator(new DefaultShadowGenerator(5, Color.gray, 0.6f, 4, -Math.PI / 4));
    assertFalse(plot1.equals(plot2));
    plot2.setShadowGenerator(new DefaultShadowGenerator(5, Color.gray, 0.6f, 4, -Math.PI / 4));
    assertTrue(plot1.equals(plot2));
    plot1.setShadowGenerator(null);
    assertFalse(plot1.equals(plot2));
    plot2.setShadowGenerator(null);
    assertTrue(plot1.equals(plot2));
    LegendItemCollection lic1 = new LegendItemCollection();
    lic1.add(new LegendItem("XYZ", Color.red));
    plot1.setFixedLegendItems(lic1);
    assertFalse(plot1.equals(plot2));
    LegendItemCollection lic2 = new LegendItemCollection();
    lic2.add(new LegendItem("XYZ", Color.red));
    plot2.setFixedLegendItems(lic2);
    assertTrue(plot1.equals(plot2));
}
Also used : BasicStroke(java.awt.BasicStroke) Stroke(java.awt.Stroke) BasicStroke(java.awt.BasicStroke) NumberAxis(org.jfree.chart.axis.NumberAxis) LegendItemCollection(org.jfree.chart.LegendItemCollection) GradientPaint(java.awt.GradientPaint) DefaultShadowGenerator(org.jfree.chart.util.DefaultShadowGenerator) DefaultXYItemRenderer(org.jfree.chart.renderer.xy.DefaultXYItemRenderer) Point2D(java.awt.geom.Point2D) LegendItem(org.jfree.chart.LegendItem) RectangleInsets(org.jfree.ui.RectangleInsets) List(java.util.List) Test(org.junit.Test)

Aggregations

BasicStroke (java.awt.BasicStroke)3 GradientPaint (java.awt.GradientPaint)3 Stroke (java.awt.Stroke)3 DefaultShadowGenerator (org.jfree.chart.util.DefaultShadowGenerator)3 Test (org.junit.Test)3 LegendItemCollection (org.jfree.chart.LegendItemCollection)2 NumberAxis (org.jfree.chart.axis.NumberAxis)2 RectangleInsets (org.jfree.ui.RectangleInsets)2 Font (java.awt.Font)1 Point2D (java.awt.geom.Point2D)1 Rectangle2D (java.awt.geom.Rectangle2D)1 List (java.util.List)1 LegendItem (org.jfree.chart.LegendItem)1 CategoryTextAnnotation (org.jfree.chart.annotations.CategoryTextAnnotation)1 AxisSpace (org.jfree.chart.axis.AxisSpace)1 CategoryAxis (org.jfree.chart.axis.CategoryAxis)1 StandardPieSectionLabelGenerator (org.jfree.chart.labels.StandardPieSectionLabelGenerator)1 StandardPieToolTipGenerator (org.jfree.chart.labels.StandardPieToolTipGenerator)1 AreaRenderer (org.jfree.chart.renderer.category.AreaRenderer)1 DefaultXYItemRenderer (org.jfree.chart.renderer.xy.DefaultXYItemRenderer)1