Package org.jfree.chart.entity
Class ChartEntity
- java.lang.Object
-
- org.jfree.chart.entity.ChartEntity
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,PublicCloneable
- Direct Known Subclasses:
AxisEntity
,CategoryItemEntity
,FlowEntity
,JFreeChartEntity
,LegendItemEntity
,NodeEntity
,PieSectionEntity
,PlotEntity
,TickLabelEntity
,TitleEntity
,XYAnnotationEntity
,XYItemEntity
public class ChartEntity extends java.lang.Object implements java.lang.Cloneable, PublicCloneable, java.io.Serializable
A class that captures information about some component of a chart (a bar, line etc).- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private java.awt.Shape
area
The area occupied by the entity (in Java 2D space).private static long
serialVersionUID
For serialization.private java.lang.String
toolTipText
The tool tip text for the entity.private java.lang.String
urlText
The URL text for the entity.
-
Constructor Summary
Constructors Constructor Description ChartEntity(java.awt.Shape area)
Creates a new chart entity.ChartEntity(java.awt.Shape area, java.lang.String toolTipText)
Creates a new chart entity.ChartEntity(java.awt.Shape area, java.lang.String toolTipText, java.lang.String urlText)
Creates a new entity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canEqual(java.lang.Object other)
Ensures symmetry between super/subclass implementations of equals.java.lang.Object
clone()
Returns a clone of the entity.boolean
equals(java.lang.Object obj)
Tests the entity for equality with an arbitrary object.java.awt.Shape
getArea()
Returns the area occupied by the entity (in Java 2D space).java.lang.String
getImageMapAreaTag(ToolTipTagFragmentGenerator toolTipTagFragmentGenerator, URLTagFragmentGenerator urlTagFragmentGenerator)
Returns an HTML image map tag for this entity.private java.lang.String
getPolyCoords(java.awt.Shape shape)
Returns a string containing the coordinates for a given shape.private java.lang.String
getRectCoords(java.awt.geom.Rectangle2D rectangle)
Returns a string containing the coordinates (x1, y1, x2, y2) for a given rectangle.java.lang.String
getShapeCoords()
Returns the shape coordinates as a string.java.lang.String
getShapeType()
Returns a string describing the entity area.java.lang.String
getToolTipText()
Returns the tool tip text for the entity.java.lang.String
getURLText()
Returns the URL text for the entity.int
hashCode()
Returns a hash code for this instance.private void
readObject(java.io.ObjectInputStream stream)
Provides serialization support.void
setArea(java.awt.Shape area)
Sets the area for the entity.void
setToolTipText(java.lang.String text)
Sets the tool tip text.void
setURLText(java.lang.String text)
Sets the URL text.java.lang.String
toString()
Returns a string representation of the chart entity, useful for debugging.private void
writeObject(java.io.ObjectOutputStream stream)
Provides serialization support.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
For serialization.- See Also:
- Constant Field Values
-
area
private transient java.awt.Shape area
The area occupied by the entity (in Java 2D space).
-
toolTipText
private java.lang.String toolTipText
The tool tip text for the entity.
-
urlText
private java.lang.String urlText
The URL text for the entity.
-
-
Constructor Detail
-
ChartEntity
public ChartEntity(java.awt.Shape area)
Creates a new chart entity.- Parameters:
area
- the area (null
not permitted).
-
ChartEntity
public ChartEntity(java.awt.Shape area, java.lang.String toolTipText)
Creates a new chart entity.- Parameters:
area
- the area (null
not permitted).toolTipText
- the tool tip text (null
permitted).
-
ChartEntity
public ChartEntity(java.awt.Shape area, java.lang.String toolTipText, java.lang.String urlText)
Creates a new entity.- Parameters:
area
- the area (null
not permitted).toolTipText
- the tool tip text (null
permitted).urlText
- the URL text for HTML image maps (null
permitted).
-
-
Method Detail
-
getArea
public java.awt.Shape getArea()
Returns the area occupied by the entity (in Java 2D space).- Returns:
- The area (never
null
).
-
setArea
public void setArea(java.awt.Shape area)
Sets the area for the entity.This class conveys information about chart entities back to a client. Setting this area doesn't change the entity (which has already been drawn).
- Parameters:
area
- the area (null
not permitted).
-
getToolTipText
public java.lang.String getToolTipText()
Returns the tool tip text for the entity. Be aware that this text may have been generated from user supplied data, so for security reasons some form of filtering should be applied before incorporating this text into any HTML output.- Returns:
- The tool tip text (possibly
null
).
-
setToolTipText
public void setToolTipText(java.lang.String text)
Sets the tool tip text.- Parameters:
text
- the text (null
permitted).
-
getURLText
public java.lang.String getURLText()
Returns the URL text for the entity. Be aware that this text may have been generated from user supplied data, so some form of filtering should be applied before this "URL" is used in any output.- Returns:
- The URL text (possibly
null
).
-
setURLText
public void setURLText(java.lang.String text)
Sets the URL text.- Parameters:
text
- the text (null
permitted).
-
getShapeType
public java.lang.String getShapeType()
Returns a string describing the entity area. This string is intended for use in an AREA tag when generating an image map.- Returns:
- The shape type (never
null
).
-
getShapeCoords
public java.lang.String getShapeCoords()
Returns the shape coordinates as a string.- Returns:
- The shape coordinates (never
null
).
-
getRectCoords
private java.lang.String getRectCoords(java.awt.geom.Rectangle2D rectangle)
Returns a string containing the coordinates (x1, y1, x2, y2) for a given rectangle. This string is intended for use in an image map.- Parameters:
rectangle
- the rectangle (null
not permitted).- Returns:
- Upper left and lower right corner of a rectangle.
-
getPolyCoords
private java.lang.String getPolyCoords(java.awt.Shape shape)
Returns a string containing the coordinates for a given shape. This string is intended for use in an image map.- Parameters:
shape
- the shape (null
not permitted).- Returns:
- The coordinates for a given shape as string.
-
getImageMapAreaTag
public java.lang.String getImageMapAreaTag(ToolTipTagFragmentGenerator toolTipTagFragmentGenerator, URLTagFragmentGenerator urlTagFragmentGenerator)
Returns an HTML image map tag for this entity. The returned fragment should beXHTML 1.0
compliant.- Parameters:
toolTipTagFragmentGenerator
- a generator for the HTML fragment that will contain the tooltip text (null
not permitted if this entity contains tooltip information).urlTagFragmentGenerator
- a generator for the HTML fragment that will contain the URL reference (null
not permitted if this entity has a URL).- Returns:
- The HTML tag.
-
toString
public java.lang.String toString()
Returns a string representation of the chart entity, useful for debugging.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A string.
-
equals
public boolean equals(java.lang.Object obj)
Tests the entity for equality with an arbitrary object.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the object to test against (null
permitted).- Returns:
- A boolean.
-
canEqual
public boolean canEqual(java.lang.Object other)
Ensures symmetry between super/subclass implementations of equals. For more detail, see http://jqno.nl/equalsverifier/manual/inheritance.- Parameters:
other
- Object- Returns:
- true ONLY if the parameter is THIS class type
-
hashCode
public int hashCode()
Returns a hash code for this instance.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- A hash code.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Returns a clone of the entity.- Specified by:
clone
in interfacePublicCloneable
- Overrides:
clone
in classjava.lang.Object
- Returns:
- A clone.
- Throws:
java.lang.CloneNotSupportedException
- if there is a problem cloning the entity.
-
writeObject
private void writeObject(java.io.ObjectOutputStream stream) throws java.io.IOException
Provides serialization support.- Parameters:
stream
- the output stream.- Throws:
java.io.IOException
- if there is an I/O error.
-
readObject
private void readObject(java.io.ObjectInputStream stream) throws java.io.IOException, java.lang.ClassNotFoundException
Provides serialization support.- Parameters:
stream
- the input stream.- Throws:
java.io.IOException
- if there is an I/O error.java.lang.ClassNotFoundException
- if there is a classpath problem.
-
-