org.crosswire.bibledesktop.display.basic

## Class TabbedBookDataDisplay

- java.lang.Object
- - org.crosswire.bibledesktop.display.basic.TabbedBookDataDisplay

- All Implemented Interfaces:
    PropertyChangeListener, EventListener, BookDataDisplay, org.crosswire.jsword.book.BookProvider

      public class TabbedBookDataDisplay
      extends Object
      implements BookDataDisplay

  An inner component of Passage pane that can't show the list.

  At some stage we should convert this code to remove Passage so it will work with all Books and not just Bibles. Code is included (commented out) on how this could be done.

  Author:
    Joe Walker
  See Also:
    `for license details.`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private BookDataDisplay` | `bookDataDisplay` If we are not using tabs, this is the main view
    `private org.crosswire.jsword.book.Book[]` | `books` The version used for display
    `private Component` | `center` Pointer to whichever of the above is currently in use
    `private List<BookDataDisplay>` | `displays` A list of all the InnerDisplayPanes so we can control listeners
    `private org.crosswire.jsword.passage.Passage` | `key` The passage that we are displaying (in one or more tabs)
    `private List<KeyChangeListener>` | `keyEventListeners` A list of all the keyEventListeners
    `private static int` | `pageSize` How many verses on a tab.
    `private JPanel` | `pnlMain` The top level component
    `private JPanel` | `pnlMore` Blank thing for the "More..." button
    `private JScrollPane` | `scrMain` The top level component
    `private JTabbedPane` | `tabMain` If we are using tabs, this is the main view
    `private boolean` | `tabs` Are we using tabs?
    `private static int` | `TITLE_LENGTH` What is the max length for a tab title
    `private List<URIEventListener>` | `uriEventListeners` A list of all the URIEventListeners
    `private Map<JScrollPane,BookDataDisplay>` | `views` An map of components to their views
    `private org.crosswire.jsword.passage.Passage` | `waiting` The verses that we have not created tabs for yet

    - ### Fields inherited from interface org.crosswire.bibledesktop.display.BookDataDisplay

      `COMPARE_BOOKS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TabbedBookDataDisplay()` Simple Constructor

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addKeyChangeListener(KeyChangeListener listener)` Add a listener for when the key changes.
    `void` | `addURIEventListener(URIEventListener listener)` Add a listener for when someone clicks on a browser 'link'
    `void` | `clearBookData()` Clear any BookData that is displayed.
    `void` | `copy()` Copy the selection to the clipboard
    `private BookDataDisplay` | `createInnerDisplayPane()` Tab creation helper
    `org.crosswire.jsword.book.Book[]` | `getBooks()`
    `Component` | `getComponent()` Accessor for the Swing component
    `org.crosswire.jsword.book.Book` | `getFirstBook()`
    `BookDataDisplay` | `getInnerDisplayPane()` Accessor for the current TextComponent
    `org.crosswire.jsword.passage.Key` | `getKey()` The Book Key that we are displaying, or null if we are not displaying anything
    `static int` | `getPageSize()` Accessor for the page size
    `private static String` | `getTabName(org.crosswire.jsword.passage.Key key)` Ensure that the tab names are not too long - 25 chars max
    `void` | `propertyChange(PropertyChangeEvent evt)`
    `void` | `refresh()` Cause the BookData to be re-displayed.
    `void` | `removeKeyChangeListener(KeyChangeListener listener)` Remove a listener for when the key changes.
    `void` | `removeURIEventListener(URIEventListener listener)` Remove a listener for when someone clicks on a browser 'link'
    `void` | `setBookData(org.crosswire.jsword.book.Book[] books, org.crosswire.jsword.passage.Key newkey)` Set the BookData to be displayed.
    `private void` | `setCenterComponent(Component comp)` Make a new component reside in the center of this panel
    `void` | `setCompareBooks(boolean compare)` Establish whether books in the book array should be compared.
    `static void` | `setPageSize(int pageSize)` Accessor for the page size
    `(package private) void` | `tabChanged()` Tabs changed, generate some stuff

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### TITLE_LENGTH

          private static final int TITLE_LENGTH

      What is the max length for a tab title
      See Also:
        Constant Field Values

    - #### pageSize

          private static int pageSize

      How many verses on a tab.

    - #### uriEventListeners

          private List<URIEventListener> uriEventListeners

      A list of all the URIEventListeners

    - #### keyEventListeners

          private List<KeyChangeListener> keyEventListeners

      A list of all the keyEventListeners

    - #### key

          private org.crosswire.jsword.passage.Passage key

      The passage that we are displaying (in one or more tabs)

    - #### waiting

          private org.crosswire.jsword.passage.Passage waiting

      The verses that we have not created tabs for yet

    - #### books

          private org.crosswire.jsword.book.Book[] books

      The version used for display

    - #### tabs

          private boolean tabs

      Are we using tabs?

    - #### tabMain

          private JTabbedPane tabMain

      If we are using tabs, this is the main view

    - #### bookDataDisplay

          private BookDataDisplay bookDataDisplay

      If we are not using tabs, this is the main view

    - #### views

          private Map<JScrollPane,BookDataDisplay> views

      An map of components to their views

    - #### displays

          private List<BookDataDisplay> displays

      A list of all the InnerDisplayPanes so we can control listeners

    - #### center

          private Component center

      Pointer to whichever of the above is currently in use

    - #### pnlMore

          private JPanel pnlMore

      Blank thing for the "More..." button

    - #### pnlMain

          private JPanel pnlMain

      The top level component

    - #### scrMain

          private JScrollPane scrMain

      The top level component

  - ### Constructor Detail

    - #### TabbedBookDataDisplay

          public TabbedBookDataDisplay()

      Simple Constructor

  - ### Method Detail

    - #### getComponent

          public Component getComponent()

      Description copied from interface: `BookDataDisplay`
      Accessor for the Swing component
      Specified by:
        `getComponent` in interface `BookDataDisplay`

    - #### clearBookData

          public void clearBookData()

      Description copied from interface: `BookDataDisplay`
      Clear any BookData that is displayed. This is equivalent to: `setBookData(null, null)`.
      Specified by:
        `clearBookData` in interface `BookDataDisplay`

    - #### setBookData

          public void setBookData(org.crosswire.jsword.book.Book[] books,
                         org.crosswire.jsword.passage.Key newkey)

      Description copied from interface: `BookDataDisplay`
      Set the BookData to be displayed. The data to be displayed is specified as a books and key rather than the more obvious BookData (the result of reading books using a key) since some displays may wish so split up the display and only look up smaller sections at a time.
      Specified by:
        `setBookData` in interface `BookDataDisplay`
      Parameters:
        `books` - The Books to read data from
        `newkey` - The key to read from the given book

    - #### setCompareBooks

          public void setCompareBooks(boolean compare)

      Description copied from interface: `BookDataDisplay`
      Establish whether books in the book array should be compared.
      Specified by:
        `setCompareBooks` in interface `BookDataDisplay`

    - #### refresh

          public void refresh()

      Description copied from interface: `BookDataDisplay`
      Cause the BookData to be re-displayed.
      Specified by:
        `refresh` in interface `BookDataDisplay`

    - #### getKey

          public org.crosswire.jsword.passage.Key getKey()

      Description copied from interface: `BookDataDisplay`
      The Book Key that we are displaying, or null if we are not displaying anything
      Specified by:
        `getKey` in interface `BookDataDisplay`
      Returns:
        The current key

    - #### getBooks

          public org.crosswire.jsword.book.Book[] getBooks()

      Specified by:
        `getBooks` in interface `org.crosswire.jsword.book.BookProvider`

    - #### getFirstBook

          public org.crosswire.jsword.book.Book getFirstBook()

      Specified by:
        `getFirstBook` in interface `org.crosswire.jsword.book.BookProvider`

    - #### copy

          public void copy()

      Description copied from interface: `BookDataDisplay`
      Copy the selection to the clipboard
      Specified by:
        `copy` in interface `BookDataDisplay`

    - #### addKeyChangeListener

          public void addKeyChangeListener(KeyChangeListener listener)

      Description copied from interface: `BookDataDisplay`
      Add a listener for when the key changes.
      Specified by:
        `addKeyChangeListener` in interface `BookDataDisplay`

    - #### removeKeyChangeListener

          public void removeKeyChangeListener(KeyChangeListener listener)

      Description copied from interface: `BookDataDisplay`
      Remove a listener for when the key changes.
      Specified by:
        `removeKeyChangeListener` in interface `BookDataDisplay`

    - #### propertyChange

          public void propertyChange(PropertyChangeEvent evt)

      Specified by:
        `propertyChange` in interface `PropertyChangeListener`

    - #### addURIEventListener

          public void addURIEventListener(URIEventListener listener)

      Description copied from interface: `BookDataDisplay`
      Add a listener for when someone clicks on a browser 'link'
      Specified by:
        `addURIEventListener` in interface `BookDataDisplay`
      Parameters:
        `listener` - The listener to add

    - #### removeURIEventListener

          public void removeURIEventListener(URIEventListener listener)

      Description copied from interface: `BookDataDisplay`
      Remove a listener for when someone clicks on a browser 'link'
      Specified by:
        `removeURIEventListener` in interface `BookDataDisplay`
      Parameters:
        `listener` - The listener to remove

    - #### setCenterComponent

          private void setCenterComponent(Component comp)

      Make a new component reside in the center of this panel

    - #### tabChanged

          final void tabChanged()

      Tabs changed, generate some stuff

    - #### getInnerDisplayPane

          public BookDataDisplay getInnerDisplayPane()

      Accessor for the current TextComponent

    - #### createInnerDisplayPane

          private BookDataDisplay createInnerDisplayPane()

      Tab creation helper

    - #### setPageSize

          public static void setPageSize(int pageSize)

      Accessor for the page size

    - #### getPageSize

          public static int getPageSize()

      Accessor for the page size

    - #### getTabName

          private static String getTabName(org.crosswire.jsword.passage.Key key)

      Ensure that the tab names are not too long - 25 chars max
      Parameters:
        `key` - The key to get a short name from
      Returns:
        The first 9 chars followed by ... followed by the last 9