org.gvsig.fmap.mapcontrol.dal.feature.swing.table
Class FeatureTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by org.gvsig.fmap.mapcontrol.dal.feature.swing.table.FeatureTableModel
All Implemented Interfaces:
Serializable, TableModel, ComplexObserver, Observer
Direct Known Subclasses:
ConfigurableFeatureTableModel

public class FeatureTableModel
extends AbstractTableModel
implements ComplexObserver

TableModel to access data of Features. This table model can't handle a FeatureSet with more than Integer.MAX_VALUE elements. In that case, only the first Integer.MAX_VALUE elements will be shown.

Author:
Cèsar Ordiñana
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
protected FeatureTableModel(org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper helper)
          Constructs a TableModel from a FeatureCollection and a Paging helper.
  FeatureTableModel(org.gvsig.fmap.dal.feature.FeatureStore featureStore, org.gvsig.fmap.dal.feature.FeatureQuery featureQuery)
          Constructs a TableModel from the features of a FeatureStore, with the default page size.
  FeatureTableModel(org.gvsig.fmap.dal.feature.FeatureStore featureStore, org.gvsig.fmap.dal.feature.FeatureQuery featureQuery, int pageSize)
          Constructs a TableModel from the features of a FeatureStore, with the default page size.
 
Method Summary
 Class<?> getColumnClass(int columnIndex)
           
 int getColumnCount()
           
 String getColumnName(int column)
           
 org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor getDescriptorForColumn(int columnIndex)
          Returns the descriptor of a Feature attribute for a table column.
 org.gvsig.fmap.dal.feature.Feature getFeatureAt(int rowIndex)
          Returns the value for a row position.
 org.gvsig.fmap.dal.feature.FeatureQuery getFeatureQuery()
          Returns the FeatureQuery used to get the Features.
 org.gvsig.fmap.dal.feature.FeatureStore getFeatureStore()
          Returns the FeatureStore of the Collection.
protected  Object getFeatureValue(org.gvsig.fmap.dal.feature.Feature feature, int columnIndex)
          Returns the value of a Feature attribute, at the given position.
 org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper getHelper()
          Returns a reference to the Paging Helper used to load the data from the DataStore.
 int getRowCount()
           
 Object getValueAt(int rowIndex, int columnIndex)
           
protected  void initialize()
          Initialize the TableModel
protected  org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor internalGetFeatureDescriptorForColumn(int columnIndex)
           
 boolean isCellEditable(int rowIndex, int columnIndex)
           
 void setFeatureType(org.gvsig.fmap.dal.feature.FeatureType featureType)
          Sets the FeatureType to show in the table.
protected  org.gvsig.fmap.dal.feature.EditableFeature setFeatureValue(org.gvsig.fmap.dal.feature.Feature feature, int columnIndex, Object value)
          Sets the value of an Feature attribute at the given position.
 void setSelectionUp(boolean selectionUp)
          Sets that the selected Features get returned first.
 void setValueAt(Object value, int rowIndex, int columnIndex)
           
 void update(Observable observable, Object notification)
           
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FeatureTableModel

public FeatureTableModel(org.gvsig.fmap.dal.feature.FeatureStore featureStore,
                         org.gvsig.fmap.dal.feature.FeatureQuery featureQuery)
                  throws BaseException
Constructs a TableModel from the features of a FeatureStore, with the default page size.

Parameters:
featureStore - to extract the features from
featureQuery - the query to get the features from the store
Throws:
BaseException - if there is an error reading data from the FeatureStore

FeatureTableModel

public FeatureTableModel(org.gvsig.fmap.dal.feature.FeatureStore featureStore,
                         org.gvsig.fmap.dal.feature.FeatureQuery featureQuery,
                         int pageSize)
                  throws BaseException
Constructs a TableModel from the features of a FeatureStore, with the default page size.

Parameters:
featureStore - to extract the features from
featureQuery - the query to get the features from the store
pageSize - the number of elements per page data
Throws:
BaseException - if there is an error reading data from the FeatureStore

FeatureTableModel

protected FeatureTableModel(org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper helper)
Constructs a TableModel from a FeatureCollection and a Paging helper.

Parameters:
featureCollection - to extract data from
helper - the paging helper
Throws:
org.gvsig.fmap.dal.exception.DataException - if there is an error reading data from the FeatureStore
Method Detail

getColumnCount

public int getColumnCount()
Specified by:
getColumnCount in interface TableModel

getRowCount

public int getRowCount()
Specified by:
getRowCount in interface TableModel

getValueAt

public Object getValueAt(int rowIndex,
                         int columnIndex)
Specified by:
getValueAt in interface TableModel

getFeatureAt

public org.gvsig.fmap.dal.feature.Feature getFeatureAt(int rowIndex)
Returns the value for a row position.

Parameters:
rowIndex - the row position
Returns:
the Feature

getColumnClass

public Class<?> getColumnClass(int columnIndex)
Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel

getColumnName

public String getColumnName(int column)
Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel

isCellEditable

public boolean isCellEditable(int rowIndex,
                              int columnIndex)
Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel

setValueAt

public void setValueAt(Object value,
                       int rowIndex,
                       int columnIndex)
Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel

getHelper

public org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper getHelper()
Returns a reference to the Paging Helper used to load the data from the DataStore.

Returns:
the paging helper

setFeatureType

public void setFeatureType(org.gvsig.fmap.dal.feature.FeatureType featureType)
Sets the FeatureType to show in the table. Used for FeatureStores with many simultaneous FeatureTypes supported. Will cause a reload of the current data.

Parameters:
featureType - the FeatureType of the Features
Throws:
org.gvsig.fmap.dal.exception.DataException - if there is an error loading the data

setSelectionUp

public void setSelectionUp(boolean selectionUp)
Sets that the selected Features get returned first.


update

public void update(Observable observable,
                   Object notification)
Specified by:
update in interface Observer

getFeatureStore

public org.gvsig.fmap.dal.feature.FeatureStore getFeatureStore()
Returns the FeatureStore of the Collection.

Returns:
the FeatureStore

getDescriptorForColumn

public org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor getDescriptorForColumn(int columnIndex)
Returns the descriptor of a Feature attribute for a table column.

Parameters:
columnIndex - the column index

internalGetFeatureDescriptorForColumn

protected org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor internalGetFeatureDescriptorForColumn(int columnIndex)
Parameters:
columnIndex -
Returns:

initialize

protected void initialize()
Initialize the TableModel


getFeatureValue

protected Object getFeatureValue(org.gvsig.fmap.dal.feature.Feature feature,
                                 int columnIndex)
Returns the value of a Feature attribute, at the given position.

Parameters:
feature - the feature to get the value from
columnIndex - the Feature attribute position
Returns:
the value

setFeatureValue

protected org.gvsig.fmap.dal.feature.EditableFeature setFeatureValue(org.gvsig.fmap.dal.feature.Feature feature,
                                                                     int columnIndex,
                                                                     Object value)
Sets the value of an Feature attribute at the given position.

Parameters:
feature - the feature to update
columnIndex - the attribute position
value - the value to set
Throws:
IsNotFeatureSettingException - if there is an error setting the value

getFeatureQuery

public org.gvsig.fmap.dal.feature.FeatureQuery getFeatureQuery()
Returns the FeatureQuery used to get the Features.

Returns:
the FeatureQuery


Copyright © 2004-2013 gvSIG. All Rights Reserved.