Package ca.spatial.table
Class PeriodFlattenedStore
java.lang.Object
javax.swing.table.AbstractTableModel
ca.spatial.table.AttributeStore
ca.spatial.table.PeriodFlattenedStore
- All Implemented Interfaces:
PopupActivationListener
,Serializable
,Comparable
,EventListener
,ListSelectionListener
,TableModel
This class provides an adapter to convert multi-period data stores
in to a flat single period store having an initial column named
"Period". If the input table is not multi-period then this
wrapper does not add the "Period" column.
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from class ca.spatial.table.AttributeStore
SELECT_ADD, SELECT_FROM, SELECT_NEW
-
Constructor Summary
ConstructorsConstructorDescriptionCreate the wrapper around the base table -
Method Summary
Modifier and TypeMethodDescriptionboolean
Query if this layer supports extended editing of features.void
close()
Close the table and release resources.int
findColumn(String field)
Get the column number of the given field in the table.getAttributeFormat(int field)
Get the format descriptor for a given column.Return the parent data source from within a caching layer.Return a string that uniquely identifies this table and provides information can be used to reconstruct the table.getColumnClass(int fieldIndex)
Get the class of the column if interest.int
Get the number of columns in this storegetColumnName(int fieldIndex)
Return the name of a column at a given position.boolean
Get the status of the extended editing mode.int
Get the total number of periods that this store supportsint
Get the number of rows in this storegetSnapshot(boolean useSelected, Observer progress)
Get a snapshot of this table definition.Get the synchronizer object for this table.getValueAt(int rowIndex, int fieldIndex)
Get a cell value using the default period for the table.getValueAt(int rowIndex, int fieldIndex, int period)
Get a cell valueint
getYearForPeriod(int period)
Get the ending year for a given period.void
setEditMode(boolean mode)
Enable or disable the extended editing mode.void
setValueAt(Object value, int rowIndex, int fieldIndex)
Set the value in a cell using the default period for the table.Methods inherited from class ca.spatial.table.AttributeStore
absoluteFile, absoluteFile, absolutePath, absolutePath, addCellEditors, addMenuItems, addPopupActivationListener, addRelate, addRelate, addTableModelListener, addToGlobalStoreList, booleanValue, booleanValue, buildIndex, calculate, calculateField, calculateField, canIndex, changeSelection, clearSelection, compareTo, decodeCharset, doubleValue, doubleValue, exportCSV, exportCSV, exportCSV, exportCSV, exportCSV, exportCSV, exportDBF, exportDBF, exportDBF, exportDBF, exportDBF, findColumn, findSimilarColumnNames, getCachingLayer, getCachingLayer, getColumnNames, getContextPeriods, getCwd, getFullColumnName, getListSelectionModel, getMinMax, getMinMax, getMinMax, getMinMax, getMinMax, getOpenStore, getOpenStore, getOpenStore, getOpenStores, getPeriod, getPeriodWidth, getRowNodeRemap, getSelectedRowCount, getSelection, getSelection, getSelection, getShortName, getSnapshot, getStoreByShortName, getStoreByTitle, getTableName, getTableSpec, getTitle, hasIndex, identifyRecords, integerValue, integerValue, isCellEditable, isSelectedIndex, isSelectionEmpty, listify, listValue, listValue, lookupRow, makeLu, maybePopup, notifyPopupActivationListeners, openOrReuse, openOrReuse, queryTable, queryTable, quoteIfRequired, relativePath, removeFromGlobalStoreList, removePopupActivationListener, removeTableModelListener, select, select, selectAdd, selectFrom, selectNew, setCwd, setCwd, setListSelectionModel, setPeriod, setRowNodeRemap, setShortName, setTableSpec, setTitle, setValueAt, showCube, showTable, toString, uniqueValues, uniqueValues, uniqueValues, uniqueValues, uniqueValues, uniqueValues, uniqueValues, uniqueValues, valueChanged
Methods inherited from class javax.swing.table.AbstractTableModel
fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners
-
Constructor Details
-
PeriodFlattenedStore
Create the wrapper around the base table- Parameters:
base
- the parent table to be flattened
-
-
Method Details
-
getColumnCount
public int getColumnCount()Description copied from class:AttributeStore
Get the number of columns in this store- Specified by:
getColumnCount
in interfaceTableModel
- Overrides:
getColumnCount
in classAttributeStore
- Returns:
- the number of columns in this store
-
getRowCount
public int getRowCount()Description copied from class:AttributeStore
Get the number of rows in this store- Specified by:
getRowCount
in interfaceTableModel
- Specified by:
getRowCount
in classAttributeStore
- Returns:
- the number of rows in this store
-
getPeriodCount
public int getPeriodCount()Description copied from class:AttributeStore
Get the total number of periods that this store supports- Specified by:
getPeriodCount
in classAttributeStore
- Returns:
- The number of periods in this store
-
getYearForPeriod
public int getYearForPeriod(int period)Description copied from class:AttributeStore
Get the ending year for a given period.- Specified by:
getYearForPeriod
in classAttributeStore
- Parameters:
period
- The period of interest- Returns:
- the year for a given period
-
getColumnName
Description copied from class:AttributeStore
Return the name of a column at a given position.- Specified by:
getColumnName
in interfaceTableModel
- Overrides:
getColumnName
in classAttributeStore
- Parameters:
fieldIndex
- the column number of interest- Returns:
- the name of the column
-
findColumn
Description copied from class:AttributeStore
Get the column number of the given field in the table. The first matching column is returned. If the column is not found then return -1.- Overrides:
findColumn
in classAttributeStore
- Parameters:
field
- The name of the field to look up
-
getColumnClass
Description copied from class:AttributeStore
Get the class of the column if interest. This returns types that the JTable will use for renderers and editors.- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in classAttributeStore
- Parameters:
fieldIndex
- the column of interest- Returns:
- the Class of the data held in this column
-
getAttributeFormat
Description copied from class:AttributeStore
Get the format descriptor for a given column.- Overrides:
getAttributeFormat
in classAttributeStore
- Parameters:
field
- The column of interest- Returns:
- The
AttributeFormat
for this field
-
getValueAt
Description copied from class:AttributeStore
Get a cell value- Specified by:
getValueAt
in classAttributeStore
- Parameters:
rowIndex
- The row containing the cellfieldIndex
- The column containing the cellperiod
- The period of interest- Returns:
- An object containing the cell value.
-
getValueAt
Description copied from class:AttributeStore
Get a cell value using the default period for the table.- Specified by:
getValueAt
in interfaceTableModel
- Overrides:
getValueAt
in classAttributeStore
- Parameters:
rowIndex
- The row containing the cellfieldIndex
- The column containing the cell- Returns:
- An object containing the cell value.
-
setValueAt
Description copied from class:AttributeStore
Set the value in a cell using the default period for the table.Implementing classes that override must call this method to ensure that joins are properly maintained.
- Specified by:
setValueAt
in interfaceTableModel
- Overrides:
setValueAt
in classAttributeStore
- Parameters:
value
- The value to be set.rowIndex
- The row containing the cellfieldIndex
- The column containing the cell
-
getCacheParent
Description copied from class:AttributeStore
Return the parent data source from within a caching layer. In case the data source is not being cached then this will simply return itself.- Overrides:
getCacheParent
in classAttributeStore
-
close
public void close()Description copied from class:AttributeStore
Close the table and release resources. The table should be used again after this method has been called.In many cases you do not need to call this method when you are finished using a table. Most tables will close automatically when they are no longer referenced.
It is possible that this method will be deprecated or removed in a future release.
- Overrides:
close
in classAttributeStore
-
getCanonicalName
Description copied from class:AttributeStore
Return a string that uniquely identifies this table and provides information can be used to reconstruct the table. This handle can be passed to theAttributeStore.openOrReuse(java.lang.String)
method to get an existing or new instance of the table.- Overrides:
getCanonicalName
in classAttributeStore
- Returns:
- The canonical name of this store.
-
getSynchronizer
Description copied from class:AttributeStore
Get the synchronizer object for this table. This object can be used to suspend the scheduling task as a set of calculations are carried out. Most tables will not have a synchronizer object. The only tables that will are tables that provide simulation results.- Overrides:
getSynchronizer
in classAttributeStore
-
allowsEditing
public boolean allowsEditing()Description copied from class:AttributeStore
Query if this layer supports extended editing of features. Extended editing usually means that values can be written out to disk.- Overrides:
allowsEditing
in classAttributeStore
- Returns:
- true if the store allows editing
-
setEditMode
Description copied from class:AttributeStore
Enable or disable the extended editing mode.- Overrides:
setEditMode
in classAttributeStore
- Parameters:
mode
- the editing mode to use- Throws:
IOException
- if an error occurs while trying to change the edit mode.
-
getEditMode
public boolean getEditMode()Description copied from class:AttributeStore
Get the status of the extended editing mode.- Overrides:
getEditMode
in classAttributeStore
- Returns:
- the editing mode in use
-
getSnapshot
Get a snapshot of this table definition. This will request a snapshot of the input data store, in case any of those are crosstabs. The results will be contained in the snapshot and will not change even if the underlying data set changes.- Overrides:
getSnapshot
in classAttributeStore
- Parameters:
useSelected
- The calculations will only be computed on the selected records.progress
- A reference to a progress widget that will be updated with the progress of the calculations.- Returns:
- This method will return a new shapshot that captures the state of the table definition for the input current data sets.
-