com.ijchart.xychart.annotation
Class AbstractTextAnnotation

java.lang.Object
  extended by com.ijchart.xychart.annotation.AbstractAnnotation
      extended by com.ijchart.xychart.annotation.AbstractTextAnnotation
All Implemented Interfaces:
IAnnotation, IAnnotationChangeListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener
Direct Known Subclasses:
CategoryTextAnnotation, XYTextAnnotation

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

Title: IJChart

A base class for text annotations.

Description: a chart library for the Java(tm) platform.

Copyright: Copyright (c) 2013

Company:

Version:
1.0
Author:
zhang feng min,shanghai china. Contract me by email.
See Also:
Serialized Form

Field Summary
static java.awt.Font DEFAULT_FONT
           The default font.
static java.awt.Paint DEFAULT_PAINT
           The default paint.
static double DEFAULT_ROTATION_ANGLE
           The default rotation angle.
static TextDirection DEFAULT_TEXT_DIRECTION
           The default text direction.
static HorizontalAlignment DEFAULT_TEXT_HORIZONTAL_ALIGNMENT
           The default text horizontal alignment.
static TextPosition DEFAULT_TEXT_POSITION
           The default text position.
static VerticalAlignment DEFAULT_TEXT_VERTICAL_ALIGNMENT
           The default text vertical alignment.
 
Constructor Summary
protected AbstractTextAnnotation(java.lang.String text)
           Constructor.
 
Method Summary
 java.lang.Object clone()
           Creates and returns a copy of this object.
 boolean equals(java.lang.Object obj)
           Indicates whether some other object is "equal to" this one.
 double getRotationAngle()
           Returns the rotation angle in radians.
 java.lang.String getText()
           Returns the text.
 TextDirection getTextDirection()
           Returns the text direction.
 java.awt.Font getTextFont()
           Returns the text font.
 HorizontalAlignment getTextHorizontalAlign()
           Returns the text horizontal alignment.
 java.awt.Paint getTextPaint()
           Get the text Paint.
 TextPosition getTextPosition()
           Returns the text position.
 VerticalAlignment getTextVerticalAlign()
           Returns the text vertical alignment.
 int hashCode()
           Returns a hash code value for the object.
protected  TextAnchor horizontalAlignToAnchor(HorizontalAlignment align)
           Convert horizontal to anchor.
 void setRotationAngle(double angle)
           Sets the rotation angle in radians and sends a AnnotationChangeEvent to all registered listeners.
 void setText(java.lang.String text)
           Sets the text and sends an AnnotationChangeEvent to all registered listeners.
 void setTextDirection(TextDirection direction)
           Sets the text direction and sends a ChartShapeChangeEvent to all registered listeners.
 void setTextFont(java.awt.Font font)
           Sets the text font and sends a AnnotationChangeEvent to all registered listeners.
 void setTextHorizontalAlign(HorizontalAlignment horizontalAlign)
           Sets the text horizontal alignment and sends a ChartShapeChangeEvent to all registered listeners.
 void setTextPaint(java.awt.Paint paint)
           Sets the text Paint and sends a AnnotationChangeEvent to all registered listeners.
 void setTextPosition(TextPosition position)
           Sets the text position and sends a ChartShapeChangeEvent to all registered listeners.
 void setTextVerticalAlign(VerticalAlignment verticalAlign)
           Sets the text vertical alignment and sends a ChartShapeChangeEvent to all registered listeners.
 java.lang.String toString()
           Returns a string representation of the object.
 
Methods inherited from class com.ijchart.xychart.annotation.AbstractAnnotation
addChangeListener, annotationChanged, fireAnnotationChanged, getTooltipText, hasListener, notifyListeners, removeAllChangeListener, removeChangeListener, setTooltipText
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_FONT

public static final java.awt.Font DEFAULT_FONT
The default font.


DEFAULT_PAINT

public static final java.awt.Paint DEFAULT_PAINT
The default paint.


DEFAULT_ROTATION_ANGLE

public static final double DEFAULT_ROTATION_ANGLE
The default rotation angle.

See Also:
Constant Field Values

DEFAULT_TEXT_HORIZONTAL_ALIGNMENT

public static final HorizontalAlignment DEFAULT_TEXT_HORIZONTAL_ALIGNMENT
The default text horizontal alignment.


DEFAULT_TEXT_VERTICAL_ALIGNMENT

public static final VerticalAlignment DEFAULT_TEXT_VERTICAL_ALIGNMENT
The default text vertical alignment.


DEFAULT_TEXT_POSITION

public static final TextPosition DEFAULT_TEXT_POSITION
The default text position.


DEFAULT_TEXT_DIRECTION

public static final TextDirection DEFAULT_TEXT_DIRECTION
The default text direction.

Constructor Detail

AbstractTextAnnotation

protected AbstractTextAnnotation(java.lang.String text)
Constructor.

Parameters:
text - The text (null not permitted).
Method Detail

getText

public java.lang.String getText()
Returns the text.

Returns:
String The text (maybe null).

setText

public void setText(java.lang.String text)
Sets the text and sends an AnnotationChangeEvent to all registered listeners.

Parameters:
text - String The text (null not permitted).

getTextFont

public java.awt.Font getTextFont()
Returns the text font.

Returns:
Font The text font.

setTextFont

public void setTextFont(java.awt.Font font)
Sets the text font and sends a AnnotationChangeEvent to all registered listeners.

Parameters:
font - Font The text font (null not permitted).

getTextPaint

public java.awt.Paint getTextPaint()
Get the text Paint.

Returns:
Paint The text Paint.

setTextPaint

public void setTextPaint(java.awt.Paint paint)
Sets the text Paint and sends a AnnotationChangeEvent to all registered listeners.

Parameters:
paint - Paint The text Paint(null not permitted).

getRotationAngle

public double getRotationAngle()
Returns the rotation angle in radians.

Returns:
The rotation angle.

setRotationAngle

public void setRotationAngle(double angle)
Sets the rotation angle in radians and sends a AnnotationChangeEvent to all registered listeners.

Parameters:
angle - The angle (in radians).

getTextHorizontalAlign

public HorizontalAlignment getTextHorizontalAlign()
Returns the text horizontal alignment.

Returns:
HorizontalAlignment The text horizontal alignment.

setTextHorizontalAlign

public void setTextHorizontalAlign(HorizontalAlignment horizontalAlign)
Sets the text horizontal alignment and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
horizontalAlign - HorizontalAlignment The text horizontal alignment (null not permitted).

getTextVerticalAlign

public VerticalAlignment getTextVerticalAlign()
Returns the text vertical alignment.

Returns:
VerticalAlignment The text vertical alignment.

setTextVerticalAlign

public void setTextVerticalAlign(VerticalAlignment verticalAlign)
Sets the text vertical alignment and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
verticalAlign - VerticalAlignment The text vertical alignment (null not permitted).

setTextPosition

public void setTextPosition(TextPosition position)
Sets the text position and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
position - TextPosition The text position (null not permitted).

getTextPosition

public TextPosition getTextPosition()
Returns the text position.

Returns:
TextPosition The text position.

getTextDirection

public TextDirection getTextDirection()
Returns the text direction.

Returns:
TextDirection The labe direction (never null).

setTextDirection

public void setTextDirection(TextDirection direction)
Sets the text direction and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
direction - TextDirection The text direction (null not permitted).

horizontalAlignToAnchor

protected TextAnchor horizontalAlignToAnchor(HorizontalAlignment align)
Convert horizontal to anchor.

Parameters:
align - HorizontalAlignment
Returns:
TextAnchor

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class AbstractAnnotation
Returns:
int A hash code value for this object.

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class AbstractAnnotation
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates and returns a copy of this object.

Overrides:
clone in class AbstractAnnotation
Returns:
object a clone of this instance.
Throws:
java.lang.CloneNotSupportedException - if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned.

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of the object.