Class FeatureTableModel

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

public class FeatureTableModel extends AbstractTableModel implements org.gvsig.tools.observer.ComplexObserver, org.gvsig.tools.dispose.SupportDisposable
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:
  • Constructor Details

    • 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
    • FeatureTableModel

      protected FeatureTableModel(org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper helper)
      Constructs a TableModel from a FeatureCollection and a Paging pagingHelper.
      Parameters:
      helper -
  • Method Details

    • 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 pagingHelper
    • 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
    • setSelectionUp

      public void setSelectionUp(boolean selectionUp)
      Sets that the selected Features get returned first.
      Parameters:
      selectionUp -
    • fireTableChanged

      protected void fireTableChanged()
    • update

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

      protected void updatePaginHelperWithHiddenColums()
    • getHiddenColumnNames

      protected String[] getHiddenColumnNames()
    • 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
      Returns:
    • 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
      Returns:
    • getFeatureQuery

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

      protected org.gvsig.fmap.dal.feature.FeatureType getFeatureType()
      Returns the type of the
      Returns:
      features.
    • isSelectionLocked

      public boolean isSelectionLocked()
      Returns true if selection must not be changed.
      Returns:
    • dispose

      public void dispose()
      Specified by:
      dispose in interface org.gvsig.tools.dispose.Disposable
    • doDispose

      public void doDispose() throws org.gvsig.tools.exception.BaseException
      Specified by:
      doDispose in interface org.gvsig.tools.dispose.SupportDisposable
      Throws:
      org.gvsig.tools.exception.BaseException