Search in sources :

Example 1 with StandardCategorySeriesLabelGenerator

use of org.jfree.chart.labels.StandardCategorySeriesLabelGenerator in project SIMVA-SoS by SESoS.

the class AbstractCategoryItemRendererTest method testCloning_LegendItemToolTipGenerator.

/**
 * Check that the legendItemToolTipGenerator is cloned.
 */
@Test
public void testCloning_LegendItemToolTipGenerator() throws CloneNotSupportedException {
    StandardCategorySeriesLabelGenerator generator = new StandardCategorySeriesLabelGenerator("Series {0}");
    BarRenderer r1 = new BarRenderer();
    r1.setLegendItemToolTipGenerator(generator);
    BarRenderer r2 = (BarRenderer) r1.clone();
    assertTrue(r1 != r2);
    assertTrue(r1.getClass() == r2.getClass());
    assertTrue(r1.equals(r2));
    // check that the generator has been cloned
    assertTrue(r1.getLegendItemToolTipGenerator() != r2.getLegendItemToolTipGenerator());
}
Also used : StandardCategorySeriesLabelGenerator(org.jfree.chart.labels.StandardCategorySeriesLabelGenerator) Test(org.junit.Test)

Example 2 with StandardCategorySeriesLabelGenerator

use of org.jfree.chart.labels.StandardCategorySeriesLabelGenerator in project SIMVA-SoS by SESoS.

the class AbstractCategoryItemRendererTest method testEquals.

/**
 * Checks that all fields are distinguished.
 */
@Test
public void testEquals() {
    BarRenderer r1 = new BarRenderer();
    BarRenderer r2 = new BarRenderer();
    assertEquals(r1, r2);
    // the plot field is NOT tested
    // toolTipGenerator
    r1.setToolTipGenerator(new StandardCategoryToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setToolTipGenerator(new StandardCategoryToolTipGenerator());
    assertTrue(r1.equals(r2));
    // toolTipGeneratorList
    r1.setSeriesToolTipGenerator(1, new StandardCategoryToolTipGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesToolTipGenerator(1, new StandardCategoryToolTipGenerator());
    assertTrue(r1.equals(r2));
    // baseToolTipGenerator
    r1.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator("{2}", NumberFormat.getInstance()));
    assertFalse(r1.equals(r2));
    r2.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator("{2}", NumberFormat.getInstance()));
    assertTrue(r1.equals(r2));
    // itemLabelGenerator
    r1.setItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setItemLabelGenerator(new StandardCategoryItemLabelGenerator());
    assertTrue(r1.equals(r2));
    // itemLabelGeneratorList
    r1.setSeriesItemLabelGenerator(1, new StandardCategoryItemLabelGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesItemLabelGenerator(1, new StandardCategoryItemLabelGenerator());
    assertTrue(r1.equals(r2));
    // baseItemLabelGenerator
    r1.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", NumberFormat.getInstance()));
    assertFalse(r1.equals(r2));
    r2.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator("{2}", NumberFormat.getInstance()));
    assertTrue(r1.equals(r2));
    // urlGenerator
    r1.setItemURLGenerator(new StandardCategoryURLGenerator());
    assertFalse(r1.equals(r2));
    r2.setItemURLGenerator(new StandardCategoryURLGenerator());
    assertTrue(r1.equals(r2));
    // urlGeneratorList
    r1.setSeriesItemURLGenerator(1, new StandardCategoryURLGenerator());
    assertFalse(r1.equals(r2));
    r2.setSeriesItemURLGenerator(1, new StandardCategoryURLGenerator());
    assertTrue(r1.equals(r2));
    // baseItemURLGenerator
    r1.setBaseItemURLGenerator(new StandardCategoryURLGenerator("abc.html"));
    assertFalse(r1.equals(r2));
    r2.setBaseItemURLGenerator(new StandardCategoryURLGenerator("abc.html"));
    assertTrue(r1.equals(r2));
    // legendItemLabelGenerator
    r1.setLegendItemLabelGenerator(new StandardCategorySeriesLabelGenerator("XYZ"));
    assertFalse(r1.equals(r2));
    r2.setLegendItemLabelGenerator(new StandardCategorySeriesLabelGenerator("XYZ"));
    assertTrue(r1.equals(r2));
    // legendItemToolTipGenerator
    r1.setLegendItemToolTipGenerator(new StandardCategorySeriesLabelGenerator("ToolTip"));
    assertFalse(r1.equals(r2));
    r2.setLegendItemToolTipGenerator(new StandardCategorySeriesLabelGenerator("ToolTip"));
    assertTrue(r1.equals(r2));
    // legendItemURLGenerator
    r1.setLegendItemURLGenerator(new StandardCategorySeriesLabelGenerator("URL"));
    assertFalse(r1.equals(r2));
    r2.setLegendItemURLGenerator(new StandardCategorySeriesLabelGenerator("URL"));
    assertTrue(r1.equals(r2));
}
Also used : StandardCategoryItemLabelGenerator(org.jfree.chart.labels.StandardCategoryItemLabelGenerator) StandardCategoryToolTipGenerator(org.jfree.chart.labels.StandardCategoryToolTipGenerator) StandardCategoryURLGenerator(org.jfree.chart.urls.StandardCategoryURLGenerator) StandardCategorySeriesLabelGenerator(org.jfree.chart.labels.StandardCategorySeriesLabelGenerator) Test(org.junit.Test)

Example 3 with StandardCategorySeriesLabelGenerator

use of org.jfree.chart.labels.StandardCategorySeriesLabelGenerator in project SIMVA-SoS by SESoS.

the class AbstractCategoryItemRendererTest method testCloning_LegendItemURLGenerator.

/**
 * Check that the legendItemURLGenerator is cloned.
 */
@Test
public void testCloning_LegendItemURLGenerator() throws CloneNotSupportedException {
    StandardCategorySeriesLabelGenerator generator = new StandardCategorySeriesLabelGenerator("Series {0}");
    BarRenderer r1 = new BarRenderer();
    r1.setLegendItemURLGenerator(generator);
    BarRenderer r2 = (BarRenderer) r1.clone();
    assertTrue(r1 != r2);
    assertTrue(r1.getClass() == r2.getClass());
    assertTrue(r1.equals(r2));
    // check that the generator has been cloned
    assertTrue(r1.getLegendItemURLGenerator() != r2.getLegendItemURLGenerator());
}
Also used : StandardCategorySeriesLabelGenerator(org.jfree.chart.labels.StandardCategorySeriesLabelGenerator) Test(org.junit.Test)

Example 4 with StandardCategorySeriesLabelGenerator

use of org.jfree.chart.labels.StandardCategorySeriesLabelGenerator in project SIMVA-SoS by SESoS.

the class AbstractCategoryItemRendererTest method testCloning_LegendItemLabelGenerator.

/**
 * Check that the legendItemLabelGenerator is cloned.
 */
@Test
public void testCloning_LegendItemLabelGenerator() throws CloneNotSupportedException {
    StandardCategorySeriesLabelGenerator generator = new StandardCategorySeriesLabelGenerator("Series {0}");
    BarRenderer r1 = new BarRenderer();
    r1.setLegendItemLabelGenerator(generator);
    BarRenderer r2 = (BarRenderer) r1.clone();
    assertTrue(r1 != r2);
    assertTrue(r1.getClass() == r2.getClass());
    assertTrue(r1.equals(r2));
    // check that the generator has been cloned
    assertTrue(r1.getLegendItemLabelGenerator() != r2.getLegendItemLabelGenerator());
}
Also used : StandardCategorySeriesLabelGenerator(org.jfree.chart.labels.StandardCategorySeriesLabelGenerator) Test(org.junit.Test)

Aggregations

StandardCategorySeriesLabelGenerator (org.jfree.chart.labels.StandardCategorySeriesLabelGenerator)4 Test (org.junit.Test)4 StandardCategoryItemLabelGenerator (org.jfree.chart.labels.StandardCategoryItemLabelGenerator)1 StandardCategoryToolTipGenerator (org.jfree.chart.labels.StandardCategoryToolTipGenerator)1 StandardCategoryURLGenerator (org.jfree.chart.urls.StandardCategoryURLGenerator)1