org.crosswire.bibledesktop.display.basic

## Class TextPaneBookDataDisplay

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

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

      public class TextPaneBookDataDisplay
      extends Object
      implements BookDataDisplay, HyperlinkListener

  A JTextPane implementation of an OSIS displayer.
  Author:
    Joe Walker, DM Smith
  See Also:
    `for license details.`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private org.crosswire.jsword.book.BookData` | `bdata` The book data being shown.
    `private boolean` | `compareBooks` Whether the books should be compared.
    `private org.crosswire.common.xml.Converter` | `converter` To convert OSIS to HTML
    `private static String` | `DOUBLE_SLASH`
    `private static String` | `HYPERLINK_STYLE`
    `private int` | `lastLength` length of last enter event
    `private int` | `lastStart` location of last enter event
    `private EventListenerList` | `listenerList` The listeners for handling URIs
    `protected static org.slf4j.Logger` | `log` The log stream
    `private static String` | `RELATIVE_URI_PROTOCOL`
    `private static String` | `SCROLL_TO_URI`
    `private Style` | `style` A sytle used to underline a hyperlink
    `private StyledDocument` | `styledDoc` The styled document of the JTextPane.
    `private JTextPane` | `txtView` The display component

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

      `COMPARE_BOOKS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TextPaneBookDataDisplay()` Simple ctor

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addKeyChangeListener(KeyChangeListener listener)` Add a listener for when the key changes.
    `void` | `addMouseListener(MouseListener li)` Forward the mouse listener to our child components
    `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
    `void` | `fireActivateURI(URIEvent e)` Notify the listeners that the hyperlink (URI) has been activated.
    `void` | `fireEnterURI(URIEvent e)` Notify the listeners that the hyperlink (URI) has been entered.
    `void` | `fireLeaveURI(URIEvent e)` Notify the listeners that the hyperlink (URI) has been left.
    `org.crosswire.jsword.book.Book[]` | `getBooks()`
    `Component` | `getComponent()` Accessor for the Swing component
    `org.crosswire.jsword.book.Book` | `getFirstBook()`
    `org.crosswire.jsword.passage.Key` | `getKey()` The Book Key that we are displaying, or null if we are not displaying anything
    `private String[]` | `getParts(String reference)`
    `void` | `hyperlinkUpdate(HyperlinkEvent ev)`
    `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` | `removeMouseListener(MouseListener li)` Forward the mouse listener to our child components
    `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 key)` Set the BookData to be displayed.
    `void` | `setCompareBooks(boolean compare)` Establish whether books in the book array should be compared.

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

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

- - ### Field Detail

    - #### HYPERLINK_STYLE

          private static final String HYPERLINK_STYLE

      See Also:
        Constant Field Values

    - #### DOUBLE_SLASH

          private static final String DOUBLE_SLASH

      See Also:
        Constant Field Values

    - #### SCROLL_TO_URI

          private static final String SCROLL_TO_URI

      See Also:
        Constant Field Values

    - #### RELATIVE_URI_PROTOCOL

          private static final String RELATIVE_URI_PROTOCOL

      See Also:
        Constant Field Values

    - #### bdata

          private org.crosswire.jsword.book.BookData bdata

      The book data being shown.

    - #### compareBooks

          private boolean compareBooks

      Whether the books should be compared.

    - #### converter

          private org.crosswire.common.xml.Converter converter

      To convert OSIS to HTML

    - #### txtView

          private JTextPane txtView

      The display component

    - #### style

          private Style style

      A sytle used to underline a hyperlink

    - #### lastStart

          private int lastStart

      location of last enter event

    - #### lastLength

          private int lastLength

      length of last enter event

    - #### styledDoc

          private StyledDocument styledDoc

      The styled document of the JTextPane.

    - #### listenerList

          private EventListenerList listenerList

      The listeners for handling URIs

    - #### log

          protected static final org.slf4j.Logger log

      The log stream

  - ### Constructor Detail

    - #### TextPaneBookDataDisplay

          public TextPaneBookDataDisplay()

      Simple ctor

  - ### Method Detail

    - #### 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 key)

      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
        `key` - 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`

    - #### hyperlinkUpdate

          public void hyperlinkUpdate(HyperlinkEvent ev)

      Specified by:
        `hyperlinkUpdate` in interface `HyperlinkListener`

    - #### propertyChange

          public void propertyChange(PropertyChangeEvent evt)

      Specified by:
        `propertyChange` in interface `PropertyChangeListener`

    - #### getParts

          private String[] getParts(String reference)
                             throws MalformedURLException

      Throws:
        `MalformedURLException`

    - #### getComponent

          public Component getComponent()

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

    - #### 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`

    - #### 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

    - #### fireActivateURI

          public void fireActivateURI(URIEvent e)

      Notify the listeners that the hyperlink (URI) has been activated.
      Parameters:
        `e` - the event
      See Also:
        `EventListenerList`

    - #### fireEnterURI

          public void fireEnterURI(URIEvent e)

      Notify the listeners that the hyperlink (URI) has been entered.
      Parameters:
        `e` - the event
      See Also:
        `EventListenerList`

    - #### fireLeaveURI

          public void fireLeaveURI(URIEvent e)

      Notify the listeners that the hyperlink (URI) has been left.
      Parameters:
        `e` - the event
      See Also:
        `EventListenerList`

    - #### removeMouseListener

          public void removeMouseListener(MouseListener li)

      Forward the mouse listener to our child components

    - #### addMouseListener

          public void addMouseListener(MouseListener li)

      Forward the mouse listener to our child components

    - #### 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`