Java Code Examples for org.jfree.chart.renderer.category.LineAndShapeRenderer#addChangeListener()

The following examples show how to use org.jfree.chart.renderer.category.LineAndShapeRenderer#addChangeListener() . 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: AbstractRendererTest.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * A check for cloning.
 */
@Test
public void testCloning2() throws CloneNotSupportedException {
    LineAndShapeRenderer r1 = new LineAndShapeRenderer();
    r1.setBasePaint(Color.blue);
    r1.setBaseLegendTextPaint(new GradientPaint(1.0f, 2.0f, Color.red,
            3.0f, 4.0f, Color.blue));
    LineAndShapeRenderer r2 = (LineAndShapeRenderer) r1.clone();
    assertTrue(r1 != r2);
    assertTrue(r1.getClass() == r2.getClass());
    assertTrue(r1.equals(r2));

    MyRendererChangeListener listener = new MyRendererChangeListener();
    r2.addChangeListener(listener);
    r2.setBasePaint(Color.red);
    assertTrue(listener.lastEvent.getRenderer() == r2);
    assertFalse(r1.hasListener(listener));
}
 
Example 2
Source File: AbstractRendererTest.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * A check for cloning.
 */
@Test
public void testCloning2() throws CloneNotSupportedException {
    LineAndShapeRenderer r1 = new LineAndShapeRenderer();
    r1.setBasePaint(Color.blue);
    r1.setBaseLegendTextPaint(new GradientPaint(1.0f, 2.0f, Color.red,
            3.0f, 4.0f, Color.blue));
    LineAndShapeRenderer r2 = (LineAndShapeRenderer) r1.clone();
    assertTrue(r1 != r2);
    assertTrue(r1.getClass() == r2.getClass());
    assertTrue(r1.equals(r2));

    MyRendererChangeListener listener = new MyRendererChangeListener();
    r2.addChangeListener(listener);
    r2.setBasePaint(Color.red);
    assertTrue(listener.lastEvent.getRenderer() == r2);
    assertFalse(r1.hasListener(listener));
}
 
Example 3
Source File: AbstractRendererTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * A check for cloning.
 */
@Test
public void testCloning2() throws CloneNotSupportedException {
    LineAndShapeRenderer r1 = new LineAndShapeRenderer();
    r1.setBasePaint(Color.blue);
    r1.setBaseLegendTextPaint(new GradientPaint(1.0f, 2.0f, Color.red,
            3.0f, 4.0f, Color.blue));
    LineAndShapeRenderer r2 = (LineAndShapeRenderer) r1.clone();
    assertTrue(r1 != r2);
    assertTrue(r1.getClass() == r2.getClass());
    assertTrue(r1.equals(r2));

    MyRendererChangeListener listener = new MyRendererChangeListener();
    r2.addChangeListener(listener);
    r2.setBasePaint(Color.red);
    assertTrue(listener.lastEvent.getRenderer() == r2);
    assertFalse(r1.hasListener(listener));
}
 
Example 4
Source File: AbstractRendererTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * A check for cloning.
 */
@Test
public void testCloning2() throws CloneNotSupportedException {
    LineAndShapeRenderer r1 = new LineAndShapeRenderer();
    r1.setBasePaint(Color.blue);
    r1.setBaseLegendTextPaint(new GradientPaint(1.0f, 2.0f, Color.red,
            3.0f, 4.0f, Color.blue));
    LineAndShapeRenderer r2 = (LineAndShapeRenderer) r1.clone();
    assertTrue(r1 != r2);
    assertTrue(r1.getClass() == r2.getClass());
    assertTrue(r1.equals(r2));

    MyRendererChangeListener listener = new MyRendererChangeListener();
    r2.addChangeListener(listener);
    r2.setBasePaint(Color.red);
    assertTrue(listener.lastEvent.getRenderer() == r2);
    assertFalse(r1.hasListener(listener));
}
 
Example 5
Source File: AbstractRendererTest.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * A check for cloning.
 */
@Test
public void testCloning2() throws CloneNotSupportedException {
    LineAndShapeRenderer r1 = new LineAndShapeRenderer();
    r1.setBasePaint(Color.blue);
    r1.setBaseLegendTextPaint(new GradientPaint(1.0f, 2.0f, Color.red,
            3.0f, 4.0f, Color.blue));
    LineAndShapeRenderer r2 = (LineAndShapeRenderer) r1.clone();
    assertTrue(r1 != r2);
    assertTrue(r1.getClass() == r2.getClass());
    assertTrue(r1.equals(r2));

    MyRendererChangeListener listener = new MyRendererChangeListener();
    r2.addChangeListener(listener);
    r2.setBasePaint(Color.red);
    assertTrue(listener.lastEvent.getRenderer() == r2);
    assertFalse(r1.hasListener(listener));
}