Package org.jfree.chart.labels

Examples of org.jfree.chart.labels.IntervalCategoryLabelGenerator


    /**
     * Tests the equals() method.
     */
    public void testEquals() {
       
        IntervalCategoryLabelGenerator g1 = new IntervalCategoryLabelGenerator();
        IntervalCategoryLabelGenerator g2 = new IntervalCategoryLabelGenerator();
        assertTrue(g1.equals(g2));
        assertTrue(g2.equals(g1));
       
        g1 = new IntervalCategoryLabelGenerator("{3} - {4}", new DecimalFormat("0.000"));
        assertFalse(g1.equals(g2));
        g2 = new IntervalCategoryLabelGenerator("{3} - {4}", new DecimalFormat("0.000"));
        assertTrue(g1.equals(g2));
       
        g1 = new IntervalCategoryLabelGenerator("{3} - {4}", new SimpleDateFormat("d-MMM"));
        assertFalse(g1.equals(g2));
        g2 = new IntervalCategoryLabelGenerator("{3} - {4}", new SimpleDateFormat("d-MMM"));
        assertTrue(g1.equals(g2));
       
    }
View Full Code Here


    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        IntervalCategoryLabelGenerator g1 = new IntervalCategoryLabelGenerator();
        IntervalCategoryLabelGenerator g2 = null;
        try {
            g2 = (IntervalCategoryLabelGenerator) g1.clone();
        }
        catch (CloneNotSupportedException e) {
            System.err.println("IntervalCategoryItemLabelGenerator.testCloning: failed to clone.");
        }
        assertTrue(g1 != g2);
        assertTrue(g1.getClass() == g2.getClass());
        assertTrue(g1.equals(g2));
    }
View Full Code Here

    /**
     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {

        IntervalCategoryLabelGenerator g1
            = new IntervalCategoryLabelGenerator("{3} - {4}", DateFormat.getInstance());
        IntervalCategoryLabelGenerator g2 = null;

        try {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(g1);
View Full Code Here

     * Confirm that cloning works.
     */
    public void testCloning2() {
       
        BarRenderer r1 = new BarRenderer();
        r1.setLabelGenerator(new IntervalCategoryLabelGenerator());
        BarRenderer r2 = null;
        try {
            r2 = (BarRenderer) r1.clone();
        }
        catch (CloneNotSupportedException e) {
            System.err.println("AbstractCategoryItemRendererTests.testCloning: failed to clone.");
        }
        assertTrue(r1 != r2);
        assertTrue(r1.getClass() == r2.getClass());
        assertTrue(r1.equals(r2));
       
        r1 = new BarRenderer();
        r1.setSeriesLabelGenerator(0, new IntervalCategoryLabelGenerator());
        r2 = null;
        try {
            r2 = (BarRenderer) r1.clone();
        }
        catch (CloneNotSupportedException e) {
            System.err.println("AbstractCategoryItemRendererTests.testCloning: failed to clone.");
        }
        assertTrue(r1 != r2);
        assertTrue(r1.getClass() == r2.getClass());
        assertTrue(r1.equals(r2));
       
        r1 = new BarRenderer();
        r1.setBaseLabelGenerator(new IntervalCategoryLabelGenerator());
        r2 = null;
        try {
            r2 = (BarRenderer) r1.clone();
        }
        catch (CloneNotSupportedException e) {
View Full Code Here

TOP

Related Classes of org.jfree.chart.labels.IntervalCategoryLabelGenerator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.