org.crosswire.bibledesktop.book
Class BooksListModel

java.lang.Object
  extended by javax.swing.AbstractListModel
      extended by org.crosswire.bibledesktop.book.BooksListModel
All Implemented Interfaces:
Serializable, ListModel
Direct Known Subclasses:
BooksComboBoxModel

public class BooksListModel
extends AbstractListModel

BooksListModel creates a Swing ListModel from the available Bibles. I would normally implement BooksListener in an inner class however doing that would stop me calling fireInterval*() in AbstractListModel because that is a protected method and the inner class is neither in the same package or a sub class.

Author:
Joe Walker [joe at eireneh dot com]
See Also:
for license details. The copyright to this program is held by it's authors., Serialized Form

Nested Class Summary
(package private)  class BooksListModel.CustomListDataListener
          So we can get a handle on what Bibles there are
 
Field Summary
private  BookList bookList
          The list of books in this tree
protected  List books
          The array of versions.
private  BookFilter filter
          The filter used to choose Bibles
private  BooksListModel.CustomListDataListener listener
          The listener
private static Logger log
          The log stream
private static long serialVersionUID
          Serialization ID
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
BooksListModel()
          Basic constructor
BooksListModel(BookFilter filter)
          Basic constructor
BooksListModel(BookFilter filter, BookList bookList)
          Basic constructor
 
Method Summary
 void addListDataListener(ListDataListener li)
           
protected  void cacheData()
          Setup the data-stores of the current Bibles and drivers
protected  void fireContentsChanged(Object source, int index0, int index1)
           
 Object getElementAt(int index)
           
 int getIndexOf(Object test)
          Returns the index-position of the specified object in the list.
 int getSize()
           
 void removeListDataListener(ListDataListener li)
           
 void setFilter(BookFilter filter)
           
 
Methods inherited from class javax.swing.AbstractListModel
fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bookList

private transient BookList bookList
The list of books in this tree


filter

private transient BookFilter filter
The filter used to choose Bibles


listener

private transient BooksListModel.CustomListDataListener listener
The listener


books

protected List books
The array of versions. All methods that access this variable have been marked synchronized to ensure that one thread can't update the list of books while another is trying to create a JList based on this class.


log

private static final Logger log
The log stream


serialVersionUID

private static final long serialVersionUID
Serialization ID

See Also:
Constant Field Values
Constructor Detail

BooksListModel

public BooksListModel()
Basic constructor


BooksListModel

public BooksListModel(BookFilter filter)
Basic constructor


BooksListModel

public BooksListModel(BookFilter filter,
                      BookList bookList)
Basic constructor

Method Detail

getSize

public int getSize()

getElementAt

public Object getElementAt(int index)

getIndexOf

public int getIndexOf(Object test)
Returns the index-position of the specified object in the list.

Parameters:
test - the object to find
Returns:
an int representing the index position, where 0 is the first position

setFilter

public void setFilter(BookFilter filter)
Parameters:
filter -

addListDataListener

public void addListDataListener(ListDataListener li)
Specified by:
addListDataListener in interface ListModel
Overrides:
addListDataListener in class AbstractListModel

removeListDataListener

public void removeListDataListener(ListDataListener li)
Specified by:
removeListDataListener in interface ListModel
Overrides:
removeListDataListener in class AbstractListModel

cacheData

protected final void cacheData()
Setup the data-stores of the current Bibles and drivers


fireContentsChanged

protected void fireContentsChanged(Object source,
                                   int index0,
                                   int index1)
Overrides:
fireContentsChanged in class AbstractListModel

Copyright ยจ 2003-2006