lt.monarch.chart.plugins
Class AxisRangeAdjuster

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

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

Plug-in for axis range adjusting and shifting.

See Also:
Serialized Form

Nested Class Summary
Modifier and Type Class and Description
protected static class AxisRangeAdjuster.Operation
          Inner enum for operation description
 
Constructor Summary
Constructor and Description
AxisRangeAdjuster(Axis2D axis)
          Constructs a axis range adjuster plug-in.
AxisRangeAdjuster(Axis2D axis, Axis2D[] relatedAxis)
          Constructs a axis range adjuster plug-in.
 
Method Summary
Modifier and Type Method and Description
 void activate()
          Activates the plug-in.
 void deactivate()
          Deactivates the plug-in.
protected  void drawRangeRectangle(AbstractGraphics g, Rectangle2D r, java.awt.Color backgroundColor, java.awt.Color foregroundColor, Alignment al)
           
 double getHeight()
          Returns height for range adjuster.
 java.awt.Color getMaxRangeBackground()
          Returns maximum range adjuster background color.
 java.awt.Color getMaxRangeForeground()
          Returns maximum range adjuster foreground color.
 java.awt.Color getMinRangeBackground()
          Returns minimum range adjuster background color.
 java.awt.Color getMinRangeForeground()
          Returns minimum range adjuster foreground color.
 java.awt.Composite getRangeComposite()
          Returns range paint composite.
 java.awt.Color getShiftRangeBackground()
          Returns shift range adjuster background color.
 java.awt.Color getShiftRangeForeground()
          Returns shift range adjuster foreground color.
 double getWidth()
          Returns width of minimum, maximum range adjusters and minimal width for shift range adjuster.
 void mouseClicked(java.awt.event.MouseEvent e)
          Invoked when the mouse has been clicked on a chart.
 void mouseDragged(java.awt.event.MouseEvent e)
          Invoked when a mouse button is pressed on a chart and then dragged.
 void mouseEntered(java.awt.event.MouseEvent e)
          Invoked when the mouse enters a chart.
 void mouseExited(java.awt.event.MouseEvent e)
          Invoked when the mouse exits a chart.
 void mouseMoved(java.awt.event.MouseEvent e)
          Invoked when the mouse button has been moved on a chart (with no buttons no down).
 void mousePressed(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been pressed on a chart.
 void mouseReleased(java.awt.event.MouseEvent e)
          Invoked when a mouse button has been released on a chart.
 void paint(AbstractGraphics g)
          Validates and paints range adjusters rectangles.
 void setHeight(double height)
          Sets height for range adjuster.
 void setMaxRangeBackground(java.awt.Color maxRangeBackground)
          Sets maximum range adjuster background color.
 void setMaxRangeForeground(java.awt.Color maxRangeForeground)
          Sets maximum range adjuster foreground color.
 void setMinRangeBackground(java.awt.Color minRangeBackground)
          Sets minimum range adjuster background color.
 void setMinRangeForeground(java.awt.Color minRangeForeground)
          Sets minimum range adjuster foreground color.
 void setRangeComposite(java.awt.Composite rangeComposite)
          Sets range paint composite.
 void setShiftRangeBackground(java.awt.Color shiftRangeBackground)
          Sets shift range adjuster background color.
 void setShiftRangeForeground(java.awt.Color shiftRangeForeground)
          Sets shift range adjuster foreground color.
 void setWidth(double width)
          Sets width of minimum, maximum range adjusters and minimal width for shift range adjuster.
protected  void validate()
          Setups rectangles for range adjusting: axisMinRangeBounds, axisShiftRangeBounds, axisMaxRangeBounds.
 
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

AxisRangeAdjuster

public AxisRangeAdjuster(Axis2D axis)
Constructs a axis range adjuster plug-in. Plug-in shows always axis ranges. Plug-in performs axis ranges changes move minimum range, move maximum range and shift range on the specified axis, when activated. Axis should be scrollable for the adjuster to work correctly.

Parameters:
axis - Axis2D object

AxisRangeAdjuster

public AxisRangeAdjuster(Axis2D axis,
                         Axis2D[] relatedAxis)
Constructs a axis range adjuster plug-in. Plug-in shows always axis ranges. Plug-in performs axis ranges changes move minimum range, move maximum range and shift range on the specified axis, when activated. Axis should be scrollable for the adjuster to work correctly. Related axis is axis for which must be setted range same as axis range.

Parameters:
axis - Axis2D object
relatedAxis - Axis2D objects for which range must be equal with main axis
Method Detail

getWidth

public double getWidth()
Returns width of minimum, maximum range adjusters and minimal width for shift range adjuster.

Returns:
the width

setWidth

public void setWidth(double width)
Sets width of minimum, maximum range adjusters and minimal width for shift range adjuster.

Parameters:
width - the width to set

getHeight

public double getHeight()
Returns height for range adjuster.

Returns:
the height

setHeight

public void setHeight(double height)
Sets height for range adjuster.

Parameters:
height - the height to set

getMinRangeBackground

public java.awt.Color getMinRangeBackground()
Returns minimum range adjuster background color.

Returns:
the background color

setMinRangeBackground

public void setMinRangeBackground(java.awt.Color minRangeBackground)
Sets minimum range adjuster background color.

Parameters:
minRangeBackground - the background color to set

getMinRangeForeground

public java.awt.Color getMinRangeForeground()
Returns minimum range adjuster foreground color.

Returns:
the foreground color

setMinRangeForeground

public void setMinRangeForeground(java.awt.Color minRangeForeground)
Sets minimum range adjuster foreground color.

Parameters:
minRangeForeground - the foreground color to set

getShiftRangeBackground

public java.awt.Color getShiftRangeBackground()
Returns shift range adjuster background color.

Returns:
the background color

setShiftRangeBackground

public void setShiftRangeBackground(java.awt.Color shiftRangeBackground)
Sets shift range adjuster background color.

Parameters:
shiftRangeBackground - the background color to set

getShiftRangeForeground

public java.awt.Color getShiftRangeForeground()
Returns shift range adjuster foreground color.

Returns:
the foreground color

setShiftRangeForeground

public void setShiftRangeForeground(java.awt.Color shiftRangeForeground)
Sets shift range adjuster foreground color.

Parameters:
shiftRangeForeground - the foreground color to set

getMaxRangeBackground

public java.awt.Color getMaxRangeBackground()
Returns maximum range adjuster background color.

Returns:
the background color

setMaxRangeBackground

public void setMaxRangeBackground(java.awt.Color maxRangeBackground)
Sets maximum range adjuster background color.

Parameters:
maxRangeBackground - the background color to set

getMaxRangeForeground

public java.awt.Color getMaxRangeForeground()
Returns maximum range adjuster foreground color.

Returns:
the foreground color

setMaxRangeForeground

public void setMaxRangeForeground(java.awt.Color maxRangeForeground)
Sets maximum range adjuster foreground color.

Parameters:
maxRangeForeground - the foreground color to set

getRangeComposite

public java.awt.Composite getRangeComposite()
Returns range paint composite.

Returns:
the range composite

setRangeComposite

public void setRangeComposite(java.awt.Composite rangeComposite)
Sets range paint composite.

Parameters:
rangeComposite - the range composite to set

activate

public void activate()
Activates the plug-in. Registers mouse and mouse motion listeners.

Specified by:
activate in class AbstractChartPlugin<Chart2D>

deactivate

public void deactivate()
Deactivates the plug-in. Unregisters mouse and mouse motion listeners.

Specified by:
deactivate in class AbstractChartPlugin<Chart2D>

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Invoked when the mouse has been clicked on a chart. If mouse event isn't consumed and click count is 2 the axis range is changed to full view.

Specified by:
mouseClicked in interface java.awt.event.MouseListener
Parameters:
e - the mouse event

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Invoked when the mouse enters a chart. Does nothing.

Specified by:
mouseEntered in interface java.awt.event.MouseListener
Parameters:
e - the mouse event

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Invoked when the mouse exits a chart. Does nothing.

Specified by:
mouseExited in interface java.awt.event.MouseListener
Parameters:
e - the mouse event

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Invoked when a mouse button has been pressed on a chart. If mouse event isn't consumed and mouse point is in adjusters rectangles prepares for selected action.

Specified by:
mousePressed in interface java.awt.event.MouseListener
Parameters:
e - the mouse event

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Invoked when a mouse button has been released on a chart. If was setted operation disposes it.

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Parameters:
e - the mouse event

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
Invoked when the mouse button has been moved on a chart (with no buttons no down). Does nothing.

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Parameters:
e - the mouse event

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Invoked when a mouse button is pressed on a chart and then dragged. If was prepared action executes it: moves minimum range, moves maximum range o shifts range.

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Parameters:
e - the mouse event

paint

public void paint(AbstractGraphics g)
Validates and paints range adjusters rectangles.

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

validate

protected void validate()
Setups rectangles for range adjusting: axisMinRangeBounds, axisShiftRangeBounds, axisMaxRangeBounds.


drawRangeRectangle

protected void drawRangeRectangle(AbstractGraphics g,
                                  Rectangle2D r,
                                  java.awt.Color backgroundColor,
                                  java.awt.Color foregroundColor,
                                  Alignment al)