public class EntriesListModel
extends java.lang.Object
implements javax.swing.ListModel
Modifier and Type | Class and Description |
---|---|
static class |
EntriesListModel.Entry
A class used to store the relationship between a database key and the
database name-column value for a given database entry.
|
Modifier and Type | Field and Description |
---|---|
protected java.sql.Connection |
conn
The SQL connection object to use for retrieving the entries
|
protected java.util.List<EntriesListModel.Entry> |
entries
The current 'cached' list of database entries for the given schema
This is used as a reference and modified by the function checkupdate.
|
protected java.util.List<javax.swing.event.ListDataListener> |
listeners
The list of ListDataListener objects associated with the list model
|
javax.swing.ListModel |
listSelf
A self-reference for any specialized subclass objects defined within
the scope of a method within this class.
|
protected DBSchema |
schema
The database table/schema to display the entries for
|
Constructor and Description |
---|
EntriesListModel(java.sql.Connection conn,
DBSchema schema)
Creates a new instance of the entries list model object - a list model
for displaying all of the entries of a schema.
|
Modifier and Type | Method and Description |
---|---|
void |
addListDataListener(javax.swing.event.ListDataListener l)
Adds a listener to the list model's collection of listener objects
|
void |
checkupdate()
Checks for updates to the entries within a database schema and updates
the list model when changes are detected.
|
protected void |
finalize()
An overridden finalize method - if the updateThread variable is used
to ensure continuous dynamic updating, then we must stop the thread
when the object is deleted to avoid memory leak and Exception throwing.
|
int |
findIndex(java.lang.String key)
Determine the index value for a given database key within the list model
|
java.lang.Object |
getElementAt(int index)
Returns a specific Entry object for the given index
|
static java.util.List<EntriesListModel.Entry> |
getEntries(java.sql.Connection conn,
DBSchema schema)
Get all of the entries for the current database schema
|
int |
getSize()
Returns the current size of the list model
(the # of database entries for the current schema)
|
void |
removeListDataListener(javax.swing.event.ListDataListener l)
Removes a listener from the list model's collection of listener objects
|
protected DBSchema schema
protected java.sql.Connection conn
protected java.util.List<EntriesListModel.Entry> entries
protected java.util.List<javax.swing.event.ListDataListener> listeners
public javax.swing.ListModel listSelf
public EntriesListModel(java.sql.Connection conn, DBSchema schema)
conn
- the database connection to perform SQL queries onschema
- the database schema to display entries forpublic void checkupdate()
public int getSize()
getSize
in interface javax.swing.ListModel
public java.lang.Object getElementAt(int index)
getElementAt
in interface javax.swing.ListModel
index
- the list index to return the object forpublic void addListDataListener(javax.swing.event.ListDataListener l)
addListDataListener
in interface javax.swing.ListModel
l
- the listener to addpublic void removeListDataListener(javax.swing.event.ListDataListener l)
removeListDataListener
in interface javax.swing.ListModel
l
- the listener to addpublic static java.util.List<EntriesListModel.Entry> getEntries(java.sql.Connection conn, DBSchema schema)
schema
- the schema to retrieve entries forprotected void finalize()
finalize
in class java.lang.Object
public int findIndex(java.lang.String key)
key
- the key value to search withCopyright © 2008-2014 University of Manitoba.