org.crosswire.bibledesktop.display.tab
Class TabbedBookDataDisplay

java.lang.Object
  extended by org.crosswire.bibledesktop.display.tab.TabbedBookDataDisplay
All Implemented Interfaces:
BookDataDisplay

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  Book book
          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  List hyperlis
          A list of all the HyperlinkListeners
private  Passage key
          The passage that we are displaying (in one or more tabs)
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  BookDataDisplay pnlView
          If we are not using tabs, this is the main view
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  Map views
          An map of compnents to their views
private  Passage waiting
          The verses that we have not created tabs for yet
 
Constructor Summary
TabbedBookDataDisplay()
          Simple Constructor
 
Method Summary
 void addURLEventListener(URLEventListener listener)
          Add a listener for when someone clicks on a browser 'link'
 void copy()
          Copy the selection to the clipboard
private  BookDataDisplay createInnerDisplayPane()
          Tab creation helper
 Book getBook()
          Accessor for the Book used in the current display, or null if we are not displaying anything.
 Component getComponent()
          Accessor for the Swing component
 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
private  void init()
          GUI creation
 void refresh()
          Cause the BookData to be re-displayed.
 void removeURLEventListener(URLEventListener listener)
          Remove a listener for when someone clicks on a browser 'link'
 void setBookData(Book book, Key newkey)
          Set the BookData to be displayed.
private  void setCenterComponent(Component comp)
          Make a new component reside in the center of this panel
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.


hyperlis

private List hyperlis
A list of all the HyperlinkListeners


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


book

private Book book
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


pnlView

private BookDataDisplay pnlView
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

Constructor Detail

TabbedBookDataDisplay

public TabbedBookDataDisplay()
Simple Constructor

Method Detail

init

private void init()
GUI creation


getComponent

public Component getComponent()
Description copied from interface: BookDataDisplay
Accessor for the Swing component

Specified by:
getComponent in interface BookDataDisplay

setBookData

public void setBookData(Book book,
                        Key newkey)
Description copied from interface: BookDataDisplay
Set the BookData to be displayed. The data to be displayed is specified as a book and key rather than the more obvious BookData (the result of reading a book 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:
book - The Book to read data from
newkey - The key to read from the given book

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

getBook

public Book getBook()
Description copied from interface: BookDataDisplay
Accessor for the Book used in the current display, or null if we are not displaying anything.

Specified by:
getBook in interface BookDataDisplay
Returns:
The current book

copy

public void copy()
Description copied from interface: BookDataDisplay
Copy the selection to the clipboard

Specified by:
copy in interface BookDataDisplay

addURLEventListener

public void addURLEventListener(URLEventListener listener)
Description copied from interface: BookDataDisplay
Add a listener for when someone clicks on a browser 'link'

Specified by:
addURLEventListener in interface BookDataDisplay
Parameters:
listener - The listener to add

removeURLEventListener

public void removeURLEventListener(URLEventListener listener)
Description copied from interface: BookDataDisplay
Remove a listener for when someone clicks on a browser 'link'

Specified by:
removeURLEventListener 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-2006