com.ijchart.xychart.title
Class TextTitle

java.lang.Object
  extended by com.ijchart.xychart.title.AbstractTitle
      extended by com.ijchart.xychart.title.TextTitle
All Implemented Interfaces:
ITitle, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
DateTitle

public class TextTitle
extends AbstractTitle
implements java.lang.Cloneable, java.io.Serializable

Title: IJChart

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

A chart title that displays a text string with automatic wrapping as required.

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 boolean DEFAULT_EXPAND_TO_FIT_SPACE
           A default flag that controls whether the title expands to fit the available space.
static java.awt.Font DEFAULT_FONT
           The default font.
static java.awt.Paint DEFAULT_TEXT_PAINT
           The default text color.
 
Fields inherited from class com.ijchart.xychart.title.AbstractTitle
DEFAULT_BACKGROUND_ALPHA, DEFAULT_BACKGROUND_PAINT, DEFAULT_BORDER_VISIBLE, DEFAULT_FILL_BACKGROUND, DEFAULT_HORIZONTAL_ALIGNMENT, DEFAULT_NOTIFY, DEFAULT_PADDING, DEFAULT_TITLE_POSITION, DEFAULT_VERTICAL_ALIGNMENT
 
Constructor Summary
TextTitle(java.lang.String text)
           Creates a new title, using default attributes where necessary.
TextTitle(java.lang.String text, java.awt.Font font)
           Creates a new title, using default attributes where necessary.
TextTitle(java.lang.String text, java.awt.Font font, java.awt.Paint textPaint, RectangleEdge position, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, RectangleInsets padding)
           Creates a new title, using default attributes where necessary.
 
Method Summary
 java.lang.Object clone()
           Returns a clone of this object.
 Rectangle draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D chartArea, ChartShapeCollection shapeCollection)
           Draw the title on chart area(chartArea).All title shape is stored in shapeCollection.
 boolean equals(java.lang.Object obj)
           Tests this title for equality with another object.
 boolean getExpandToFitSpace()
           Returns the flag that controls whether the title expands to fit the available space.
 java.lang.String getText()
           Returns the title text.
 java.awt.Font getTextFont()
           Returns the font used to display the title string.
 java.awt.Paint getTextPaint()
           Returns the paint used to display the title string.
 int hashCode()
           Returns a hash code.
 void setExpandToFitSpace(boolean flag)
           Sets a flag that controls whether the title expands to fit the available space and sends a TitleChangeEvent to all registered listeners.
 void setText(java.lang.String text)
           Sets the title to the specified text and sends a TitleChangeEvent to all registered listeners.
 void setTextFont(java.awt.Font font)
           Sets the font used to display the title string.
 void setTextPaint(java.awt.Paint paint)
           Sets the paint used to display the title string.Registered listeners are notified that the title has been modified.
 
Methods inherited from class com.ijchart.xychart.title.AbstractTitle
addChangeListener, fireTitleChanged, getBackgroundAlpha, getBackgroundPaint, getBorderPaint, getBorderStroke, getHorizontalAlignment, getNotify, getPadding, getPosition, getToolTipText, getURLText, getVerticalAlignment, hasListener, isBorderVisible, isFillBackground, notifyListeners, removeAllChangeListener, removeChangeListener, setBackgroundAlpha, setBackgroundPaint, setBorderPaint, setBorderStroke, setBorderVisible, setFillBackground, setHorizontalAlignment, setNotify, setPadding, setPosition, setToolTipText, setURLText, setVerticalAlignment
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FONT

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


DEFAULT_TEXT_PAINT

public static final java.awt.Paint DEFAULT_TEXT_PAINT
The default text color.


DEFAULT_EXPAND_TO_FIT_SPACE

public static final boolean DEFAULT_EXPAND_TO_FIT_SPACE
A default flag that controls whether the title expands to fit the available space.

See Also:
Constant Field Values
Constructor Detail

TextTitle

public TextTitle(java.lang.String text)
Creates a new title, using default attributes where necessary.

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

TextTitle

public TextTitle(java.lang.String text,
                 java.awt.Font font)
Creates a new title, using default attributes where necessary.

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

TextTitle

public TextTitle(java.lang.String text,
                 java.awt.Font font,
                 java.awt.Paint textPaint,
                 RectangleEdge position,
                 HorizontalAlignment horizontalAlignment,
                 VerticalAlignment verticalAlignment,
                 RectangleInsets padding)
Creates a new title, using default attributes where necessary.

Parameters:
text - String The title text (null not permitted).
font - Font The title font (null not permitted).
textPaint - Paint The title paint (null not permitted).
position - RectangleEdge The title position (null not permitted).
horizontalAlignment - HorizontalAlignment The horizontal alignment (null not permitted).
verticalAlignment - VerticalAlignment The vertical alignment (null not permitted).
padding - RectangleInsets The space to leave around the outside of the title (null not permitted).
Method Detail

getText

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

Returns:
The text (never null).

setText

public void setText(java.lang.String text)
Sets the title to the specified text and sends a TitleChangeEvent to all registered listeners.

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

getTextFont

public java.awt.Font getTextFont()
Returns the font used to display the title string.

Returns:
Font The font (never null).

setTextFont

public void setTextFont(java.awt.Font font)
Sets the font used to display the title string. Registered listeners are notified that the title has been modified.

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

getTextPaint

public java.awt.Paint getTextPaint()
Returns the paint used to display the title string.

Returns:
Paint The paint (never null).

setTextPaint

public void setTextPaint(java.awt.Paint paint)
Sets the paint used to display the title string.Registered listeners are notified that the title has been modified.

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

getExpandToFitSpace

public boolean getExpandToFitSpace()
Returns the flag that controls whether the title expands to fit the available space.

Returns:
boolean A boolean.

setExpandToFitSpace

public void setExpandToFitSpace(boolean flag)
Sets a flag that controls whether the title expands to fit the available space and sends a TitleChangeEvent to all registered listeners.

Parameters:
flag - boolean A boolean.

draw

public Rectangle draw(java.awt.Graphics2D g2,
                      java.awt.geom.Rectangle2D chartArea,
                      ChartShapeCollection shapeCollection)
Draw the title on chart area(chartArea).All title shape is stored in shapeCollection.

Specified by:
draw in interface ITitle
Parameters:
g2 - Graphics2D The graphics device (null not permitted).
chartArea - Rectangle2D The area within which the chart should be drawn.
shapeCollection - ChartShapeCollection Collects information about the plot (null permitted).
Returns:
Rectangle The area within which the title should be drawn.

equals

public boolean equals(java.lang.Object obj)
Tests this title for equality with another object.

Overrides:
equals in class AbstractTitle
Parameters:
obj - the object (null permitted).
Returns:
true or false.

hashCode

public int hashCode()
Returns a hash code.

Overrides:
hashCode in class AbstractTitle
Returns:
A hash code.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a clone of this object.

Overrides:
clone in class AbstractTitle
Returns:
A clone.
Throws:
java.lang.CloneNotSupportedException - never.