#253 Event handling for annotations

Peter Kolb

An event notifcation mechanism for annotations has been added. Previously, if the properties of an instance of any of the annotation classes were changing, the changes were only shown in a GUI if a repaint was triggered by another way (which could be irritating).
new interface org.jfree.chart.annotations.Annotation: declares a mechanism for registering AnnotationChangeListener.
new interface org.jfree.chart.event.AnnotationChangeListener
new classes org.jfree.chart.annotations.AbstractAnnotation (implements a mechanism for registering AnnotationChangeListeners) and org.jfree.chart.event.AnnotationChangeEvent

Changes to the existing interfaces and classes in the package org.jfree.chart.annotations (they now extend the new interface/class where appropriate)
Changes to Plot, XYPlot, CategoryPlot and AbstractXYItemRenderer: these classes implement AnnotationChangeListener and register/deregister as listeners of annotations if they are added to/removed from the plot or renderer.

The class AbstractAnnotation contains a private static flag "notify" that indicates whether listeners should be notifed about changes to an annotation. This allows to turn off the event notification and prevents multiple repaints if several changes to one ore more annotations are performed.


  • David Gilbert

    David Gilbert - 2009-06-24
    • assigned_to: nobody --> mungady
    • status: open --> closed-accepted
  • David Gilbert

    David Gilbert - 2009-06-24

    Thanks very much! I've committed this for inclusion in the 1.0.14 release.

    Best regards,

    Dave Gilbert
    JFreeChart Project Leader


Log in to post a comment.