org.geotools.gui.swing.table
Class FeatureTableModel

Object
  extended by AbstractTableModel
      extended by FeatureTableModel
All Implemented Interfaces:
Serializable, TableModel

public class FeatureTableModel
extends AbstractTableModel
implements TableModel

An implementation of Swing's table model which allows feature tables to be displayed.

Since:
2.2
Author:
James Macgill, CCG
See Also:
Serialized Form
Module:

Field Summary
 
Fields inherited from class AbstractTableModel
listenerList
 
Constructor Summary
FeatureTableModel()
          Creates a new instance of feature table model.
FeatureTableModel(FeatureCollection<SimpleFeatureType,SimpleFeature> features)
          Creates a new instance of FeatureTableModel based on the feature collection provided.
 
Method Summary
 int getColumnCount()
          The number of columns in the feature table.
 String getColumnName(int col)
          Gets the name of a specified column.
 int getRowCount()
          Gets the row count for the featureTable.
 Object getValueAt(int row, int col)
          Gets the value stored in a specified cell.
 void setFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> features)
          Sets which featureTable to represent
 
Methods inherited from class AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface TableModel
addTableModelListener, getColumnClass, isCellEditable, removeTableModelListener, setValueAt
 

Constructor Detail

FeatureTableModel

public FeatureTableModel()
Creates a new instance of feature table model.


FeatureTableModel

public FeatureTableModel(FeatureCollection<SimpleFeatureType,SimpleFeature> features)
Creates a new instance of FeatureTableModel based on the feature collection provided.

Method Detail

setFeatureCollection

public void setFeatureCollection(FeatureCollection<SimpleFeatureType,SimpleFeature> features)
Sets which featureTable to represent

Parameters:
features - The featureTable to represent. This could fire a Table Structure Changed event.

getColumnCount

public int getColumnCount()
The number of columns in the feature table. Note: for the moment, this is determined by the first feature.

Specified by:
getColumnCount in interface TableModel
Returns:
the number of columns in this feature table.

getRowCount

public int getRowCount()
Gets the row count for the featureTable.

Specified by:
getRowCount in interface TableModel
Returns:
the number of features in feature table.

getColumnName

public String getColumnName(int col)
Gets the name of a specified column.

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel
Parameters:
col - the index of the column to get the name of.
Returns:
the name of col.

getValueAt

public Object getValueAt(int row,
                         int col)
Gets the value stored in a specified cell. In this case, row=Feature and col=Attribute.

Specified by:
getValueAt in interface TableModel
Parameters:
row - the row number.
col - the column number.
Returns:
the value in the specified cell.


Copyright © 1996-2009 Geotools. All Rights Reserved.