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:
java.io.Serializable, javax.swing.table.TableModel, org.gvsig.tools.observer.ComplexObserver, org.gvsig.tools.observer.Observer
Direct Known Subclasses:
ConfigurableFeatureTableModel

public class FeatureTableModel
extends javax.swing.table.AbstractTableModel
implements org.gvsig.tools.observer.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
 java.lang.Class<?> getColumnClass(int columnIndex)
           
 int getColumnCount()
           
 java.lang.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  java.lang.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()
           
 java.lang.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, java.lang.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(java.lang.Object value, int rowIndex, int columnIndex)
           
 void update(org.gvsig.tools.observer.Observable observable, java.lang.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

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

FeatureTableModel

public FeatureTableModel(org.gvsig.fmap.dal.feature.FeatureStore featureStore,
                         org.gvsig.fmap.dal.feature.FeatureQuery featureQuery)
                  throws org.gvsig.tools.exception.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:
org.gvsig.tools.exception.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 org.gvsig.tools.exception.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:
org.gvsig.tools.exception.BaseException - if there is an error reading data from the FeatureStore
Method Detail

getColumnClass

public java.lang.Class<?> getColumnClass(int columnIndex)
Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel

getColumnCount

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

getColumnName

public java.lang.String getColumnName(int column)
Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel

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

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

getFeatureQuery

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

Returns:
the FeatureQuery

getFeatureStore

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

Returns:
the FeatureStore

getFeatureValue

protected java.lang.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

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

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

initialize

protected void initialize()
Initialize the TableModel


internalGetFeatureDescriptorForColumn

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

isCellEditable

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

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

setFeatureValue

protected org.gvsig.fmap.dal.feature.EditableFeature setFeatureValue(org.gvsig.fmap.dal.feature.Feature feature,
                                                                     int columnIndex,
                                                                     java.lang.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

setSelectionUp

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


setValueAt

public void setValueAt(java.lang.Object value,
                       int rowIndex,
                       int columnIndex)
Specified by:
setValueAt in interface javax.swing.table.TableModel
Overrides:
setValueAt in class javax.swing.table.AbstractTableModel

update

public void update(org.gvsig.tools.observer.Observable observable,
                   java.lang.Object notification)
Specified by:
update in interface org.gvsig.tools.observer.Observer


Copyright © 2014 gvSIG Association. All Rights Reserved.