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

文本类型的注解(annotation)对象的基类.

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
          缺省的字体.
static java.awt.Paint DEFAULT_PAINT
          缺省的文本颜色.
static double DEFAULT_ROTATION_ANGLE
          缺省旋转的角度.
static TextDirection DEFAULT_TEXT_DIRECTION
          缺省的文字方向.
static HorizontalAlignment DEFAULT_TEXT_HORIZONTAL_ALIGNMENT
          缺省文字水平对齐方式.
static TextPosition DEFAULT_TEXT_POSITION
          缺省文字和图形的位置关系.
static VerticalAlignment DEFAULT_TEXT_VERTICAL_ALIGNMENT
          缺省文字垂直对齐方式.
 
Constructor Summary
protected AbstractTextAnnotation(java.lang.String text)
          构造器.
 
Method Summary
 java.lang.Object clone()
          返回克隆的对象.
 boolean equals(java.lang.Object obj)
          测试两个对象是否相等.
 double getRotationAngle()
          返回旋转的角度(单位是弧度).
 java.lang.String getText()
          返回显示的文字.
 TextDirection getTextDirection()
          返回文字的方向.
 java.awt.Font getTextFont()
          返回文字的字体.
 HorizontalAlignment getTextHorizontalAlign()
          返回文字的水平对齐方式.
 java.awt.Paint getTextPaint()
          返回文字Paint.
 TextPosition getTextPosition()
          返回文字和图形的位置关系.
 VerticalAlignment getTextVerticalAlign()
          返回文字的垂直对齐方式.
 int hashCode()
          计算对象的hashcode值.
protected  TextAnchor horizontalAlignToAnchor(HorizontalAlignment align)
          根据水平对齐方式转化为TextAnchor对象.
 void setRotationAngle(double angle)
          设置旋转的角度(单位是弧度),并向所有监听器发送 AnnotationChangeEvent事件.
 void setText(java.lang.String text)
          设置显示的文字,并向所有监听器发送 AnnotationChangeEvent事件.
 void setTextDirection(TextDirection direction)
          设置文字的方向, 并向所有监听器发送ChartShapeChangeEvent事件.
 void setTextFont(java.awt.Font font)
          设置文字的字体, 并向所有监听器发送AnnotationChangeEvent事件.
 void setTextHorizontalAlign(HorizontalAlignment horizontalAlign)
          设置文字水平对齐方式, 并向所有监听器发送ChartShapeChangeEvent事件.
 void setTextPaint(java.awt.Paint paint)
          设置文字的Paint,并向所有监听器发送 AnnotationChangeEvent事件.
 void setTextPosition(TextPosition position)
          设置文字和图形的位置关系, 并向所有监听器发送ChartShapeChangeEvent事件.
 void setTextVerticalAlign(VerticalAlignment verticalAlign)
          设置文字垂直对齐方式, 并向所有监听器发送ChartShapeChangeEvent事件.
 java.lang.String toString()
          覆盖toString方法.
 
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
缺省的字体.


DEFAULT_PAINT

public static final java.awt.Paint DEFAULT_PAINT
缺省的文本颜色.


DEFAULT_ROTATION_ANGLE

public static final double DEFAULT_ROTATION_ANGLE
缺省旋转的角度.

See Also:
Constant Field Values

DEFAULT_TEXT_HORIZONTAL_ALIGNMENT

public static final HorizontalAlignment DEFAULT_TEXT_HORIZONTAL_ALIGNMENT
缺省文字水平对齐方式.


DEFAULT_TEXT_VERTICAL_ALIGNMENT

public static final VerticalAlignment DEFAULT_TEXT_VERTICAL_ALIGNMENT
缺省文字垂直对齐方式.


DEFAULT_TEXT_POSITION

public static final TextPosition DEFAULT_TEXT_POSITION
缺省文字和图形的位置关系.


DEFAULT_TEXT_DIRECTION

public static final TextDirection DEFAULT_TEXT_DIRECTION
缺省的文字方向.

Constructor Detail

AbstractTextAnnotation

protected AbstractTextAnnotation(java.lang.String text)
构造器.

Parameters:
text - 要绘制的文本 (不可为null).
Method Detail

getText

public java.lang.String getText()
返回显示的文字.

Returns:
String 显示的文字 (可能为null).

setText

public void setText(java.lang.String text)
设置显示的文字,并向所有监听器发送 AnnotationChangeEvent事件.

Parameters:
text - String 要显示的文字 (不可为null).

getTextFont

public java.awt.Font getTextFont()
返回文字的字体.

Returns:
Font 字体.

setTextFont

public void setTextFont(java.awt.Font font)
设置文字的字体, 并向所有监听器发送AnnotationChangeEvent事件.

Parameters:
font - Font 文字的字体 (不可为null).

getTextPaint

public java.awt.Paint getTextPaint()
返回文字Paint.

Returns:
Paint 文字Paint.

setTextPaint

public void setTextPaint(java.awt.Paint paint)
设置文字的Paint,并向所有监听器发送 AnnotationChangeEvent事件.

Parameters:
paint - Paint 文字Paint(不可为null)

getRotationAngle

public double getRotationAngle()
返回旋转的角度(单位是弧度).

Returns:
角度.

setRotationAngle

public void setRotationAngle(double angle)
设置旋转的角度(单位是弧度),并向所有监听器发送 AnnotationChangeEvent事件.

Parameters:
angle - 角度.

getTextHorizontalAlign

public HorizontalAlignment getTextHorizontalAlign()
返回文字的水平对齐方式.

Returns:
HorizontalAlignment 文字水平对齐方式.

setTextHorizontalAlign

public void setTextHorizontalAlign(HorizontalAlignment horizontalAlign)
设置文字水平对齐方式, 并向所有监听器发送ChartShapeChangeEvent事件.

Parameters:
horizontalAlign - HorizontalAlignment 文字水平对齐方式 (不可为null).

getTextVerticalAlign

public VerticalAlignment getTextVerticalAlign()
返回文字的垂直对齐方式.

Returns:
VerticalAlignment 文字垂直对齐方式.

setTextVerticalAlign

public void setTextVerticalAlign(VerticalAlignment verticalAlign)
设置文字垂直对齐方式, 并向所有监听器发送ChartShapeChangeEvent事件.

Parameters:
verticalAlign - VerticalAlignment 文字垂直对齐方式 (不可为null).

setTextPosition

public void setTextPosition(TextPosition position)
设置文字和图形的位置关系, 并向所有监听器发送ChartShapeChangeEvent事件.

Parameters:
position - TextPosition 文字和图形的位置关系 (不可为null).

getTextPosition

public TextPosition getTextPosition()
返回文字和图形的位置关系.

Returns:
TextPosition 文字和图形的位置关系.

getTextDirection

public TextDirection getTextDirection()
返回文字的方向.

Returns:
TextDirection 文字的方向 (不为null).

setTextDirection

public void setTextDirection(TextDirection direction)
设置文字的方向, 并向所有监听器发送ChartShapeChangeEvent事件.

Parameters:
direction - TextDirection 文字的方向 (不可为null).

horizontalAlignToAnchor

protected TextAnchor horizontalAlignToAnchor(HorizontalAlignment align)
根据水平对齐方式转化为TextAnchor对象.

Parameters:
align - HorizontalAlignment
Returns:
TextAnchor

hashCode

public int hashCode()
计算对象的hashcode值.

Overrides:
hashCode in class AbstractAnnotation
Returns:
int 对象的hashcode值.

equals

public boolean equals(java.lang.Object obj)
测试两个对象是否相等.

Overrides:
equals in class AbstractAnnotation
Parameters:
obj - 要比较的对象
Returns:
相等返回true,否则返回false.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
返回克隆的对象.

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()
覆盖toString方法.

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