org.openstreetmap.josm.gui.dialogs.relation
Class SelectionTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by org.openstreetmap.josm.gui.dialogs.relation.SelectionTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel, SelectionChangedListener, MapView.LayerChangeListener

public class SelectionTableModel
extends javax.swing.table.AbstractTableModel
implements SelectionChangedListener, MapView.LayerChangeListener

See Also:
Serialized Form

Field Summary
private  java.util.ArrayList<OsmPrimitive> cache
           
private  OsmDataLayer layer
          this selection table model only displays selected primitives in this layer
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
SelectionTableModel(OsmDataLayer layer)
          constructor
 
Method Summary
 void activeLayerChange(Layer oldLayer, Layer newLayer)
          Notifies this listener that the active layer has changed.
 int getColumnCount()
           
 OsmPrimitive getPrimitive(int row)
          Replies the primitive at row row in this model
 int getRowCount()
           
 java.util.List<OsmPrimitive> getSelection()
           
 java.lang.Object getValueAt(int rowIndex, int columnIndex)
           
 void layerAdded(Layer newLayer)
          Notifies this listener that a layer has been added.
 void layerRemoved(Layer oldLayer)
          Notifies this listener that a layer has been removed.
protected  void populateSelectedPrimitives(OsmDataLayer layer)
          populates the model with the primitives currently selected in layer
 void register()
           
 void selectionChanged(java.util.Collection<? extends OsmPrimitive> newSelection)
          Informs the listener that the selection in the dataset has changed.
 void unregister()
           
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

layer

private OsmDataLayer layer
this selection table model only displays selected primitives in this layer


cache

private java.util.ArrayList<OsmPrimitive> cache
Constructor Detail

SelectionTableModel

public SelectionTableModel(OsmDataLayer layer)
                    throws java.lang.IllegalArgumentException
constructor

Parameters:
layer - the data layer. Must not be null.
Throws:
java.lang.IllegalArgumentException - thrown if layer is null
Method Detail

register

public void register()

unregister

public void unregister()

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface javax.swing.table.TableModel

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface javax.swing.table.TableModel

getValueAt

public java.lang.Object getValueAt(int rowIndex,
                                   int columnIndex)
Specified by:
getValueAt in interface javax.swing.table.TableModel

activeLayerChange

public void activeLayerChange(Layer oldLayer,
                              Layer newLayer)
Description copied from interface: MapView.LayerChangeListener
Notifies this listener that the active layer has changed.

Specified by:
activeLayerChange in interface MapView.LayerChangeListener
Parameters:
oldLayer - The previous active layer
newLayer - The new activer layer

layerAdded

public void layerAdded(Layer newLayer)
Description copied from interface: MapView.LayerChangeListener
Notifies this listener that a layer has been added.

Specified by:
layerAdded in interface MapView.LayerChangeListener
Parameters:
newLayer - The new added layer

layerRemoved

public void layerRemoved(Layer oldLayer)
Description copied from interface: MapView.LayerChangeListener
Notifies this listener that a layer has been removed.

Specified by:
layerRemoved in interface MapView.LayerChangeListener
Parameters:
oldLayer - The old removed layer

selectionChanged

public void selectionChanged(java.util.Collection<? extends OsmPrimitive> newSelection)
Description copied from interface: SelectionChangedListener
Informs the listener that the selection in the dataset has changed.

Specified by:
selectionChanged in interface SelectionChangedListener
Parameters:
newSelection - The new selection.

getSelection

public java.util.List<OsmPrimitive> getSelection()

populateSelectedPrimitives

protected void populateSelectedPrimitives(OsmDataLayer layer)
populates the model with the primitives currently selected in layer

Parameters:
layer - the data layer

getPrimitive

public OsmPrimitive getPrimitive(int row)
Replies the primitive at row row in this model

Parameters:
row - the row
Returns:
the primitive at row row in this model


JOSM