Java Code Examples for org.jfree.chart.plot.dial.DialPlot#addChangeListener()

The following examples show how to use org.jfree.chart.plot.dial.DialPlot#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: DialPlotTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the notification event mechanism for the dial background.
 */
public void testBackgroundListener() {
    DialPlot p = new DialPlot();
    DialBackground b1 = new DialBackground(Color.red);
    p.setBackground(b1);
    p.addChangeListener(this);
    this.lastEvent = null;
    b1.setPaint(Color.blue);
    assertNotNull(this.lastEvent);

    DialBackground b2 = new DialBackground(Color.green);
    p.setBackground(b2);
    this.lastEvent = null;
    b1.setPaint(Color.red);
    assertNull(this.lastEvent);
    b2.setPaint(Color.red);
    assertNotNull(this.lastEvent);
}
 
Example 2
Source File: DialPlotTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the notification event mechanism for the dial cap.
 */
public void testCapListener() {
    DialPlot p = new DialPlot();
    DialCap c1 = new DialCap();
    p.setCap(c1);
    p.addChangeListener(this);
    this.lastEvent = null;
    c1.setFillPaint(Color.red);
    assertNotNull(this.lastEvent);

    DialCap c2 = new DialCap();
    p.setCap(c2);
    this.lastEvent = null;
    c1.setFillPaint(Color.blue);
    assertNull(this.lastEvent);
    c2.setFillPaint(Color.green);
    assertNotNull(this.lastEvent);
}
 
Example 3
Source File: DialPlotTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the notification event mechanism for the dial frame.
 */
public void testFrameListener() {
    DialPlot p = new DialPlot();
    ArcDialFrame f1 = new ArcDialFrame();
    p.setDialFrame(f1);
    p.addChangeListener(this);
    this.lastEvent = null;
    f1.setBackgroundPaint(Color.gray);
    assertNotNull(this.lastEvent);

    ArcDialFrame f2 = new ArcDialFrame();
    p.setDialFrame(f2);
    this.lastEvent = null;
    f1.setBackgroundPaint(Color.blue);
    assertNull(this.lastEvent);
    f2.setBackgroundPaint(Color.green);
    assertNotNull(this.lastEvent);
}
 
Example 4
Source File: DialPlotTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the notification event mechanism for the dial scales.
 */
public void testScaleListener() {
    DialPlot p = new DialPlot();
    StandardDialScale s1 = new StandardDialScale();
    p.addScale(0, s1);
    p.addChangeListener(this);
    this.lastEvent = null;
    s1.setStartAngle(22.0);
    assertNotNull(this.lastEvent);

    StandardDialScale s2 = new StandardDialScale();
    p.addScale(0, s2);
    this.lastEvent = null;
    s1.setStartAngle(33.0);
    assertNull(this.lastEvent);
    s2.setStartAngle(33.0);
    assertNotNull(this.lastEvent);
}
 
Example 5
Source File: DialPlotTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the notification event mechanism for a layer.
 */
public void testLayerListener() {
    DialPlot p = new DialPlot();
    DialBackground b1 = new DialBackground(Color.red);
    p.addLayer(b1);
    p.addChangeListener(this);
    this.lastEvent = null;
    b1.setPaint(Color.blue);
    assertNotNull(this.lastEvent);

    DialBackground b2 = new DialBackground(Color.green);
    p.addLayer(b2);
    this.lastEvent = null;
    b1.setPaint(Color.red);
    assertNotNull(this.lastEvent);
    b2.setPaint(Color.green);
    assertNotNull(this.lastEvent);

    p.removeLayer(b2);
    this.lastEvent = null;
    b2.setPaint(Color.red);
    assertNull(this.lastEvent);
}
 
Example 6
Source File: DialPlotTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the notification event mechanism for the dial background.
 */
public void testBackgroundListener() {
    DialPlot p = new DialPlot();
    DialBackground b1 = new DialBackground(Color.red);
    p.setBackground(b1);
    p.addChangeListener(this);
    this.lastEvent = null;
    b1.setPaint(Color.blue);
    assertNotNull(this.lastEvent);
    
    DialBackground b2 = new DialBackground(Color.green);
    p.setBackground(b2);
    this.lastEvent = null;
    b1.setPaint(Color.red);
    assertNull(this.lastEvent);
    b2.setPaint(Color.red);
    assertNotNull(this.lastEvent);
}
 
Example 7
Source File: DialPlotTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the notification event mechanism for the dial cap.
 */
public void testCapListener() {
    DialPlot p = new DialPlot();
    DialCap c1 = new DialCap();
    p.setCap(c1);
    p.addChangeListener(this);
    this.lastEvent = null;
    c1.setFillPaint(Color.red);
    assertNotNull(this.lastEvent);
    
    DialCap c2 = new DialCap();
    p.setCap(c2);
    this.lastEvent = null;
    c1.setFillPaint(Color.blue);
    assertNull(this.lastEvent);
    c2.setFillPaint(Color.green);
    assertNotNull(this.lastEvent);
}
 
Example 8
Source File: DialPlotTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the notification event mechanism for the dial frame.
 */
public void testFrameListener() {
    DialPlot p = new DialPlot();
    ArcDialFrame f1 = new ArcDialFrame();
    p.setDialFrame(f1);
    p.addChangeListener(this);
    this.lastEvent = null;
    f1.setBackgroundPaint(Color.gray);
    assertNotNull(this.lastEvent);
    
    ArcDialFrame f2 = new ArcDialFrame();
    p.setDialFrame(f2);
    this.lastEvent = null;
    f1.setBackgroundPaint(Color.blue);
    assertNull(this.lastEvent);
    f2.setBackgroundPaint(Color.green);
    assertNotNull(this.lastEvent);
}
 
Example 9
Source File: DialPlotTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the notification event mechanism for the dial scales.
 */
public void testScaleListener() {
    DialPlot p = new DialPlot();
    StandardDialScale s1 = new StandardDialScale();
    p.addScale(0, s1);
    p.addChangeListener(this);
    this.lastEvent = null;
    s1.setStartAngle(22.0);
    assertNotNull(this.lastEvent);
    
    StandardDialScale s2 = new StandardDialScale();
    p.addScale(0, s2);
    this.lastEvent = null;
    s1.setStartAngle(33.0);
    assertNull(this.lastEvent);
    s2.setStartAngle(33.0);
    assertNotNull(this.lastEvent);
}
 
Example 10
Source File: DialPlotTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Check the notification event mechanism for a layer.
 */
public void testLayerListener() {
    DialPlot p = new DialPlot();
    DialBackground b1 = new DialBackground(Color.red);
    p.addLayer(b1);
    p.addChangeListener(this);
    this.lastEvent = null;
    b1.setPaint(Color.blue);
    assertNotNull(this.lastEvent);
    
    DialBackground b2 = new DialBackground(Color.green);
    p.addLayer(b2);
    this.lastEvent = null;
    b1.setPaint(Color.red);
    assertNotNull(this.lastEvent);
    b2.setPaint(Color.green);
    assertNotNull(this.lastEvent);
    
    p.removeLayer(b2);
    this.lastEvent = null;
    b2.setPaint(Color.red);
    assertNull(this.lastEvent);   
}