org.fhcrc.cpl.viewer.quant.gui
Class LogRatioHistMouseListener

java.lang.Object
  extended by java.awt.event.MouseAdapter
      extended by org.fhcrc.cpl.toolbox.gui.chart.ChartMouseAndMotionListener
          extended by org.fhcrc.cpl.viewer.quant.gui.LogRatioHistMouseListener
All Implemented Interfaces:
java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.event.MouseWheelListener, java.util.EventListener

public class LogRatioHistMouseListener
extends ChartMouseAndMotionListener


Nested Class Summary
protected  class LogRatioHistMouseListener.SelectedRegionOverlay
          A ChartPanel overlay that draws in the selected region
 
Field Summary
protected static org.apache.log4j.Logger _log
           
protected  java.awt.Color fillColor
           
protected  double lastMousedRatio
           
protected  java.util.List<java.awt.event.ActionListener> rangeUpdateListeners
           
protected  float selectedRealXMaxValue
           
protected  float selectedRealXMinValue
           
protected  java.awt.geom.Rectangle2D selectedRegion
           
protected  LogRatioHistMouseListener.SelectedRegionOverlay selectionOverlay
           
protected  java.awt.Stroke stroke
           
 
Fields inherited from class org.fhcrc.cpl.toolbox.gui.chart.ChartMouseAndMotionListener
_chartPanel, domainAxis, rangeAxis
 
Constructor Summary
LogRatioHistMouseListener(PanelWithChart panelWithChart)
           
LogRatioHistMouseListener(PanelWithChart panelWithChart, java.awt.event.ActionListener actionListener)
          Convenience constructor for adding a single actionlistener
 
Method Summary
 void addRangeUpdateListener(java.awt.event.ActionListener actionListener)
          These get updated when the selection changes
protected  void drawBoxForRatio(java.awt.Graphics2D g)
          Draw the box to contain the ratio
protected  void drawOrUndrawRegion()
          Draw or undraw the selected region.
protected  void drawRatioInBox(java.awt.Graphics2D g)
          Draw the ratio in its box.
 float getSelectedRealXMaxValue()
           
 float getSelectedRealXMinValue()
           
 void mouseDragged(java.awt.event.MouseEvent e)
          Undraw the previous selected region (if it was drawn), calculate the new regions, draw again, save the points, and draw the numeric ratio in its little box
 void mouseExited(java.awt.event.MouseEvent e)
          When mouse leaves chart, paint over the ratio so it doesn't hang out there
 void mouseMoved(java.awt.event.MouseEvent e)
          When mouse moved, draw the ratio under the mouse pointer
 void mousePressed(java.awt.event.MouseEvent e)
          Save the initial selection point
 void mouseReleased(java.awt.event.MouseEvent e)
          When the mouse is let go, save the range and signal the range update listeners
 void setSelectedRealXMaxValue(float selectedRealXMaxValue)
           
 void setSelectedRealXMinValue(float selectedRealXMinValue)
           
 void setSelectedRegionWithChartValues(float minValue, float maxValue)
          Set the axis-scale coordinates
protected  void transformAndSaveSelectedRegion()
          Transform the region into values in units of the chart X axis
 
Methods inherited from class org.fhcrc.cpl.toolbox.gui.chart.ChartMouseAndMotionListener
drawAllButSelectedRegionHoriz, drawSelectedRegion, getChartPanel, getChartPanelGraphics, getPointInRectangle, setChartPanel, transformMouseXValue, transformXValueToMouse
 
Methods inherited from class java.awt.event.MouseAdapter
mouseClicked, mouseEntered, mouseWheelMoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_log

protected static org.apache.log4j.Logger _log

selectedRealXMinValue

protected float selectedRealXMinValue

selectedRealXMaxValue

protected float selectedRealXMaxValue

rangeUpdateListeners

protected java.util.List<java.awt.event.ActionListener> rangeUpdateListeners

fillColor

protected java.awt.Color fillColor

stroke

protected java.awt.Stroke stroke

selectionOverlay

protected LogRatioHistMouseListener.SelectedRegionOverlay selectionOverlay

selectedRegion

protected java.awt.geom.Rectangle2D selectedRegion

lastMousedRatio

protected double lastMousedRatio
Constructor Detail

LogRatioHistMouseListener

public LogRatioHistMouseListener(PanelWithChart panelWithChart)

LogRatioHistMouseListener

public LogRatioHistMouseListener(PanelWithChart panelWithChart,
                                 java.awt.event.ActionListener actionListener)
Convenience constructor for adding a single actionlistener

Parameters:
panelWithChart -
actionListener -
Method Detail

mouseMoved

public void mouseMoved(java.awt.event.MouseEvent e)
When mouse moved, draw the ratio under the mouse pointer

Specified by:
mouseMoved in interface java.awt.event.MouseMotionListener
Overrides:
mouseMoved in class java.awt.event.MouseAdapter
Parameters:
e -

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
When mouse leaves chart, paint over the ratio so it doesn't hang out there

Specified by:
mouseExited in interface java.awt.event.MouseListener
Overrides:
mouseExited in class java.awt.event.MouseAdapter
Parameters:
e -

drawBoxForRatio

protected void drawBoxForRatio(java.awt.Graphics2D g)
Draw the box to contain the ratio


drawRatioInBox

protected void drawRatioInBox(java.awt.Graphics2D g)
Draw the ratio in its box. Separated from drawBoxForRatio so the box can be drawn empty

Parameters:
g -

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Save the initial selection point

Specified by:
mousePressed in interface java.awt.event.MouseListener
Overrides:
mousePressed in class java.awt.event.MouseAdapter
Parameters:
e -

addRangeUpdateListener

public void addRangeUpdateListener(java.awt.event.ActionListener actionListener)
These get updated when the selection changes

Parameters:
actionListener -

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
When the mouse is let go, save the range and signal the range update listeners

Specified by:
mouseReleased in interface java.awt.event.MouseListener
Overrides:
mouseReleased in class java.awt.event.MouseAdapter
Parameters:
e -

transformAndSaveSelectedRegion

protected void transformAndSaveSelectedRegion()
Transform the region into values in units of the chart X axis


setSelectedRegionWithChartValues

public void setSelectedRegionWithChartValues(float minValue,
                                             float maxValue)
Set the axis-scale coordinates

Parameters:
minValue -
maxValue -

mouseDragged

public void mouseDragged(java.awt.event.MouseEvent e)
Undraw the previous selected region (if it was drawn), calculate the new regions, draw again, save the points, and draw the numeric ratio in its little box

Specified by:
mouseDragged in interface java.awt.event.MouseMotionListener
Overrides:
mouseDragged in class java.awt.event.MouseAdapter
Parameters:
e -

drawOrUndrawRegion

protected void drawOrUndrawRegion()
Draw or undraw the selected region. Since the region is XORed with the chart image, have to undraw the old one before drawing the new one.


getSelectedRealXMinValue

public float getSelectedRealXMinValue()

setSelectedRealXMinValue

public void setSelectedRealXMinValue(float selectedRealXMinValue)

getSelectedRealXMaxValue

public float getSelectedRealXMaxValue()

setSelectedRealXMaxValue

public void setSelectedRealXMaxValue(float selectedRealXMaxValue)


Fred Hutchinson Cancer Research Center