ChartCat 1.2

li.netcat.chart.util
Class LabelPart

java.lang.Object
  extended byli.netcat.chart.util.AbstractPart
      extended byli.netcat.chart.util.TextPart
          extended byli.netcat.chart.util.LabelPart
All Implemented Interfaces:
ChartModelListener, java.util.EventListener, Part

public class LabelPart
extends TextPart
implements ChartModelListener

The LabelPart is used to write an arbitrary text to the chart. It can have a constant text or retrieves it's text from a chart model using a key. It's also possible to specify an angle that rotates this label part by an arbitrary value.

Author:
Arthur Marxer

Field Summary
static int BASELINE
          Equal to ChartConstants.BASELINE
static int BOTTOM
          Equal to ChartConstants.BOTTOM
static int CENTER
          Equal to ChartConstants.CENTER
static int LEFT
          Equal to ChartConstants.LEFT
static int RIGHT
          Equal to ChartConstants.RIGHT
static int TOP
          Equal to ChartConstants.TOP
 
Fields inherited from class li.netcat.chart.util.AbstractPart
BACKGROUND, FOREGROUND, PERSPECTIVE
 
Constructor Summary
LabelPart(ChartModel chartModel, java.lang.String key)
          Constructs a new instance of a LabelPart that uses the given key to retrieve the text from the given chart model.
LabelPart(java.lang.String text)
          Constructs a new instance of a LabelPart using the given constant text.
 
Method Summary
 float getAngleDegrees()
          Returns the angle in degrees. 0 refers to normal, horizontal text, 90 is vertical (turned anticlockwise).
 ChartModel getChartModel()
          Returns the chart model that provides the text.
 int getHorizontalTextAlignment()
          Returns the horizontal alignment of the text.
 java.lang.String getKey()
          Returns the key that is used to retrieve the text from the chart model.
 Layout getLayout(java.awt.Graphics g)
          Returns an instance of a layout that is able to report the bounds of this part and is able to paint this part.
 int getVerticalTextAlignment()
          Returns the vertical alignment of the text.
 void onChartModelChange(ChartModelEvent event)
          Callback method that gets invoked when a change in the chart model occurs.
 void setAngleDegrees(float angle)
          Sets the angle in degrees. 0 refers to normal, horizontal text, 90 is vertical (turned anticlockwise).
 void setChartModel(ChartModel chartModel)
          Sets the chart model that provides the text.
 void setHorizontalTextAlignment(int horizontalTextAlignment)
          Sets the horizontal alignment of the text.
 void setKey(java.lang.String key)
          Sets the key that is used to retrieve the text from the chart model.
 void setVerticalTextAlignment(int verticalTextAlignment)
          Sets the vertical alignment of the text.
 
Methods inherited from class li.netcat.chart.util.TextPart
getTextLook, setTextLook
 
Methods inherited from class li.netcat.chart.util.AbstractPart
getChart, getPerspective, invalidate, setChart, setPerspective
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOP

public static final int TOP
Equal to ChartConstants.TOP

See Also:
Constant Field Values

LEFT

public static final int LEFT
Equal to ChartConstants.LEFT

See Also:
Constant Field Values

BOTTOM

public static final int BOTTOM
Equal to ChartConstants.BOTTOM

See Also:
Constant Field Values

RIGHT

public static final int RIGHT
Equal to ChartConstants.RIGHT

See Also:
Constant Field Values

CENTER

public static final int CENTER
Equal to ChartConstants.CENTER

See Also:
Constant Field Values

BASELINE

public static final int BASELINE
Equal to ChartConstants.BASELINE

See Also:
Constant Field Values
Constructor Detail

LabelPart

public LabelPart(java.lang.String text)
Constructs a new instance of a LabelPart using the given constant text. Internally this text is saved as the key.

Parameters:
text - The text that gets displayed.

LabelPart

public LabelPart(ChartModel chartModel,
                 java.lang.String key)
Constructs a new instance of a LabelPart that uses the given key to retrieve the text from the given chart model.

Parameters:
chartModel - The chart model that provides the text.
key - The key that is used to retrieve the text.
Method Detail

getKey

public java.lang.String getKey()
Returns the key that is used to retrieve the text from the chart model. If the chart model is null, the key is directly used as a constant text.

Returns:
The key, possibly also null.

setKey

public void setKey(java.lang.String key)
Sets the key that is used to retrieve the text from the chart model. If the chart model is null, the key is directly used as a constant text.

Parameters:
key - The new key, can be null.

getChartModel

public ChartModel getChartModel()
Returns the chart model that provides the text. If the chart model is null, the key is directly used as a constant text.

Returns:
The chart model, or null.

setChartModel

public void setChartModel(ChartModel chartModel)
Sets the chart model that provides the text. If the chart model is set to null, the key is directly used as a constant text.

Parameters:
chartModel - The chart model that provides the text.

getHorizontalTextAlignment

public int getHorizontalTextAlignment()
Returns the horizontal alignment of the text.

Returns:
One of LEFT, CENTER or RIGHT.

setHorizontalTextAlignment

public void setHorizontalTextAlignment(int horizontalTextAlignment)
Sets the horizontal alignment of the text.

Parameters:
horizontalTextAlignment - Specify one of LEFT, CENTER or RIGHT.

getVerticalTextAlignment

public int getVerticalTextAlignment()
Returns the vertical alignment of the text.

Returns:
One of TOP, CENTER, BASELINE or BOTTOM.

setVerticalTextAlignment

public void setVerticalTextAlignment(int verticalTextAlignment)
Sets the vertical alignment of the text.


getAngleDegrees

public float getAngleDegrees()
Returns the angle in degrees. 0 refers to normal, horizontal text, 90 is vertical (turned anticlockwise).

Returns:
The angle in degrees.

setAngleDegrees

public void setAngleDegrees(float angle)
Sets the angle in degrees. 0 refers to normal, horizontal text, 90 is vertical (turned anticlockwise).

Returns:
The angle in degrees.

onChartModelChange

public void onChartModelChange(ChartModelEvent event)
Description copied from interface: ChartModelListener
Callback method that gets invoked when a change in the chart model occurs.

Specified by:
onChartModelChange in interface ChartModelListener
Parameters:
event - The description of the event.

getLayout

public Layout getLayout(java.awt.Graphics g)
Description copied from interface: Part
Returns an instance of a layout that is able to report the bounds of this part and is able to paint this part.

Specified by:
getLayout in interface Part
Parameters:
g - The relevant graphics object.
Returns:
A layout that is able to report the bounds of this part and is able to paint this part. This method may also return null.

ChartCat 1.2

Copyright © 2003 - 2005 NetCat Inc.. All rights reserved. Feedback

Chart,Charting,Charts,Java,Java Chart,Java Charting,Java Charts,Chart Java,Charts Java,3D,3D Chart,3Dchart,Graph,Graphs,Chart Graph,Java Graph,Diagram,Diagrams,Java Diagram,Java Diagrams,Curve,Curves,Bar Chart,Pie Chart,Line Chart,Area Chart,Bar Graph,Pie Graph,Line Graph,Java Diagram,Chart Diagram,Package,Library,Chart Library,Chart Engine,Chart Package,Graph Package,Paint,Support,Graphic,Graphics,Print, Chart,Charting,Charts,Java,Java Chart,Java Charting,Java Charts,Chart Java,Charts Java,3D,3D Chart,3Dchart,Graph,Graphs,Chart Graph,Java Graph,Diagram,Diagrams,Java Diagram,Java Diagrams,Curve,Curves,Bar Chart,Pie Chart,Line Chart,Area Chart,Bar Graph,Pie Graph,Line Graph,Java Diagram,Chart Diagram,Package,Library,Chart Library,Chart Engine,Chart Package,Graph Package,Paint,Support,Graphic,Graphics,Print, Chart,Charting,Charts,Java,Java Chart,Java Charting,Java Charts,Chart Java,Charts Java,3D,3D Chart,3Dchart,Graph,Graphs,Chart Graph,Java Graph,Diagram,Diagrams,Java Diagram,Java Diagrams,Curve,Curves,Bar Chart,Pie Chart,Line Chart,Area Chart,Bar Graph,Pie Graph,Line Graph,Java Diagram,Chart Diagram,Package,Library,Chart Library,Chart Engine,Chart Package,Graph Package,Paint,Support,Graphic,Graphics,Print