org.ujac.chart
Class TextChartItem

java.lang.Object
  extended by org.ujac.chart.BaseChartItem
      extended by org.ujac.chart.TextChartItem
All Implemented Interfaces:
ChartItem
Direct Known Subclasses:
PieChartDescriptionItem

public class TextChartItem
extends BaseChartItem

Name: ChartTextItem
Description: Holds the data, required to precisely place a texual chart item.

Author:
lauerc

Field Summary
static Color DEFAULT_TEXT_COLOR
          The default text color.
 
Fields inherited from class org.ujac.chart.BaseChartItem
outputArea, position
 
Constructor Summary
TextChartItem(ChartItemPosition position, int maxWidth, int hAlign, String text, Font font)
          Constructs a ChartTextItem instance with specific attributes.
TextChartItem(ChartItemPosition position, int maxWidth, int hAlign, String text, Font font, Color color)
          Constructs a ChartTextItem instance with specific attributes.
TextChartItem(ChartItemPosition position, int hAlign, String text, Font font)
          Constructs a ChartTextItem instance with specific attributes.
TextChartItem(ChartItemPosition position, int hAlign, String text, Font font, Color color)
          Constructs a ChartTextItem instance with specific attributes.
TextChartItem(ChartItemPosition position, String text, Font font)
          Constructs a ChartTextItem instance with specific attributes.
TextChartItem(ChartItemPosition position, String text, Font font, Color color)
          Constructs a ChartTextItem instance with specific attributes.
TextChartItem(ChartItemPosition position, String text, Font font, Color color, boolean rotate)
          Constructs a ChartTextItem instance with specific attributes.
 
Method Summary
 Rectangle2D calculateOutputArea(Rectangle2D viewport, Graphics2D graphics)
          Calculates the position of the item.
 void draw(Rectangle2D viewport, Graphics2D graphics)
          Draws the item to the given graphic instance.
 Color getColor()
          Getter method for the the property color.
 Font getFont()
          Gets the item's font.
 int getHAlign()
          Gets the item's horizontal alignment.
 int getMaxWidth()
          Gets the maximum width of the item box.
 boolean getRotate()
          Getter method for the the property angle.
 String getText()
          Gets the item's text.
 TextChartItem setRotate(boolean rotate)
          Setter method for the the property color.
 
Methods inherited from class org.ujac.chart.BaseChartItem
alignItem, getHeight, getOutputArea, getPosition, getWidth, move, moveTo, resetMetrics
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TEXT_COLOR

public static final Color DEFAULT_TEXT_COLOR
The default text color.

Constructor Detail

TextChartItem

public TextChartItem(ChartItemPosition position,
                     String text,
                     Font font)
Constructs a ChartTextItem instance with specific attributes.

Parameters:
position - The position of the chart item.
text - The text of the chart item.
font - The font to render with.

TextChartItem

public TextChartItem(ChartItemPosition position,
                     String text,
                     Font font,
                     Color color,
                     boolean rotate)
Constructs a ChartTextItem instance with specific attributes.

Parameters:
position - The position of the chart item.
text - The text of the chart item.
font - The font to render with.
color - The text color to use.
rotate - The rotation angle of the text.

TextChartItem

public TextChartItem(ChartItemPosition position,
                     String text,
                     Font font,
                     Color color)
Constructs a ChartTextItem instance with specific attributes.

Parameters:
position - The position of the chart item.
text - The text of the chart item.
font - The font to render with.
color - The text color to use.

TextChartItem

public TextChartItem(ChartItemPosition position,
                     int hAlign,
                     String text,
                     Font font)
Constructs a ChartTextItem instance with specific attributes.

Parameters:
position - The position of the chart item.
hAlign - The horizontal alignment of the text.
text - The text of the chart item.
font - The font to render with.

TextChartItem

public TextChartItem(ChartItemPosition position,
                     int hAlign,
                     String text,
                     Font font,
                     Color color)
Constructs a ChartTextItem instance with specific attributes.

Parameters:
position - The position of the chart item.
hAlign - The horizontal alignment of the text.
text - The text of the chart item.
font - The font to render with.
color - The text color to use.

TextChartItem

public TextChartItem(ChartItemPosition position,
                     int maxWidth,
                     int hAlign,
                     String text,
                     Font font)
Constructs a ChartTextItem instance with specific attributes.

Parameters:
position - The position of the chart item.
maxWidth - The maximm width of the text item.
hAlign - The horizontal alignment of the text.
text - The text of the chart item.
font - The font to render with.

TextChartItem

public TextChartItem(ChartItemPosition position,
                     int maxWidth,
                     int hAlign,
                     String text,
                     Font font,
                     Color color)
Constructs a ChartTextItem instance with specific attributes.

Parameters:
position - The position of the chart item.
maxWidth - The maximm width of the text item.
hAlign - The horizontal alignment of the text.
text - The text of the chart item.
font - The font to render with.
color - The text color to use.
Method Detail

getText

public String getText()
Gets the item's text.

Returns:
The text of the chart item.

getMaxWidth

public int getMaxWidth()
Gets the maximum width of the item box.

Returns:
The maximum width of the item box.

getHAlign

public int getHAlign()
Gets the item's horizontal alignment.

Returns:
The horizontal alignment of the chart item text.

getFont

public Font getFont()
Gets the item's font.

Returns:
The font for the chart item.

getColor

public Color getColor()
Getter method for the the property color.

Returns:
The current value of property color.

getRotate

public boolean getRotate()
Getter method for the the property angle.

Returns:
The current value of property angle.

setRotate

public TextChartItem setRotate(boolean rotate)
Setter method for the the property color.

Parameters:
rotate - The new value for the property color.
Returns:
this instance.

calculateOutputArea

public Rectangle2D calculateOutputArea(Rectangle2D viewport,
                                       Graphics2D graphics)
Calculates the position of the item.

Specified by:
calculateOutputArea in class BaseChartItem
Parameters:
viewport - The viewport for chart output.
graphics - The graphics object, needed to calculate the metrics.
Returns:
The calculated output area.

draw

public void draw(Rectangle2D viewport,
                 Graphics2D graphics)
Draws the item to the given graphic instance.

Parameters:
viewport - The viewport for chart output.
graphics - The graphics object, used for output.


Copyright © 2003-2004 UJAC.org. All Rights Reserved.