each child of this element is called whatever
StoreSource.getTagName()
returns, with the attributes "description"
and "date-stamp", what goes after this is determined by the writer
of the configurations, but the general idea is for each object in
the configuration to write its state to a new Element.
- Author:
- Peter W. Draper
- See Also:
Element
,
StoreControlFrame
,
StoreSource
,
Serialized Form
Methods inherited from class javax.swing.table.AbstractTableModel |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
document
protected Document document
- The Document.
rootElement
protected Element rootElement
- Document root Element.
applicationName
protected String applicationName
- Name of the application (used for name of config directory).
storeName
protected String storeName
- Name of the file used for storage.
StoreConfiguration
public StoreConfiguration(String applicationName,
String storeName)
- Create an instance. This synchronises the current total state
with that of the backing store.
- Parameters:
applicationName
- name of the application controlling this
store. Used to create a top-element,
also defines the configuration directory.
XXX use Properties for this?storeName
- name of the file that contains the
configuration
StoreConfiguration
public StoreConfiguration(InputStream inputStream)
- Create an instance. This synchronises the current total state
with that read from a given InputStream (useful when want to
get a default configuration using a getResource()). If you use
this method it is not possible to save to backing store.
- Parameters:
stream
- InputStream that contains an XML description of a
series of configurations (i.e. a wrapped backing
store file).
initFromBackingStore
public void initFromBackingStore(InputStream inputStream)
- Initialise the local DOM from an InputStream.
initFromBackingStore
public void initFromBackingStore()
- Initialise the local DOM from the backing store file. If this
doesn't exist then just create an empty Document with a basic
root Element.
createEmptyDoc
protected void createEmptyDoc()
- Create an empty document
getChildElements
public static List getChildElements(Element element)
- Return all the Elements that are children of another Element.
getCount
public int getCount()
- Get the number of states that are stored.
getState
public Element getState(int index)
- Get a state from the store. These are indexed simply by the
order in the current document.
reGetState
public Element reGetState(int index)
- Re-get a state from the store. Re-getting implies that this
will be overwritten so all children are removed.
getDescription
public String getDescription(int index)
- Get the description of a state by index.
setDescription
public void setDescription(int index,
String value)
- Set the description of a state by index.
getDateStamp
public String getDateStamp(int index)
- Get the date stamp of a state by index.
setDateStamp
public void setDateStamp(int index)
- Set the date stamp of a state by index. Updates to
representation of the current time.
stateCompleted
public void stateCompleted(Element newState)
- Add a new state root in a given Element. The Element should be
created by the newState method.
newState
public Element newState(String elementName,
String description)
- Create a new Element ready for attaching a configuration state
to (i.e. get this Element then write the configuration data
attached to it). When the new configuration is completed invoke
the stateCompleted method, the configuration will not be part
of the structure until then.
removeState
public void removeState(int index)
- Permanently remove a state from store.
writeToBackingStore
public void writeToBackingStore()
- Save the Document to backing store.
getRowCount
public int getRowCount()
- Return the numbers of states that we're currently storing.
getColumnCount
public int getColumnCount()
- Get the number of columns. Always 2.
getValueAt
public Object getValueAt(int row,
int column)
- Return either the description or date stamp of a state.
getColumnName
public String getColumnName(int column)
- Get the name of a column.
- Specified by:
getColumnName
in interface TableModel
- Overrides:
getColumnName
in class AbstractTableModel
setValueAt
public void setValueAt(Object value,
int row,
int column)
- Change a description in response to a user edit.
- Specified by:
setValueAt
in interface TableModel
- Overrides:
setValueAt
in class AbstractTableModel
isCellEditable
public boolean isCellEditable(int row,
int column)
- Let the JTable know that the descriptions are edittable.
- Specified by:
isCellEditable
in interface TableModel
- Overrides:
isCellEditable
in class AbstractTableModel
Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.