org.crosswire.bibledesktop.display.basic
Class TabbedBookDataDisplay

java.lang.Object
  extended by org.crosswire.bibledesktop.display.basic.TabbedBookDataDisplay
All Implemented Interfaces:
PropertyChangeListener, EventListener, BookDataDisplay, 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 [joe at eireneh dot com]
See Also:
for license details. The copyright to this program is held by it's authors.

Field Summary
private  BookDataDisplay bookDataDisplay
          If we are not using tabs, this is the main view
private  Book[] books
          The version used for display
private  Component center
          Pointer to whichever of the above is currently in use
private  List displays
          A list of all the InnerDisplayPanes so we can control listeners
private  Passage key
          The passage that we are displaying (in one or more tabs)
private  List 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 uriEventListeners
          A list of all the URIEventListeners
private  Map views
          An map of compnents to their views
private  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
TabbedBookDataDisplay()
          Simple Constructor
 
Method Summary
 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
 Book[] getBooks()
          Provide books.
 Component getComponent()
          Accessor for the Swing component
 Book getFirstBook()
          Provide the first book.
 BookDataDisplay getInnerDisplayPane()
          Accessor for the current TextComponent
 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(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(Book[] books, 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 uriEventListeners
A list of all the URIEventListeners


keyEventListeners

private List keyEventListeners
A list of all the keyEventListeners


key

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


waiting

private Passage waiting
The verses that we have not created tabs for yet


books

private 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 views
An map of compnents to their views


displays

private List 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(Book[] books,
                        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 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 Book[] getBooks()
Description copied from interface: BookProvider
Provide books.

Specified by:
getBooks in interface BookProvider
Returns:
the books

getFirstBook

public Book getFirstBook()
Description copied from interface: BookProvider
Provide the first book.

Specified by:
getFirstBook in interface BookProvider
Returns:
the first book

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

Copyright ยจ 2003-2007