SORTIE Java Interface  1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
sortie.gui.harvepplant.EpisodicEventsMouseListener Class Reference

Class for interpreting mouse clicks on the chart for selecting cells for episodic event editing. More...

Inheritance diagram for sortie.gui.harvepplant.EpisodicEventsMouseListener:

Public Member Functions

void chartMouseClicked (org.jfree.chart.ChartMouseEvent oEvent)
 Interprets a mouse click on the chart. More...
 
void mousePressed (java.awt.event.MouseEvent oEvent)
 Captures the point of click for possible dragging. More...
 
void mouseDragged (java.awt.event.MouseEvent oEvent)
 Handles a 'mouse dragged' event. More...
 
void mouseReleased (java.awt.event.MouseEvent oEvent)
 Handles a mouse button release event, presumably after a drag to select cells. More...
 
void mouseClicked (java.awt.event.MouseEvent oEvent)
 Does nothing. More...
 
void chartMouseMoved (org.jfree.chart.ChartMouseEvent oEvent)
 Does nothing. More...
 
void mouseEntered (java.awt.event.MouseEvent oEvent)
 Does nothing. More...
 
void mouseExited (java.awt.event.MouseEvent oEvent)
 Does nothing. More...
 
void mouseMoved (java.awt.event.MouseEvent oEvent)
 Does nothing. More...
 

Private Member Functions

java.awt.Point getPointInRectangle (int x, int y, java.awt.geom.Rectangle2D area)
 Returns a point based on (x, y) but constrained to be within the bounds of the given rectangle. More...
 
void setCellValues (int iFromX, int iFromY, int iToX, int iToY) throws ModelException
 Handles the selection of cells from a drag mouse event. More...
 
void setCellValues (int iXClickPoint, int iYClickPoint) throws ModelException
 Handles the selection of a cell from a single mouse click. More...
 

Private Attributes

EditWindowBase m_oParentWindow
 Pointer to the object to exchange data with. More...
 
java.awt.geom.Point2D m_jDragPoint = null
 The selection rectangle starting point (selected by the user with a mouse click) More...
 
java.awt.geom.Rectangle2D m_jDragRectangle = null
 The selection rectangle (selected by the user with the mouse). More...
 

Detailed Description

Class for interpreting mouse clicks on the chart for selecting cells for episodic event editing.

This will detect both single clicks on the chart and click-and-drag. When a user has selected a cell or group of cells on this chart, this will toggle them as selected/unselected with the parent window.

Copyright: Copyright (c) Charles D. Canham 2003

Company: Cary Institute of Ecosystem Studies

Author
Lora E. Murphy
Version
1.0

Member Function Documentation

◆ chartMouseClicked()

void sortie.gui.harvepplant.EpisodicEventsMouseListener.chartMouseClicked ( org.jfree.chart.ChartMouseEvent  oEvent)

Interprets a mouse click on the chart.

This takes the point of the click and translates the click point to chart coordinates. The cell containing the click point is toggled between a value of 0 and 1 in HarvestEdit::mp_iCells.

Parameters
oEventMouseEvent from which to get the click point.

◆ chartMouseMoved()

void sortie.gui.harvepplant.EpisodicEventsMouseListener.chartMouseMoved ( org.jfree.chart.ChartMouseEvent  oEvent)

Does nothing.

Parameters
oEventIgnored.

◆ getPointInRectangle()

java.awt.Point sortie.gui.harvepplant.EpisodicEventsMouseListener.getPointInRectangle ( int  x,
int  y,
java.awt.geom.Rectangle2D  area 
)
private

Returns a point based on (x, y) but constrained to be within the bounds of the given rectangle.

This method could be moved to JCommon.

Parameters
xthe x-coordinate.
ythe y-coordinate.
areathe rectangle (null not permitted).
Returns
A point within the rectangle.

◆ mouseClicked()

void sortie.gui.harvepplant.EpisodicEventsMouseListener.mouseClicked ( java.awt.event.MouseEvent  oEvent)

Does nothing.

Parameters
oEventIgnored.

◆ mouseDragged()

void sortie.gui.harvepplant.EpisodicEventsMouseListener.mouseDragged ( java.awt.event.MouseEvent  oEvent)

Handles a 'mouse dragged' event.

Draws a rectangle of the drag. I modified this code from org.jfree.chart.ChartPanel::mouseDragged by David Gilbert.

Parameters
oEventthe mouse event.

◆ mouseEntered()

void sortie.gui.harvepplant.EpisodicEventsMouseListener.mouseEntered ( java.awt.event.MouseEvent  oEvent)

Does nothing.

Parameters
oEventIgnored.

◆ mouseExited()

void sortie.gui.harvepplant.EpisodicEventsMouseListener.mouseExited ( java.awt.event.MouseEvent  oEvent)

Does nothing.

Parameters
oEventIgnored.

◆ mouseMoved()

void sortie.gui.harvepplant.EpisodicEventsMouseListener.mouseMoved ( java.awt.event.MouseEvent  oEvent)

Does nothing.

Parameters
oEventIgnored.

◆ mousePressed()

void sortie.gui.harvepplant.EpisodicEventsMouseListener.mousePressed ( java.awt.event.MouseEvent  oEvent)

Captures the point of click for possible dragging.

I modified this code from org.jfree.chart.ChartPanel::mousePressed by David Gilbert.

Parameters
oEventMouseEvent from which to get the click point.

◆ mouseReleased()

void sortie.gui.harvepplant.EpisodicEventsMouseListener.mouseReleased ( java.awt.event.MouseEvent  oEvent)

Handles a mouse button release event, presumably after a drag to select cells.

This will take all the cells selected in the drag, and toggle their value in mp_iCells between 0 and 1. I modified the code for retrieving drag coordinates from from org.jfree.chart.ChartPanel::mouseReleased by David Gilbert.

Parameters
oEventMouse event.

◆ setCellValues() [1/2]

void sortie.gui.harvepplant.EpisodicEventsMouseListener.setCellValues ( int  iFromX,
int  iFromY,
int  iToX,
int  iToY 
) throws ModelException
private

Handles the selection of cells from a drag mouse event.

This takes the points, translates them to plot coordinates, translates those to plot cells, and then toggles the values in each cell from 0 to 1 or from 1 to 0 in HarvestEdit::mp_iCells.

Parameters
iFromXX coordinate of the beginning point of drag, in Java2D coordinates.
iFromYY coordinate of the beginning point of drag, in Java2D coordinates.
iToXX coordinate of the end point of drag, in Java2D coordinates.
iToYY coordinate of the end point of drag, in Java2D coordinates.
Exceptions
ModelExceptionpassing through from called methods.

◆ setCellValues() [2/2]

void sortie.gui.harvepplant.EpisodicEventsMouseListener.setCellValues ( int  iXClickPoint,
int  iYClickPoint 
) throws ModelException
private

Handles the selection of a cell from a single mouse click.

This takes the point, translates it to plot coordinates, translates it to plot cells, and then toggles the value in the cell from 0 to 1 or from 1 to 0 in HarvestEdit::mp_iCells.

Parameters
iXClickPointThe X click point, in Java2D coordinates.
iYClickPointThe Y click point, in Java2D coordinates.
Exceptions
ModelExceptionPassed through from called methods.

Member Data Documentation

◆ m_jDragPoint

java.awt.geom.Point2D sortie.gui.harvepplant.EpisodicEventsMouseListener.m_jDragPoint = null
private

The selection rectangle starting point (selected by the user with a mouse click)

◆ m_jDragRectangle

java.awt.geom.Rectangle2D sortie.gui.harvepplant.EpisodicEventsMouseListener.m_jDragRectangle = null
private

The selection rectangle (selected by the user with the mouse).

◆ m_oParentWindow

EditWindowBase sortie.gui.harvepplant.EpisodicEventsMouseListener.m_oParentWindow
private

Pointer to the object to exchange data with.


The documentation for this class was generated from the following file: