ChartCat 1.2

li.netcat.chart.util
Class TagPart

java.lang.Object
  extended byli.netcat.chart.util.AbstractPart
      extended byli.netcat.chart.util.TextPart
          extended byli.netcat.chart.util.TagPart
All Implemented Interfaces:
Part
Direct Known Subclasses:
CartesianScalePart, InscribePart, PolarScalePart

public abstract class TagPart
extends TextPart

Abstract super class of all parts that have to layout a series of labels (tags) that might need special handling of overlaps. Examples are scales or value parts that label directly some areas of the chart. The naming "tag" is used for this concept.

This class basically holds an instance of a tag manager, an instance of a pen that draws the lines and insets that define the bounds of the tags.

Author:
Arthur Marxer

Field Summary
 
Fields inherited from class li.netcat.chart.util.AbstractPart
BACKGROUND, FOREGROUND, PERSPECTIVE
 
Constructor Summary
TagPart()
          Constructs and initializes a new instance of a TagPart.
 
Method Summary
protected  Tag createTag(DeviceString text, float x, float y)
          Utility methods for subclasses that creates a tag with the corresponding properties.
protected  Tag createTag(DeviceString text, float x, float y, java.lang.Object perspective)
          Utility methods for subclasses that creates a tag with the corresponding properties.
protected  Tag createTag(DeviceString text, TextLook textLook, Pen pen, float x, float y, java.lang.Object perspective)
          Utility methods for subclasses that creates a tag with the corresponding properties.
 float getAdditionalLineLength()
          Returns the additional line length that shifts the text in the direction of the lines by an additional amount.
 int getBottom()
          Returns the bottom inset.
 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 getLeft()
          Returns the left inset.
 PenBox getLinePenBox()
          Returns the pen box that provides the pens used to draw the lines from the tag to the target point.
 Pen getPen()
          Returns the pen that is used to draw the line from the tag to the target point.
 int getRight()
          Returns the right inset.
abstract  TagConstraints getTagConstraints(java.awt.Graphics g)
          Subclasses must implement this method to report the tag constraints that do the first displacements.
 TagManager getTagManager()
          Returns the instance of the tag manager that is responsible to do the layout.
abstract  Tag[] getTags(java.awt.Graphics g)
          Subclasses must implement this method to report the list of tags that must be layouted.
 PenBox getTextPenBox()
          Returns the pen box that provides the pens used to draw the texts.
 int getTop()
          Returns the top inset.
 void setAdditionalLineLength(float length)
          Sets the additional line length that shifts the text in the direction of the lines by an additional amount.
 void setInsets(int top, int left, int bottom, int right)
          Sets the insets of this TagPart.
 void setLinePenBox(PenBox penBox)
          Sets a pen box that provides the pens used to draw the lines from the tag to the target point.
 void setPen(Pen pen)
          Sets the pen that is used to draw the lines from the tag to the target point.
 void setTagManager(TagManager manager)
          Sets the instance of the tag manager that is responsible to do the layout.
 void setTextPenBox(PenBox penBox)
          Sets a pen box that provides the pens used to draw the texts.
 
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
 

Constructor Detail

TagPart

public TagPart()
Constructs and initializes a new instance of a TagPart.

Method Detail

getPen

public Pen getPen()
Returns the pen that is used to draw the line from the tag to the target point.

Returns:
The pen, might be null.

setPen

public void setPen(Pen pen)
Sets the pen that is used to draw the lines from the tag to the target point.

Parameters:
pen - The pen, specify null to avoid the painting of the lines.

getLinePenBox

public PenBox getLinePenBox()
Returns the pen box that provides the pens used to draw the lines from the tag to the target point.


setLinePenBox

public void setLinePenBox(PenBox penBox)
Sets a pen box that provides the pens used to draw the lines from the tag to the target point.

Parameters:
penBox - The pen box, or null if the default pen should be used.

getTextPenBox

public PenBox getTextPenBox()
Returns the pen box that provides the pens used to draw the texts.


setTextPenBox

public void setTextPenBox(PenBox penBox)
Sets a pen box that provides the pens used to draw the texts.

Parameters:
penBox - The pen box, or null if the default should be used.

getAdditionalLineLength

public float getAdditionalLineLength()
Returns the additional line length that shifts the text in the direction of the lines by an additional amount.

Returns:
The length of the additional shift.

setAdditionalLineLength

public void setAdditionalLineLength(float length)
Sets the additional line length that shifts the text in the direction of the lines by an additional amount.

Returns:
The length of the additional shift.

getTop

public int getTop()
Returns the top inset.

Returns:
The top inset.

getLeft

public int getLeft()
Returns the left inset.

Returns:
The left inset.

getBottom

public int getBottom()
Returns the bottom inset.

Returns:
The bottom inset.

getRight

public int getRight()
Returns the right inset.

Returns:
The right inset.

setInsets

public void setInsets(int top,
                      int left,
                      int bottom,
                      int right)
Sets the insets of this TagPart. The insets are added to the bounds of the text before the detection of overlaps takes place.

Parameters:
top - The top inset.
left - The left inset.
bottom - The bottom inset.
right - The right inset.

getTagManager

public TagManager getTagManager()
Returns the instance of the tag manager that is responsible to do the layout.

Returns:
The currently installed TagManager.

setTagManager

public void setTagManager(TagManager manager)
Sets the instance of the tag manager that is responsible to do the layout.

Parameters:
manager - The new tag manager, not null.

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.

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.

createTag

protected Tag createTag(DeviceString text,
                        float x,
                        float y)
Utility methods for subclasses that creates a tag with the corresponding properties.

Parameters:
text - The text of the tag.
x - The x-coordinate of the target point.
y - The y-coordinate of the target point.

createTag

protected Tag createTag(DeviceString text,
                        float x,
                        float y,
                        java.lang.Object perspective)
Utility methods for subclasses that creates a tag with the corresponding properties.

Parameters:
text - The text of the tag.
x - The x-coordinate of the target point.
y - The y-coordinate of the target point.
perspective - The perspective position of the tag.
See Also:
PerspectivePart

createTag

protected Tag createTag(DeviceString text,
                        TextLook textLook,
                        Pen pen,
                        float x,
                        float y,
                        java.lang.Object perspective)
Utility methods for subclasses that creates a tag with the corresponding properties.

Parameters:
text - The text of the tag.
textLook - The look of the text.
pen - The pen used to paint the line.
x - The x-coordinate of the target point.
y - The y-coordinate of the target point.
perspective - The perspective position of the tag.
See Also:
PerspectivePart

getTagConstraints

public abstract TagConstraints getTagConstraints(java.awt.Graphics g)
Subclasses must implement this method to report the tag constraints that do the first displacements.

Parameters:
g - The relevant graphics object.
Returns:
The constraints that define where to place the tag labels.

getTags

public abstract Tag[] getTags(java.awt.Graphics g)
Subclasses must implement this method to report the list of tags that must be layouted.

Parameters:
g - The relevant graphics object.
Returns:
An array of tags that must be layouted, can also be empty or null, but must not contain null entries.

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