public class TabbedBookDataDisplay extends Object implements BookDataDisplay
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.
for license details.| 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
|
COMPARE_BOOKS| Constructor and Description |
|---|
TabbedBookDataDisplay()
Simple Constructor
|
| 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
|
private static final int TITLE_LENGTH
private static int pageSize
private List<URIEventListener> uriEventListeners
private List<KeyChangeListener> keyEventListeners
private org.crosswire.jsword.passage.Passage key
private org.crosswire.jsword.passage.Passage waiting
private org.crosswire.jsword.book.Book[] books
private boolean tabs
private JTabbedPane tabMain
private BookDataDisplay bookDataDisplay
private Map<JScrollPane,BookDataDisplay> views
private List<BookDataDisplay> displays
private Component center
private JPanel pnlMore
private JPanel pnlMain
private JScrollPane scrMain
public Component getComponent()
BookDataDisplaygetComponent in interface BookDataDisplaypublic void clearBookData()
BookDataDisplaysetBookData(null, null).clearBookData in interface BookDataDisplaypublic void setBookData(org.crosswire.jsword.book.Book[] books,
org.crosswire.jsword.passage.Key newkey)
BookDataDisplaysetBookData in interface BookDataDisplaybooks - The Books to read data fromnewkey - The key to read from the given bookpublic void setCompareBooks(boolean compare)
BookDataDisplaysetCompareBooks in interface BookDataDisplaypublic void refresh()
BookDataDisplayrefresh in interface BookDataDisplaypublic org.crosswire.jsword.passage.Key getKey()
BookDataDisplaygetKey in interface BookDataDisplaypublic org.crosswire.jsword.book.Book[] getBooks()
getBooks in interface org.crosswire.jsword.book.BookProviderpublic org.crosswire.jsword.book.Book getFirstBook()
getFirstBook in interface org.crosswire.jsword.book.BookProviderpublic void copy()
BookDataDisplaycopy in interface BookDataDisplaypublic void addKeyChangeListener(KeyChangeListener listener)
BookDataDisplayaddKeyChangeListener in interface BookDataDisplaypublic void removeKeyChangeListener(KeyChangeListener listener)
BookDataDisplayremoveKeyChangeListener in interface BookDataDisplaypublic void propertyChange(PropertyChangeEvent evt)
propertyChange in interface PropertyChangeListenerpublic void addURIEventListener(URIEventListener listener)
BookDataDisplayaddURIEventListener in interface BookDataDisplaylistener - The listener to addpublic void removeURIEventListener(URIEventListener listener)
BookDataDisplayremoveURIEventListener in interface BookDataDisplaylistener - The listener to removeprivate void setCenterComponent(Component comp)
final void tabChanged()
public BookDataDisplay getInnerDisplayPane()
private BookDataDisplay createInnerDisplayPane()
public static void setPageSize(int pageSize)
public static int getPageSize()
private static String getTabName(org.crosswire.jsword.passage.Key key)
key - The key to get a short name from