|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ijchart.xychart.shape.AbstractChartShape
public abstract class AbstractChartShape
Title: IJChart
Description: a chart library for the Java(tm) platform.
A base class for handling the drawing ofIChartShape
.
Copyright: Copyright (c) 2013
Company:
Field Summary | |
---|---|
static ChartShapeDrawType |
DEFAULT_DRAW_TYPE
The default chart shape draw type. |
static int |
DEFAULT_SHAPE_ID
The default shape id. |
static boolean |
DEFAULT_VISIBLE
A default flag controls whether or not the ChartShape can be selected. |
protected java.awt.Shape |
transformedShape
The transformed shape for calculate whether or not contains a point. |
Constructor Summary | |
---|---|
protected |
AbstractChartShape()
No argument constructor. |
Method Summary | |
---|---|
void |
addChangeListener(IChartShapeChangeListener listener)
Registers an object for notification of changes to the IChartShape . |
protected void |
afterDraw(java.awt.Graphics2D g2)
Call the afterDraw method of class IShapeChange . |
protected void |
beforeDraw(java.awt.Graphics2D g2)
Call the beforeDraw method of class IShapeChange . |
protected abstract void |
calculateTransformedShape()
Calculate the transformed shape. |
void |
chartShapeChanged(ChartShapeChangeEvent event)
Receives notification of an IChartShape change event. |
java.lang.Object |
clone()
Creates and returns a copy of this object. |
boolean |
contains(double x,
double y)
Tests if a specified Point2D is inside the boundary of the ChartShape. |
boolean |
contains(java.awt.geom.Point2D point)
Tests if a specified Point2D is inside the boundary of the ChartShape. |
protected void |
drawAnchorByPoints(java.awt.Graphics2D g2,
double translateX,
double translateY,
java.awt.geom.Point2D.Double[] points)
Draw anchor by the coordinates of points. |
protected void |
drawBackground(java.awt.Graphics2D g2,
java.awt.Shape drawArea)
Draw background color. |
protected void |
drawBorder(java.awt.Graphics2D g2,
java.awt.Shape drawArea)
Draw border. |
protected abstract void |
drawSelect(java.awt.Graphics2D g2)
Draw the selected ChartShape on a Java 2d graphics device(such as the screen or the printer). |
protected void |
drawShapeBorder(java.awt.Graphics2D g2,
java.awt.Shape shape)
Outline this shape. |
boolean |
equals(java.lang.Object obj)
Indicates if some other object is "equal to" this one. |
protected void |
fillShape(java.awt.Graphics2D g2,
java.awt.Paint fillPaint,
java.awt.Shape shape)
Fill this shape. |
protected void |
fireChartShapeChanged()
Notifies all registered listeners that the chart shape has changed. |
void |
forceChartShapeChanged()
If the data object of IChartShape changed and no event
triggered,set IChartShape changed by this method. |
java.awt.Paint |
getBorderPaint()
Get the ChartShape border Paint. |
java.awt.Stroke |
getBorderStroke()
Get the ChartShape border Stroke. |
java.awt.geom.Rectangle2D |
getBound()
Returns a Rectangle2D that completely encloses the Shape. |
IChartData |
getData()
Returns the IChartData object. |
float |
getFillAlpha()
Returns the alpha value for fill background. |
java.awt.Paint |
getFillPaint()
Get the ChartShape fill paint. |
GradientPaintTransformType |
getGradientPaintTransformType()
Get the ChartShape GradientPaintTransformType type. |
java.lang.String |
getHotspotPolyCoords(java.awt.Shape parentClipArea)
Returns a string containing the coordinates for a given shape.This string is intended for use in an image map. |
protected abstract java.awt.Shape |
getHotspotShape()
Returns the hotspot shape. |
java.lang.String |
getHotspotType()
Returns the shape type of hotspot. |
protected java.lang.String |
getHotspotType(java.awt.Shape shape)
Returns the shape type of hotspot. |
int |
getId()
Returns the ID. |
java.awt.geom.Point2D |
getLockPoint()
Returns the lock coordinates of this shape. |
RectangleInsets |
getMargin()
Returns the margin around the inside of the block. |
java.awt.Shape |
getOriginTooltipShape()
Returns the original tooltip shape. |
double |
getRotate()
Return the angle of rotation in radians. |
java.awt.Paint |
getSelectAnchorPaint()
Returns the anchor Paint of selected ChartShape. |
float |
getSelectRectAlpha()
Returns the anchor rectangle alpha value of selected ChartShape. |
double |
getSelectRectWidth()
Returns the anchor rectangle width of selected ChartShape. |
IShapeChange |
getShapeChange()
Returns the IShapeChange object. |
ChartShapeDrawType |
getShapeDrawType()
Returns the chart shape draw type. |
java.awt.Shape |
getTooltipShape()
Returns the tooltip shape. |
protected double |
getTooltipShapeRotate()
Returns the angle of rotation of the tooltip shape. |
protected java.awt.geom.Point2D |
getTooltipShapeTranslatePoint()
Returns the translate point of tooltip shape. |
java.lang.String |
getTooltipText()
Returns the tooltip text. |
java.lang.String |
getURL()
Returns the URL text. |
int |
hashCode()
Returns a hash code value for the object. |
boolean |
hasListener(IChartShapeChangeListener listener)
Returns true if the specified object is registered with the IChartShape as a listener. |
boolean |
isDrawBorder()
A flag that controls whether or not the shape border is visible. |
boolean |
isFillShape()
A flag that controls whether or not the shape is filled. |
boolean |
isSelected()
Returns whether or not this shape is selected. |
boolean |
isVisible()
Returns whether or not the shape is visible. |
protected void |
notifyListeners(ChartShapeChangeEvent event)
Notifies all registered listeners that the chart shape has changed. |
void |
removeAllChangeListener()
Deregisters all object for notification of changes to the IChartShape . |
void |
removeChangeListener(IChartShapeChangeListener listener)
Deregisters an object for notification of changes to the IChartShape . |
void |
setBorderPaint(java.awt.Paint paint)
Sets the shape border Paint and sends a ChartShapeChangeEvent to all registered listeners. |
void |
setBorderStroke(java.awt.Stroke stroke)
Sets the shape border Stroke and sends a ChartShapeChangeEvent to all registered listeners. |
void |
setData(IChartData data)
Sets the IChartData object and sends a ChartShapeChangeEvent to all registered listeners. |
void |
setDrawBorder(boolean flag)
Sets a flag that controls whether or not the shape border is visible and sends a ChartShapeChangeEvent to all registered listeners. |
void |
setFillAlpha(float alpha)
The alpha value for fill background and sends a ChartShapeChangeEvent to all registered listeners. |
void |
setFillPaint(java.awt.Paint paint)
Sets the shape fill Paint and sends a ChartShapeChangeEvent to all registered listeners. |
void |
setFillShape(boolean bFillShape)
Sets a flag that controls whether or not the shape is filled,and sends a ChartShapeChangeEvent to all registered listeners. |
void |
setGradientPaintTransformType(GradientPaintTransformType transformType)
Sets the ChartShape GradientPaintTransformType type,use only when fill Paint is GradientPaint,and sends a ChartShapeChangeEvent to all registered listeners. |
void |
setId(int shapeId)
Sets an ID for this shape,the shape ID is unique and continuous in a chart. |
void |
setMargin(RectangleInsets margin)
Sets the margin around the inside of the block,and sends a ChartShapeChangeEvent to all registered listeners. |
void |
setOriginTooltipShape(java.awt.Shape shape)
Sets the original tooltip shape. |
void |
setRotate(double theta)
Sets the anchor Paint of selected ChartShape,and sends a ChartShapeChangeEvent to all registered listeners. |
void |
setSelected(boolean flag)
Sets a flag controls whether or not the shape is selected,and sends a ChartShapeChangeEvent to all registered listeners. |
void |
setSelectRectAlpha(float selectRectAlpha)
Sets the anchor rectangle alpha value of selected ChartShape,and sends a ChartShapeChangeEvent to all registered listeners. |
void |
setSelectRectWidth(double width)
Sets the anchor rectangle width of selected ChartShape,and sends a ChartShapeChangeEvent to all registered listeners. |
void |
setShapeChange(IShapeChange change)
Sets the IShapeChange object. |
void |
setShapeDrawType(ChartShapeDrawType drawType)
Sets the chart shape draw type and sends a ChartShapeChangeEvent to all registered listeners. |
void |
setTooltipText(java.lang.String tooltip)
Sets the tooltip text. |
void |
setURL(java.lang.String url)
Sets the URL text. |
void |
setVisible(boolean flag)
Sets whether or not the shape is visible and sends a ChartShapeChangeEvent to all registered listeners. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.ijchart.xychart.shape.IChartShape |
---|
draw, getShapeType, getTopLeftPoint, translate |
Field Detail |
---|
public static final int DEFAULT_SHAPE_ID
public static final ChartShapeDrawType DEFAULT_DRAW_TYPE
public static final boolean DEFAULT_VISIBLE
protected transient java.awt.Shape transformedShape
Constructor Detail |
---|
protected AbstractChartShape()
Method Detail |
---|
public void setId(int shapeId)
setId
in interface IChartShape
shapeId
- intpublic int getId()
getId
in interface IChartShape
public java.awt.Paint getFillPaint()
getFillPaint
in interface IChartShape
public GradientPaintTransformType getGradientPaintTransformType()
getGradientPaintTransformType
in interface IChartShape
public java.awt.Paint getBorderPaint()
getBorderPaint
in interface IChartShape
public java.awt.Stroke getBorderStroke()
getBorderStroke
in interface IChartShape
public boolean isDrawBorder()
isDrawBorder
in interface IChartShape
public boolean isFillShape()
isFillShape
in interface IChartShape
public void setDrawBorder(boolean flag)
ChartShapeChangeEvent
to all registered listeners.
setDrawBorder
in interface IChartShape
flag
- boolean
true,draw the border of the shape;false otherwise.public void setFillPaint(java.awt.Paint paint)
ChartShapeChangeEvent
to all registered listeners.
setFillPaint
in interface IChartShape
paint
- Paint
The ChartShape fill Paint(null not permitted).public void setFillShape(boolean bFillShape)
ChartShapeChangeEvent
to all registered listeners.
setFillShape
in interface IChartShape
bFillShape
- boolean
true,fill the shape;false otherwise.public void setGradientPaintTransformType(GradientPaintTransformType transformType)
ChartShapeChangeEvent
to all registered listeners.
setGradientPaintTransformType
in interface IChartShape
transformType
- GradientPaintTransformType
The gradient paint transform type (null permitted).public void setBorderPaint(java.awt.Paint paint)
ChartShapeChangeEvent
to all registered listeners.
setBorderPaint
in interface IChartShape
paint
- Paint
The ChartShape border Paint(null not permitted).public void setBorderStroke(java.awt.Stroke stroke)
ChartShapeChangeEvent
to all registered listeners.
setBorderStroke
in interface IChartShape
stroke
- Stroke
The ChartShape border Stroke(null not permitted).public void setRotate(double theta)
ChartShapeChangeEvent
to all registered listeners.
Subsequent rendering is rotated by the specified radians relative to the previous
origin.This is equivalent to calling transform(R), where R is an
AffineTransform represented by the following matrix:
[ cos(theta) -sin(theta) 0 ] [ sin(theta) cos(theta) 0 ] [ 0 0 1 ]Rotating with a positive angle theta rotates points on the positive x axis toward the positive y axis.
setRotate
in interface IChartShape
theta
-
the angle of rotation in radians.public void setSelected(boolean flag)
ChartShapeChangeEvent
to all registered listeners.
setSelected
in interface IChartShape
flag
- boolean
A boolean.public double getRotate()
getRotate
in interface IChartShape
public boolean isSelected()
isSelected
in interface IChartShape
public java.awt.Shape getOriginTooltipShape()
getOriginTooltipShape
in interface IChartShape
public void setOriginTooltipShape(java.awt.Shape shape)
setOriginTooltipShape
in interface IChartShape
shape
- Shape
A shape (null permitted).public java.awt.Shape getTooltipShape()
getTooltipShape
in interface IChartShape
protected java.awt.geom.Point2D getTooltipShapeTranslatePoint()
protected double getTooltipShapeRotate()
public void setSelectRectWidth(double width)
ChartShapeChangeEvent
to all registered listeners.
width
- double
The width,must greater than 0.public void setSelectAnchorPaint(java.awt.Paint selectAnchorPaint)
ChartShapeChangeEvent
to all registered listeners.
selectAnchorPaint
- Paint
null not permitted.public double getSelectRectWidth()
public java.awt.Paint getSelectAnchorPaint()
public boolean contains(java.awt.geom.Point2D point)
contains
in interface IChartShape
point
- Point2D
The position,maybe a mouse point (null not permitted).
public boolean contains(double x, double y)
contains
in interface IChartShape
x
- double
the x position.y
- double
the y position.
protected abstract void calculateTransformedShape()
public void setMargin(RectangleInsets margin)
ChartShapeChangeEvent
to all registered listeners.
margin
- RectangleInsets
The margin around the inside of the block (null permitted).public RectangleInsets getMargin()
public void setSelectRectAlpha(float selectRectAlpha)
ChartShapeChangeEvent
to all registered listeners.
selectRectAlpha
- float
The alpha value,must be a floating point number in the inclusive range [0.0,1.0].public float getSelectRectAlpha()
public void setFillAlpha(float alpha)
ChartShapeChangeEvent
to all registered listeners.
setFillAlpha
in interface IChartShape
alpha
- float
The alpha transparency (in the range 0.0f to 1.0f, where 0.0f is fully transparent,
and 1.0f is fully opaque).public float getFillAlpha()
getFillAlpha
in interface IChartShape
public void setTooltipText(java.lang.String tooltip)
setTooltipText
in interface IChartShape
tooltip
- String
The tooltip text (null permitted).public java.lang.String getTooltipText()
getTooltipText
in interface IChartShape
public void setURL(java.lang.String url)
setURL
in interface IChartShape
url
- String
The URL text (null permitted).public java.lang.String getURL()
getURL
in interface IChartShape
public java.awt.geom.Rectangle2D getBound()
getBound
in interface IChartShape
protected void drawBackground(java.awt.Graphics2D g2, java.awt.Shape drawArea)
g2
- Graphics2D
The specified Graphics context.drawArea
- Shape
The draw area.protected void drawBorder(java.awt.Graphics2D g2, java.awt.Shape drawArea)
g2
- Graphics2D
The specified Graphics context.drawArea
- Shape
The draw area.public java.awt.geom.Point2D getLockPoint()
getLockPoint
in interface IChartShape
public IChartData getData()
getData
in interface IChartShape
public void setData(IChartData data)
ChartShapeChangeEvent
to all registered listeners.
setData
in interface IChartShape
data
- IChartData
(null permitted).public boolean isVisible()
isVisible
in interface IChartShape
public void setVisible(boolean flag)
ChartShapeChangeEvent
to all registered listeners.
setVisible
in interface IChartShape
flag
- boolean
A boolean.public ChartShapeDrawType getShapeDrawType()
getShapeDrawType
in interface IChartShape
public void setShapeDrawType(ChartShapeDrawType drawType)
ChartShapeChangeEvent
to all registered listeners.
setShapeDrawType
in interface IChartShape
drawType
- ChartShapeDrawType
(null not permitted).public void addChangeListener(IChartShapeChangeListener listener)
IChartShape
.
addChangeListener
in interface IChartShape
listener
-
the object to register.public void removeChangeListener(IChartShapeChangeListener listener)
IChartShape
.
removeChangeListener
in interface IChartShape
listener
-
the object to deregister.public void removeAllChangeListener()
IChartShape
.
removeAllChangeListener
in interface IChartShape
public boolean hasListener(IChartShapeChangeListener listener)
IChartShape
as a listener. Most applications won't need to call this
method, it exists mainly for use by unit testing code.
listener
-
the listener.
public void forceChartShapeChanged()
IChartShape
changed and no event
triggered,set IChartShape
changed by this method.
forceChartShapeChanged
in interface IChartShape
public void chartShapeChanged(ChartShapeChangeEvent event)
IChartShape
change event.
chartShapeChanged
in interface IChartShapeChangeListener
event
-
Information about the event.public void setShapeChange(IShapeChange change)
IShapeChange
object.
setShapeChange
in interface IChartShape
change
- IShapeChange
IShapeChange
object (null permitted).public java.lang.String getHotspotPolyCoords(java.awt.Shape parentClipArea)
getHotspotPolyCoords
in interface IChartShape
parentClipArea
- Shape
The clip area.
public java.lang.String getHotspotType()
getHotspotType
in interface IChartShape
protected abstract java.awt.Shape getHotspotShape()
public IShapeChange getShapeChange()
IShapeChange
object.
getShapeChange
in interface IChartShape
IShapeChange
object (maybe null).protected abstract void drawSelect(java.awt.Graphics2D g2)
g2
- Graphics2D
the graphics device (such as the screen or the printer) (null not permitted).protected void fireChartShapeChanged()
protected void notifyListeners(ChartShapeChangeEvent event)
event
-
contains information about the event that triggered the notification.protected void drawAnchorByPoints(java.awt.Graphics2D g2, double translateX, double translateY, java.awt.geom.Point2D.Double[] points)
g2
- Graphics2D
the graphics device (such as the screen or the printer) (null not permitted).translateX
- double
The x offset value, the other point coordinates are relative to this coordinate.translateY
- double
The y offset value, the other point coordinates are relative to this coordinate.points
- Double[]
The coordinates of draw anchor.protected void fillShape(java.awt.Graphics2D g2, java.awt.Paint fillPaint, java.awt.Shape shape)
g2
- Graphics2D
the graphics device (such as the screen or the printer) (null not permitted).fillPaint
- Paint
The fill paint (null not permitted).shape
- Shape
The fill shape (null not permitted).protected void drawShapeBorder(java.awt.Graphics2D g2, java.awt.Shape shape)
g2
- Graphics2D
the graphics device (such as the screen or the printer) (null not permitted).shape
- Shape
The fill shape (null not permitted).protected void beforeDraw(java.awt.Graphics2D g2)
IShapeChange
.
g2
- Graphics2D
The graphics device (such as the screen or the printer) (null not permitted).protected void afterDraw(java.awt.Graphics2D g2)
IShapeChange
.
g2
- Graphics2D
The graphics device (such as the screen or the printer) (null not permitted).protected java.lang.String getHotspotType(java.awt.Shape shape)
shape
- Shape
The shape (null permitted).
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
-
the reference object with which to compare.
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- if the object's class does not
support the Cloneable interface. Subclasses
that override the clone method can also
throw this exception to indicate that an instance cannot
be cloned.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |