com.ijchart.xychart.title
Class AbstractTitle

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

public abstract class AbstractTitle
extends java.lang.Object
implements ITitle, java.io.Serializable, java.lang.Cloneable

Title: IJChart

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

The abstract implementation of title.

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 float DEFAULT_BACKGROUND_ALPHA
           The default foreground alpha transparency.
static java.awt.Paint DEFAULT_BACKGROUND_PAINT
           The default background fill paint.
static boolean DEFAULT_BORDER_VISIBLE
           A default flag that controls whether or not the chart border is drawn.
static boolean DEFAULT_FILL_BACKGROUND
           A default flag controls whether or not fill shape with background paint.
static HorizontalAlignment DEFAULT_HORIZONTAL_ALIGNMENT
           The default horizontal alignment.
static boolean DEFAULT_NOTIFY
           A default flag that can be used to temporarily disable the listener mechanism.
static RectangleInsets DEFAULT_PADDING
           Default title padding.
static RectangleEdge DEFAULT_TITLE_POSITION
           The default title position.
static VerticalAlignment DEFAULT_VERTICAL_ALIGNMENT
           The default vertical alignment.
 
Constructor Summary
protected AbstractTitle()
           Creates a new title, using default attributes where necessary.
protected AbstractTitle(RectangleEdge position, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment)
           Creates a new title, using default attributes where necessary.
protected AbstractTitle(RectangleEdge position, HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment, RectangleInsets padding)
           Creates a new title.
 
Method Summary
 void addChangeListener(ITitleChangeListener listener)
           Registers an object for notification of changes to the title.
 java.lang.Object clone()
           Returns a clone of the title.
 boolean equals(java.lang.Object obj)
           Tests an object for equality with this title.
protected  void fireTitleChanged()
           Notifies all registered listeners that the dataset has changed.
 float getBackgroundAlpha()
           Returns the alpha transparency of the plot area background.
 java.awt.Paint getBackgroundPaint()
           Returns the background paint.
 java.awt.Paint getBorderPaint()
           Returns the paint used to draw the chart border (if visible).
 java.awt.Stroke getBorderStroke()
           Returns the stroke used to draw the chart border (if visible).
 HorizontalAlignment getHorizontalAlignment()
           Returns the horizontal alignment of the title.
 boolean getNotify()
           Returns the flag that indicates whether or not the notification mechanism is enabled.
 RectangleInsets getPadding()
           Returns the title padding.
 RectangleEdge getPosition()
           Returns the position of the title.
 java.lang.String getToolTipText()
           Returns the tool tip text.
 java.lang.String getURLText()
           Returns the URL text.
 VerticalAlignment getVerticalAlignment()
           Returns the vertical alignment of the title.
 int hashCode()
          Returns a hashcode for the title.
 boolean hasListener(java.util.EventListener listener)
           Returns true if the specified object is registered with the dataset as a listener.
 boolean isBorderVisible()
           Returns a flag that controls whether or not a border is drawn around the outside of the chart.
 boolean isFillBackground()
           Returns whether or not fill shape with background paint.
protected  void notifyListeners(TitleChangeEvent event)
           Notifies all registered listeners that the chart title has changed in some way.
 void removeAllChangeListener()
           Deregisters all object for notification of changes to the axis.
 void removeChangeListener(ITitleChangeListener listener)
           Unregisters an object for notification of changes to the chart title.
 void setBackgroundAlpha(float alpha)
           Sets the alpha transparency of the plot area background, and notifies registered listeners that the plot has been modified.
 void setBackgroundPaint(java.awt.Paint paint)
           Sets the background paint and sends a TitleChangeEvent to all registered listeners.
 void setBorderPaint(java.awt.Paint paint)
           Sets the paint used to draw the chart border (if visible),and sends a TitleChangeEvent to all registered listeners.
 void setBorderStroke(java.awt.Stroke stroke)
           Sets the stroke used to draw the chart border (if visible),and sends a TitleChangeEvent to all registered listeners.
 void setBorderVisible(boolean visible)
           Sets a flag that controls whether or not a border is drawn around the outside of the chart,and sends a TitleChangeEvent to all registered listeners.
 void setFillBackground(boolean flag)
           Sets whether or not fill shape with background paint and sends a TitleChangeEvent to all registered listeners.
 void setHorizontalAlignment(HorizontalAlignment alignment)
           Sets the horizontal alignment for the title and sends a TitleChangeEvent to all registered listeners.
 void setNotify(boolean flag)
           Sets the flag that indicates whether or not the notification mechanism is enabled.
 void setPadding(RectangleInsets padding)
           Sets the title padding, and notifies any registered listeners of the change.
 void setPosition(RectangleEdge position)
           Sets the position for the title and sends a TitleChangeEvent to all registered listeners.
 void setToolTipText(java.lang.String tooltip)
           Sets the tool tip text to the specified text and sends a TitleChangeEvent to all registered listeners.
 void setURLText(java.lang.String url)
           Sets the URL text to the specified text and sends a TitleChangeEvent to all registered listeners.
 void setVerticalAlignment(VerticalAlignment alignment)
           Sets the vertical alignment for the title, and notifies any registered listeners of the change.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ijchart.xychart.title.ITitle
draw
 

Field Detail

DEFAULT_TITLE_POSITION

public static final RectangleEdge DEFAULT_TITLE_POSITION
The default title position.


DEFAULT_HORIZONTAL_ALIGNMENT

public static final HorizontalAlignment DEFAULT_HORIZONTAL_ALIGNMENT
The default horizontal alignment.


DEFAULT_VERTICAL_ALIGNMENT

public static final VerticalAlignment DEFAULT_VERTICAL_ALIGNMENT
The default vertical alignment.


DEFAULT_PADDING

public static final RectangleInsets DEFAULT_PADDING
Default title padding.


DEFAULT_BACKGROUND_PAINT

public static final java.awt.Paint DEFAULT_BACKGROUND_PAINT
The default background fill paint.


DEFAULT_BORDER_VISIBLE

public static final boolean DEFAULT_BORDER_VISIBLE
A default flag that controls whether or not the chart border is drawn.

See Also:
Constant Field Values

DEFAULT_FILL_BACKGROUND

public static final boolean DEFAULT_FILL_BACKGROUND
A default flag controls whether or not fill shape with background paint.

See Also:
Constant Field Values

DEFAULT_NOTIFY

public static final boolean DEFAULT_NOTIFY
A default flag that can be used to temporarily disable the listener mechanism.

See Also:
Constant Field Values

DEFAULT_BACKGROUND_ALPHA

public static final float DEFAULT_BACKGROUND_ALPHA
The default foreground alpha transparency.

See Also:
Constant Field Values
Constructor Detail

AbstractTitle

protected AbstractTitle()
Creates a new title, using default attributes where necessary.


AbstractTitle

protected AbstractTitle(RectangleEdge position,
                        HorizontalAlignment horizontalAlignment,
                        VerticalAlignment verticalAlignment)
Creates a new title, using default attributes where necessary.

Parameters:
position - RectangleEdge The position of the title (null not permitted).
horizontalAlignment - HorizontalAlignment The horizontal alignment of the title (null not permitted).
verticalAlignment - VerticalAlignment The vertical alignment of the title (null not permitted).

AbstractTitle

protected AbstractTitle(RectangleEdge position,
                        HorizontalAlignment horizontalAlignment,
                        VerticalAlignment verticalAlignment,
                        RectangleInsets padding)
Creates a new title.

Parameters:
position - RectangleEdge The position of the title (null not permitted).
horizontalAlignment - HorizontalAlignment The horizontal alignment of the title (null not permitted).
verticalAlignment - VerticalAlignment The vertical alignment of the title (null not permitted).
padding - RectangleInsets The title padding.
Method Detail

getPosition

public RectangleEdge getPosition()
Returns the position of the title.

Returns:
RectangleEdge The title position (never null).

setPosition

public void setPosition(RectangleEdge position)
Sets the position for the title and sends a TitleChangeEvent to all registered listeners.

Parameters:
position - RectangleEdge The position (null not permitted).

getHorizontalAlignment

public HorizontalAlignment getHorizontalAlignment()
Returns the horizontal alignment of the title.

Returns:
HorizontalAlignment The horizontal alignment (never null).

setHorizontalAlignment

public void setHorizontalAlignment(HorizontalAlignment alignment)
Sets the horizontal alignment for the title and sends a TitleChangeEvent to all registered listeners.

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

getVerticalAlignment

public VerticalAlignment getVerticalAlignment()
Returns the vertical alignment of the title.

Returns:
VerticalAlignment The vertical alignment (never null).

setVerticalAlignment

public void setVerticalAlignment(VerticalAlignment alignment)
Sets the vertical alignment for the title, and notifies any registered listeners of the change.

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

getNotify

public boolean getNotify()
Returns the flag that indicates whether or not the notification mechanism is enabled.

Returns:
boolean The flag.

setNotify

public void setNotify(boolean flag)
Sets the flag that indicates whether or not the notification mechanism is enabled. There are certain situations (such as cloning) where you want to turn notification off temporarily.

Parameters:
flag - boolean The new value of the flag.

getPadding

public RectangleInsets getPadding()
Returns the title padding.

Returns:
RectangleInsets Returns the title padding (never null).

setPadding

public void setPadding(RectangleInsets padding)
Sets the title padding, and notifies any registered listeners of the change.

Parameters:
padding - RectangleInsets The title padding (null not permitted).

getToolTipText

public java.lang.String getToolTipText()
Returns the tool tip text.

Returns:
String The tool tip text (possibly null).

setToolTipText

public void setToolTipText(java.lang.String tooltip)
Sets the tool tip text to the specified text and sends a TitleChangeEvent to all registered listeners.

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

getURLText

public java.lang.String getURLText()
Returns the URL text.

Returns:
String The URL text (possibly null).

setURLText

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

Parameters:
url - String The URL string (null permitted).

isFillBackground

public boolean isFillBackground()
Returns whether or not fill shape with background paint.

Returns:
boolean A boolean.

setFillBackground

public void setFillBackground(boolean flag)
Sets whether or not fill shape with background paint and sends a TitleChangeEvent to all registered listeners.

Parameters:
flag - boolean A boolean.

getBackgroundPaint

public java.awt.Paint getBackgroundPaint()
Returns the background paint.

Returns:
Paint The paint (possibly null).

setBackgroundPaint

public void setBackgroundPaint(java.awt.Paint paint)
Sets the background paint and sends a TitleChangeEvent to all registered listeners. If you set this attribute to null, no background is painted (which makes the title background transparent).

Parameters:
paint - Paint The background paint (null permitted).

getBackgroundAlpha

public float getBackgroundAlpha()
Returns the alpha transparency of the plot area background.

Returns:
The alpha transparency.

setBackgroundAlpha

public void setBackgroundAlpha(float alpha)
Sets the alpha transparency of the plot area background, and notifies registered listeners that the plot has been modified.

Parameters:
alpha - The new alpha value (in the range 0.0f to 1.0f).

isBorderVisible

public boolean isBorderVisible()
Returns a flag that controls whether or not a border is drawn around the outside of the chart.

Returns:
boolean A boolean.

setBorderVisible

public void setBorderVisible(boolean visible)
Sets a flag that controls whether or not a border is drawn around the outside of the chart,and sends a TitleChangeEvent to all registered listeners.

Parameters:
visible - boolean A boolean.

getBorderStroke

public java.awt.Stroke getBorderStroke()
Returns the stroke used to draw the chart border (if visible).

Returns:
Stroke The border stroke (never null).

setBorderStroke

public void setBorderStroke(java.awt.Stroke stroke)
Sets the stroke used to draw the chart border (if visible),and sends a TitleChangeEvent to all registered listeners.

Parameters:
stroke - Stroke The stroke (null not permitted).

getBorderPaint

public java.awt.Paint getBorderPaint()
Returns the paint used to draw the chart border (if visible).

Returns:
Paint The border paint (never null).

setBorderPaint

public void setBorderPaint(java.awt.Paint paint)
Sets the paint used to draw the chart border (if visible),and sends a TitleChangeEvent to all registered listeners.

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

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a clone of the title.

Overrides:
clone in class java.lang.Object
Returns:
Object A clone of the title.
Throws:
java.lang.CloneNotSupportedException - not thrown by this class, but it may be thrown by subclasses.

addChangeListener

public void addChangeListener(ITitleChangeListener listener)
Registers an object for notification of changes to the title.

Parameters:
listener - ITitleChangeListener The object that is being registered.

removeChangeListener

public void removeChangeListener(ITitleChangeListener listener)
Unregisters an object for notification of changes to the chart title.

Parameters:
listener - ITitleChangeListener The object that is being unregistered.

removeAllChangeListener

public void removeAllChangeListener()
Deregisters all object for notification of changes to the axis.


hasListener

public boolean hasListener(java.util.EventListener listener)
Returns true if the specified object is registered with the dataset as a listener. Most applications won't need to call this method, it exists mainly for use by unit testing code.

Parameters:
listener - the listener.
Returns:
A boolean.

fireTitleChanged

protected void fireTitleChanged()
Notifies all registered listeners that the dataset has changed.


notifyListeners

protected void notifyListeners(TitleChangeEvent event)
Notifies all registered listeners that the chart title has changed in some way.

Parameters:
event - TitleChangeEvent An object that contains information about the change to the title.

equals

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

Overrides:
equals in class java.lang.Object
Parameters:
obj - Object Tthe object (null not permitted).
Returns:
true or false.

hashCode

public int hashCode()
Returns a hashcode for the title.

Overrides:
hashCode in class java.lang.Object
Returns:
The hashcode.