org.jfree.chart.labels.StandardXYItemLabelGenerator Java Examples

The following examples show how to use org.jfree.chart.labels.StandardXYItemLabelGenerator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: YIntervalRendererTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Confirm that cloning works.
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    YIntervalRenderer r1 = new YIntervalRenderer();
    YIntervalRenderer r2 = (YIntervalRenderer) r1.clone();
    assertTrue(r1 != r2);
    assertTrue(r1.getClass() == r2.getClass());
    assertTrue(r1.equals(r2));

    // check independence
    r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.FOREGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.FOREGROUND);
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.BACKGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.BACKGROUND);
    assertTrue(r1.equals(r2));

}
 
Example #2
Source File: AbstractXYItemRendererTest.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testEquals_ObjectList() {
    XYBarRenderer r1 = new XYBarRenderer();
    r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    XYBarRenderer r2 = new XYBarRenderer();
    r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertEquals(r1, r2);
    r2.setSeriesItemLabelGenerator(1, new StandardXYItemLabelGenerator("X"));
    assertNotEquals(r1, r2);
}
 
Example #3
Source File: YIntervalRendererTest.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Confirm that cloning works.
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    YIntervalRenderer r1 = new YIntervalRenderer();
    YIntervalRenderer r2 = (YIntervalRenderer) r1.clone();
    assertTrue(r1 != r2);
    assertTrue(r1.getClass() == r2.getClass());
    assertTrue(r1.equals(r2));

    // check independence
    r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.FOREGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.FOREGROUND);
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.BACKGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.BACKGROUND);
    assertTrue(r1.equals(r2));

}
 
Example #4
Source File: Prd4343Test.java    From pentaho-reporting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void testValidateXYLineChartItemLabels() throws ResourceException, Exception {
  final URL url = getClass().getResource( "Prd-4343.prpt" );
  assertNotNull( url );
  final ResourceManager resourceManager = new ResourceManager();
  resourceManager.registerDefaults();
  final Resource directly = resourceManager.createDirectly( url, MasterReport.class );
  final MasterReport report = (MasterReport) directly.getResource();

  LogicalPageBox logicalPageBox = DebugReportRunner.layoutPage( report, 0 );
  final RenderNode renderNode = MatchFactory.findElementByName( logicalPageBox, "xy-chart" );
  assertTrue( renderNode instanceof RenderableReplacedContentBox );

  final RenderableReplacedContentBox xyChart = (RenderableReplacedContentBox) renderNode;
  RenderableReplacedContent xyChartContent = xyChart.getContent();
  assertTrue( xyChartContent.getRawObject() instanceof DrawableWrapper );

  final DrawableWrapper drawable = (DrawableWrapper) xyChartContent.getRawObject();
  assertTrue( drawable.getBackend() instanceof JFreeChartReportDrawable );
  final JFreeChartReportDrawable jFreeChartReportDrawable = (JFreeChartReportDrawable) drawable.getBackend();
  final JFreeChart xyLineChart = jFreeChartReportDrawable.getChart();
  final XYPlot xyLinePlot = xyLineChart.getXYPlot();

  assertTrue( xyLinePlot.getRenderer() instanceof XYLineAndShapeRenderer );
  final XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) xyLinePlot.getRenderer();
  assertNotNull( renderer );
  assertTrue( renderer.getBaseLinesVisible() );
  assertNotNull( renderer.getBaseItemLabelGenerator() );
  assertTrue( renderer.getBaseItemLabelGenerator() instanceof StandardXYItemLabelGenerator );
}
 
Example #5
Source File: YIntervalRendererTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Confirm that cloning works.
 */
public void testCloning() {
    YIntervalRenderer r1 = new YIntervalRenderer();
    YIntervalRenderer r2 = null;
    try {
        r2 = (YIntervalRenderer) r1.clone();
    }
    catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    assertTrue(r1 != r2);
    assertTrue(r1.getClass() == r2.getClass());
    assertTrue(r1.equals(r2));
    
    // check independence
    r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));
    
    r1.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));
    
    r1.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0), 
            Layer.FOREGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0), 
            Layer.FOREGROUND);
    assertTrue(r1.equals(r2));
    
    r1.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0), 
            Layer.BACKGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0), 
            Layer.BACKGROUND);
    assertTrue(r1.equals(r2));

}
 
Example #6
Source File: StandardXYItemLabelGeneratorTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Simple check that hashCode is implemented.
 */
public void testHashCode() {
    StandardXYItemLabelGenerator g1
            = new StandardXYItemLabelGenerator();
    StandardXYItemLabelGenerator g2
            = new StandardXYItemLabelGenerator();
    assertTrue(g1.equals(g2));
    assertTrue(g1.hashCode() == g2.hashCode());
}
 
Example #7
Source File: YIntervalRendererTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Confirm that cloning works.
 */
public void testCloning() {
    YIntervalRenderer r1 = new YIntervalRenderer();
    YIntervalRenderer r2 = null;
    try {
        r2 = (YIntervalRenderer) r1.clone();
    }
    catch (CloneNotSupportedException e) {
        e.printStackTrace();
    }
    assertTrue(r1 != r2);
    assertTrue(r1.getClass() == r2.getClass());
    assertTrue(r1.equals(r2));

    // check independence
    r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.FOREGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.FOREGROUND);
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.BACKGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.BACKGROUND);
    assertTrue(r1.equals(r2));

}
 
Example #8
Source File: AbstractXYItemRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
@Test
public void testEquals_ObjectList() {
    XYBarRenderer r1 = new XYBarRenderer();
    r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    XYBarRenderer r2 = new XYBarRenderer();
    r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertEquals(r1, r2);
    r2.setSeriesItemLabelGenerator(1, new StandardXYItemLabelGenerator("X"));
    assertNotEquals(r1, r2);
}
 
Example #9
Source File: YIntervalRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Confirm that cloning works.
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    YIntervalRenderer r1 = new YIntervalRenderer();
    YIntervalRenderer r2 = (YIntervalRenderer) r1.clone();
    assertTrue(r1 != r2);
    assertTrue(r1.getClass() == r2.getClass());
    assertTrue(r1.equals(r2));

    // check independence
    r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.FOREGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.FOREGROUND);
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.BACKGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.BACKGROUND);
    assertTrue(r1.equals(r2));

}
 
Example #10
Source File: XYItemLabelGenerator.java    From openbd-core with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Tests this object for equality with an arbitrary object.
 *
 * @param obj  the other object (<code>null</code> permitted).
 *
 * @return A boolean.
 */
public boolean equals(Object obj) {
    if (obj == this) {
        return true;
    }
    if (obj instanceof StandardXYItemLabelGenerator) {
        return super.equals(obj);
    }
    return false;
}
 
Example #11
Source File: AbstractXYItemRendererTest.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
@Test
public void testEquals_ObjectList() {
    XYBarRenderer r1 = new XYBarRenderer();
    r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    XYBarRenderer r2 = new XYBarRenderer();
    r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertEquals(r1, r2);
    r2.setSeriesItemLabelGenerator(1, new StandardXYItemLabelGenerator("X"));
    assertNotEquals(r1, r2);
}
 
Example #12
Source File: YIntervalRendererTest.java    From SIMVA-SoS with Apache License 2.0 5 votes vote down vote up
/**
 * Confirm that cloning works.
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    YIntervalRenderer r1 = new YIntervalRenderer();
    YIntervalRenderer r2 = (YIntervalRenderer) r1.clone();
    assertTrue(r1 != r2);
    assertTrue(r1.getClass() == r2.getClass());
    assertTrue(r1.equals(r2));

    // check independence
    r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.FOREGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.FOREGROUND);
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.BACKGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.BACKGROUND);
    assertTrue(r1.equals(r2));

}
 
Example #13
Source File: AbstractXYItemRendererTest.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testEquals_ObjectList() {
    XYBarRenderer r1 = new XYBarRenderer();
    r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    XYBarRenderer r2 = new XYBarRenderer();
    r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertEquals(r1, r2);
    r2.setSeriesItemLabelGenerator(1, new StandardXYItemLabelGenerator("X"));
    assertNotEquals(r1, r2);
}
 
Example #14
Source File: YIntervalRendererTest.java    From ccu-historian with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Confirm that cloning works.
 */
@Test
public void testCloning() throws CloneNotSupportedException {
    YIntervalRenderer r1 = new YIntervalRenderer();
    YIntervalRenderer r2 = (YIntervalRenderer) r1.clone();
    assertTrue(r1 != r2);
    assertTrue(r1.getClass() == r2.getClass());
    assertTrue(r1.equals(r2));

    // check independence
    r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.FOREGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.FOREGROUND);
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.BACKGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("ABC", 1.0, 2.0),
            Layer.BACKGROUND);
    assertTrue(r1.equals(r2));

}
 
Example #15
Source File: AbstractXYItemRendererTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testEquals_ObjectList() {
    XYBarRenderer r1 = new XYBarRenderer();
    r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    XYBarRenderer r2 = new XYBarRenderer();
    r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertEquals(r1, r2);
    r2.setSeriesItemLabelGenerator(1, new StandardXYItemLabelGenerator("X"));
    assertNotEquals(r1, r2);
}
 
Example #16
Source File: MDSDemo.java    From COMP6237 with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public Component getComponent(int width, int height) throws IOException {
	final JPanel base = new JPanel();
	base.setOpaque(false);
	base.setPreferredSize(new Dimension(width, height));
	base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));

	chart = ChartFactory.createScatterPlot("", "", "", dataset, PlotOrientation.VERTICAL, false, false, false);

	final XYItemRenderer renderer = new XYLineAndShapeRenderer(false, true) {
		private static final long serialVersionUID = 1L;

		@Override
		public ItemLabelPosition getPositiveItemLabelPosition(int row, int column) {
			return new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_LEFT);
		}
	};
	final Font font = Font.decode("Helvetica Neue-22");
	renderer.setBaseItemLabelFont(font);
	chart.getXYPlot().setRenderer(renderer);
	// chart.getXYPlot().getDomainAxis().setRange(-0.5, 5.5)
	chart.getXYPlot().getDomainAxis().setTickLabelFont(font);
	// chart.getXYPlot().getDomainAxis().setTickUnit(new NumberTickUnit(1))
	// chart.getXYPlot().getRangeAxis().setRange(-0.5, 5.5)
	chart.getXYPlot().getRangeAxis().setTickLabelFont(font);
	// chart.getXYPlot().getRangeAxis().setTickUnit(new NumberTickUnit(1))

	chart.getXYPlot().getRenderer().setBaseItemLabelGenerator(new StandardXYItemLabelGenerator() {
		private static final long serialVersionUID = 1L;

		@Override
		public String generateLabel(XYDataset ds, int series, int item) {
			return ((Dataset) ds).getLabel(series, item);
		};
	});
	chart.getXYPlot().getRenderer().setBaseItemLabelsVisible(true);

	chartPanel = new ChartPanel(chart);
	chart.setBackgroundPaint(new java.awt.Color(255, 255, 255, 255));
	chart.getXYPlot().setBackgroundPaint(java.awt.Color.WHITE);
	chart.getXYPlot().setRangeGridlinePaint(java.awt.Color.GRAY);
	chart.getXYPlot().setDomainGridlinePaint(java.awt.Color.GRAY);

	chartPanel.setSize(width, height - 50);
	chartPanel.setPreferredSize(chartPanel.getSize());
	base.add(chartPanel);

	final JPanel controls = new JPanel();
	controls.setPreferredSize(new Dimension(width, 50));
	controls.setMaximumSize(new Dimension(width, 50));
	controls.setSize(new Dimension(width, 50));

	controls.add(new JSeparator(SwingConstants.VERTICAL));
	controls.add(new JLabel("Distance:"));

	distCombo = new JComboBox<String>();
	distCombo.addItem("Euclidean");
	distCombo.addItem("1-Pearson");
	distCombo.addItem("1-Cosine");
	controls.add(distCombo);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	runBtn = new JButton("Run MDS");
	runBtn.setActionCommand("button.run");
	runBtn.addActionListener(this);
	controls.add(runBtn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	cnclBtn = new JButton("Cancel");
	cnclBtn.setEnabled(false);
	cnclBtn.setActionCommand("button.cancel");
	cnclBtn.addActionListener(this);
	controls.add(cnclBtn);

	base.add(controls);

	controls.add(new JSeparator(SwingConstants.VERTICAL));
	iterLabel = new JLabel("                         ");
	final Dimension size = iterLabel.getPreferredSize();
	iterLabel.setMinimumSize(size);
	iterLabel.setPreferredSize(size);
	controls.add(iterLabel);

	updateImage();

	return base;
}
 
Example #17
Source File: TSNEDemo.java    From COMP6237 with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public Component getComponent(int width, int height) throws IOException {
	final JPanel base = new JPanel();
	base.setOpaque(false);
	base.setPreferredSize(new Dimension(width, height));
	base.setLayout(new BoxLayout(base, BoxLayout.Y_AXIS));

	chart = ChartFactory.createScatterPlot("", "", "", dataset, PlotOrientation.VERTICAL, false, false, false);

	final XYItemRenderer renderer = new XYLineAndShapeRenderer(false, true) {
		private static final long serialVersionUID = 1L;

		@Override
		public ItemLabelPosition getPositiveItemLabelPosition(int row, int column) {
			return new ItemLabelPosition(ItemLabelAnchor.OUTSIDE6, TextAnchor.TOP_LEFT);
		}
	};
	final Font font = Font.decode("Helvetica Neue-22");
	renderer.setBaseItemLabelFont(font);
	chart.getXYPlot().setRenderer(renderer);
	// chart.getXYPlot().getDomainAxis().setRange(-0.5, 5.5)
	chart.getXYPlot().getDomainAxis().setTickLabelFont(font);
	// chart.getXYPlot().getDomainAxis().setTickUnit(new NumberTickUnit(1))
	// chart.getXYPlot().getRangeAxis().setRange(-0.5, 5.5)
	chart.getXYPlot().getRangeAxis().setTickLabelFont(font);
	// chart.getXYPlot().getRangeAxis().setTickUnit(new NumberTickUnit(1))

	chart.getXYPlot().getRenderer().setBaseItemLabelGenerator(new StandardXYItemLabelGenerator() {
		private static final long serialVersionUID = 1L;

		@Override
		public String generateLabel(XYDataset ds, int series, int item) {
			return ((Dataset) ds).getLabel(series, item);
		};
	});
	chart.getXYPlot().getRenderer().setBaseItemLabelsVisible(true);

	chartPanel = new ChartPanel(chart);
	chart.setBackgroundPaint(new java.awt.Color(255, 255, 255, 255));
	chart.getXYPlot().setBackgroundPaint(java.awt.Color.WHITE);
	chart.getXYPlot().setRangeGridlinePaint(java.awt.Color.GRAY);
	chart.getXYPlot().setDomainGridlinePaint(java.awt.Color.GRAY);

	chartPanel.setSize(width, height - 50);
	chartPanel.setPreferredSize(chartPanel.getSize());
	base.add(chartPanel);

	final JPanel controls = new JPanel();
	controls.setPreferredSize(new Dimension(width, 50));
	controls.setMaximumSize(new Dimension(width, 50));
	controls.setSize(new Dimension(width, 50));

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	runBtn = new JButton("Run t-SNE");
	runBtn.setActionCommand("button.run");
	runBtn.addActionListener(this);
	controls.add(runBtn);

	controls.add(new JSeparator(SwingConstants.VERTICAL));

	cnclBtn = new JButton("Cancel");
	cnclBtn.setEnabled(false);
	cnclBtn.setActionCommand("button.cancel");
	cnclBtn.addActionListener(this);
	controls.add(cnclBtn);

	base.add(controls);

	controls.add(new JSeparator(SwingConstants.VERTICAL));
	iterLabel = new JLabel("                         ");
	final Dimension size = iterLabel.getPreferredSize();
	iterLabel.setMinimumSize(size);
	iterLabel.setPreferredSize(size);
	controls.add(iterLabel);

	updateImage();

	return base;
}
 
Example #18
Source File: YIntervalRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Check that the equals() method distinguishes all fields.
 */
@Test
public void testEquals() {
    YIntervalRenderer r1 = new YIntervalRenderer();
    YIntervalRenderer r2 = new YIntervalRenderer();
    assertEquals(r1, r2);

    // the following fields are inherited from the AbstractXYItemRenderer
    r1.setItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setToolTipGenerator(new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setToolTipGenerator(new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.setURLGenerator(new StandardXYURLGenerator());
    assertFalse(r1.equals(r2));
    r2.setURLGenerator(new StandardXYURLGenerator());
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.FOREGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.FOREGROUND);
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.BACKGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.BACKGROUND);
    assertTrue(r1.equals(r2));

    r1.setDefaultEntityRadius(99);
    assertFalse(r1.equals(r2));
    r2.setDefaultEntityRadius(99);
    assertTrue(r1.equals(r2));

    r1.setLegendItemLabelGenerator(new StandardXYSeriesLabelGenerator(
            "{0} {1}"));
    assertFalse(r1.equals(r2));
    r2.setLegendItemLabelGenerator(new StandardXYSeriesLabelGenerator(
            "{0} {1}"));
    assertTrue(r1.equals(r2));

    r1.setLegendItemToolTipGenerator(new StandardXYSeriesLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setLegendItemToolTipGenerator(new StandardXYSeriesLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setLegendItemURLGenerator(new StandardXYSeriesLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setLegendItemURLGenerator(new StandardXYSeriesLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setAdditionalItemLabelGenerator(new IntervalXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setAdditionalItemLabelGenerator(new IntervalXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

}
 
Example #19
Source File: YIntervalRendererTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Check that the equals() method distinguishes all fields.
 */
public void testEquals() {
    YIntervalRenderer r1 = new YIntervalRenderer();
    YIntervalRenderer r2 = new YIntervalRenderer();
    assertEquals(r1, r2);

    // the following fields are inherited from the AbstractXYItemRenderer
    r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.setSeriesURLGenerator(0, new StandardXYURLGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesURLGenerator(0, new StandardXYURLGenerator());
    assertTrue(r1.equals(r2));

    r1.setBaseURLGenerator(new StandardXYURLGenerator());
    assertFalse(r1.equals(r2));
    r2.setBaseURLGenerator(new StandardXYURLGenerator());
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.FOREGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.FOREGROUND);
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.BACKGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.BACKGROUND);
    assertTrue(r1.equals(r2));

    r1.setDefaultEntityRadius(99);
    assertFalse(r1.equals(r2));
    r2.setDefaultEntityRadius(99);
    assertTrue(r1.equals(r2));

    r1.setLegendItemLabelGenerator(new StandardXYSeriesLabelGenerator(
            "{0} {1}"));
    assertFalse(r1.equals(r2));
    r2.setLegendItemLabelGenerator(new StandardXYSeriesLabelGenerator(
            "{0} {1}"));
    assertTrue(r1.equals(r2));

    r1.setLegendItemToolTipGenerator(new StandardXYSeriesLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setLegendItemToolTipGenerator(new StandardXYSeriesLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setLegendItemURLGenerator(new StandardXYSeriesLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setLegendItemURLGenerator(new StandardXYSeriesLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setAdditionalItemLabelGenerator(new IntervalXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setAdditionalItemLabelGenerator(new IntervalXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

}
 
Example #20
Source File: YIntervalRendererTest.java    From SIMVA-SoS with Apache License 2.0 4 votes vote down vote up
/**
 * Check that the equals() method distinguishes all fields.
 */
@Test
public void testEquals() {
    YIntervalRenderer r1 = new YIntervalRenderer();
    YIntervalRenderer r2 = new YIntervalRenderer();
    assertEquals(r1, r2);

    // the following fields are inherited from the AbstractXYItemRenderer
    r1.setItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setToolTipGenerator(new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setToolTipGenerator(new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.setURLGenerator(new StandardXYURLGenerator());
    assertFalse(r1.equals(r2));
    r2.setURLGenerator(new StandardXYURLGenerator());
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.FOREGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.FOREGROUND);
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.BACKGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.BACKGROUND);
    assertTrue(r1.equals(r2));

    r1.setDefaultEntityRadius(99);
    assertFalse(r1.equals(r2));
    r2.setDefaultEntityRadius(99);
    assertTrue(r1.equals(r2));

    r1.setLegendItemLabelGenerator(new StandardXYSeriesLabelGenerator(
            "{0} {1}"));
    assertFalse(r1.equals(r2));
    r2.setLegendItemLabelGenerator(new StandardXYSeriesLabelGenerator(
            "{0} {1}"));
    assertTrue(r1.equals(r2));

    r1.setLegendItemToolTipGenerator(new StandardXYSeriesLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setLegendItemToolTipGenerator(new StandardXYSeriesLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setLegendItemURLGenerator(new StandardXYSeriesLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setLegendItemURLGenerator(new StandardXYSeriesLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setAdditionalItemLabelGenerator(new IntervalXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setAdditionalItemLabelGenerator(new IntervalXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

}
 
Example #21
Source File: StandardXYItemLabelGeneratorTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Check to ensure that this class implements PublicCloneable.
 */
public void testPublicCloneable() {
    StandardXYItemLabelGenerator g1 = new StandardXYItemLabelGenerator();
    assertTrue(g1 instanceof PublicCloneable);
}
 
Example #22
Source File: YIntervalRendererTests.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Check that the equals() method distinguishes all fields.
 */
public void testEquals() {
    YIntervalRenderer r1 = new YIntervalRenderer();
    YIntervalRenderer r2 = new YIntervalRenderer();
    assertEquals(r1, r2);
    
    // the following fields are inherited from the AbstractXYItemRenderer
    r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));
    
    r1.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));
    
    r1.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));
    
    r1.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));
    
    r1.setSeriesURLGenerator(0, new StandardXYURLGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesURLGenerator(0, new StandardXYURLGenerator());
    assertTrue(r1.equals(r2));
    
    r1.setBaseURLGenerator(new StandardXYURLGenerator());
    assertFalse(r1.equals(r2));
    r2.setBaseURLGenerator(new StandardXYURLGenerator());
    assertTrue(r1.equals(r2));
    
    r1.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.FOREGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.FOREGROUND);
    assertTrue(r1.equals(r2));
    
    r1.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.BACKGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.BACKGROUND);
    assertTrue(r1.equals(r2));
    
    r1.setDefaultEntityRadius(99);
    assertFalse(r1.equals(r2));
    r2.setDefaultEntityRadius(99);
    assertTrue(r1.equals(r2));
    
    r1.setLegendItemLabelGenerator(new StandardXYSeriesLabelGenerator(
            "{0} {1}"));
    assertFalse(r1.equals(r2));
    r2.setLegendItemLabelGenerator(new StandardXYSeriesLabelGenerator(
            "{0} {1}"));
    assertTrue(r1.equals(r2));
    
    r1.setLegendItemToolTipGenerator(new StandardXYSeriesLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setLegendItemToolTipGenerator(new StandardXYSeriesLabelGenerator());
    assertTrue(r1.equals(r2));
    
    r1.setLegendItemURLGenerator(new StandardXYSeriesLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setLegendItemURLGenerator(new StandardXYSeriesLabelGenerator());
    assertTrue(r1.equals(r2));
}
 
Example #23
Source File: YIntervalRendererTest.java    From ccu-historian with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Check that the equals() method distinguishes all fields.
 */
@Test
public void testEquals() {
    YIntervalRenderer r1 = new YIntervalRenderer();
    YIntervalRenderer r2 = new YIntervalRenderer();
    assertEquals(r1, r2);

    // the following fields are inherited from the AbstractXYItemRenderer
    r1.setItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setToolTipGenerator(new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setToolTipGenerator(new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.setURLGenerator(new StandardXYURLGenerator());
    assertFalse(r1.equals(r2));
    r2.setURLGenerator(new StandardXYURLGenerator());
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.FOREGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.FOREGROUND);
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.BACKGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.BACKGROUND);
    assertTrue(r1.equals(r2));

    r1.setDefaultEntityRadius(99);
    assertFalse(r1.equals(r2));
    r2.setDefaultEntityRadius(99);
    assertTrue(r1.equals(r2));

    r1.setLegendItemLabelGenerator(new StandardXYSeriesLabelGenerator(
            "{0} {1}"));
    assertFalse(r1.equals(r2));
    r2.setLegendItemLabelGenerator(new StandardXYSeriesLabelGenerator(
            "{0} {1}"));
    assertTrue(r1.equals(r2));

    r1.setLegendItemToolTipGenerator(new StandardXYSeriesLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setLegendItemToolTipGenerator(new StandardXYSeriesLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setLegendItemURLGenerator(new StandardXYSeriesLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setLegendItemURLGenerator(new StandardXYSeriesLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setAdditionalItemLabelGenerator(new IntervalXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setAdditionalItemLabelGenerator(new IntervalXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

}
 
Example #24
Source File: YIntervalRendererTest.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Check that the equals() method distinguishes all fields.
 */
@Test
public void testEquals() {
    YIntervalRenderer r1 = new YIntervalRenderer();
    YIntervalRenderer r2 = new YIntervalRenderer();
    assertEquals(r1, r2);

    // the following fields are inherited from the AbstractXYItemRenderer
    r1.setItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setToolTipGenerator(new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setToolTipGenerator(new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.setURLGenerator(new StandardXYURLGenerator());
    assertFalse(r1.equals(r2));
    r2.setURLGenerator(new StandardXYURLGenerator());
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.FOREGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.FOREGROUND);
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.BACKGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.BACKGROUND);
    assertTrue(r1.equals(r2));

    r1.setDefaultEntityRadius(99);
    assertFalse(r1.equals(r2));
    r2.setDefaultEntityRadius(99);
    assertTrue(r1.equals(r2));

    r1.setLegendItemLabelGenerator(new StandardXYSeriesLabelGenerator(
            "{0} {1}"));
    assertFalse(r1.equals(r2));
    r2.setLegendItemLabelGenerator(new StandardXYSeriesLabelGenerator(
            "{0} {1}"));
    assertTrue(r1.equals(r2));

    r1.setLegendItemToolTipGenerator(new StandardXYSeriesLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setLegendItemToolTipGenerator(new StandardXYSeriesLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setLegendItemURLGenerator(new StandardXYSeriesLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setLegendItemURLGenerator(new StandardXYSeriesLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setAdditionalItemLabelGenerator(new IntervalXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setAdditionalItemLabelGenerator(new IntervalXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

}
 
Example #25
Source File: YIntervalRendererTest.java    From openstock with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Check that the equals() method distinguishes all fields.
 */
@Test
public void testEquals() {
    YIntervalRenderer r1 = new YIntervalRenderer();
    YIntervalRenderer r2 = new YIntervalRenderer();
    assertEquals(r1, r2);

    // the following fields are inherited from the AbstractXYItemRenderer
    r1.setItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesItemLabelGenerator(0, new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setBaseItemLabelGenerator(new StandardXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setToolTipGenerator(new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setToolTipGenerator(new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesToolTipGenerator(0, new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setBaseToolTipGenerator(new StandardXYToolTipGenerator());
    assertTrue(r1.equals(r2));

    r1.setURLGenerator(new StandardXYURLGenerator());
    assertFalse(r1.equals(r2));
    r2.setURLGenerator(new StandardXYURLGenerator());
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.FOREGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.FOREGROUND);
    assertTrue(r1.equals(r2));

    r1.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.BACKGROUND);
    assertFalse(r1.equals(r2));
    r2.addAnnotation(new XYTextAnnotation("X", 1.0, 2.0), Layer.BACKGROUND);
    assertTrue(r1.equals(r2));

    r1.setDefaultEntityRadius(99);
    assertFalse(r1.equals(r2));
    r2.setDefaultEntityRadius(99);
    assertTrue(r1.equals(r2));

    r1.setLegendItemLabelGenerator(new StandardXYSeriesLabelGenerator(
            "{0} {1}"));
    assertFalse(r1.equals(r2));
    r2.setLegendItemLabelGenerator(new StandardXYSeriesLabelGenerator(
            "{0} {1}"));
    assertTrue(r1.equals(r2));

    r1.setLegendItemToolTipGenerator(new StandardXYSeriesLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setLegendItemToolTipGenerator(new StandardXYSeriesLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setLegendItemURLGenerator(new StandardXYSeriesLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setLegendItemURLGenerator(new StandardXYSeriesLabelGenerator());
    assertTrue(r1.equals(r2));

    r1.setAdditionalItemLabelGenerator(new IntervalXYItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setAdditionalItemLabelGenerator(new IntervalXYItemLabelGenerator());
    assertTrue(r1.equals(r2));

}