lt.monarch.chart.text
Class AxisLabel

java.lang.Object
  extended by lt.monarch.chart.text.AxisLabel
All Implemented Interfaces:
java.io.Serializable, AbstractAxisLabel

public class AxisLabel
extends java.lang.Object
implements AbstractAxisLabel

Axis label class

See Also:
Serialized Form

Field Summary
Modifier and Type Field and Description
protected  Area area
          Label bounding polygon
protected  Orientation axisOrientation
          Axis orientation
protected  Rectangle2D bounds
          Rectangle inside which label text should be painted
protected  java.awt.FontMetrics fm
          Font metrics
protected  boolean keyLabel
          Is key label
protected  Rectangle2D wrappedBounds
          Rectangle inside which word wrapped label text should be painted
 
Constructor Summary
Constructor and Description
AxisLabel(int level, Rectangle2D r, java.awt.Font font, java.lang.String text, RotatedLabelPainter painter, java.awt.FontMetrics fm, Orientation axisOrientation, int index, boolean isKeyLabel)
          Axis label class constructor
 
Method Summary
Modifier and Type Method and Description
protected  void drawText(AbstractGraphics g, Rectangle2D r, AbstractTextPainter painter)
          Draws the text using specified painter
 double endPos()
          Returns the end position of the label.
 double endPosOtherAxis()
           
 Orientation getAxisOrientation()
          Return axis on which is label orientation
 Rectangle2D getBounds()
          Gets label bounds
 int getIndex()
          Gets the index value of this label
 Area getLabelArea()
          Gets label bounding area
 RotatedLabelPainter getPainter()
          Return label text painter
 java.lang.String getText()
          Gets label text
 boolean isKeyLabel()
          Indicates that label is key label
 int level()
          Returns a level of the label.
 void move(double deltax, double deltay)
          Moves the label the specified x and y offset.
 void moveToX(double posX)
          Moves the label to the specified X position.
 void moveToY(double posY)
          Moves the label to the specified Y position.
 void paint(AbstractGraphics g)
          Renders lebel on the Graphics context.
 double position()
          Returns a label position.
 double startPos()
          Returns the start position of the label.
 double startPosOtherAxis()
           
 java.lang.String toString()
           
 void wrap(double wrapWidth)
          Attempt to word wrap text to specified width
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

wrappedBounds

protected Rectangle2D wrappedBounds
Rectangle inside which word wrapped label text should be painted


bounds

protected Rectangle2D bounds
Rectangle inside which label text should be painted


fm

protected java.awt.FontMetrics fm
Font metrics


area

protected Area area
Label bounding polygon


axisOrientation

protected Orientation axisOrientation
Axis orientation


keyLabel

protected boolean keyLabel
Is key label

Constructor Detail

AxisLabel

public AxisLabel(int level,
                 Rectangle2D r,
                 java.awt.Font font,
                 java.lang.String text,
                 RotatedLabelPainter painter,
                 java.awt.FontMetrics fm,
                 Orientation axisOrientation,
                 int index,
                 boolean isKeyLabel)
Axis label class constructor

Parameters:
level - label level
r - bounding rectangle
font - label font
text - label text
painter - text painter
fm - font metrics
axisOrientation - axis orientation
index - index of the label in the axis
isKeyLabel - is key label
Method Detail

getText

public java.lang.String getText()
Gets label text

Specified by:
getText in interface AbstractAxisLabel
Returns:
label text

drawText

protected void drawText(AbstractGraphics g,
                        Rectangle2D r,
                        AbstractTextPainter painter)
Draws the text using specified painter

Parameters:
g - graphics context
r - rectangle bounds
painter - text painter

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getIndex

public int getIndex()
Description copied from interface: AbstractAxisLabel
Gets the index value of this label

Specified by:
getIndex in interface AbstractAxisLabel
Returns:
the index value

wrap

public void wrap(double wrapWidth)
Attempt to word wrap text to specified width

Parameters:
wrapWidth - width of wrapping area

getBounds

public Rectangle2D getBounds()
Gets label bounds

Specified by:
getBounds in interface AbstractAxisLabel
Returns:
label bounds

move

public void move(double deltax,
                 double deltay)
Description copied from interface: AbstractAxisLabel
Moves the label the specified x and y offset.

Specified by:
move in interface AbstractAxisLabel
Parameters:
deltax - x offset
deltay - y offset

paint

public void paint(AbstractGraphics g)
Description copied from interface: AbstractAxisLabel
Renders lebel on the Graphics context.

Specified by:
paint in interface AbstractAxisLabel
Parameters:
g - graphics context

level

public int level()
Description copied from interface: AbstractAxisLabel
Returns a level of the label.

Specified by:
level in interface AbstractAxisLabel
Returns:
the level of the label

position

public double position()
Description copied from interface: AbstractAxisLabel
Returns a label position. For example label's horizontal or vertical center can be used as position.

Specified by:
position in interface AbstractAxisLabel
Returns:
label's position

startPos

public double startPos()
Description copied from interface: AbstractAxisLabel
Returns the start position of the label.

Specified by:
startPos in interface AbstractAxisLabel
Returns:
the start position of the label

startPosOtherAxis

public double startPosOtherAxis()

endPos

public double endPos()
Description copied from interface: AbstractAxisLabel
Returns the end position of the label.

Specified by:
endPos in interface AbstractAxisLabel
Returns:
the end position of the label

endPosOtherAxis

public double endPosOtherAxis()

moveToY

public void moveToY(double posY)
Description copied from interface: AbstractAxisLabel
Moves the label to the specified Y position.

Specified by:
moveToY in interface AbstractAxisLabel
Parameters:
posY - the Y position to move label to

moveToX

public void moveToX(double posX)
Description copied from interface: AbstractAxisLabel
Moves the label to the specified X position.

Specified by:
moveToX in interface AbstractAxisLabel
Parameters:
posX - the X position to move label to

getLabelArea

public Area getLabelArea()
Description copied from interface: AbstractAxisLabel
Gets label bounding area

Specified by:
getLabelArea in interface AbstractAxisLabel
Returns:
label bounding area

isKeyLabel

public boolean isKeyLabel()
Description copied from interface: AbstractAxisLabel
Indicates that label is key label

Specified by:
isKeyLabel in interface AbstractAxisLabel
Returns:
true if label is key label

getPainter

public RotatedLabelPainter getPainter()
Return label text painter

Returns:
rotated label painter

getAxisOrientation

public Orientation getAxisOrientation()
Return axis on which is label orientation

Returns:
axis orientation