org.jfree.chart.annotations

## Class AbstractAnnotation

- java.lang.Object
- - org.jfree.chart.annotations.AbstractAnnotation

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, Annotation

Direct Known Subclasses:
  AbstractXYAnnotation, CategoryLineAnnotation, TextAnnotation

    public abstract class AbstractAnnotation
    extends java.lang.Object
    implements Annotation, java.lang.Cloneable, java.io.Serializable

An abstract implementation of the `Annotation` interface, containing a mechanism for registering change listeners.

Since:
  1.0.14
See Also:
  Serialized Form

### Constructor Summary

Constructors
`protected` `AbstractAnnotation()` Constructs an annotation.

### Method Summary

Methods
`void` `addChangeListener(AnnotationChangeListener listener)` Registers an object to receive notification of changes to the annotation.
`java.lang.Object` `clone()` Returns a clone of the annotation.
`protected void` `fireAnnotationChanged()` Notifies all registered listeners that the annotation has changed.
`boolean` `getNotify()` Returns a flag that indicates whether listeners should be notified about changes to the annotation.
`boolean` `hasListener(java.util.EventListener listener)` Returns `true` if the specified object is registered with the annotation as a listener.
`protected void` `notifyListeners(AnnotationChangeEvent event)` Notifies all registered listeners that the annotation has changed.
`void` `removeChangeListener(AnnotationChangeListener listener)` Deregisters an object so that it no longer receives notification of changes to the annotation.
`void` `setNotify(boolean flag)` Sets a flag that indicates whether listeners should be notified about changes of an annotation.

### Methods inherited from class java.lang.Object

`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### AbstractAnnotation

    protected AbstractAnnotation()

Constructs an annotation.

### Method Detail

#### addChangeListener

    public void addChangeListener(AnnotationChangeListener listener)

Registers an object to receive notification of changes to the annotation.

Specified by:
  `addChangeListener` in interface `Annotation`
Parameters:
  `listener` - the object to register.
See Also:
  `removeChangeListener(AnnotationChangeListener)`

#### removeChangeListener

    public void removeChangeListener(AnnotationChangeListener listener)

Deregisters an object so that it no longer receives notification of changes to the annotation.

Specified by:
  `removeChangeListener` in interface `Annotation`
Parameters:
  `listener` - the object to deregister.
See Also:
  `addChangeListener(AnnotationChangeListener)`

#### hasListener

    public boolean hasListener(java.util.EventListener listener)

Returns `true` if the specified object is registered with the annotation as a listener. Most applications won't need to call this method, it exists mainly for use by unit testing code.

Parameters:
  `listener` - the listener.
Returns:
  A boolean.
See Also:
  `addChangeListener(AnnotationChangeListener)`, `removeChangeListener(AnnotationChangeListener)`

#### fireAnnotationChanged

    protected void fireAnnotationChanged()

Notifies all registered listeners that the annotation has changed.

See Also:
  `addChangeListener(AnnotationChangeListener)`

#### notifyListeners

    protected void notifyListeners(AnnotationChangeEvent event)

Notifies all registered listeners that the annotation has changed.

Parameters:
  `event` - contains information about the event that triggered the notification.
See Also:
  `addChangeListener(AnnotationChangeListener)`, `removeChangeListener(AnnotationChangeListener)`

#### getNotify

    public boolean getNotify()

Returns a flag that indicates whether listeners should be notified about changes to the annotation.

Returns:
  the flag.
See Also:
  `setNotify(boolean)`

#### setNotify

    public void setNotify(boolean flag)

Sets a flag that indicates whether listeners should be notified about changes of an annotation.

Parameters:
  `flag` - the flag
See Also:
  `getNotify()`

#### clone

    public java.lang.Object clone()
                           throws java.lang.CloneNotSupportedException

Returns a clone of the annotation. The cloned annotation will NOT include the `AnnotationChangeListener` references that have been registered with this annotation.

Overrides:
  `clone` in class `java.lang.Object`
Returns:
  A clone.
Throws:
  `java.lang.CloneNotSupportedException` - if the annotation does not support cloning.