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:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList -
Constructor Summary
ConstructorsModifierConstructorDescriptionFeatureTableModel(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.protectedFeatureTableModel(org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper helper) Constructs a TableModel from a FeatureCollection and a Paging pagingHelper. -
Method Summary
Modifier and TypeMethodDescriptionvoiddispose()voidprotected voidClass<?> getColumnClass(int columnIndex) intgetColumnName(int column) org.gvsig.fmap.dal.feature.FeatureAttributeDescriptorgetDescriptorForColumn(int columnIndex) Returns the descriptor of a Feature attribute for a table column.org.gvsig.fmap.dal.feature.FeaturegetFeatureAt(int rowIndex) Returns the value for a row position.org.gvsig.fmap.dal.feature.FeatureQueryReturns the FeatureQuery used to get the Features.org.gvsig.fmap.dal.feature.FeatureStoreReturns the FeatureStore of the Collection.protected org.gvsig.fmap.dal.feature.FeatureTypeReturns the type of theprotected ObjectgetFeatureValue(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.FeaturePagingHelperReturns a reference to the Paging Helper used to load the data from the DataStore.protected String[]intgetValueAt(int rowIndex, int columnIndex) protected voidInitialize the TableModelprotected org.gvsig.fmap.dal.feature.FeatureAttributeDescriptorinternalGetFeatureDescriptorForColumn(int columnIndex) booleanisCellEditable(int rowIndex, int columnIndex) booleanReturns true if selection must not be changed.voidsetFeatureType(org.gvsig.fmap.dal.feature.FeatureType featureType) Sets the FeatureType to show in the table.protected org.gvsig.fmap.dal.feature.EditableFeaturesetFeatureValue(org.gvsig.fmap.dal.feature.Feature feature, int columnIndex, Object value) Sets the value of an Feature attribute at the given position.voidsetSelectionUp(boolean selectionUp) Sets that the selected Features get returned first.voidsetValueAt(Object value, int rowIndex, int columnIndex) voidprotected voidMethods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
-
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 fromfeatureQuery- 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 fromfeatureQuery- the query to get the features from the storepageSize- 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:
getColumnCountin interfaceTableModel
-
getRowCount
public int getRowCount()- Specified by:
getRowCountin interfaceTableModel
-
getValueAt
- Specified by:
getValueAtin interfaceTableModel
-
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
- Specified by:
getColumnClassin interfaceTableModel- Overrides:
getColumnClassin classAbstractTableModel
-
getColumnName
- Specified by:
getColumnNamein interfaceTableModel- Overrides:
getColumnNamein classAbstractTableModel
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex) - Specified by:
isCellEditablein interfaceTableModel- Overrides:
isCellEditablein classAbstractTableModel
-
setValueAt
- Specified by:
setValueAtin interfaceTableModel- Overrides:
setValueAtin classAbstractTableModel
-
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
- Specified by:
updatein interfaceorg.gvsig.tools.observer.Observer
-
updatePaginHelperWithHiddenColums
protected void updatePaginHelperWithHiddenColums() -
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
Returns the value of a Feature attribute, at the given position.- Parameters:
feature- the feature to get the value fromcolumnIndex- 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 updatecolumnIndex- the attribute positionvalue- 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:
disposein interfaceorg.gvsig.tools.dispose.Disposable
-
doDispose
public void doDispose() throws org.gvsig.tools.exception.BaseException- Specified by:
doDisposein interfaceorg.gvsig.tools.dispose.SupportDisposable- Throws:
org.gvsig.tools.exception.BaseException
-