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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate EventListenerList
Storage for registered change listeners.private boolean
A flag that indicates whether listeners should be notified about changes of the annotation. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChangeListener
(AnnotationChangeListener listener) Registers an object to receive notification of changes to the annotation.boolean
Ensures symmetry between super/subclass implementations of equals.clone()
Returns a clone of the annotation.boolean
protected void
Notifies all registered listeners that the annotation has changed.boolean
Returns a flag that indicates whether listeners should be notified about changes to the annotation.int
hashCode()
boolean
hasListener
(EventListener listener) Returnstrue
if the specified object is registered with the annotation as a listener.protected void
Notifies all registered listeners that the annotation has changed.private void
readObject
(ObjectInputStream stream) Restores a serialized object.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.private void
writeObject
(ObjectOutputStream stream) Handles serialization.
-
Field Details
-
listenerList
Storage for registered change listeners. -
notify
private boolean notifyA flag that indicates whether listeners should be notified about changes of the 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:
addChangeListener
in interfaceAnnotation
- Parameters:
listener
- the object to register.- See Also:
-
removeChangeListener
Deregisters an object so that it no longer receives notification of changes to the annotation.- Specified by:
removeChangeListener
in interfaceAnnotation
- Parameters:
listener
- the object to deregister.- See Also:
-
hasListener
Returnstrue
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:
-
fireAnnotationChanged
protected void fireAnnotationChanged()Notifies all registered listeners that the annotation has changed.- See Also:
-
notifyListeners
Notifies all registered listeners that the annotation has changed.- Parameters:
event
- contains information about the event that triggered the notification.- See Also:
-
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
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:
-
clone
Returns a clone of the annotation. The cloned annotation will NOT include theAnnotationChangeListener
references that have been registered with this annotation.- Overrides:
clone
in classObject
- Returns:
- A clone.
- Throws:
CloneNotSupportedException
- if the annotation does not support cloning.
-
writeObject
Handles serialization.- Parameters:
stream
- the output stream.- Throws:
IOException
- if there is an I/O problem.
-
readObject
Restores a serialized object.- Parameters:
stream
- the input stream.- Throws:
IOException
- if there is an I/O problem.ClassNotFoundException
- if there is a problem loading a class.
-
hashCode
public int hashCode() -
equals
-
canEqual
Ensures symmetry between super/subclass implementations of equals. For more detail, see http://jqno.nl/equalsverifier/manual/inheritance.- Parameters:
other
- Object- Returns:
- true ONLY if the parameter is THIS class type
-