org.jfree.chart.event.MarkerChangeListener Java Examples

The following examples show how to use org.jfree.chart.event.MarkerChangeListener. 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: MarkerTest.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Checks that a CategoryPlot deregisters listeners when clearing markers.
 */
@Test
public void testListenersWithCategoryPlot() {
    CategoryPlot plot = new CategoryPlot();
    CategoryMarker marker1 = new CategoryMarker("X");
    ValueMarker marker2 = new ValueMarker(1.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: MarkerTest.java    From openstock with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Checks that an XYPlot deregisters listeners when clearing markers.
 */
@Test
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 #3
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that a CategoryPlot deregisters listeners when clearing markers.
 */
public void testListenersWithCategoryPlot() {
    CategoryPlot plot = new CategoryPlot();
    CategoryMarker marker1 = new CategoryMarker("X");
    ValueMarker marker2 = new ValueMarker(1.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 #4
Source File: MarkerTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that an XYPlot deregisters listeners when clearing markers.
 */
@Test
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 #5
Source File: MarkerTest.java    From ECG-Viewer with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that a CategoryPlot deregisters listeners when clearing markers.
 */
@Test
public void testListenersWithCategoryPlot() {
    CategoryPlot plot = new CategoryPlot();
    CategoryMarker marker1 = new CategoryMarker("X");
    ValueMarker marker2 = new ValueMarker(1.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 #6
Source File: MarkerTest.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Checks that an XYPlot deregisters listeners when clearing markers.
 */
@Test
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 #7
Source File: MarkerTest.java    From buffer_bci with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Checks that a CategoryPlot deregisters listeners when clearing markers.
 */
@Test
public void testListenersWithCategoryPlot() {
    CategoryPlot plot = new CategoryPlot();
    CategoryMarker marker1 = new CategoryMarker("X");
    ValueMarker marker2 = new ValueMarker(1.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 #8
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 #9
Source File: MarkerTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Checks that a CategoryPlot deregisters listeners when clearing markers.
 */
@Test
public void testListenersWithCategoryPlot() {
    CategoryPlot plot = new CategoryPlot();
    CategoryMarker marker1 = new CategoryMarker("X");
    ValueMarker marker2 = new ValueMarker(1.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 #10
Source File: MarkerTest.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Checks that a CategoryPlot deregisters listeners when clearing markers.
 */
@Test
public void testListenersWithCategoryPlot() {
    CategoryPlot plot = new CategoryPlot();
    CategoryMarker marker1 = new CategoryMarker("X");
    ValueMarker marker2 = new ValueMarker(1.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 #11
Source File: MarkerTest.java    From ccu-historian with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Checks that an XYPlot deregisters listeners when clearing markers.
 */
@Test
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 #12
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 #13
Source File: MarkerTest.java    From SIMVA-SoS with Apache License 2.0 6 votes vote down vote up
/**
 * Checks that an XYPlot deregisters listeners when clearing markers.
 */
@Test
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 #14
Source File: MarkerTests.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Checks that a CategoryPlot deregisters listeners when clearing markers.
 */
public void testListenersWithCategoryPlot() {
    CategoryPlot plot = new CategoryPlot();
    CategoryMarker marker1 = new CategoryMarker("X");
    ValueMarker marker2 = new ValueMarker(1.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 #15
Source File: Marker.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Notifies all registered listeners that the marker has been modified.
 *
 * @param event  information about the change event.
 *
 * @since 1.0.3
 */
public void notifyListeners(MarkerChangeEvent event) {

    Object[] listeners = this.listenerList.getListenerList();
    for (int i = listeners.length - 2; i >= 0; i -= 2) {
        if (listeners[i] == MarkerChangeListener.class) {
            ((MarkerChangeListener) listeners[i + 1]).markerChanged(event);
        }
    }

}
 
Example #16
Source File: CategoryPlotTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some tests for the addRangeMarker() method(s).
 */
public void testAddRangeMarker() {
    CategoryPlot plot = new CategoryPlot();
    Marker m = new ValueMarker(1.0);
    plot.addRangeMarker(m);
    List listeners = Arrays.asList(m.getListeners(
            MarkerChangeListener.class));
    assertTrue(listeners.contains(plot));
    plot.clearRangeMarkers();
    listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    assertFalse(listeners.contains(plot));
}
 
Example #17
Source File: XYPlotTest.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Some tests for the addRangeMarker() method(s).
 */
@Test
public void testAddRangeMarker() {
    XYPlot plot = new XYPlot();
    Marker m = new ValueMarker(1.0);
    plot.addRangeMarker(m);
    List listeners = Arrays.asList(m.getListeners(
            MarkerChangeListener.class));
    assertTrue(listeners.contains(plot));
    plot.clearRangeMarkers();
    listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    assertFalse(listeners.contains(plot));
}
 
Example #18
Source File: XYPlotTest.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Some tests for the addDomainMarker() method(s).
 */
@Test
public void testAddDomainMarker() {
    XYPlot plot = new XYPlot();
    Marker m = new ValueMarker(1.0);
    plot.addDomainMarker(m);
    List listeners = Arrays.asList(m.getListeners(
            MarkerChangeListener.class));
    assertTrue(listeners.contains(plot));
    plot.clearDomainMarkers();
    listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    assertFalse(listeners.contains(plot));
}
 
Example #19
Source File: CategoryPlotTest.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Some tests for the addRangeMarker() method(s).
 */
@Test
public void testAddRangeMarker() {
    CategoryPlot plot = new CategoryPlot();
    Marker m = new ValueMarker(1.0);
    plot.addRangeMarker(m);
    List listeners = Arrays.asList(m.getListeners(
            MarkerChangeListener.class));
    assertTrue(listeners.contains(plot));
    plot.clearRangeMarkers();
    listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    assertFalse(listeners.contains(plot));
}
 
Example #20
Source File: CategoryPlotTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some tests for the addRangeMarker() method(s).
 */
public void testAddRangeMarker() {
    CategoryPlot plot = new CategoryPlot();
    Marker m = new ValueMarker(1.0);
    plot.addRangeMarker(m);
    List listeners = Arrays.asList(m.getListeners(
            MarkerChangeListener.class));
    assertTrue(listeners.contains(plot));
    plot.clearRangeMarkers();
    listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    assertFalse(listeners.contains(plot));
}
 
Example #21
Source File: XYPlotTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some tests for the addRangeMarker() method(s).
 */
public void testAddRangeMarker() {
    XYPlot plot = new XYPlot();
    Marker m = new ValueMarker(1.0);
    plot.addRangeMarker(m);
    List listeners = Arrays.asList(m.getListeners(
            MarkerChangeListener.class));
    assertTrue(listeners.contains(plot));
    plot.clearRangeMarkers();
    listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    assertFalse(listeners.contains(plot));
}
 
Example #22
Source File: CategoryPlotTest.java    From openstock with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Some tests for the addRangeMarker() method(s).
 */
@Test
public void testAddRangeMarker() {
    CategoryPlot plot = new CategoryPlot();
    Marker m = new ValueMarker(1.0);
    plot.addRangeMarker(m);
    List listeners = Arrays.asList(m.getListeners(
            MarkerChangeListener.class));
    assertTrue(listeners.contains(plot));
    plot.clearRangeMarkers();
    listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    assertFalse(listeners.contains(plot));
}
 
Example #23
Source File: Marker.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Notifies all registered listeners that the marker has been modified.
 *
 * @param event  information about the change event.
 *
 * @since 1.0.3
 */
public void notifyListeners(MarkerChangeEvent event) {

    Object[] listeners = this.listenerList.getListenerList();
    for (int i = listeners.length - 2; i >= 0; i -= 2) {
        if (listeners[i] == MarkerChangeListener.class) {
            ((MarkerChangeListener) listeners[i + 1]).markerChanged(event);
        }
    }

}
 
Example #24
Source File: CategoryPlotTest.java    From buffer_bci with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Some tests for the addDomainMarker() method(s).
 */
@Test
public void testAddDomainMarker() {
    CategoryPlot plot = new CategoryPlot();
    CategoryMarker m = new CategoryMarker("C1");
    plot.addDomainMarker(m);
    List listeners = Arrays.asList(m.getListeners(
            MarkerChangeListener.class));
    assertTrue(listeners.contains(plot));
    plot.clearDomainMarkers();
    listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    assertFalse(listeners.contains(plot));
}
 
Example #25
Source File: Marker.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Notifies all registered listeners that the marker has been modified.
 *
 * @param event  information about the change event.
 *
 * @since 1.0.3
 */
public void notifyListeners(MarkerChangeEvent event) {

    Object[] listeners = this.listenerList.getListenerList();
    for (int i = listeners.length - 2; i >= 0; i -= 2) {
        if (listeners[i] == MarkerChangeListener.class) {
            ((MarkerChangeListener) listeners[i + 1]).markerChanged(event);
        }
    }

}
 
Example #26
Source File: CategoryPlotTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some tests for the addDomainMarker() method(s).
 */
public void testAddDomainMarker() {
    CategoryPlot plot = new CategoryPlot();
    CategoryMarker m = new CategoryMarker("C1");
    plot.addDomainMarker(m);
    List listeners = Arrays.asList(m.getListeners(
            MarkerChangeListener.class));
    assertTrue(listeners.contains(plot));
    plot.clearDomainMarkers();
    listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    assertFalse(listeners.contains(plot));
}
 
Example #27
Source File: CategoryPlotTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some tests for the addDomainMarker() method(s).
 */
public void testAddDomainMarker() {
    CategoryPlot plot = new CategoryPlot();
    CategoryMarker m = new CategoryMarker("C1");
    plot.addDomainMarker(m);
    List listeners = Arrays.asList(m.getListeners(
            MarkerChangeListener.class));
    assertTrue(listeners.contains(plot));
    plot.clearDomainMarkers();
    listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    assertFalse(listeners.contains(plot));
}
 
Example #28
Source File: XYPlotTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some tests for the addRangeMarker() method(s).
 */
public void testAddRangeMarker() {
    XYPlot plot = new XYPlot();
    Marker m = new ValueMarker(1.0);
    plot.addRangeMarker(m);
    List listeners = Arrays.asList(m.getListeners(
            MarkerChangeListener.class));
    assertTrue(listeners.contains(plot));
    plot.clearRangeMarkers();
    listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    assertFalse(listeners.contains(plot));
}
 
Example #29
Source File: XYPlotTests.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Some tests for the addDomainMarker() method(s).
 */
public void testAddDomainMarker() {
    XYPlot plot = new XYPlot();
    Marker m = new ValueMarker(1.0);
    plot.addDomainMarker(m);
    List listeners = Arrays.asList(m.getListeners(
            MarkerChangeListener.class));
    assertTrue(listeners.contains(plot));
    plot.clearDomainMarkers();
    listeners = Arrays.asList(m.getListeners(MarkerChangeListener.class));
    assertFalse(listeners.contains(plot));
}
 
Example #30
Source File: Marker.java    From ECG-Viewer with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Notifies all registered listeners that the marker has been modified.
 *
 * @param event  information about the change event.
 *
 * @since 1.0.3
 */
public void notifyListeners(MarkerChangeEvent event) {

    Object[] listeners = this.listenerList.getListenerList();
    for (int i = listeners.length - 2; i >= 0; i -= 2) {
        if (listeners[i] == MarkerChangeListener.class) {
            ((MarkerChangeListener) listeners[i + 1]).markerChanged(event);
        }
    }

}