Java Code Examples for org.jfree.chart.plot.ValueMarker#getListeners()

The following examples show how to use org.jfree.chart.plot.ValueMarker#getListeners() . 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: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that an XYPlot deregisters listeners when clearing markers.
 */
public void testListenersWithXYPlot() {
    XYPlot plot = new XYPlot();
    ValueMarker marker1 = new ValueMarker(1.0);
    ValueMarker marker2 = new ValueMarker(2.0);
    plot.addDomainMarker(marker1);
    plot.addRangeMarker(marker2);
    EventListener[] listeners1 = marker1.getListeners(
            MarkerChangeListener.class);
    assertTrue(Arrays.asList(listeners1).contains(plot));
    EventListener[] listeners2 = marker1.getListeners(
            MarkerChangeListener.class);
    assertTrue(Arrays.asList(listeners2).contains(plot));
    plot.clearDomainMarkers();
    plot.clearRangeMarkers();
    listeners1 = marker1.getListeners(MarkerChangeListener.class);
    assertFalse(Arrays.asList(listeners1).contains(plot));
    listeners2 = marker1.getListeners(MarkerChangeListener.class);
    assertFalse(Arrays.asList(listeners2).contains(plot));
}
 
Example 2
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that an XYPlot deregisters listeners when clearing markers.
 */
public void testListenersWithXYPlot() {
    XYPlot plot = new XYPlot();
    ValueMarker marker1 = new ValueMarker(1.0);
    ValueMarker marker2 = new ValueMarker(2.0);
    plot.addDomainMarker(marker1);
    plot.addRangeMarker(marker2);
    EventListener[] listeners1 = marker1.getListeners(
            MarkerChangeListener.class);
    assertTrue(Arrays.asList(listeners1).contains(plot));
    EventListener[] listeners2 = marker1.getListeners(
            MarkerChangeListener.class);
    assertTrue(Arrays.asList(listeners2).contains(plot));
    plot.clearDomainMarkers();
    plot.clearRangeMarkers();
    listeners1 = marker1.getListeners(MarkerChangeListener.class);
    assertFalse(Arrays.asList(listeners1).contains(plot));
    listeners2 = marker1.getListeners(MarkerChangeListener.class);
    assertFalse(Arrays.asList(listeners2).contains(plot));
}