com.ijchart.xychart.chartinfo
Class ChartShapeCollection

java.lang.Object
  extended by com.ijchart.xychart.chartinfo.AbstractShapeCollection
      extended by com.ijchart.xychart.chartinfo.ChartShapeCollection
All Implemented Interfaces:
IShapeCollection, IChartShapeChangeListener, java.io.Serializable, java.lang.Cloneable, java.util.EventListener

public class ChartShapeCollection
extends AbstractShapeCollection
implements java.io.Serializable, java.lang.Cloneable

Title: IJChart

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

All elements in chart is a IChartShape , type is:title,legend,plot.

Copyright: Copyright (c) 2013

Company:

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

Field Summary
static double DEFAULT_SCALE_X_AXIS
           The default scale value of x-axis.
static double DEFAULT_SCALE_Y_AXIS
           The default scale value of y-axis.
 
Fields inherited from class com.ijchart.xychart.chartinfo.AbstractShapeCollection
shapeIdSequence
 
Constructor Summary
ChartShapeCollection()
           No argument constructor.
 
Method Summary
 void addPlotShapes(PlotShapeCollection plotShapes)
           Adds the plot shapes collection.
 void addTitleShapes(TitleShapeCollection titleShape)
           Add a title shape.
 void chartShapeChanged(ChartShapeChangeEvent event)
           Receives notification of an IChartShape change event.
 void clearPlotShapes()
           Remove all plots shape collection.
 void clearSelectedShapes()
           Sets all shapes to unselected.
 void clearShapesListener()
           Remove all the shapes of the listener.
 java.lang.Object clone()
           Creates and returns a copy of this object.
 void draw(java.awt.Graphics2D g2)
           Drawing all ChartShape in this collection.
 boolean equals(java.lang.Object obj)
           Override equals method.
 IChartShape findChartShape(java.awt.geom.Point2D point, ChartShapeDrawType drawType)
           Returns the IChartShape whose area contains the specified point.
 void forceChartChanged()
           Sets the boolean flag that the chart is changed.
 java.util.Collection getAllPlotShapes()
           Returns the shapes collection of all plot.
 IChartShape getBackgroundImageShape()
           Returns the background image shape.
 IChartShape getBackgroundShape()
           Returns the background shape.
 IChartShape getBorderShape()
           The border shape.
 IChangeChartShape getChangeChartShape()
           Returns the shape change object.
 java.util.List getHotspotAreas(java.util.List drawTypes, IAreaFragment fragment)
           Returns the hotspot areas.
 IJChart getIJChart()
           Returns the IJChart object.
 LegendShapeCollection getLegendShapes()
           Returns the legend shapes collection.
 PlotShapeCollection getPlotShapes()
           Returns the first plot shapes collection.
 PlotShapeCollection getPlotShapes(int index)
           Returns the plot shapes collection of the specified index.
 double getScaleX()
           Returns the scale value of x-axis.
 double getScaleY()
           Returns the scale value of y-axis.
 TitleShapeCollection getTitleShapes()
           Returns the first title shapes collection.
 TitleShapeCollection getTitleShapes(int index)
           Returns the title shapes collection of the specified index.
 java.util.List getTitleShapesList()
           Returns the list of title shapes and is unmodifiable.
 int hashCode()
           Override hasCode method.
 boolean isShapeChanged()
           Returns the boolean flag that controls whether or not the shape is changed.
 void setBackgroundImageShape(IChartShape shape)
           Sets the background image shape.
 void setBackgroundShape(IChartShape shape)
           Sets the background shape.
 void setBorderShape(IChartShape borderShape)
           Sets the border shape.
 void setChangeChartShape(IChangeChartShape change)
           Sets the shape change object.
 void setIJChart(IJChart chart)
           Sets the IJChart object.
 void setLegendShapes(LegendShapeCollection legendShapes)
           Sets the legend shapes collection.
 void setScaleX(double scale)
           Sets the scale value of x-axis.
 void setScaleY(double scale)
           Sets the scale value of y-axis.
 void setShapeChanged(boolean flag)
           Sets the boolean flag that controls whether or not the shape is changed.
 java.lang.String toString()
           Override toString method.
 void translate(double x, double y)
           Translates the origin of the all shape in this chart to the point (x, y) in the current coordinate system.
 
Methods inherited from class com.ijchart.xychart.chartinfo.AbstractShapeCollection
addChangeListener, addHotspotArea, addHotspotArea, clearSelectedShape, clearSelectedShape, clearShapesListener, clip, draw, findShape, fireChartShapeChanged, getDrawArea, hasListener, isDrawAreaContains, notifyListeners, removeAllChangeListener, removeChangeListener, removeShapesListener, resetShapeIdSequence, restoreClip, setDrawArea, translate
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_SCALE_X_AXIS

public static final double DEFAULT_SCALE_X_AXIS
The default scale value of x-axis.

See Also:
Constant Field Values

DEFAULT_SCALE_Y_AXIS

public static final double DEFAULT_SCALE_Y_AXIS
The default scale value of y-axis.

See Also:
Constant Field Values
Constructor Detail

ChartShapeCollection

public ChartShapeCollection()
No argument constructor.

Method Detail

getBackgroundShape

public IChartShape getBackgroundShape()
Returns the background shape.

Returns:
IChartShape The background shape (maybe null).

setBackgroundShape

public void setBackgroundShape(IChartShape shape)
Sets the background shape.

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

getBackgroundImageShape

public IChartShape getBackgroundImageShape()
Returns the background image shape.

Returns:
IChartShape The background image shape (maybe null).

setBackgroundImageShape

public void setBackgroundImageShape(IChartShape shape)
Sets the background image shape.

Parameters:
shape - IChartShape The background image shape (null permitted).

setBorderShape

public void setBorderShape(IChartShape borderShape)
Sets the border shape.

Parameters:
borderShape - IChartShape The border shape (null permitted).

getBorderShape

public IChartShape getBorderShape()
The border shape.

Returns:
IChartShape The border shape (maybe null).

getTitleShapesList

public java.util.List getTitleShapesList()
Returns the list of title shapes and is unmodifiable.

Returns:
List The list of title shapes and is unmodifiable.

addTitleShapes

public void addTitleShapes(TitleShapeCollection titleShape)
Add a title shape.

Parameters:
titleShape - TitleShapeCollection A title shape (null permitted).

getTitleShapes

public TitleShapeCollection getTitleShapes()
Returns the first title shapes collection.

Returns:
TitleShapeCollection The title shapes collection.

getTitleShapes

public TitleShapeCollection getTitleShapes(int index)
Returns the title shapes collection of the specified index.

Parameters:
index - int The index.
Returns:
TitleShapeCollection The title shapes collection.

getLegendShapes

public LegendShapeCollection getLegendShapes()
Returns the legend shapes collection.

Returns:
LegendShapeCollection The legend shapes collection.

setLegendShapes

public void setLegendShapes(LegendShapeCollection legendShapes)
Sets the legend shapes collection.

Parameters:
legendShapes - LegendShapeCollection The legend shapes collection (null permitted).

addPlotShapes

public void addPlotShapes(PlotShapeCollection plotShapes)
Adds the plot shapes collection.

Parameters:
plotShapes - PlotShapeCollection The plot shapes collection (null permitted).

getPlotShapes

public PlotShapeCollection getPlotShapes()
Returns the first plot shapes collection.

Returns:
PlotShapeCollection The plot shapes collection.

getPlotShapes

public PlotShapeCollection getPlotShapes(int index)
Returns the plot shapes collection of the specified index.

Parameters:
index - int The index.
Returns:
PlotShapeCollection The plot shapes collection.

getAllPlotShapes

public java.util.Collection getAllPlotShapes()
Returns the shapes collection of all plot.

Returns:
Collection The collection is unmodifiable.

clearPlotShapes

public void clearPlotShapes()
Remove all plots shape collection.


getIJChart

public IJChart getIJChart()
Returns the IJChart object.

Returns:
IJChart The IJChart (never null).

setIJChart

public void setIJChart(IJChart chart)
Sets the IJChart object.

Parameters:
chart - IJChart The IJChart (null not permitted).

isShapeChanged

public boolean isShapeChanged()
Returns the boolean flag that controls whether or not the shape is changed.

Returns:
boolean A boolean.

setShapeChanged

public void setShapeChanged(boolean flag)
Sets the boolean flag that controls whether or not the shape is changed.

Parameters:
flag - boolean A boolean.

forceChartChanged

public void forceChartChanged()
Sets the boolean flag that the chart is changed.


getScaleX

public double getScaleX()
Returns the scale value of x-axis.

Returns:
double The scale value.

setScaleX

public void setScaleX(double scale)
Sets the scale value of x-axis.

Parameters:
scale - double The scale value.

getScaleY

public double getScaleY()
Returns the scale value of y-axis.

Returns:
double The scale value.

setScaleY

public void setScaleY(double scale)
Sets the scale value of y-axis.

Parameters:
scale - double The scale value.

getChangeChartShape

public IChangeChartShape getChangeChartShape()
Returns the shape change object.

Returns:
IChangeChartShape The shape change object (maybe null).

setChangeChartShape

public void setChangeChartShape(IChangeChartShape change)
Sets the shape change object.

Parameters:
change - IChangeChartShape The shape change object.

draw

public void draw(java.awt.Graphics2D g2)
Drawing all ChartShape in this collection.

Specified by:
draw in interface IShapeCollection
Parameters:
g2 - Graphics2D The graphics device (null not permitted).

chartShapeChanged

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

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

translate

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

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

clearShapesListener

public void clearShapesListener()
Remove all the shapes of the listener.

Specified by:
clearShapesListener in interface IShapeCollection

findChartShape

public IChartShape findChartShape(java.awt.geom.Point2D point,
                                  ChartShapeDrawType drawType)
Returns the IChartShape whose area contains the specified point.

Specified by:
findChartShape in interface IShapeCollection
Parameters:
point - Point2D The point (null not permitted).
drawType - ChartShapeDrawType The shape draw shape (null permitted).
Returns:
IChartShape The chart shape (maybe null).

getHotspotAreas

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

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

clearSelectedShapes

public void clearSelectedShapes()
Sets all shapes to unselected.

Specified by:
clearSelectedShapes in interface IShapeCollection

hashCode

public int hashCode()
Override hasCode method.

Overrides:
hashCode in class AbstractShapeCollection
Returns:
int

equals

public boolean equals(java.lang.Object obj)
Override equals method.

Overrides:
equals in class AbstractShapeCollection
Parameters:
obj - Object
Returns:
boolean

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates and returns a copy of this object.

Overrides:
clone in class AbstractShapeCollection
Returns:
object a clone of this instance.
Throws:
java.lang.CloneNotSupportedException

toString

public java.lang.String toString()
Override toString method.

Overrides:
toString in class AbstractShapeCollection
Returns:
String