org.strbio.util.graph
Class ClickablePointPlot

java.lang.Object
  extended by org.strbio.util.graph.ClickablePointPlot
All Implemented Interfaces:
Graph2D.ClickListener, Graphable2D

public class ClickablePointPlot
extends java.lang.Object
implements Graphable2D, Graph2D.ClickListener

A component that acts like it's displaying points, but only circles the one that's been clicked on. Also, a callback function in ClickListener gets called when the point is clicked. It should be overlayed with a PointPlot or PointColorPlot to work.

  Version 1.0, 5/14/99 - original version.
  

Version:
1.0, 5/14/99
Author:
JMC

Nested Class Summary
static interface ClickablePointPlot.ClickListener
          This is an interface for things that are interested in knowing when the graph is clicked.
 
Field Summary
protected  DVectorSet points
          This is a vector of points to plot.
protected  PointType ptype
          type of point to draw.
 
Constructor Summary
ClickablePointPlot(DVectorSet x, ClickablePointPlot.ClickListener y)
          initialize with a set of points.
 
Method Summary
 void clicked(double x, double y)
          this method gets called by Graph2D when the graph is clicked on.
 Legend getLegend()
          there is no legend for this type of graph.
 DVectorSet getPoints()
          Returns a pointer to the points being drawn.
 double maxX()
          maximum x value that will be graphed.
 double maxY()
          maximum y value that will be graphed.
 double minX()
          minimum x value that will be graphed.
 double minY()
          minimum y value that will be graphed.
 void paintGraph(java.awt.Graphics g, java.awt.Rectangle r, Graph2D gr)
          draw the graph, in a given rectangle.
 void setListener(ClickablePointPlot.ClickListener l)
           
 void setPoints(DVectorSet x)
          Sets the points being drawn.
 void setPointType(PointType pt)
          Set point type to draw.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

points

protected DVectorSet points
This is a vector of points to plot. Each point is a DVector, and must contain at least 2 coordinates.


ptype

protected PointType ptype
type of point to draw.

Constructor Detail

ClickablePointPlot

public ClickablePointPlot(DVectorSet x,
                          ClickablePointPlot.ClickListener y)
initialize with a set of points.

Method Detail

setListener

public void setListener(ClickablePointPlot.ClickListener l)

getPoints

public DVectorSet getPoints()
Returns a pointer to the points being drawn.


getLegend

public Legend getLegend()
there is no legend for this type of graph.

Specified by:
getLegend in interface Graphable2D

setPoints

public void setPoints(DVectorSet x)
Sets the points being drawn. Does not copy data.


minX

public double minX()
Description copied from interface: Graphable2D
minimum x value that will be graphed.

Specified by:
minX in interface Graphable2D

minY

public double minY()
Description copied from interface: Graphable2D
minimum y value that will be graphed.

Specified by:
minY in interface Graphable2D

maxX

public double maxX()
Description copied from interface: Graphable2D
maximum x value that will be graphed.

Specified by:
maxX in interface Graphable2D

maxY

public double maxY()
Description copied from interface: Graphable2D
maximum y value that will be graphed.

Specified by:
maxY in interface Graphable2D

setPointType

public void setPointType(PointType pt)
Set point type to draw.


clicked

public void clicked(double x,
                    double y)
this method gets called by Graph2D when the graph is clicked on.

Specified by:
clicked in interface Graph2D.ClickListener

paintGraph

public void paintGraph(java.awt.Graphics g,
                       java.awt.Rectangle r,
                       Graph2D gr)
Description copied from interface: Graphable2D
draw the graph, in a given rectangle. Should not clear the background, since more than 1 could be drawn.

Specified by:
paintGraph in interface Graphable2D