Class TransientUpdateStore
- All Implemented Interfaces:
PopupActivationListener
,Serializable
,Comparable
,EventListener
,ListSelectionListener
,TableModel
This class only keeps track of updates on a single record at at time. As soon as the record of interest is changed then the original values are read in from the underlying stream.
This class also allows the addition of user defined fields. These fields are not present in the original data stream. The values of user defined fields are initially "" or 0, but may be modified using the setValueAt methods. User defined values are not lost when the record of interest changes.
This store understands the concept of time periods, although this is irrelevant for any dataset read from a file.
This class can also be instantiated with no-args constructor, in which case no values come from the underlying data store. In this case the store is a single row in length, and only has columns that have been added with the addColumn() method.
The store supports a stack-based approach to tracking changes to variable values. The current values of all attributes can be 'pushed' on to a stack. When the variables are later 'popped' they will resume their former values. There is also a peek() method to retrieve the stack values without changing the stack, and a getStackSize method to determine the number of elements in the stack. Calling reloadCache will clear the stack.
This class should be thread safe.
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from class ca.spatial.table.AttributeStore
SELECT_ADD, SELECT_FROM, SELECT_NEW
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
int
Add a new column to this attribute store.int
Get the total number of periods that this store supportsint
Get the number of rows in this storeint
getValueAt(int row, int column, int period)
Retrieve an object from the store.int
getYearForPeriod(int period)
Get the ending year for a given period.void
peek()
void
pop()
void
push()
void
reloadCache(int row)
Reload the cached values for a given record at the default period.void
reloadCache(int row, int period)
Reload the original values for a given record and time period.void
setColumnCount(int count)
A special version of setColumnCount that allows additional fields to be defined.void
setValueAt(Object aValue, int row, int column, int period)
Set an object in the storeMethods inherited from class ca.spatial.table.AttributeStore
absoluteFile, absoluteFile, absolutePath, absolutePath, addCellEditors, addMenuItems, addPopupActivationListener, addRelate, addRelate, addTableModelListener, addToGlobalStoreList, allowsEditing, booleanValue, booleanValue, buildIndex, calculate, calculateField, calculateField, canIndex, changeSelection, clearSelection, close, compareTo, decodeCharset, doubleValue, doubleValue, exportCSV, exportCSV, exportCSV, exportCSV, exportCSV, exportCSV, exportDBF, exportDBF, exportDBF, exportDBF, exportDBF, findColumn, findColumn, findSimilarColumnNames, getAttributeFormat, getCacheParent, getCachingLayer, getCachingLayer, getCanonicalName, getColumnClass, getColumnCount, getColumnName, getColumnNames, getContextPeriods, getCwd, getEditMode, getFullColumnName, getListSelectionModel, getMinMax, getMinMax, getMinMax, getMinMax, getMinMax, getOpenStore, getOpenStore, getOpenStore, getOpenStores, getPeriod, getPeriodWidth, getRowNodeRemap, getSelectedRowCount, getSelection, getSelection, getSelection, getShortName, getSnapshot, getSnapshot, getStoreByShortName, getStoreByTitle, getSynchronizer, getTableName, getTableSpec, getTitle, getValueAt, 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, setEditMode, 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
-
TransientUpdateStore
public TransientUpdateStore() -
TransientUpdateStore
-
-
Method Details
-
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
-
addColumn
Add a new column to this attribute store. This column is not present in the underlying data store and values only come from the user. The initial value in any user defined column is "" for String, 0 for numbers, false for boolean. -
addColumn
-
setColumnCount
public void setColumnCount(int count)A special version of setColumnCount that allows additional fields to be defined. -
getValueAt
Retrieve an object from the store.- Specified by:
getValueAt
in classAttributeStore
- Parameters:
row
- The row containing the cellcolumn
- The column containing the cellperiod
- The period of interest- Returns:
- An object containing the cell value.
-
setValueAt
Set an object in the store- Overrides:
setValueAt
in classAttributeStore
- Parameters:
aValue
- The value to be set.row
- The row containing the cellcolumn
- The column containing the cellperiod
- The period of interest
-
reloadCache
public void reloadCache(int row, int period)Reload the original values for a given record and time period. This routine will not touch the user-defined fields.The stack will be emptied after calling this routine.
-
reloadCache
public void reloadCache(int row)Reload the cached values for a given record at the default period. -
push
public void push() -
peek
public void peek() -
pop
public void pop() -
getStackSize
public int getStackSize()
-