Package org.jfree.chart.annotations
Class AbstractAnnotation
java.lang.Object
org.jfree.chart.annotations.AbstractAnnotation
- All Implemented Interfaces:
Serializable,Cloneable,Annotation
- Direct Known Subclasses:
AbstractXYAnnotation,CategoryLineAnnotation,TextAnnotation
public abstract class AbstractAnnotation extends Object implements Annotation, Cloneable, Serializable
An abstract implementation of the
Annotation interface, containing a
mechanism for registering change listeners.- See Also:
- Serialized Form
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractAnnotation()Constructs an annotation. -
Method Summary
Modifier and Type Method Description voidaddChangeListener(AnnotationChangeListener listener)Registers an object to receive notification of changes to the annotation.Objectclone()Returns a clone of the annotation.protected voidfireAnnotationChanged()Notifies all registered listeners that the annotation has changed.booleangetNotify()Returns a flag that indicates whether listeners should be notified about changes to the annotation.booleanhasListener(EventListener listener)Returnstrueif the specified object is registered with the annotation as a listener.protected voidnotifyListeners(AnnotationChangeEvent event)Notifies all registered listeners that the annotation has changed.voidremoveChangeListener(AnnotationChangeListener listener)Deregisters an object so that it no longer receives notification of changes to the annotation.voidsetNotify(boolean flag)Sets a flag that indicates whether listeners should be notified about changes of an annotation.
-
Constructor Details
-
AbstractAnnotation
protected AbstractAnnotation()Constructs an annotation.
-
-
Method Details
-
addChangeListener
Registers an object to receive notification of changes to the annotation.- Specified by:
addChangeListenerin interfaceAnnotation- Parameters:
listener- the object to register.- See Also:
removeChangeListener(AnnotationChangeListener)
-
removeChangeListener
Deregisters an object so that it no longer receives notification of changes to the annotation.- Specified by:
removeChangeListenerin interfaceAnnotation- Parameters:
listener- the object to deregister.- See Also:
addChangeListener(AnnotationChangeListener)
-
hasListener
Returnstrueif 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
Notifies all registered listeners that the annotation has changed. -
notifyListeners
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
Returns a flag that indicates whether listeners should be notified about changes to the annotation.- Returns:
- the flag.
- See Also:
setNotify(boolean)
-
setNotify
Sets a flag that indicates whether listeners should be notified about changes of an annotation.- Parameters:
flag- the flag- See Also:
getNotify()
-
clone
Returns a clone of the annotation. The cloned annotation will NOT include theAnnotationChangeListenerreferences that have been registered with this annotation.- Overrides:
clonein classObject- Returns:
- A clone.
- Throws:
CloneNotSupportedException- if the annotation does not support cloning.
-