info.monitorenter.gui.chart.axistitlepainters
Class AxisTitlePainterDefault

java.lang.Object
  extended by info.monitorenter.gui.chart.axistitlepainters.AxisTitlePainterDefault
All Implemented Interfaces:
IAxisTitlePainter, Serializable

public class AxisTitlePainterDefault
extends Object
implements IAxisTitlePainter

An IAxisTitlePainter implementation that will render titles in a default way while adapting to x or y axis use

For x axis the title will be displayed centered below the axis. For y axis the title will be displayed rotated by 90 degrees centered left of the axis.

Version:
$Revision: 1.6 $
Author:
Achim Westermann
See Also:
Serialized Form

Field Summary
 
Fields inherited from interface info.monitorenter.gui.chart.IAxisTitlePainter
PROPERTY_TITLEFONT
 
Constructor Summary
AxisTitlePainterDefault()
          Defcon.
 
Method Summary
 void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
          Add a listener for the given property.
 int getHeight(IAxis axis, Graphics2D g2d)
          Returns the height of this axis title in px with respect to the current title of the given axis.
 PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
          Returns an array of all the listeners that were added to the this instance with IAxisTitlePainter.addPropertyChangeListener(String, PropertyChangeListener).
 Font getTitleFont()
          Returns the font used for painting the title or null if not configured.
 int getWidth(IAxis axis, Graphics2D g2d)
          Returns the width of this axis title in px with respect to the current title of the given axis.
 void paintTitle(IAxis axis, Graphics2D g)
          Invoked to let implementations paint the given title of the given axis.
 void removePropertyChangeListener(String property, PropertyChangeListener listener)
          Remove a PropertyChangeListener for a specific property.
 void setTitleFont(Font titleFont)
          Sets the title font to use.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AxisTitlePainterDefault

public AxisTitlePainterDefault()
Defcon.

Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
Description copied from interface: IAxisTitlePainter
Add a listener for the given property.

The following PropertyChangeEvent types should be fired to listeners:

getPropertyName() getSource() getOldValue() getNewValue()
IAxisTitlePainter.PROPERTY_TITLEFONT IAxisTitlePainter that changed Font, the old value. Font, the new value.

Specified by:
addPropertyChangeListener in interface IAxisTitlePainter
Parameters:
propertyName - the property to be informed about changes.
listener - the listener that will be informed.
See Also:
IAxisTitlePainter.addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)

getPropertyChangeListeners

public PropertyChangeListener[] getPropertyChangeListeners(String propertyName)
Description copied from interface: IAxisTitlePainter
Returns an array of all the listeners that were added to the this instance with IAxisTitlePainter.addPropertyChangeListener(String, PropertyChangeListener).

Specified by:
getPropertyChangeListeners in interface IAxisTitlePainter
Parameters:
propertyName - The name of the property being listened to.
Returns:
an array of all the listeners that were added to the this instance with IAxisTitlePainter.addPropertyChangeListener(String, PropertyChangeListener).
See Also:
IAxisTitlePainter.getPropertyChangeListeners(java.lang.String)

removePropertyChangeListener

public void removePropertyChangeListener(String property,
                                         PropertyChangeListener listener)
Description copied from interface: IAxisTitlePainter
Remove a PropertyChangeListener for a specific property. If listener was added more than once to the same event source for the specified property, it will be notified one less time after being removed. If propertyName is null, no exception is thrown and no action is taken. If listener is null, or was never added for the specified property, no exception is thrown and no action is taken.

Specified by:
removePropertyChangeListener in interface IAxisTitlePainter
Parameters:
property - The name of the property that was listened on.
listener - The PropertyChangeListener to be removed.
See Also:
IAxisTitlePainter.removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)

getHeight

public int getHeight(IAxis axis,
                     Graphics2D g2d)
Description copied from interface: IAxisTitlePainter
Returns the height of this axis title in px with respect to the current title of the given axis.

Specified by:
getHeight in interface IAxisTitlePainter
Parameters:
axis - the instance this title painter is working for.
g2d - needed for size informations (e.g. font widths).
Returns:
the height of this axis title in px with respect to the current title of the given axis.
See Also:
IAxisTitlePainter.getHeight(info.monitorenter.gui.chart.IAxis, java.awt.Graphics2D)

getTitleFont

public final Font getTitleFont()
Description copied from interface: IAxisTitlePainter
Returns the font used for painting the title or null if not configured.

Specified by:
getTitleFont in interface IAxisTitlePainter
Returns:
the font used for painting the title or null if not configured.
See Also:
IAxisTitlePainter.getTitleFont()

getWidth

public int getWidth(IAxis axis,
                    Graphics2D g2d)
Description copied from interface: IAxisTitlePainter
Returns the width of this axis title in px with respect to the current title of the given axis.

Specified by:
getWidth in interface IAxisTitlePainter
Parameters:
axis - the instance this title painter is working for.
g2d - needed for size informations (e.g. font widths).
Returns:
the width of this axis title in px with respect to the current title of the given axis.
See Also:
IAxisTitlePainter.getWidth(info.monitorenter.gui.chart.IAxis, java.awt.Graphics2D)

paintTitle

public void paintTitle(IAxis axis,
                       Graphics2D g)
Description copied from interface: IAxisTitlePainter
Invoked to let implementations paint the given title of the given axis.

Implementations should make use of the information about the axis coordinates (start pixel,end pixel) and the graphics context (for font dimensions) to do it right.

Specified by:
paintTitle in interface IAxisTitlePainter
Parameters:
axis - the axis to paint the title of, needed e.g. to IAxis.getTitle().
g - needed for size informations.
See Also:
IAxisTitlePainter.paintTitle(info.monitorenter.gui.chart.IAxis, java.awt.Graphics2D)

setTitleFont

public final void setTitleFont(Font titleFont)
Description copied from interface: IAxisTitlePainter
Sets the title font to use.

Specified by:
setTitleFont in interface IAxisTitlePainter
Parameters:
titleFont - the font to use for the title.
See Also:
IAxisTitlePainter.setTitleFont(java.awt.Font)


Copyright © 2001 - 2007 LGPL, All Rights Footloose.