com.ijchart.xychart.marker
Class AbstractMarker

java.lang.Object
  extended by com.ijchart.xychart.marker.AbstractMarker
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
CategoryMarker, IntervalValueMarker, ValueMarker

public abstract class AbstractMarker
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

Title: IJChart

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

The base class for markers that can be added to plots to highlight a value or range of values.

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 java.awt.Paint DEFAULT_FILL_PAINT
           The default fill Paint
static TextPosition DEFAULT_TEXT_POSITION
           The default text position.
 
Constructor Summary
protected AbstractMarker()
           Creates a new marker with default attributes.
protected AbstractMarker(java.awt.Paint fillPaint)
           Constructs a new marker.
protected AbstractMarker(java.awt.Paint fillPaint, java.awt.Paint borderPaint, java.awt.Stroke borderStroke, float fillAlpha)
           Constructs a new marker.
 
Method Summary
 void addChangeListener(IMarkerChangeListener listener)
           Registers an object for notification of changes to the marker.
 java.lang.Object clone()
           Creates a clone of the marker.
 boolean equals(java.lang.Object obj)
           Tests the marker for equality with an arbitrary object.
protected  void fireMarkerChanged()
           Notifies all registered listeners that the dataset has changed.
 java.awt.Paint getBorderPaint()
           Get the ChartShape border Paint
 java.awt.Stroke getBorderStroke()
           Get the ChartShape border Stroke
 float getFillAlpha()
           Returns the alpha value for fill background.
 java.awt.Paint getFillPaint()
           Get the ChartShape fill paint
 java.util.EventListener[] getListeners(java.lang.Class listenerType)
           Returns an array containing all the listeners of the specified type.
 RectangleInsets getMargin()
           Returns the margin around the inside of the block.
 java.lang.String getText()
           Returns the text.
 java.awt.Font getTextFont()
           Returns the text font.
 HorizontalAlignment getTextHorizontalAlign()
           Returns the text horizontal alignment.
 java.awt.Paint getTextPaint()
           Get the ChartShape text Paint
 TextPosition getTextPosition()
           Returns the text position.
 VerticalAlignment getTextVerticalAlign()
           Returns the text vertical alignment.
 int hashCode()
           Returns a hash code value for the object.
 boolean isDrawBorder()
           A flag that controls whether or not the shape border is visible
 boolean isDrawText()
           Returns a flag that controls whether or not the text is drawn.
 boolean isFillShape()
           A flag that controls whether or not the shape is filled
protected  void notifyListeners(MarkerChangeEvent event)
           Notifies all registered listeners that the marker has been modified.
 void removeChangeListener(IMarkerChangeListener listener)
           Unregisters an object for notification of changes to the marker.
 void setBorderPaint(java.awt.Paint paint)
           Sets the shape border Paint,and sends a MarkerChangeEvent to all registered listeners.
 void setBorderStroke(java.awt.Stroke stroke)
           Sets the shape border Stroke,and sends a MarkerChangeEvent to all registered listeners.
 void setDrawBorder(boolean flag)
           Sets a flag that controls whether or not the shape border is visible,and sends a MarkerChangeEvent to all registered listeners.
 void setDrawText(boolean flag)
           Sets a flag that controls whether or not the text is drawn and sends an MarkerChangeEvent to all registered listeners.
 void setFillAlpha(float alpha)
           The alpha value for fill background,and sends a MarkerChangeEvent to all registered listeners.
 void setFillPaint(java.awt.Paint paint)
           Sets the shape fill Paint,and sends a MarkerChangeEvent to all registered listeners.
 void setFillShape(boolean bFillShape)
           Sets a flag that controls whether or not the shape is filled,and sends a MarkerChangeEvent to all registered listeners.
 void setMargin(RectangleInsets margin)
           Sets the margin around the inside of the block,and sends a MarkerChangeEvent to all registered listeners..
 void setText(java.lang.String text)
           Sets the text,and sends a MarkerChangeEvent to all registered listeners..
 void setTextFont(java.awt.Font font)
           Sets the text font and sends a MarkerChangeEvent to all registered listeners.
 void setTextHorizontalAlign(HorizontalAlignment horizontalAlign)
           Sets the text horizontal alignment and sends an MarkerChangeEvent to all registered listeners.
 void setTextPaint(java.awt.Paint paint)
           Sets the shape text Paint and sends an MarkerChangeEvent to all registered listeners.
 void setTextPosition(TextPosition position)
           Sets the text position and sends a ChartShapeChangeEvent to all registered listeners.
 void setTextVerticalAlign(VerticalAlignment verticalAlign)
           Sets the text vertical alignment and sends an MarkerChangeEvent to all registered listeners.
 java.lang.String toString()
           Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_FILL_PAINT

public static final transient java.awt.Paint DEFAULT_FILL_PAINT
The default fill Paint


DEFAULT_TEXT_POSITION

public static final TextPosition DEFAULT_TEXT_POSITION
The default text position.

Constructor Detail

AbstractMarker

protected AbstractMarker()
Creates a new marker with default attributes.


AbstractMarker

protected AbstractMarker(java.awt.Paint fillPaint)
Constructs a new marker.

Parameters:
fillPaint - The fill paint (null not permitted).

AbstractMarker

protected AbstractMarker(java.awt.Paint fillPaint,
                         java.awt.Paint borderPaint,
                         java.awt.Stroke borderStroke,
                         float fillAlpha)
Constructs a new marker.

Parameters:
fillPaint - Paint The fill paint (null not permitted).
borderPaint - Paint The border paint (null permitted).
borderStroke - Stroke The border stroke (null permitted).
fillAlpha - float The alpha transparency (must be in the range 0.0f to 1.0f).
Method Detail

isFillShape

public boolean isFillShape()
A flag that controls whether or not the shape is filled

Returns:
boolean A boolean flag

setFillShape

public void setFillShape(boolean bFillShape)
Sets a flag that controls whether or not the shape is filled,and sends a MarkerChangeEvent to all registered listeners.

Parameters:
bFillShape - boolean true,fill the shape;false otherwise

getFillPaint

public java.awt.Paint getFillPaint()
Get the ChartShape fill paint

Returns:
Paint The ChartShape fill paint

setFillPaint

public void setFillPaint(java.awt.Paint paint)
Sets the shape fill Paint,and sends a MarkerChangeEvent to all registered listeners.

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

setFillAlpha

public void setFillAlpha(float alpha)
The alpha value for fill background,and sends a MarkerChangeEvent to all registered listeners.

Parameters:
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).

getFillAlpha

public float getFillAlpha()
Returns the alpha value for fill background.

Returns:
float The alpha value.

getBorderPaint

public java.awt.Paint getBorderPaint()
Get the ChartShape border Paint

Returns:
Paint The border Paint

setBorderPaint

public void setBorderPaint(java.awt.Paint paint)
Sets the shape border Paint,and sends a MarkerChangeEvent to all registered listeners.

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

getBorderStroke

public java.awt.Stroke getBorderStroke()
Get the ChartShape border Stroke

Returns:
Stroke The border Stroke

setBorderStroke

public void setBorderStroke(java.awt.Stroke stroke)
Sets the shape border Stroke,and sends a MarkerChangeEvent to all registered listeners.

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

isDrawBorder

public boolean isDrawBorder()
A flag that controls whether or not the shape border is visible

Returns:
boolean A boolean flag

setDrawBorder

public void setDrawBorder(boolean flag)
Sets a flag that controls whether or not the shape border is visible,and sends a MarkerChangeEvent to all registered listeners.

Parameters:
flag - boolean true,draw the border of the shape;false otherwise

setText

public void setText(java.lang.String text)
Sets the text,and sends a MarkerChangeEvent to all registered listeners..

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

getText

public java.lang.String getText()
Returns the text.

Returns:
String The text,maybe null.

setMargin

public void setMargin(RectangleInsets margin)
Sets the margin around the inside of the block,and sends a MarkerChangeEvent to all registered listeners..

Parameters:
margin - RectangleInsets The margin around the inside of the block (null permitted).

getMargin

public RectangleInsets getMargin()
Returns the margin around the inside of the block.

Returns:
RectangleInsets The margin around the inside of the block.

getTextFont

public java.awt.Font getTextFont()
Returns the text font.

Returns:
Font

setTextFont

public void setTextFont(java.awt.Font font)
Sets the text font and sends a MarkerChangeEvent to all registered listeners.

Parameters:
font - Font The text font (null not permitted).

setDrawText

public void setDrawText(boolean flag)
Sets a flag that controls whether or not the text is drawn and sends an MarkerChangeEvent to all registered listeners.

Parameters:
flag - boolean

isDrawText

public boolean isDrawText()
Returns a flag that controls whether or not the text is drawn.

Returns:
boolean

setTextPaint

public void setTextPaint(java.awt.Paint paint)
Sets the shape text Paint and sends an MarkerChangeEvent to all registered listeners.

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

getTextPaint

public java.awt.Paint getTextPaint()
Get the ChartShape text Paint

Returns:
Paint The text Paint

setTextHorizontalAlign

public void setTextHorizontalAlign(HorizontalAlignment horizontalAlign)
Sets the text horizontal alignment and sends an MarkerChangeEvent to all registered listeners.

Parameters:
horizontalAlign - HorizontalAlignment The text horizontal alignment (null not permitted).

getTextHorizontalAlign

public HorizontalAlignment getTextHorizontalAlign()
Returns the text horizontal alignment.

Returns:
HorizontalAlignment The text horizontal alignment.

setTextVerticalAlign

public void setTextVerticalAlign(VerticalAlignment verticalAlign)
Sets the text vertical alignment and sends an MarkerChangeEvent to all registered listeners.

Parameters:
verticalAlign - VerticalAlignment The text vertical alignment (null not permitted).

getTextVerticalAlign

public VerticalAlignment getTextVerticalAlign()
Returns the text vertical alignment.

Returns:
VerticalAlignment The text vertical alignment.

getTextPosition

public TextPosition getTextPosition()
Returns the text position.

Returns:
TextPosition The text position.

setTextPosition

public void setTextPosition(TextPosition position)
Sets the text position and sends a ChartShapeChangeEvent to all registered listeners.

Parameters:
position - TextPosition The text position (null not permitted).

addChangeListener

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

Parameters:
listener - The object to be registered.

removeChangeListener

public void removeChangeListener(IMarkerChangeListener listener)
Unregisters an object for notification of changes to the marker.

Parameters:
listener - The object to be unregistered.

notifyListeners

protected void notifyListeners(MarkerChangeEvent event)
Notifies all registered listeners that the marker has been modified.

Parameters:
event - Information about the change event.

getListeners

public java.util.EventListener[] getListeners(java.lang.Class listenerType)
Returns an array containing all the listeners of the specified type.

Parameters:
listenerType - The listener type.
Returns:
The array of listeners.

fireMarkerChanged

protected void fireMarkerChanged()
Notifies all registered listeners that the dataset has changed.


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.

equals

public boolean equals(java.lang.Object obj)
Tests the marker for equality with an arbitrary object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object (null permitted).
Returns:
A boolean.

hashCode

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

Overrides:
hashCode in class java.lang.Object
Returns:
int The hashcode value.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Creates a clone of the marker.

Overrides:
clone in class java.lang.Object
Returns:
A clone.
Throws:
java.lang.CloneNotSupportedException - never.