org.tbee.swing.jdbc
Class JdbcListModel

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

public class JdbcListModel
extends AbstractListModel
implements 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 String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
JdbcListModel(Connection connection, String sql, boolean hideFirstColumn)
           
JdbcListModel(Connection connection, String sql, boolean hideFirstColumn, boolean cached)
           
 
Method Summary
 void finalize()
          clean up
 Object getElementAt(int idx)
           
 int getSize()
           
 void reload()
          Requery
 TableModelValueWrapper.ValueWrapper wrap(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 String SOURCECODE_VERSION
Standard variable for determining version of a class file.

See Also:
Constant Field Values
Constructor Detail

JdbcListModel

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

JdbcListModel

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

reload

public void reload()
            throws SQLException
Requery

Throws:
SQLException

finalize

public void finalize()
clean up

Overrides:
finalize in class Object

getSize

public int getSize()
Specified by:
getSize in interface ListModel

getElementAt

public Object getElementAt(int idx)
Specified by:
getElementAt in interface ListModel

wrap

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

Specified by:
wrap in interface TableModelValueWrapper.ValueWrapperFactory


Copyright © 2012 KnowledgePlaza. All Rights Reserved.