Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.eireneh.bible.book.swing
Class BiblesListModel  view BiblesListModel download BiblesListModel.java

java.lang.Object
  extended byjavax.swing.AbstractListModel
      extended bycom.eireneh.bible.book.swing.BiblesListModel
All Implemented Interfaces:
com.eireneh.bible.book.BiblesListener, java.util.EventListener, javax.swing.ListModel, java.io.Serializable
Direct Known Subclasses:
BiblesComboBoxModel

public class BiblesListModel
extends javax.swing.AbstractListModel
implements com.eireneh.bible.book.BiblesListener

BiblesListModel creates a Swing ListModel from the available Bibles. I would normally implement BiblesListener 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.
Distribution Licence:
Project B is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
The License is available on the internet here, by writing to Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA, Or locally at the Licence link below.
The copyright to this program is held by it's authors.

Version:
D0.I0.T0

Field Summary
protected  java.lang.String[] bibles
          The array of versions
protected  java.lang.String[] drivers
          The array of driver names
 
Fields inherited from class javax.swing.AbstractListModel
listenerList
 
Constructor Summary
BiblesListModel()
          Basic constructor
 
Method Summary
 void addListDataListener(javax.swing.event.ListDataListener li)
          Add a listener to the list that's notified each time a change to the data model occurs.
 void biblesChanged(com.eireneh.bible.book.BiblesEvent ev)
          Called whenever a new Bible is added or a Bible is removed from the system.
private  void cacheData()
          Setup the data-stores of the current Bibles and drivers
 java.lang.String getBibleName(java.lang.Object test)
          Given an item, work out the name of the Bible that it represents
 java.lang.String getDriverName(java.lang.Object test)
          Given an item, work out the name of the Driver that it represents
 java.lang.Object getElementAt(int index)
          Returns the value at the specified index.
 int getIndexOf(java.lang.Object test)
          Returns the index-position of the specified object in the list.
 int getSize()
          Returns the length of the list.
 void removeListDataListener(javax.swing.event.ListDataListener li)
          Remove a listener from the list that's notified each time a change to the data model occurs.
 
Methods inherited from class javax.swing.AbstractListModel
fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

bibles

protected java.lang.String[] bibles
The array of versions


drivers

protected java.lang.String[] drivers
The array of driver names

Constructor Detail

BiblesListModel

public BiblesListModel()
Basic constructor

Method Detail

cacheData

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


getSize

public int getSize()
Returns the length of the list.

Specified by:
getSize in interface javax.swing.ListModel

getElementAt

public java.lang.Object getElementAt(int index)
Returns the value at the specified index.

Specified by:
getElementAt in interface javax.swing.ListModel

getIndexOf

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


getBibleName

public java.lang.String getBibleName(java.lang.Object test)
Given an item, work out the name of the Bible that it represents


getDriverName

public java.lang.String getDriverName(java.lang.Object test)
Given an item, work out the name of the Driver that it represents


addListDataListener

public void addListDataListener(javax.swing.event.ListDataListener li)
Add a listener to the list that's notified each time a change to the data model occurs.

Specified by:
addListDataListener in interface javax.swing.ListModel

removeListDataListener

public void removeListDataListener(javax.swing.event.ListDataListener li)
Remove a listener from the list that's notified each time a change to the data model occurs.

Specified by:
removeListDataListener in interface javax.swing.ListModel

biblesChanged

public void biblesChanged(com.eireneh.bible.book.BiblesEvent ev)
Called whenever a new Bible is added or a Bible is removed from the system.

Specified by:
biblesChanged in interface com.eireneh.bible.book.BiblesListener