com.ijchart.xychart.shape
Class PaintScaleLegendChartShape

java.lang.Object
  extended by com.ijchart.xychart.shape.AbstractChartShape
      extended by com.ijchart.xychart.shape.PaintScaleLegendChartShape
All Implemented Interfaces:
IChartShapeChangeListener, IChartShape, java.io.Serializable, java.lang.Cloneable, java.util.EventListener

public class PaintScaleLegendChartShape
extends AbstractChartShape
implements java.lang.Cloneable, java.io.Serializable

Title: IJChart

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

A legend shape for block chart.

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_AXIS_OFFSET
           The default offset between the axis and the strip.
static int DEFAULT_DIVISION
           The default number of divisions.
static boolean DEFAULT_DRAW_STRIP_BORDER
           A default boolean flag controls whether or not draw strip border.
static java.awt.Paint DEFAULT_STRIP_BORDER_PAINT
           The default paint used to draw strip border.
static java.awt.Stroke DEFAULT_STRIP_BORDER_STROKE
           The default stroke used to draw strip border.
static double DEFAULT_STRIP_WIDTH
           The width of strip.
 
Fields inherited from class com.ijchart.xychart.shape.AbstractChartShape
DEFAULT_DRAW_TYPE, DEFAULT_SHAPE_ID, DEFAULT_VISIBLE, transformedShape
 
Fields inherited from interface com.ijchart.xychart.shape.IChartShape
DEFAULT_BORDER_PAINT, DEFAULT_BORDER_STROKE, DEFAULT_CONTENT_PAINT, DEFAULT_DRAW_BORDER, DEFAULT_FILL_ALPHA, DEFAULT_FILL_PAINT, DEFAULT_FILL_SHAPE, DEFAULT_GRADIENT_PAINT_TRANSFORM_TYPE, DEFAULT_MARGIN, DEFAULT_SELECT_FILL_PAINT, DEFAULT_SELECT_RECT_ALPHA, DEFAULT_SELECT_RECT_WIDTH, DEFAULT_SELECTED, DEFAULT_TEXT_FONT, DEFAULT_TOOLTIP_SHAPE_WIDTH, HOTSPOT_TYPE_CIRCLE, HOTSPOT_TYPE_POLYGON, HOTSPOT_TYPE_RECTANGLE
 
Constructor Summary
PaintScaleLegendChartShape(IPaintScale paintScale, java.lang.String label, RectangleEdge position, java.awt.geom.Rectangle2D drawArea, IMatrixDataset dataset)
           A constructor.
 
Method Summary
protected  void calculateTransformedShape()
           Calculate the transformed shape.
 java.lang.Object clone()
           Creates and returns a copy of this object.
 void draw(java.awt.Graphics2D g2)
           Draw the ChartShape on a Java 2d graphics device(such as the screen or the printer).
protected  void drawSelect(java.awt.Graphics2D g2)
           Draw the selected ChartShape on a Java 2d graphics device(such as the screen or the printer).
 boolean equals(java.lang.Object obj)
           Indicates whether some other object is "equal to" this one.
 double getAxisOffset()
           Returns the offset between the axis and the strip.
 AxisShapeCollection getAxisShapes()
           Returns the axis shapes collection.
 IMatrixDataset getDataset()
           Returns the dataset.
 NumberRange getDatasetRange()
           Calculate the range of dataset.
 int getDivisions()
           Returns the number of divisions.
 java.awt.geom.Rectangle2D getDrawArea()
           Returns the drawing area.
protected  java.awt.Shape getHotspotShape()
           Returns the hotspot shape.
 java.lang.String getLabel()
           Returns the label.
protected  java.lang.String getMaximumLengthLabel()
           Returns the label of maximum length.
 IPaintScale getPaintScale()
           Returns the IPaintScale object.
 RectangleEdge getPosition()
           Returns the position of legend.
 ShapeType getShapeType()
           The type for describe this shape.
 java.awt.Paint getStripBorderPaint()
           Returns the paint used to draw strip border.
 java.awt.Stroke getStripBorderStroke()
           Returns the stroke used to draw strip border.
 double getStripWidth()
           Returns the width of strip.
 java.awt.geom.Point2D getTopLeftPoint()
           Returns the top left corner coordinates of this shape (not consider rotation).
 int hashCode()
           Returns a hash code value for the object.
 boolean isDrawStripBorder()
           Returns the boolean flag controls whether or not draw strip border.
 void setAxisOffset(double offset)
           Sets the offset between the axis and the strip and sends a ChartShapeChangeEvent to all registered listeners.
 void setDataset(IMatrixDataset dataset)
           Sets the dataset and sends a ChartShapeChangeEvent to all registered listeners.
 void setDivisions(int divisions)
           Sets the number of divisions and sends a ChartShapeChangeEvent to all registered listeners.
 void setDrawArea(java.awt.geom.Rectangle2D drawArea)
           Sets the drawing area and sends a ChartShapeChangeEvent to all registered listeners.
 void setDrawStripBorder(boolean flag)
           Sets the boolean flag controls whether or not draw strip border and sends a ChartShapeChangeEvent to all registered listeners.
 void setLabel(java.lang.String label)
           Sets the label of the strip and sends a ChartShapeChangeEvent to all registered listeners.
 void setPaintScale(IPaintScale paintScale)
           Sets the IPaintScale object and sends a ChartShapeChangeEvent to all registered listeners.
 void setPosition(RectangleEdge position)
           Sets the position of legend and sends a ChartShapeChangeEvent to all registered listeners.
 void setStripBorderPaint(java.awt.Paint paint)
           Sets the paint used to draw strip border and sends a ChartShapeChangeEvent to all registered listeners.
 void setStripBorderStroke(java.awt.Stroke stroke)
           Sets the stroke used to draw strip border and sends a ChartShapeChangeEvent to all registered listeners.
 void setStripWidth(double width)
           Sets the width of strip and sends a ChartShapeChangeEvent to all registered listeners.
 java.lang.String toString()
           Returns a string representation of the object.
 void translate(double tx, double ty)
           Concatenates the current Graphics2D Transform with a translation transform.and sends a ChartShapeChangeEvent to all registered listeners.
 
Methods inherited from class com.ijchart.xychart.shape.AbstractChartShape
addChangeListener, afterDraw, beforeDraw, chartShapeChanged, contains, contains, drawAnchorByPoints, drawBackground, drawBorder, drawShapeBorder, fillShape, fireChartShapeChanged, forceChartShapeChanged, getBorderPaint, getBorderStroke, getBound, getData, getFillAlpha, getFillPaint, getGradientPaintTransformType, getHotspotPolyCoords, getHotspotType, getHotspotType, getId, getLockPoint, getMargin, getOriginTooltipShape, getRotate, getSelectAnchorPaint, getSelectRectAlpha, getSelectRectWidth, getShapeChange, getShapeDrawType, getTooltipShape, getTooltipShapeRotate, getTooltipShapeTranslatePoint, getTooltipText, getURL, hasListener, isDrawBorder, isFillShape, isSelected, isVisible, notifyListeners, removeAllChangeListener, removeChangeListener, setBorderPaint, setBorderStroke, setData, setDrawBorder, setFillAlpha, setFillPaint, setFillShape, setGradientPaintTransformType, setId, setMargin, setOriginTooltipShape, setRotate, setSelectAnchorPaint, setSelected, setSelectRectAlpha, setSelectRectWidth, setShapeChange, setShapeDrawType, setTooltipText, setURL, setVisible
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_DIVISION

public static final int DEFAULT_DIVISION
The default number of divisions.

See Also:
Constant Field Values

DEFAULT_STRIP_WIDTH

public static final double DEFAULT_STRIP_WIDTH
The width of strip.

See Also:
Constant Field Values

DEFAULT_DRAW_STRIP_BORDER

public static final boolean DEFAULT_DRAW_STRIP_BORDER
A default boolean flag controls whether or not draw strip border.

See Also:
Constant Field Values

DEFAULT_STRIP_BORDER_PAINT

public static final java.awt.Paint DEFAULT_STRIP_BORDER_PAINT
The default paint used to draw strip border.


DEFAULT_STRIP_BORDER_STROKE

public static final java.awt.Stroke DEFAULT_STRIP_BORDER_STROKE
The default stroke used to draw strip border.


DEFAULT_AXIS_OFFSET

public static final double DEFAULT_AXIS_OFFSET
The default offset between the axis and the strip.

See Also:
Constant Field Values
Constructor Detail

PaintScaleLegendChartShape

public PaintScaleLegendChartShape(IPaintScale paintScale,
                                  java.lang.String label,
                                  RectangleEdge position,
                                  java.awt.geom.Rectangle2D drawArea,
                                  IMatrixDataset dataset)
A constructor.

Parameters:
paintScale - IPaintScale An object implements IPaintScale interface.
label - String The label.
position - RectangleEdge The position of legend (null not permitted).
drawArea - Rectangle2D The drawing area (null not permitted).
dataset - IMatrixDataset The dataset (null not permitted).
Method Detail

getPaintScale

public IPaintScale getPaintScale()
Returns the IPaintScale object.

Returns:
IPaintScale An IPaintScale object (never null).

setPaintScale

public void setPaintScale(IPaintScale paintScale)
Sets the IPaintScale object and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
paintScale - IPaintScale The IPaintScale object (null not permitted).

getPosition

public RectangleEdge getPosition()
Returns the position of legend.

Returns:
RectangleEdge The position of legend (never null).

setPosition

public void setPosition(RectangleEdge position)
Sets the position of legend and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
position - RectangleEdge The position of legend.

getDrawArea

public java.awt.geom.Rectangle2D getDrawArea()
Returns the drawing area.

Returns:
Rectangle2D The rectangle (never null).

setDrawArea

public void setDrawArea(java.awt.geom.Rectangle2D drawArea)
Sets the drawing area and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
drawArea - Rectangle2D The rectangle (null not permitted).

getDivisions

public int getDivisions()
Returns the number of divisions.

Returns:
int The count.

setDivisions

public void setDivisions(int divisions)
Sets the number of divisions and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
divisions - int The count and must be >0.

getStripWidth

public double getStripWidth()
Returns the width of strip.

Returns:
double The width.

setStripWidth

public void setStripWidth(double width)
Sets the width of strip and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
width - double The width.

isDrawStripBorder

public boolean isDrawStripBorder()
Returns the boolean flag controls whether or not draw strip border.

Returns:
boolean A boolean.

setDrawStripBorder

public void setDrawStripBorder(boolean flag)
Sets the boolean flag controls whether or not draw strip border and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
flag - boolean A boolean.

getStripBorderPaint

public java.awt.Paint getStripBorderPaint()
Returns the paint used to draw strip border.

Returns:
Paint The paint (never null).

setStripBorderPaint

public void setStripBorderPaint(java.awt.Paint paint)
Sets the paint used to draw strip border and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
paint - Paint The paint (null not permitted).

getStripBorderStroke

public java.awt.Stroke getStripBorderStroke()
Returns the stroke used to draw strip border.

Returns:
Stroke The stroke (never null).

setStripBorderStroke

public void setStripBorderStroke(java.awt.Stroke stroke)
Sets the stroke used to draw strip border and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
stroke - Stroke The stroke (null not permitted).

getAxisOffset

public double getAxisOffset()
Returns the offset between the axis and the strip.

Returns:
double The offset.

setAxisOffset

public void setAxisOffset(double offset)
Sets the offset between the axis and the strip and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
offset - double The offset.

getAxisShapes

public AxisShapeCollection getAxisShapes()
Returns the axis shapes collection.

Returns:
AxisShapeCollection The axis shapes collection (maybe null).

getLabel

public java.lang.String getLabel()
Returns the label.

Returns:
String The label (maybe null).

setLabel

public void setLabel(java.lang.String label)
Sets the label of the strip and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
label - String The label (null permitted).

getDataset

public IMatrixDataset getDataset()
Returns the dataset.

Returns:
IMatrixDataset The dataset (never null).

setDataset

public void setDataset(IMatrixDataset dataset)
Sets the dataset and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
dataset - IMatrixDataset The dataset (null not permitted).

draw

public void draw(java.awt.Graphics2D g2)
Draw the ChartShape on a Java 2d graphics device(such as the screen or the printer).

Specified by:
draw in interface IChartShape
Parameters:
g2 - Graphics2D The graphics device (such as the screen or the printer) (null not permitted).

drawSelect

protected void drawSelect(java.awt.Graphics2D g2)
Draw the selected ChartShape on a Java 2d graphics device(such as the screen or the printer).

Specified by:
drawSelect in class AbstractChartShape
Parameters:
g2 - Graphics2D the graphics device (such as the screen or the printer) (null not permitted).

getHotspotShape

protected java.awt.Shape getHotspotShape()
Returns the hotspot shape.

Specified by:
getHotspotShape in class AbstractChartShape
Returns:
Shape The hotspot shape (maybe null).

getShapeType

public ShapeType getShapeType()
The type for describe this shape.

Specified by:
getShapeType in interface IChartShape
Returns:
ShapeType The constant value in class ShapeType.

getTopLeftPoint

public java.awt.geom.Point2D getTopLeftPoint()
Returns the top left corner coordinates of this shape (not consider rotation).

Specified by:
getTopLeftPoint in interface IChartShape
Returns:
Point2D The coordinate.

translate

public void translate(double tx,
                      double ty)
Concatenates the current Graphics2D Transform with a translation transform.and sends a ChartShapeChangeEvent to all registered listeners. Subsequent rendering is translated by the specified distance relative to the previous position. This is equivalent to calling transform(T), where T is an AffineTransform represented by the following matrix:
                [   1    0    tx  ]
                [   0    1    ty  ]
                [   0    0    1   ]
 
.

Specified by:
translate in interface IChartShape
Parameters:
tx - double The distance to translate along the x-axis.
ty - double The distance to translate along the y-axis.

calculateTransformedShape

protected void calculateTransformedShape()
Calculate the transformed shape.

Specified by:
calculateTransformedShape in class AbstractChartShape

getMaximumLengthLabel

protected java.lang.String getMaximumLengthLabel()
Returns the label of maximum length.

Returns:
String

getDatasetRange

public NumberRange getDatasetRange()
Calculate the range of dataset.

Returns:
NumberRange

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class AbstractChartShape
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.

hashCode

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

Overrides:
hashCode in class AbstractChartShape
Returns:
int A hash code value for this object.

clone

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

Overrides:
clone in class AbstractChartShape
Returns:
object a clone of this instance.
Throws:
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.

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.