org.omegahat.Graphics.Plots.Examples.Events
Class TableSelectionHandler

java.lang.Object
  |
  +--org.omegahat.Graphics.Plots.Examples.Events.TableSelectionHandler
All Implemented Interfaces:
java.util.EventListener, javax.swing.event.ListSelectionListener

public class TableSelectionHandler
extends java.lang.Object
implements javax.swing.event.ListSelectionListener

Example for events using plots, highlighting graphical components in a scatter plot as one selects rows in an associated DataViewer (or generally, a JTable). This listens to the selection model of the table, and loops over the graphical components children in the data region passed to the object and identifies the corresponding components by changing their color by setting the GraphicsParameters for those components. See Events


Field Summary
protected  GraphicalContainerInt dataRegion
          The data region of a plot containing the children to highlight.
 
Constructor Summary
TableSelectionHandler(javax.swing.JTable table)
          Just specify the table from which the row selections are received.
TableSelectionHandler(javax.swing.JTable table, GraphicalContainerInt dataRegion)
          Constructor for specifying the table from which to get selection events and the plotting area to update.
TableSelectionHandler(javax.swing.ListSelectionModel selectionModel)
          Lower level constructor which listens to the specified selection model, in contrast with retrieving the model from a JTable.
 
Method Summary
 GraphicalContainerInt getDataRegion()
          Accessor for dataRegion field
 GraphicalContainerInt setDataRegion(GraphicalContainerInt value)
          Accessor for setting dataRegion field
 void valueChanged(javax.swing.event.ListSelectionEvent ev)
          Event handler triggered when the selection model for the JTable changes that computes which rows are selected and highlights the corresponding children in the graphical container previously specified by dataRegion, finishing by redrawing all the children to update the appearance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataRegion

protected GraphicalContainerInt dataRegion
The data region of a plot containing the children to highlight.
Constructor Detail

TableSelectionHandler

public TableSelectionHandler(javax.swing.JTable table)
Just specify the table from which the row selections are received.

TableSelectionHandler

public TableSelectionHandler(javax.swing.JTable table,
                             GraphicalContainerInt dataRegion)
Constructor for specifying the table from which to get selection events and the plotting area to update.

TableSelectionHandler

public TableSelectionHandler(javax.swing.ListSelectionModel selectionModel)
Lower level constructor which listens to the specified selection model, in contrast with retrieving the model from a JTable.
Method Detail

valueChanged

public void valueChanged(javax.swing.event.ListSelectionEvent ev)
Event handler triggered when the selection model for the JTable changes that computes which rows are selected and highlights the corresponding children in the graphical container previously specified by dataRegion, finishing by redrawing all the children to update the appearance.
Specified by:
valueChanged in interface javax.swing.event.ListSelectionListener

getDataRegion

public GraphicalContainerInt getDataRegion()
Accessor for dataRegion field

setDataRegion

public GraphicalContainerInt setDataRegion(GraphicalContainerInt value)
Accessor for setting dataRegion field