public class ConnectionTable extends TableComponent implements IKeyManager, IUpdateableListener
TableComponent
.
Each connection is defined by the following parameters (although it must be noted that the only required unique value is the name/key/ID):
component
iComponentVisitor
iComponentListener
Constructor and Description |
---|
ConnectionTable()
The default constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addKeyChangeListener(IKeyChangeListener listener)
Adds a new
IKeyChangeListener to listen for key change events in
the manager. |
int |
addRow()
This operation adds a row to the Table and returns the index of that row.
|
boolean |
deleteRow(int index)
This operation will delete the row in the table with the specified index.
|
java.util.List<java.lang.String> |
getAvailableKeys()
Gets the list of available keys.
|
java.util.List<Entry> |
getConnection(java.lang.String name)
Gets the row from the underlying
TableComponent corresponding to
the name of the connection. |
java.util.List<java.lang.String> |
getConnectionNames()
Gets the list of connection names or keys.
|
java.lang.String |
getNextKey()
Returns the next available key, usually based on some default prefix,
e.g., "key1", "key2".
|
boolean |
keyAvailable(java.lang.String key)
Determines whether the specified key is available.
|
void |
removeKeyChangeListener(IKeyChangeListener listener)
Removes an existing
IKeyChangeListener from the key manager. |
void |
setRowTemplate(java.util.ArrayList<Entry> template)
Does nothing.
|
void |
update(IUpdateable component)
Updates the bookkeeping for connection keys.
|
accept, clone, copy, equals, getColumnNames, getRow, getRowIds, getRowTemplate, getSelectedRows, hashCode, numberOfColumns, numberOfRows, setSelectedRows
copy, equals, getDescription, getId, getName, register, setDescription, setId, setName, unregister, update
getClass, notify, notifyAll, toString, wait, wait, wait
register, unregister, update
equals, getDescription, getId, getName, setDescription, setId, setName
public void setRowTemplate(java.util.ArrayList<Entry> template)
setRowTemplate
in class TableComponent
template
- The set of Entries that represent the canonical row of this table.
public int addRow()
TableComponent
This operation adds a row to the Table and returns the index of that row. The new row may be retrieved and its Entries may be edited by calling getRow() using the returned index. When a new row is added, the elements of that row are configured from the row template using its default values. If the Row Template has not yet been set for the TableComponent, this operation cannot add a row and it returns -1.
addRow
in class TableComponent
The index of the new row in the table.
public boolean deleteRow(int index)
TableComponent
This operation will delete the row in the table with the specified index. It will return true if it is success or false otherwise (like if it can not find a row with that index).
deleteRow
in class TableComponent
index
- The index of the row that should be deleted.
True if the row was deleted and false if some problem was encountered, like an incorrect row id.
public void update(IUpdateable component)
update
in interface IUpdateableListener
component
- The updated component. This should only every be an
Entry
for a connection's key.public java.util.List<java.lang.String> getConnectionNames()
public java.util.List<Entry> getConnection(java.lang.String name)
TableComponent
corresponding to
the name of the connection.name
- The name of the connection.TableComponent
, or null if the name is
invalid.public boolean keyAvailable(java.lang.String key)
IKeyManager
keyAvailable
in interface IKeyManager
key
- The key to test.public java.util.List<java.lang.String> getAvailableKeys()
IKeyManager
getAvailableKeys
in interface IKeyManager
public java.lang.String getNextKey() throws java.lang.IllegalStateException
IKeyManager
getNextKey
in interface IKeyManager
java.lang.IllegalStateException
- An exception is thrown if there is a pre-defined list of keys
and there are no more keys available.public void addKeyChangeListener(IKeyChangeListener listener)
IKeyManager
IKeyChangeListener
to listen for key change events in
the manager.addKeyChangeListener
in interface IKeyManager
listener
- The new listener. The same listener should not be added twice.public void removeKeyChangeListener(IKeyChangeListener listener)
IKeyManager
IKeyChangeListener
from the key manager.removeKeyChangeListener
in interface IKeyManager
listener
- The old listener. This removes the first matching occurrence
of the listener from the manager.