ucar.unidata.idv.control.chart
Class ChartAnnotation

java.lang.Object
  extended by ucar.unidata.collab.SharableImpl
      extended by ucar.unidata.collab.PropertiedThing
          extended by ucar.unidata.idv.control.chart.ChartAnnotation
All Implemented Interfaces:
PropertyChangeListener, EventListener, org.jfree.chart.annotations.XYAnnotation, Sharable
Direct Known Subclasses:
RangeFilter, TrackSegment, WayPoint

public abstract class ChartAnnotation
extends PropertiedThing
implements org.jfree.chart.annotations.XYAnnotation

Class ChartAnnotation is an abstract class for the annotations on charts

Version:
$Revision: 1.20 $
Author:
IDV Development Team

Field Summary
static Color COLOR_SELECTED
          Selected color
protected  AffineTransform transform
          The transform from the last draw
protected  int x
          x location.
protected  int y
          y location.
 
Fields inherited from class ucar.unidata.collab.PropertiedThing
propertiesDialog
 
Constructor Summary
ChartAnnotation()
          Default ctor
ChartAnnotation(PlotWrapper plotWrapper)
          Ctro
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          new property change listener
protected  boolean applyProperties()
          Apply the properties
 double distance(int x, int y)
          Distance to the given point.
static double distance(int x1, int y1, int x2, int y2)
          utility method to calculate distance
 void doRemove()
          Annotation was removed
 String formatValue(double v)
          tuility
 Color getColor()
          Get the Color property.
 String getName()
          Get the Name property.
 PlotWrapper getPlotWrapper()
          Get the PlotWrapper property.
protected  void getPropertiesComponents(List comps, int tabIdx)
          Collect the components that go into the properties dialog
 boolean getSelected()
          Get the Selected property.
 String getToolTipText()
          Hook for tooltip
abstract  String getTypeName()
          Type of annotation
 int getX()
          Get the x position
 int getY()
          Get the y position
 boolean isActive()
          Get the Active property.
 void removePropertyChangeListener(PropertyChangeListener listener)
          property change listener
 void setActive(boolean value)
          Set the Active property.
 void setColor(Color value)
          Set the Color property.
protected  void setGraphicsState(Graphics2D g2)
          Called by base classes when drawn.
 void setName(String value)
          Set the Name property.
 void setPlotWrapper(PlotWrapper value)
          Set the PlotWrapper property.
 void setPosition(int x, int y)
          Set the position to the given x/y screen coordinate
 void setPosition(MouseEvent event)
          Set the position to the x/y of the event
 void setSelected(boolean value)
          Set the Selected property.
protected  boolean showColorInProperties()
          Should the color widget be shown in the properties dialog
 String toString()
          tostring
 
Methods inherited from class ucar.unidata.collab.PropertiedThing
doApplyProperties, firePropertyChange, firePropertyChange, getPropertyListeners, getPropertyTabs, isShowing, propertyChange, showProperties, showProperties
 
Methods inherited from class ucar.unidata.collab.SharableImpl
applySharableProperties, doShare, doShare, doShareExternal, doShareInternal, getReceiveShareTime, getSharablePropertiesComponent, getShareGroup, getSharing, getUniqueId, initSharable, receiveShareData, removeSharable, setReceiveShareTime, setShareGroup, setSharing, setUniqueId, showSharableDialog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jfree.chart.annotations.XYAnnotation
draw
 

Field Detail

COLOR_SELECTED

public static final Color COLOR_SELECTED
Selected color


x

protected int x
x location. Though not all annotations have a single x/y


y

protected int y
y location. Though not all annotations have a single x/y


transform

protected AffineTransform transform
The transform from the last draw

Constructor Detail

ChartAnnotation

public ChartAnnotation()
Default ctor


ChartAnnotation

public ChartAnnotation(PlotWrapper plotWrapper)
Ctro

Parameters:
plotWrapper - The chart we are in
Method Detail

formatValue

public String formatValue(double v)
tuility

Parameters:
v - value
Returns:
formatted value

getToolTipText

public String getToolTipText()
Hook for tooltip

Returns:
Tooltip text for this annotation

setGraphicsState

protected void setGraphicsState(Graphics2D g2)
Called by base classes when drawn. We set the transform here

Parameters:
g2 - The graphics

distance

public double distance(int x,
                       int y)
Distance to the given point. This transforms our x/y to the display space.

Parameters:
x - Mouse x
y - Mouse y
Returns:
Distance to x/y

distance

public static double distance(int x1,
                              int y1,
                              int x2,
                              int y2)
utility method to calculate distance

Parameters:
x1 - x1
y1 - y1
x2 - x2
y2 - y2
Returns:
distance

getTypeName

public abstract String getTypeName()
Type of annotation

Returns:
Type of annotation

applyProperties

protected boolean applyProperties()
Apply the properties

Overrides:
applyProperties in class PropertiedThing
Returns:
success

getPropertiesComponents

protected void getPropertiesComponents(List comps,
                                       int tabIdx)
Collect the components that go into the properties dialog

Overrides:
getPropertiesComponents in class PropertiedThing
Parameters:
comps - List of left/right components
tabIdx - Which tab

setPosition

public void setPosition(int x,
                        int y)
Set the position to the given x/y screen coordinate

Parameters:
x - x
y - y

setPosition

public void setPosition(MouseEvent event)
Set the position to the x/y of the event

Parameters:
event - The event

doRemove

public void doRemove()
Annotation was removed


setSelected

public void setSelected(boolean value)
Set the Selected property.

Parameters:
value - The new value for Selected

getSelected

public boolean getSelected()
Get the Selected property.

Returns:
The Selected

showColorInProperties

protected boolean showColorInProperties()
Should the color widget be shown in the properties dialog

Returns:
Show color widget

setColor

public void setColor(Color value)
Set the Color property.

Parameters:
value - The new value for Color

getColor

public Color getColor()
Get the Color property.

Returns:
The Color

setPlotWrapper

public void setPlotWrapper(PlotWrapper value)
Set the PlotWrapper property.

Parameters:
value - The new value for PlotWrapper

getPlotWrapper

public PlotWrapper getPlotWrapper()
Get the PlotWrapper property.

Returns:
The PlotWrapper

setName

public void setName(String value)
Set the Name property.

Parameters:
value - The new value for Name

getName

public String getName()
Get the Name property.

Returns:
The Name

getY

public int getY()
Get the y position

Returns:
y

getX

public int getX()
Get the x position

Returns:
x

setActive

public void setActive(boolean value)
Set the Active property.

Parameters:
value - The new value for Active

isActive

public boolean isActive()
Get the Active property.

Returns:
The Active

toString

public String toString()
tostring

Overrides:
toString in class Object
Returns:
tostring

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
new property change listener

Overrides:
addPropertyChangeListener in class PropertiedThing
Parameters:
listener - listener

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
property change listener

Overrides:
removePropertyChangeListener in class PropertiedThing
Parameters:
listener - listener