Package org.jfree.chart.plot.dial
Class DialTextAnnotation
- java.lang.Object
-
- org.jfree.chart.plot.dial.AbstractDialLayer
-
- org.jfree.chart.plot.dial.DialTextAnnotation
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,DialLayer
,PublicCloneable
public class DialTextAnnotation extends AbstractDialLayer implements DialLayer, java.lang.Cloneable, PublicCloneable, java.io.Serializable
A text annotation for aDialPlot
.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private TextAnchor
anchor
The text anchor to be aligned to the annotation's anchor point.private double
angle
The angle that defines the anchor point for the annotation.private java.awt.Font
font
The font.private java.lang.String
label
The label text.private java.awt.Paint
paint
The paint for the label.private double
radius
The radius that defines the anchor point for the annotation.(package private) static long
serialVersionUID
For serialization.
-
Constructor Summary
Constructors Constructor Description DialTextAnnotation(java.lang.String label)
Creates a new instance ofDialTextAnnotation
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
Returns a clone of this instance.void
draw(java.awt.Graphics2D g2, DialPlot plot, java.awt.geom.Rectangle2D frame, java.awt.geom.Rectangle2D view)
Draws the background to the specified graphics device.boolean
equals(java.lang.Object obj)
Tests this instance for equality with an arbitrary object.TextAnchor
getAnchor()
Returns the text anchor point that will be aligned to the position specified bygetAngle()
andgetRadius()
.double
getAngle()
Returns the angle used to calculate the anchor point.java.awt.Font
getFont()
Returns the font used to display the label.java.lang.String
getLabel()
Returns the label text.java.awt.Paint
getPaint()
Returns the paint used to display the label.double
getRadius()
Returns the radius used to calculate the anchor point.int
hashCode()
Returns a hash code for this instance.boolean
isClippedToWindow()
Returnstrue
to indicate that this layer should be clipped within the dial window.private void
readObject(java.io.ObjectInputStream stream)
Provides serialization support.void
setAnchor(TextAnchor anchor)
Sets the text anchor point and sends aDialLayerChangeEvent
to all registered listeners.void
setAngle(double angle)
Sets the angle used to calculate the anchor point and sends aDialLayerChangeEvent
to all registered listeners.void
setFont(java.awt.Font font)
Sets the font used to display the label and sends aDialLayerChangeEvent
to all registered listeners.void
setLabel(java.lang.String label)
Sets the label and sends aDialLayerChangeEvent
to all registered listeners.void
setPaint(java.awt.Paint paint)
Sets the paint used to display the label and sends aDialLayerChangeEvent
to all registered listeners.void
setRadius(double radius)
Sets the radius used to calculate the anchor point and sends aDialLayerChangeEvent
to all registered listeners.private void
writeObject(java.io.ObjectOutputStream stream)
Provides serialization support.-
Methods inherited from class org.jfree.chart.plot.dial.AbstractDialLayer
addChangeListener, hasListener, isVisible, notifyListeners, removeChangeListener, setVisible
-
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
addChangeListener, hasListener, isVisible, removeChangeListener
-
-
-
-
Field Detail
-
serialVersionUID
static final long serialVersionUID
For serialization.- See Also:
- Constant Field Values
-
label
private java.lang.String label
The label text.
-
font
private java.awt.Font font
The font.
-
paint
private transient java.awt.Paint paint
The paint for the label. This field is transient because it requires special handling for serialization.
-
angle
private double angle
The angle that defines the anchor point for the annotation.
-
radius
private double radius
The radius that defines the anchor point for the annotation.
-
anchor
private TextAnchor anchor
The text anchor to be aligned to the annotation's anchor point.
-
-
Method Detail
-
getLabel
public java.lang.String getLabel()
Returns the label text.- Returns:
- The label text (never
null
). - See Also:
setLabel(String)
-
setLabel
public void setLabel(java.lang.String label)
Sets the label and sends aDialLayerChangeEvent
to all registered listeners.- Parameters:
label
- the label (null
not permitted).- See Also:
getLabel()
-
getFont
public java.awt.Font getFont()
Returns the font used to display the label.- Returns:
- The font (never
null
). - See Also:
setFont(Font)
-
setFont
public void setFont(java.awt.Font font)
Sets the font used to display the label and sends aDialLayerChangeEvent
to all registered listeners.- Parameters:
font
- the font (null
not permitted).- See Also:
getFont()
-
getPaint
public java.awt.Paint getPaint()
Returns the paint used to display the label.- Returns:
- The paint (never
null
). - See Also:
setPaint(Paint)
-
setPaint
public void setPaint(java.awt.Paint paint)
Sets the paint used to display the label and sends aDialLayerChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- See Also:
getPaint()
-
getAngle
public double getAngle()
Returns the angle used to calculate the anchor point.- Returns:
- The angle (in degrees).
- See Also:
setAngle(double)
,getRadius()
-
setAngle
public void setAngle(double angle)
Sets the angle used to calculate the anchor point and sends aDialLayerChangeEvent
to all registered listeners.- Parameters:
angle
- the angle (in degrees).- See Also:
getAngle()
,setRadius(double)
-
getRadius
public double getRadius()
Returns the radius used to calculate the anchor point. This is specified as a percentage relative to the dial's framing rectangle.- Returns:
- The radius.
- See Also:
setRadius(double)
,getAngle()
-
setRadius
public void setRadius(double radius)
Sets the radius used to calculate the anchor point and sends aDialLayerChangeEvent
to all registered listeners.- Parameters:
radius
- the radius (as a percentage of the dial's framing rectangle).- See Also:
getRadius()
,setAngle(double)
-
getAnchor
public TextAnchor getAnchor()
Returns the text anchor point that will be aligned to the position specified bygetAngle()
andgetRadius()
.- Returns:
- The anchor point.
- See Also:
setAnchor(TextAnchor)
-
setAnchor
public void setAnchor(TextAnchor anchor)
Sets the text anchor point and sends aDialLayerChangeEvent
to all registered listeners.- Parameters:
anchor
- the anchor point (null
not permitted).- See Also:
getAnchor()
-
isClippedToWindow
public boolean isClippedToWindow()
Returnstrue
to indicate that this layer should be clipped within the dial window.- Specified by:
isClippedToWindow
in interfaceDialLayer
- Returns:
true
.
-
draw
public void draw(java.awt.Graphics2D g2, DialPlot plot, java.awt.geom.Rectangle2D frame, java.awt.geom.Rectangle2D view)
Draws the background to the specified graphics device. If the dial frame specifies a window, the clipping region will already have been set to this window before this method is called.
-
equals
public boolean equals(java.lang.Object obj)
Tests this instance for equality with an arbitrary object.- Overrides:
equals
in classAbstractDialLayer
- Parameters:
obj
- the object (null
permitted).- Returns:
- A boolean.
-
hashCode
public int hashCode()
Returns a hash code for this instance.- Overrides:
hashCode
in classAbstractDialLayer
- Returns:
- The hash code.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Returns a clone of this instance.- Specified by:
clone
in interfacePublicCloneable
- Overrides:
clone
in classAbstractDialLayer
- Returns:
- The clone.
- Throws:
java.lang.CloneNotSupportedException
- if some attribute of this instance cannot be cloned.
-
writeObject
private void writeObject(java.io.ObjectOutputStream stream) throws java.io.IOException
Provides serialization support.- Parameters:
stream
- the output stream.- Throws:
java.io.IOException
- if there is an I/O error.
-
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.
-
-