Package ca.spatial.table
Class MultiPeriodRamAttributeStore
java.lang.Object
javax.swing.table.AbstractTableModel
ca.spatial.table.AttributeStore
ca.spatial.table.MultiPeriodRamAttributeStore
- All Implemented Interfaces:
EditableTableModel
,PopupActivationListener
,Serializable
,Comparable
,EventListener
,ListSelectionListener
,TableModel
This class holds an in-memory
AttributeStore
. There
are methods for adding, rearanging and removing rows. The method
for adding rows must be overriden to create the appropriate values
for each column.
This class has constructors to intitialze the table fron an existing table, or to construct an empty table with a specified set of columns.
There are also static methods to create summary tables from other tables.
This class is restricted to tables having a single time period.
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from class ca.spatial.table.AttributeStore
SELECT_ADD, SELECT_FROM, SELECT_NEW
-
Constructor Summary
ConstructorsConstructorDescriptionMultiPeriodRamAttributeStore(AttributeFormat[] f, Object[][][] cache, int[] periodWidths)
Construct a newMultiPeriodRamAttributeStore
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a row of data to the table using an interactive query.void
Add a row of data to the end of the table.void
Add a row of data to the end of the table.void
Add multiple rows of data to the end of the table.void
Remove all rows from this tableObject[][][]
getCache()
Return a reference to the underlying data for this tableint
Get the total number of periods that this store supportsint
Get the number of rows in this storegetValueAt(int row, int column, int period)
Get a cell valueint
getYearForPeriod(int period)
Get the ending year for a given period.void
Insert a row of data at a given position in the table.void
insertRows(Object[][][] rowData, int pos)
Insert multiple rows of data at a given position in the table.void
moveRow(int from, int to)
Move the specified row to a new locationvoid
removeRow(int row)
Remove the row specified by the row number.void
setValueAt(Object object, int row, int column, int period)
Set the value in a cell and notify listeners that the value has changed.Methods 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
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, getColumnClass, getColumnCount, getColumnName, getValueAt, isCellEditable, removeTableModelListener, setValueAt
-
Constructor Details
-
MultiPeriodRamAttributeStore
Construct a newMultiPeriodRamAttributeStore
. The column definitions are as specified, and the table is backed by the data in the cache that is provided.- Parameters:
f
- The list of column spcificationscache
- The array of data for the initial rows, columns and periods in this table.periodWidths
- an array of the width of each period, including period 0
-
-
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
-
clearAllRows
public void clearAllRows()Remove all rows from this table -
getCache
Return a reference to the underlying data for this table -
getValueAt
Description copied from class:AttributeStore
Get a cell value- 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
Description copied from class:AttributeStore
Set the value in a cell and notify listeners that the value has changed.Implementing classes that override must call this method to ensure that joins are properly maintained.
- Overrides:
setValueAt
in classAttributeStore
- Parameters:
object
- The value to be set.row
- The row containing the cellcolumn
- The column containing the cellperiod
- The period of interest
-
insertRow
Insert a row of data at a given position in the table. The position must be a valid row number between 0 and the number of rows in the table.- Parameters:
rowData
- an array containg the data to addpos
- the row position to add the data at
-
insertRows
Insert multiple rows of data at a given position in the table. The position must be a valid row number between 0 and the number of rows in the table.- Parameters:
rowData
- an array of arrays containg the rows to addpos
- the row position to add the data at
-
addRow
Add a row of data to the end of the table.- Specified by:
addRow
in interfaceEditableTableModel
- Parameters:
rowData
- an array containg the data to add
-
addRow
Add a row of data to the end of the table.- Parameters:
rowData
- an array containg the data to add
-
addRows
Add multiple rows of data to the end of the table.- Parameters:
rowData
- an array of arrays containg the rows to add
-
addRow
Add a row of data to the table using an interactive query. This method must be overridden to provide the interface to fill in the data.- Specified by:
addRow
in interfaceEditableTableModel
-
removeRow
public void removeRow(int row)Remove the row specified by the row number.- Specified by:
removeRow
in interfaceEditableTableModel
-
moveRow
public void moveRow(int from, int to)Description copied from interface:EditableTableModel
Move the specified row to a new location- Specified by:
moveRow
in interfaceEditableTableModel
-