Examples of LookupPaintScale


Examples of org.jfree.chart.renderer.LookupPaintScale

   
    /**
     * Serialize an instance, restore it, and check for equality.
     */
    public void testSerialization() {
        LookupPaintScale g1 = new LookupPaintScale();
        LookupPaintScale g2 = null;
        try {
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
            ObjectOutput out = new ObjectOutputStream(buffer);
            out.writeObject(g1);
            out.close();

            ObjectInput in = new ObjectInputStream(
                    new ByteArrayInputStream(buffer.toByteArray()));
            g2 = (LookupPaintScale) in.readObject();
            in.close();
        }
        catch (Exception e) {
            e.printStackTrace();
        }
        assertEquals(g1, g2);      
       
        g1 = new LookupPaintScale(1.0, 2.0, new GradientPaint(1.0f, 2.0f,
                Color.red, 3.0f, 4.0f, Color.yellow));
        g1.add(new Double(1.5), new GradientPaint(1.1f, 2.2f, Color.red, 3.3f,
                4.4f, Color.blue));
        g2 = null;
        try {
View Full Code Here

Examples of org.jfree.chart.renderer.LookupPaintScale

   
    /**
     * Some checks for the default constructor.
     */
    public void testConstructor1() {
        LookupPaintScale s = new LookupPaintScale();
        assertEquals(0.0, s.getLowerBound(), EPSILON);
        assertEquals(1.0, s.getUpperBound(), EPSILON);
    }
View Full Code Here

Examples of org.jfree.chart.renderer.LookupPaintScale

   
    /**
     * Some checks for the other constructor.
     */
    public void testConstructor2() {
        LookupPaintScale s = new LookupPaintScale(1.0, 2.0, Color.red);
        assertEquals(1.0, s.getLowerBound(), EPSILON);
        assertEquals(2.0, s.getUpperBound(), EPSILON);
        assertEquals(Color.red, s.getDefaultPaint());
    }
View Full Code Here

Examples of org.jfree.chart.renderer.LookupPaintScale

    /**
     * Some general checks for the lookup table.
     */
    public void testGeneral() {
       
        LookupPaintScale s = new LookupPaintScale(0.0, 100.0, Color.black);
        assertEquals(Color.black, s.getPaint(-1.0));
        assertEquals(Color.black, s.getPaint(0.0));
        assertEquals(Color.black, s.getPaint(50.0));
        assertEquals(Color.black, s.getPaint(100.0));
        assertEquals(Color.black, s.getPaint(101.0));
       
        s.add(new Double(50.0), Color.blue);
        assertEquals(Color.black, s.getPaint(-1.0));
        assertEquals(Color.black, s.getPaint(0.0));
        assertEquals(Color.blue, s.getPaint(50.0));
        assertEquals(Color.blue, s.getPaint(100.0));
        assertEquals(Color.black, s.getPaint(101.0));
       
        s.add(new Double(50.0), Color.red);
        assertEquals(Color.black, s.getPaint(-1.0));
        assertEquals(Color.black, s.getPaint(0.0));
        assertEquals(Color.red, s.getPaint(50.0));
        assertEquals(Color.red, s.getPaint(100.0));
        assertEquals(Color.black, s.getPaint(101.0));
       
        s.add(new Double(25.0), Color.green);
        assertEquals(Color.black, s.getPaint(-1.0));
        assertEquals(Color.black, s.getPaint(0.0));
        assertEquals(Color.green, s.getPaint(25.0));
        assertEquals(Color.red, s.getPaint(50.0));
        assertEquals(Color.red, s.getPaint(100.0));
        assertEquals(Color.black, s.getPaint(101.0));
       
        s.add(new Double(75.0), Color.yellow);
        assertEquals(Color.black, s.getPaint(-1.0));
        assertEquals(Color.black, s.getPaint(0.0));
        assertEquals(Color.green, s.getPaint(25.0));
        assertEquals(Color.red, s.getPaint(50.0));
        assertEquals(Color.yellow, s.getPaint(75.0));
        assertEquals(Color.yellow, s.getPaint(100.0));
        assertEquals(Color.black, s.getPaint(101.0));
    }
View Full Code Here

Examples of org.jfree.chart.renderer.LookupPaintScale

    /**
     * Confirm that cloning works.
     */
    public void testCloning() {
        XYBlockRenderer r1 = new XYBlockRenderer();
        LookupPaintScale scale1 = new LookupPaintScale();
        r1.setPaintScale(scale1);
        XYBlockRenderer r2 = null;
        try {
            r2 = (XYBlockRenderer) r1.clone();
        }
        catch (CloneNotSupportedException e) {
            e.printStackTrace();
        }
        assertTrue(r1 != r2);
        assertTrue(r1.getClass() == r2.getClass());
        assertTrue(r1.equals(r2));
       
        // check independence
        scale1.add(0.5, Color.red);
        assertFalse(r1.equals(r2));
        LookupPaintScale scale2 = (LookupPaintScale) r2.getPaintScale();
        scale2.add(0.5, Color.red);
        assertTrue(r1.equals(r2));
    }
View Full Code Here

Examples of org.jfree.chart.renderer.LookupPaintScale

                new NumberAxis("X"));
        assertTrue(l1.equals(l2));
        assertTrue(l2.equals(l1));
       
        // paintScale
        l1.setScale(new LookupPaintScale());
        assertFalse(l1.equals(l2));
        l2.setScale(new LookupPaintScale());
        assertTrue(l1.equals(l2));
       
        // axis
        l1.setAxis(new NumberAxis("Axis 2"));
        assertFalse(l1.equals(l2));
View Full Code Here

Examples of org.jfree.chart.renderer.LookupPaintScale

    /**
     * Creates a new <code>XYShapeRenderer</code> instance with default
     * attributes.
     */
    public XYShapeRenderer() {
        this.paintScale = new LookupPaintScale();
        this.useFillPaint = false;
        this.drawOutlines = false;
        this.useOutlinePaint = true;
        this.guideLinesVisible = false;
        this.guideLinePaint = Color.DARK_GRAY;
View Full Code Here

Examples of org.jfree.chart.renderer.LookupPaintScale

     * Creates a new <code>XYBlockRenderer</code> instance with default
     * attributes.
     */
    public XYBlockRenderer() {
        updateOffsets();
        this.paintScale = new LookupPaintScale();
    }
View Full Code Here

Examples of org.jfree.chart.renderer.LookupPaintScale

                new NumberAxis("X"));
        assertEquals(l1, l2);
        assertEquals(l2, l1);

        // paintScale
        l1.setScale(new LookupPaintScale());
        assertFalse(l1.equals(l2));
        l2.setScale(new LookupPaintScale());
        assertEquals(l1, l2);

        // axis
        l1.setAxis(new NumberAxis("Axis 2"));
        assertFalse(l1.equals(l2));
View Full Code Here

Examples of org.jfree.chart.renderer.LookupPaintScale

     * Confirm that cloning works.
     */
    @Test
    public void testCloning() throws CloneNotSupportedException {
        XYBlockRenderer r1 = new XYBlockRenderer();
        LookupPaintScale scale1 = new LookupPaintScale();
        r1.setPaintScale(scale1);
        XYBlockRenderer r2 = (XYBlockRenderer) r1.clone();

        assertNotSame(r1, r2);
        assertSame(r1.getClass(), r2.getClass());
        assertEquals(r1, r2);

        // check independence
        scale1.add(0.5, Color.RED);
        assertFalse(r1.equals(r2));
        LookupPaintScale scale2 = (LookupPaintScale) r2.getPaintScale();
        scale2.add(0.5, Color.RED);
        assertEquals(r1, r2);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.