lt.monarch.chart.plugins
Class MarkerValuePlugin

java.lang.Object
  extended by lt.monarch.chart.plugins.AbstractChartPlugin<Chart2D>
      extended by lt.monarch.chart.plugins.MarkerValuePlugin
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.io.Serializable, java.util.EventListener, ChartPlugin<Chart2D>

public class MarkerValuePlugin
extends AbstractChartPlugin<Chart2D>
implements java.awt.event.MouseMotionListener, java.awt.event.MouseListener

Plug-in for Chart2D axis, which implements line value markers showing

See Also:
Serialized Form

Nested Class Summary
Modifier and Type Class and Description
static interface MarkerValuePlugin.ValueChangeListener
           
 
Constructor Summary
Constructor and Description
MarkerValuePlugin(Axis2D axis)
          Constructs a new MarkerValuePlugin for the specified axis.
MarkerValuePlugin(Axis2D axis, Point2D markerLocation, boolean onlyFollowDrag)
          Constructs a new MarkerValuePlugin for the specified axis.
 
Method Summary
Modifier and Type Method and Description
 void activate()
          Prepares the plug-in, when it is installed.
 void addListener(MarkerValuePlugin.ValueChangeListener listener)
          Registers a value change listener
 void deactivate()
          Cleanups the plug-in, when it is uninstalled.
protected  void fireMarkerPositionChanged(double projectedLevel)
          Forwards the given notification event to all ValueChangeListener objects that registered themselves as listeners for this chart plugin.
 Marker getMarker()
           
 MarkerLine getMarkerLine()
           
 double getRotationAngle()
          Returns rotation angle (in radians) of marker.
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseDragged(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mouseMoved(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void paint(AbstractGraphics g)
          Does nothing- must be overridden in extending classes.
 void removeListener(MarkerValuePlugin.ValueChangeListener listener)
          Unregisters a value change listener
 void setMarker(Marker marker)
          Sets marker.
 void setMarkerLine(MarkerLine markerLine)
          Sets marker line to the plugin.
 void setRotationAngle(double rotationAngle)
          Sets rotation angle of marker.
 
Methods inherited from class lt.monarch.chart.plugins.AbstractChartPlugin
adjustChart, chart, getChart, install, isActivated, uninstall
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MarkerValuePlugin

public MarkerValuePlugin(Axis2D axis)
Constructs a new MarkerValuePlugin for the specified axis.

Parameters:
axis - Axis to which the marker and marker line will be attached.

MarkerValuePlugin

public MarkerValuePlugin(Axis2D axis,
                         Point2D markerLocation,
                         boolean onlyFollowDrag)
Constructs a new MarkerValuePlugin for the specified axis.

Parameters:
axis - Axis to which the marker and marker line will be attached.
markerLocation - starting marker location in normalized range.
onlyFollowDrag - should the marker be translated when it is dragged or when chart is pressed where it could be located.
Method Detail

addListener

public void addListener(MarkerValuePlugin.ValueChangeListener listener)
Registers a value change listener

Parameters:
listener - value change listener

removeListener

public void removeListener(MarkerValuePlugin.ValueChangeListener listener)
Unregisters a value change listener

Parameters:
listener - value change listener

activate

public void activate()
Description copied from class: AbstractChartPlugin
Prepares the plug-in, when it is installed. Also called when chart is activated.

Specified by:
activate in class AbstractChartPlugin<Chart2D>

deactivate

public void deactivate()
Description copied from class: AbstractChartPlugin
Cleanups the plug-in, when it is uninstalled. Also called when chart is deactivated.

Specified by:
deactivate in class AbstractChartPlugin<Chart2D>

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

paint

public void paint(AbstractGraphics g)
Description copied from class: AbstractChartPlugin
Does nothing- must be overridden in extending classes.

Specified by:
paint in interface ChartPlugin<Chart2D>
Overrides:
paint in class AbstractChartPlugin<Chart2D>
Parameters:
g - the Graphics context in which chart is painted
See Also:
ChartPlugin.paint(lt.monarch.chart.engine.AbstractGraphics)

getRotationAngle

public double getRotationAngle()
Returns rotation angle (in radians) of marker.

Returns:
Rotation angle in radians

setRotationAngle

public void setRotationAngle(double rotationAngle)
Sets rotation angle of marker. Given angle has to be in radians.

Parameters:
rotationAngle - Rotation angle of marker

getMarkerLine

public MarkerLine getMarkerLine()

setMarkerLine

public void setMarkerLine(MarkerLine markerLine)
Sets marker line to the plugin.

Parameters:
markerLine -

getMarker

public Marker getMarker()

setMarker

public void setMarker(Marker marker)
Sets marker. Marer's position is controlled by plugin.

Parameters:
marker -

fireMarkerPositionChanged

protected void fireMarkerPositionChanged(double projectedLevel)
Forwards the given notification event to all ValueChangeListener objects that registered themselves as listeners for this chart plugin.

Parameters:
event - the event to be forwarded