skrueger.geotools.selection
Class TableSelectionSynchronizer

java.lang.Object
  extended by skrueger.geotools.selection.StyledLayerSelectionModelSynchronizer<StyledFeatureLayerSelectionModel>
      extended by skrueger.geotools.selection.TableSelectionSynchronizer
All Implemented Interfaces:
PropertyChangeListener, EventListener, ListSelectionListener

public class TableSelectionSynchronizer
extends StyledLayerSelectionModelSynchronizer<StyledFeatureLayerSelectionModel>
implements ListSelectionListener

This class keeps the selection of a (feature) JTable synchronized with the StyledLayerSelectionModel of a layer. This is done by implementing:

After creating, the instance of this synchronizer must be added as listener to both, the StyledLayerSelectionModel and the table's ListSelectionModel.

Author:
Martin Schmitz (University of Bonn/Germany)

Field Summary
protected  JTable featureTable
          Holds the table to keep synchronized with the layer selection model.
protected  FeatureCollectionTableModel featureTableModel
          Holds the table's data.
 
Fields inherited from class skrueger.geotools.selection.StyledLayerSelectionModelSynchronizer
layerSelModel, LOGGER, selectionChangeCausedByMe
 
Constructor Summary
TableSelectionSynchronizer(StyledFeatureLayerSelectionModel layerSelModel, JTable table)
          Creates a new synchronizer
 
Method Summary
 void propertyChange(PropertyChangeEvent evt)
          Called by StyledLayerSelectionModel when a the selection on other selection components (map, chart, ...) has changed.
 void valueChanged(ListSelectionEvent evt)
          Called when the table selection is changed by the user.
 
Methods inherited from class skrueger.geotools.selection.StyledLayerSelectionModelSynchronizer
isEnabled, setEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

featureTable

protected JTable featureTable
Holds the table to keep synchronized with the layer selection model.


featureTableModel

protected FeatureCollectionTableModel featureTableModel
Holds the table's data.

Constructor Detail

TableSelectionSynchronizer

public TableSelectionSynchronizer(StyledFeatureLayerSelectionModel layerSelModel,
                                  JTable table)
Creates a new synchronizer

Parameters:
layerSelModel - layer selection model to keep synchronized with the feature table
table - table to keep synchronized with the layer selection model
Method Detail

propertyChange

public void propertyChange(PropertyChangeEvent evt)
Called by StyledLayerSelectionModel when a the selection on other selection components (map, chart, ...) has changed. When calling this method changes the table selection according to the StyledLayerSelectionModel selection.

Specified by:
propertyChange in interface PropertyChangeListener
Parameters:
evt - an event

valueChanged

public void valueChanged(ListSelectionEvent evt)
Called when the table selection is changed by the user. When calling this method changes the selection of the StyledLayerSelectionModel.

Specified by:
valueChanged in interface ListSelectionListener
Parameters:
evt - an event