Package org.jfree.chart.plot.dial
Class AbstractDialLayer
- java.lang.Object
-
- org.jfree.chart.plot.dial.AbstractDialLayer
-
- All Implemented Interfaces:
DialLayer
- Direct Known Subclasses:
ArcDialFrame
,DialBackground
,DialCap
,DialPointer
,DialTextAnnotation
,DialValueIndicator
,StandardDialFrame
,StandardDialRange
,StandardDialScale
public abstract class AbstractDialLayer extends java.lang.Object implements DialLayer
A base class that can be used to implement aDialLayer
. It includes an event notification mechanism.
-
-
Field Summary
Fields Modifier and Type Field Description private javax.swing.event.EventListenerList
listenerList
Storage for registered listeners.private boolean
visible
A flag that controls whether or not the layer is visible.
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractDialLayer()
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChangeListener(DialLayerChangeListener listener)
Registers an object for notification of changes to the dial layer.java.lang.Object
clone()
Returns a clone of this instance.boolean
equals(java.lang.Object obj)
Tests this instance for equality with an arbitrary object.int
hashCode()
Returns a hash code for this instance.boolean
hasListener(java.util.EventListener listener)
Returnstrue
if the specified object is registered with the dataset as a listener.boolean
isVisible()
Returnstrue
if this layer is visible (should be displayed), andfalse
otherwise.protected void
notifyListeners(DialLayerChangeEvent event)
Notifies all registered listeners that the dial layer has changed.private void
readObject(java.io.ObjectInputStream stream)
Provides serialization support.void
removeChangeListener(DialLayerChangeListener listener)
Deregisters an object for notification of changes to the dial layer.void
setVisible(boolean visible)
Sets the flag that determines whether or not this layer is drawn by the plot, and sends aDialLayerChangeEvent
to all registered listeners.-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.jfree.chart.plot.dial.DialLayer
draw, isClippedToWindow
-
-
-
-
Method Detail
-
isVisible
public boolean isVisible()
Returnstrue
if this layer is visible (should be displayed), andfalse
otherwise.- Specified by:
isVisible
in interfaceDialLayer
- Returns:
- A boolean.
- See Also:
setVisible(boolean)
-
setVisible
public void setVisible(boolean visible)
Sets the flag that determines whether or not this layer is drawn by the plot, and sends aDialLayerChangeEvent
to all registered listeners.- Parameters:
visible
- the flag.- See Also:
isVisible()
-
equals
public boolean equals(java.lang.Object obj)
Tests this instance for equality with an arbitrary object.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the object (null
permitted).- Returns:
- A boolean.
-
hashCode
public int hashCode()
Returns a hash code for this instance.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- A hash code.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Returns a clone of this instance.- Overrides:
clone
in classjava.lang.Object
- Returns:
- A clone.
- Throws:
java.lang.CloneNotSupportedException
- if there is a problem cloning this instance.
-
addChangeListener
public void addChangeListener(DialLayerChangeListener listener)
Registers an object for notification of changes to the dial layer.- Specified by:
addChangeListener
in interfaceDialLayer
- Parameters:
listener
- the object that is being registered.- See Also:
removeChangeListener(DialLayerChangeListener)
-
removeChangeListener
public void removeChangeListener(DialLayerChangeListener listener)
Deregisters an object for notification of changes to the dial layer.- Specified by:
removeChangeListener
in interfaceDialLayer
- Parameters:
listener
- the object to deregister.- See Also:
addChangeListener(DialLayerChangeListener)
-
hasListener
public boolean hasListener(java.util.EventListener listener)
Returnstrue
if the specified object is registered with the dataset as a listener. Most applications won't need to call this method, it exists mainly for use by unit testing code.- Specified by:
hasListener
in interfaceDialLayer
- Parameters:
listener
- the listener.- Returns:
- A boolean.
-
notifyListeners
protected void notifyListeners(DialLayerChangeEvent event)
Notifies all registered listeners that the dial layer has changed. TheDialLayerChangeEvent
provides information about the change.- Parameters:
event
- information about the change to the axis.
-
readObject
private void readObject(java.io.ObjectInputStream stream) throws java.io.IOException, java.lang.ClassNotFoundException
Provides serialization support.- Parameters:
stream
- the input stream.- Throws:
java.io.IOException
- if there is an I/O error.java.lang.ClassNotFoundException
- if there is a classpath problem.
-
-