org.tbee.swing.jdbc
Class JdbcListModel

java.lang.Object
  extended by javax.swing.AbstractListModel
      extended by org.tbee.swing.jdbc.JdbcListModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.ListModel, TableModelValueWrapper.ValueWrapperFactory
Direct Known Subclasses:
JdbcComboBoxModel

public class JdbcListModel
extends javax.swing.AbstractListModel
implements javax.swing.ListModel, TableModelValueWrapper.ValueWrapperFactory

This model populates a ListModel from a ResultSet (or SQL statement). It offers support for the TableModelValueWrapper so Comboboxes may show a different description for their actual values.

Version:
$Revision: 1.10 $
See Also:
Serialized Form

Field Summary
static java.lang.String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
JdbcListModel(java.sql.Connection connection, java.lang.String sql, boolean hideFirstColumn)
           
JdbcListModel(java.sql.Connection connection, java.lang.String sql, boolean hideFirstColumn, boolean cached)
           
 
Method Summary
 void finalize()
          clean up
 java.lang.Object getElementAt(int idx)
           
 int getSize()
           
 void reload()
          Requery
 TableModelValueWrapper.ValueWrapper wrap(java.lang.Object value)
          This implementation of JTable.ValueWrapperFactory
 
Methods inherited from class javax.swing.AbstractListModel
addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.swing.ListModel
addListDataListener, removeListDataListener
 

Field Detail

SOURCECODE_VERSION

public static final java.lang.String SOURCECODE_VERSION
Standard variable for determining version of a class file.

See Also:
Constant Field Values
Constructor Detail

JdbcListModel

public JdbcListModel(java.sql.Connection connection,
                     java.lang.String sql,
                     boolean hideFirstColumn)
              throws java.sql.SQLException
Parameters:
connection -
sql -
hideFirstColumn -
Throws:
java.sql.SQLException

JdbcListModel

public JdbcListModel(java.sql.Connection connection,
                     java.lang.String sql,
                     boolean hideFirstColumn,
                     boolean cached)
              throws java.sql.SQLException
Parameters:
connection -
sql -
hideFirstColumn -
Throws:
java.sql.SQLException
Method Detail

reload

public void reload()
            throws java.sql.SQLException
Requery

Throws:
java.sql.SQLException

finalize

public void finalize()
clean up

Overrides:
finalize in class java.lang.Object

getSize

public int getSize()
Specified by:
getSize in interface javax.swing.ListModel

getElementAt

public java.lang.Object getElementAt(int idx)
Specified by:
getElementAt in interface javax.swing.ListModel

wrap

public TableModelValueWrapper.ValueWrapper wrap(java.lang.Object value)
This implementation of JTable.ValueWrapperFactory

Specified by:
wrap in interface TableModelValueWrapper.ValueWrapperFactory


Copyright © 2010. All Rights Reserved.