Package ca.spatial.patchworks
Class AccessTableModel
java.lang.Object
javax.swing.table.AbstractTableModel
ca.spatial.table.AttributeStore
ca.spatial.patchworks.AccessTableModel
- All Implemented Interfaces:
PopupActivationListener
,Serializable
,Comparable
,EventListener
,ListSelectionListener
,TableModel
This class encapsulates the timing constraints table.
Timing constraints specify the time periods when the scheduler
may or may not make changes to the schedule.
Timing constraints are associated with blocks using a
relational join based on a common column. Use the
setKey(java.lang.String)
method to change the join key.
Changes to the values can be made using the
setValueAt(java.lang.Object, int, int, int)
method. This table is flat in that it
does not have any periods. Instead, period data are stored
in columns named "PERIOD1", "PERIOD2", etc. To change a
value use code like the following:
/* * This changes the value for the row with unit value "LRU" * to a value of unavailable. *\/ AccessTableModel atm = control.getAccessTable(); int row = atm.lookupRow("LRU", 0); int col = atm.findColumn("PERIOD1"); atm.setValueAt(new Integer(atm.UNAVAILABLE), row, col);
Changes will not take effect until the apply()
method
has been invoked.
- See Also:
- Serialized Form
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic int
The code for an available timing.static int
The code for an available timing.static int
The code for an unavailable timing.Fields inherited from class ca.spatial.table.AttributeStore
SELECT_ADD, SELECT_FROM, SELECT_NEW
-
Method Summary
Modifier and TypeMethodDescriptionvoid
void
apply()
Apply any changes to the timing constraints.void
apply(SimpleProgress3 sp)
Apply any changes to the timing constraints.getKey()
Get the name of the join key fieldgetKeys()
Get a list of all keys in this tableint
Get the total number of periods that this store supportsint
Get the number of rows in this storegetStore()
Get the name of the base table in the relationgetValueAt(int row, int column, int period)
Get a cell valueint
getYearForPeriod(int period)
Get the ending year for a given period.boolean
Test of the table has been altered but the changes not yet applied.void
Load a set of timing constraints from a filevoid
Load a set of timing constraints from a filevoid
void
Save the current timing constraints to a filevoid
Save the current timing constraints to a filevoid
setEligForZone(String zone, int[] codes)
void
Set the join key for the timing constraints table.void
setKey(String key, SimpleProgress3 sp, boolean notifyListeners)
Set the join key in the timing constraints table.void
setValueAt(Object o, int row, int column, int period)
Set the value in a cell and notify listeners that the value has changed.void
setZoneForUnit(String unit, String zone)
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
-
Field Details
-
AVAILABLE
public static final int AVAILABLEThe code for an available timing. Scheduling is allowed and existing treatments are allowed to remain.- See Also:
- Constant Field Values
-
MANUAL
public static final int MANUALThe code for an available timing. No scheduleing is allowed, but existing treatments will allowed to remain.- See Also:
- Constant Field Values
-
UNAVAILABLE
public static final int UNAVAILABLEThe code for an unavailable timing. No scheduleing is allowed, and when applied all existing treatments will be removed.- See Also:
- Constant Field Values
-
-
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
-
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:
o
- The value to be set.row
- The row containing the cellcolumn
- The column containing the cellperiod
- The period of interest
-
setKey
Set the join key for the timing constraints table. -
setKey
Set the join key in the timing constraints table.- Parameters:
key
- the join key expressionsp
- a progress bar that will be updatednotifyListeners
- if true then notify any listeners when the key changes
-
apply
public void apply()Apply any changes to the timing constraints. -
apply
Apply any changes to the timing constraints. This version will display a custom progress bar. This intereacts with Swing, and must be done on the EDT. -
load
Load a set of timing constraints from a file -
load
Load a set of timing constraints from a file -
setZoneForUnit
-
setEligForZone
-
save
Save the current timing constraints to a file -
save
Save the current timing constraints to a file -
getKeys
Get a list of all keys in this table -
getKey
Get the name of the join key field -
getStore
Get the name of the base table in the relation -
isAltered
public boolean isAltered()Test of the table has been altered but the changes not yet applied. -
addKeyListener
-
removeKeyListener
-