com.ijchart.xychart.chartinfo
Class AbstractShapeCollection

java.lang.Object
  extended by com.ijchart.xychart.chartinfo.AbstractShapeCollection
All Implemented Interfaces:
IShapeCollection, IChartShapeChangeListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener
Direct Known Subclasses:
AnnotationShapeCollection, AxisShapeCollection, ChartShapeCollection, LegendShapeCollection, PlotShapeCollection, RenderShapeCollection, TitleShapeCollection

public abstract class AbstractShapeCollection
extends java.lang.Object
implements IChartShapeChangeListener, IShapeCollection, java.lang.Cloneable, java.io.Serializable

Title: IJChart

Description: a chart library for the Java(tm) platform.

The abstract class for all chart shape collection class.

Copyright: Copyright (c) 2013

Company:

Version:
1.0
Author:
zhang feng min,shanghai china. Contract me by email.
See Also:
Serialized Form

Field Summary
protected  int shapeIdSequence
           The sequence of shapes,first is 0.
 
Constructor Summary
AbstractShapeCollection()
           The constructor.
 
Method Summary
 void addChangeListener(IChartShapeChangeListener listener)
           Registers an object for notification of changes to the IChartShape.
protected  void addHotspotArea(java.util.List result, IChartShape shape, IAreaFragment fragment, ChartShapeDrawType drawType)
           Calculate the area of hotspot shape.
protected  void addHotspotArea(java.util.List result, java.util.List shapes, IAreaFragment fragment, ChartShapeDrawType drawType)
           Calculate the area of hotspot shape.
 void chartShapeChanged(ChartShapeChangeEvent event)
           Receives notification of an IChartShape change event.
protected  void clearSelectedShape(IChartShape shape)
           Clear the selected shape.
protected  void clearSelectedShape(java.util.List shapes)
           Clear all the selected shapes.
protected  void clearShapesListener(java.util.List shapes)
           Remove all the shapes of the listener.
protected  void clip(java.awt.Graphics2D g2)
           Set clip area.
 java.lang.Object clone()
           Returns a clone of the axis.
protected  void draw(java.awt.Graphics2D g2, java.util.List shapes)
           Drawing all ChartShape in this collection.
 boolean equals(java.lang.Object obj)
           Tests this axis for equality with another object.
protected  IChartShape findShape(java.util.List shapes, java.awt.geom.Point2D point, ChartShapeDrawType drawType)
           Find a shape which contains the specified point.
protected  void fireChartShapeChanged(IChartShape shape)
           Notifies all registered listeners that the chart shape has changed.
 java.awt.geom.Rectangle2D getDrawArea()
           Returns the draw area for all shapes.
 java.util.List getHotspotAreas(java.util.List drawTypes, IAreaFragment fragment)
           Returns the hotspot areas.
 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 isDrawAreaContains(java.awt.geom.Point2D point)
           Whether or not the draw area contains a point.
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.
protected  void removeShapesListener(java.util.List shapes, IChartShapeChangeListener listener)
           Remove all the shapes of the listener.
 void resetShapeIdSequence()
           Reset the sequence of shape to 0.
protected  void restoreClip(java.awt.Graphics2D g2)
           Restore clip area.
 void setDrawArea(java.awt.geom.Rectangle2D drawArea)
           For a series of graphics and their common belonging to a particular region, by recording the region, in dealing with the incident when the mouse to provide faster, no need to determine whether all the graphics are selected by the mouse, optional through this area To narrow the scope of the search.
 java.lang.String toString()
           Returns a string representation of the object.
 void translate(double x, double y)
           Translates the origin of the all shapes(not include axisLine3DShape) in this chart to the point (x, y) in the current coordinate system.
protected  void translate(double x, double y, java.util.List shapes)
           Translates the origin of the all shapes(not include axisLine3DShape) in this chart to the point (x, y) in the current coordinate system.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.ijchart.xychart.chartinfo.IShapeCollection
clearSelectedShapes, clearShapesListener, draw, findChartShape
 

Field Detail

shapeIdSequence

protected int shapeIdSequence
The sequence of shapes,first is 0.

Constructor Detail

AbstractShapeCollection

public AbstractShapeCollection()
The constructor.

Method Detail

setDrawArea

public void setDrawArea(java.awt.geom.Rectangle2D drawArea)
For a series of graphics and their common belonging to a particular region, by recording the region, in dealing with the incident when the mouse to provide faster, no need to determine whether all the graphics are selected by the mouse, optional through this area To narrow the scope of the search.

Specified by:
setDrawArea in interface IShapeCollection
Parameters:
drawArea - Rectangle2D The draw area for all shapes (null not permitted).

getDrawArea

public java.awt.geom.Rectangle2D getDrawArea()
Returns the draw area for all shapes.

Specified by:
getDrawArea in interface IShapeCollection
Returns:
Rectangle2D The draw area for all shapes (never null).

resetShapeIdSequence

public void resetShapeIdSequence()
Reset the sequence of shape to 0.

Specified by:
resetShapeIdSequence in interface IShapeCollection

isDrawAreaContains

public boolean isDrawAreaContains(java.awt.geom.Point2D point)
Whether or not the draw area contains a point.

Specified by:
isDrawAreaContains in interface IShapeCollection
Parameters:
point - Point2D The point (null not permitted).
Returns:
boolean Returns true if the draw area contains point,otherwise return false.

addChangeListener

public void addChangeListener(IChartShapeChangeListener listener)
Registers an object for notification of changes to the IChartShape.

Parameters:
listener - the object to register.

removeChangeListener

public void removeChangeListener(IChartShapeChangeListener listener)
Deregisters an object for notification of changes to the IChartShape.

Parameters:
listener - the object to deregister.

removeAllChangeListener

public void removeAllChangeListener()
Deregisters all object for notification of changes to the IChartShape.


hasListener

public boolean hasListener(IChartShapeChangeListener listener)
Returns true if the specified object is registered with the IChartShape as a listener. Most applications won't need to call this method, it exists mainly for use by unit testing code.

Parameters:
listener - the listener.
Returns:
A boolean.

notifyListeners

protected void notifyListeners(ChartShapeChangeEvent event)
Notifies all registered listeners that the chart shape has changed.

Parameters:
event - contains information about the event that triggered the notification.

fireChartShapeChanged

protected void fireChartShapeChanged(IChartShape shape)
Notifies all registered listeners that the chart shape has changed.

Parameters:
shape - IChartShape The chart shape object.

chartShapeChanged

public void chartShapeChanged(ChartShapeChangeEvent event)
Receives notification of an IChartShape change event.

Specified by:
chartShapeChanged in interface IChartShapeChangeListener
Parameters:
event - ChartShapeChangeEvent Information about the event.

translate

public void translate(double x,
                      double y)
Translates the origin of the all shapes(not include axisLine3DShape) in this chart to the point (x, y) in the current coordinate system.

Specified by:
translate in interface IShapeCollection
Parameters:
x - double The x coordinate.
y - double The y coordinate.

getHotspotAreas

public java.util.List getHotspotAreas(java.util.List drawTypes,
                                      IAreaFragment fragment)
Returns the hotspot areas.

Specified by:
getHotspotAreas in interface IShapeCollection
Parameters:
drawTypes - List The types of hotspot shape (null not permitted).
fragment - IAreaFragment The IAreaFragment object (maybe null).
Returns:
List The hotspot areas (never null).

clip

protected void clip(java.awt.Graphics2D g2)
Set clip area.

Parameters:
g2 - Graphics2D The graphics device (null not permitted).

restoreClip

protected void restoreClip(java.awt.Graphics2D g2)
Restore clip area.

Parameters:
g2 - Graphics2D The graphics device (null not permitted).

findShape

protected IChartShape findShape(java.util.List shapes,
                                java.awt.geom.Point2D point,
                                ChartShapeDrawType drawType)
Find a shape which contains the specified point.

Parameters:
shapes - List The collection of shapes (null permitted).
point - Point2D A point (null not permitted).
drawType - ChartShapeDrawType The shape draw shape (null permitted).
Returns:
IChartShape

draw

protected void draw(java.awt.Graphics2D g2,
                    java.util.List shapes)
Drawing all ChartShape in this collection.

Parameters:
g2 - Graphics2D The graphics device (null not permitted).
shapes - List The collection of shapes (null permitted).

translate

protected void translate(double x,
                         double y,
                         java.util.List shapes)
Translates the origin of the all shapes(not include axisLine3DShape) in this chart to the point (x, y) in the current coordinate system.

Parameters:
x - double The x coordinate.
y - double The y coordinate.
shapes - List The collection of shapes (null permitted).

clearShapesListener

protected void clearShapesListener(java.util.List shapes)
Remove all the shapes of the listener.

Parameters:
shapes - List The collection of shapes (null permitted).

clearSelectedShape

protected void clearSelectedShape(IChartShape shape)
Clear the selected shape.

Parameters:
shape - IChartShape The IChartShape object (null permitted).

clearSelectedShape

protected void clearSelectedShape(java.util.List shapes)
Clear all the selected shapes.

Parameters:
shapes - List The collection of shapes (null permitted).

removeShapesListener

protected void removeShapesListener(java.util.List shapes,
                                    IChartShapeChangeListener listener)
Remove all the shapes of the listener.

Parameters:
shapes - List The collection of shapes (null permitted).
listener - IChartShapeChangeListener The listener object (null permitted).

addHotspotArea

protected void addHotspotArea(java.util.List result,
                              IChartShape shape,
                              IAreaFragment fragment,
                              ChartShapeDrawType drawType)
Calculate the area of hotspot shape.

Parameters:
result - The result (null not permitted).
shape - List The chart shape (null permitted).
fragment - IAreaFragment The IAreaFragment object (maybe null).
drawType - ChartShapeDrawType The shape draw type (null permitted).

addHotspotArea

protected void addHotspotArea(java.util.List result,
                              java.util.List shapes,
                              IAreaFragment fragment,
                              ChartShapeDrawType drawType)
Calculate the area of hotspot shape.

Parameters:
result - The result (null not permitted).
shapes - List The collection of shapes (null permitted).
fragment - IAreaFragment The IAreaFragment object (maybe null).
drawType - ChartShapeDrawType The shape draw type (null permitted).

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a clone of the axis.

Overrides:
clone in class java.lang.Object
Returns:
A clone.
Throws:
java.lang.CloneNotSupportedException - if some component of the axis does not support cloning.

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class java.lang.Object
Returns:
A hash code value for this object.

equals

public boolean equals(java.lang.Object obj)
Tests this axis for equality with another object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The object (null permitted).
Returns:
true or false.

toString

public java.lang.String toString()
Returns a string representation of the object.

Overrides:
toString in class java.lang.Object
Returns:
A string representation of the object.