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

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

public class ConfigurableFeatureTableModel
extends FeatureTableModel

Extends the FeatureTableModel to add more configurable options, like the visible columns, column name aliases and row order. TODO: añadir la persistencia.

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

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
ConfigurableFeatureTableModel(org.gvsig.fmap.dal.feature.FeatureStore featureStore, org.gvsig.fmap.dal.feature.FeatureQuery featureQuery)
           
ConfigurableFeatureTableModel(org.gvsig.fmap.dal.feature.FeatureStore featureStore, org.gvsig.fmap.dal.feature.FeatureQuery featureQuery, int pageSize)
           
 
Method Summary
 void acceptChanges()
          Make current changes in configuration (visible columns and aliases) as definitive.
 void cancelChanges()
          Cancel current changes in configuration (visible columns and aliases) and return to previous status.
protected  java.lang.String getAliasForColumn(java.lang.String name)
          Returns the alias for the name of a column.
 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.
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.
 int getOriginalColumnCount()
           
protected  int getOriginalColumnIndex(int columnIndex)
          Returns the original position of a column.
 java.lang.String getOriginalColumnName(int column)
          Returns the original name of the column, ignoring the alias.
protected  void initialize()
          Initialize the TableModel
protected  void initializeVisibleColumns()
          Initializes the table visible columns.
 boolean isVisible(java.lang.String name)
          Returns if a column is visible.
 void orderByColumn(java.lang.String name, boolean ascending)
           
 void setAlias(java.lang.String name, java.lang.String alias)
          Sets the alias for a column.
 void setAllVisible()
          Changes all columns to be visible.
 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 setVisible(java.lang.String name, boolean visible)
          Sets the visibility of a table column.
 void setVisibleColumns(java.util.List<java.lang.String> names)
          Sets the current visible columns list, in the original order.
 
Methods inherited from class org.gvsig.fmap.mapcontrol.dal.feature.swing.table.FeatureTableModel
getFeatureAt, getFeatureQuery, getFeatureStore, getHelper, getRowCount, getValueAt, internalGetFeatureDescriptorForColumn, isCellEditable, setSelectionUp, setValueAt, update
 
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

ConfigurableFeatureTableModel

public ConfigurableFeatureTableModel(org.gvsig.fmap.dal.feature.FeatureStore featureStore,
                                     org.gvsig.fmap.dal.feature.FeatureQuery featureQuery)
                              throws org.gvsig.tools.exception.BaseException
Throws:
org.gvsig.tools.exception.BaseException
See Also:
FeatureTableModel.FeatureTableModel(FeatureStore, FeatureQuery)

ConfigurableFeatureTableModel

public ConfigurableFeatureTableModel(org.gvsig.fmap.dal.feature.FeatureStore featureStore,
                                     org.gvsig.fmap.dal.feature.FeatureQuery featureQuery,
                                     int pageSize)
                              throws org.gvsig.tools.exception.BaseException
Throws:
org.gvsig.tools.exception.BaseException
See Also:
FeatureTableModel.FeatureTableModel(FeatureStore, FeatureQuery, int)
Method Detail

acceptChanges

public void acceptChanges()
Make current changes in configuration (visible columns and aliases) as definitive.


cancelChanges

public void cancelChanges()
Cancel current changes in configuration (visible columns and aliases) and return to previous status.


getAliasForColumn

protected java.lang.String getAliasForColumn(java.lang.String name)
Returns the alias for the name of a column.

Parameters:
name - of the column
Returns:
the alias

getColumnClass

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

getColumnCount

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

getColumnName

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

getDescriptorForColumn

public org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor getDescriptorForColumn(int columnIndex)
Description copied from class: FeatureTableModel
Returns the descriptor of a Feature attribute for a table column.

Overrides:
getDescriptorForColumn in class FeatureTableModel
Parameters:
columnIndex - the column index

getFeatureValue

protected java.lang.Object getFeatureValue(org.gvsig.fmap.dal.feature.Feature feature,
                                           int columnIndex)
Description copied from class: FeatureTableModel
Returns the value of a Feature attribute, at the given position.

Overrides:
getFeatureValue in class FeatureTableModel
Parameters:
feature - the feature to get the value from
columnIndex - the Feature attribute position
Returns:
the value

getOriginalColumnCount

public int getOriginalColumnCount()

getOriginalColumnIndex

protected int getOriginalColumnIndex(int columnIndex)
Returns the original position of a column.

Parameters:
columnIndex - the current visible column index
Returns:
the original column index

getOriginalColumnName

public java.lang.String getOriginalColumnName(int column)
Returns the original name of the column, ignoring the alias.

Parameters:
column - the original index of the column
Returns:
the original column name

initialize

protected void initialize()
Description copied from class: FeatureTableModel
Initialize the TableModel

Overrides:
initialize in class FeatureTableModel

initializeVisibleColumns

protected void initializeVisibleColumns()
Initializes the table visible columns.


isVisible

public boolean isVisible(java.lang.String name)
Returns if a column is visible.

Parameters:
name - the name of the column
Returns:
if the column is visible

orderByColumn

public void orderByColumn(java.lang.String name,
                          boolean ascending)
                   throws org.gvsig.tools.exception.BaseException
Throws:
org.gvsig.tools.exception.BaseException

setAlias

public void setAlias(java.lang.String name,
                     java.lang.String alias)
Sets the alias for a column.

Parameters:
name - the name of the column
alias - the alias for the column

setAllVisible

public void setAllVisible()
Changes all columns to be visible.


setFeatureType

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

Overrides:
setFeatureType in class FeatureTableModel
Parameters:
featureType - the FeatureType of the Features

setFeatureValue

protected org.gvsig.fmap.dal.feature.EditableFeature setFeatureValue(org.gvsig.fmap.dal.feature.Feature feature,
                                                                     int columnIndex,
                                                                     java.lang.Object value)
Description copied from class: FeatureTableModel
Sets the value of an Feature attribute at the given position.

Overrides:
setFeatureValue in class FeatureTableModel
Parameters:
feature - the feature to update
columnIndex - the attribute position
value - the value to set

setVisible

public void setVisible(java.lang.String name,
                       boolean visible)
Sets the visibility of a table column.

Parameters:
columnIndex - the index of the column to update
visible - if the column will be visible or not

setVisibleColumns

public void setVisibleColumns(java.util.List<java.lang.String> names)
Sets the current visible columns list, in the original order.

Parameters:
names - the names of the columns to set as visible


Copyright © 2014 gvSIG Association. All Rights Reserved.