Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.crosswire.bibledesktop.passage
Class PassageListModel

    java.lang.Object
      javax.swing.AbstractListModel
          org.crosswire.bibledesktop.passage.PassageListModel

All Implemented Interfaces:
  Serializable, EventListener, ListModel, PassageListener

    public class PassageListModel

extends AbstractListModel
implements PassageListener

The PassageListModel class gives access to a Passage via a ListModel.

Distribution Licence: JSword 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, or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA The copyright to this program is held by it's authors.

Version:
  $Id: PassageListModel.java,v 1.10 2005/01/24 23:25:18 dmsmith Exp $
Author:
  Joe Walker [joe at eireneh dot com]
See Also:
  `Licence`, `JList`, `AbstractListModel`, Serialized Form

Field Summary
`private PassageListType` | `mode` Are we modelling in groups or individually
`private Passage` | `ref` The Passage that we are modelling
`private RestrictionType` | `restrict` If we are modelling in groups, do we break at chapter/book boundries
`private static long` | `serialVersionUID` Serialization ID
`private int` | `size` We need to cache the passage size because we need to report on changed ranges, when informed by the passage that has already changed

Fields inherited from class javax.swing.AbstractListModel
`listenerList`

Constructor Summary
`PassageListModel()` Create a PassageListModel (in verse mode) from a Passage.
`PassageListModel(Passage ref)` Create a PassageListModel (in verse mode) from a Passage.
`PassageListModel(Passage ref, PassageListType mode, RestrictionType restrict)` Create a PassageListModel from a Passage.

Method Summary
`Object` | `getElementAt(int index)` Returns the value at the specified index.
`PassageListType` | `getMode()` Return the mode we are operating in.
`Passage` | `getPassage()` Accessor for the current passage
`RestrictionType` | `getRestriction()` Return the current txtRestrict
`int` | `getSize()` Returns the length of the list.
`private void` | `recomputeSize()` Recompute the size from the reference.
`void` | `setMode(PassageListType mode)` Change the mode we are operating in.
`void` | `setPassage(Passage newRef)` Accessor for the current passage
`void` | `setRestriction(RestrictionType restrict)` Change the restrictions we are using when the mode is LIST_RANGES.
`void` | `versesAdded(PassageEvent ev)` Sent after stuff has been added to the Passage.
`void` | `versesChanged(PassageEvent ev)` Sent after verses have been simultaneously added and removed from the Passage.
`void` | `versesRemoved(PassageEvent ev)` Sent after stuff has been removed from the Passage.

Methods inherited from class javax.swing.AbstractListModel
`addListDataListener, fireContentsChanged, fireIntervalAdded, fireIntervalRemoved, getListDataListeners, getListeners, removeListDataListener`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### ref

    private Passage ref

  The Passage that we are modelling

### size

    private int size

  We need to cache the passage size because we need to report on changed ranges, when informed by the passage that has already changed

### mode

    private PassageListType mode

  Are we modelling in groups or individually

### restrict

    private RestrictionType restrict

  If we are modelling in groups, do we break at chapter/book boundries

### serialVersionUID

    private static final long serialVersionUID

  Serialization ID

  See Also:
    Constant Field Values

Constructor Detail

### PassageListModel

    public PassageListModel()

  Create a PassageListModel (in verse mode) from a Passage.

  Throws:
    `IllegalArgumentException` - If the mode is illegal

### PassageListModel

    public PassageListModel(Passage ref)

  Create a PassageListModel (in verse mode) from a Passage.

  Parameters:
    `ref` - The reference that we are modeling
  Throws:
    `IllegalArgumentException` - If the mode is illegal

### PassageListModel

    public PassageListModel(Passage ref,
                            PassageListType mode,
                            RestrictionType restrict)

  Create a PassageListModel from a Passage. We also specify whether to list the individual verses.

  Parameters:
    `ref` - The reference that we are modeling
    `mode` - The verse/range mode
    `restrict` - When we are in range mode, do we chop at chapter boundries
  Throws:
    `IllegalArgumentException` - If the mode is illegal

Method Detail

### setMode

    public final void setMode(PassageListType mode)

  Change the mode we are operating in.

  Parameters:
    `mode` - The new operation mode
  Throws:
    `IllegalArgumentException` - If the mode is illegal

### getMode

    public PassageListType getMode()

  Return the mode we are operating in.

  Returns:
    The operation mode

### setRestriction

    public void setRestriction(RestrictionType restrict)

  Change the restrictions we are using when the mode is LIST_RANGES. Must be one of: `RESTRICT_NONE`, `RESTRICT_BOOK` or `RESTRICT_CHAPTER`

  Parameters:
    `restrict` - The new restrictions

### getRestriction

    public RestrictionType getRestriction()

  Return the current txtRestrict

### getSize

    public int getSize()

  Returns the length of the list.

  Specified by:
    `getSize` in interface `ListModel`
  Returns:
    The number of verses/ranges in the list

### recomputeSize

    private void recomputeSize()

  Recompute the size from the reference.

### getElementAt

    public Object getElementAt(int index)

  Returns the value at the specified index.

  Specified by:
    `getElementAt` in interface `ListModel`
  Parameters:
    `index` - The index (based at 0) of the element to fetch
  Returns:
    The required verse/range

### versesAdded

    public void versesAdded(PassageEvent ev)

  Sent after stuff has been added to the Passage. More info about what and where can be had from the Event

  Specified by:
    `versesAdded` in interface `PassageListener`
  Parameters:
    `ev` - a PassageEvent encapuslating the event information

### versesRemoved

    public void versesRemoved(PassageEvent ev)

  Sent after stuff has been removed from the Passage. More info about what and where can be had from the Event

  Specified by:
    `versesRemoved` in interface `PassageListener`
  Parameters:
    `ev` - a PassageEvent encapuslating the event information

### versesChanged

    public void versesChanged(PassageEvent ev)

  Sent after verses have been simultaneously added and removed from the Passage. More info about what and where can be had from the Event

  Specified by:
    `versesChanged` in interface `PassageListener`
  Parameters:
    `ev` - a PassageEvent encapuslating the event information

### setPassage

    public final void setPassage(Passage newRef)

  Accessor for the current passage

### getPassage

    public Passage getPassage()

  Accessor for the current passage

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ? 2003-2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD