[jsword-svn] r1381 - in trunk: bibledesktop/src/main/java/org/crosswire/bibledesktop/book bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop bibledesktop/src/main/java/org/crosswire/bibledesktop/display bibledesktop/src/main/java/org/crosswire/bibledesktop/display/basic bibledesktop/src/main/java/org/crosswire/bibledesktop/passage jsword/src/main/java/org/crosswire/jsword/book jsword/src/main/java/org/crosswire/jsword/examples jsword-limbo/src/main/java/org/crosswire/bibledesktop/book jsword-limbo/src/main/java/org/crosswire/bibledesktop/display/jdtb jsword-limbo/src/main/java/org/crosswire/bibledesktop/reference jsword-limbo/src/main/java/org/crosswire/jsword/book/ser
dmsmith at www.crosswire.org
dmsmith at www.crosswire.org
Mon Jun 4 12:23:53 MST 2007
Author: dmsmith
Date: 2007-06-04 12:23:52 -0700 (Mon, 04 Jun 2007)
New Revision: 1381
Added:
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BookSelectEvent.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BookSelectListener.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/ParallelBookPicker.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/ParallelBookPicker.properties
Modified:
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleViewPane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectEvent.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/MultiBookPane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/DesktopActions.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/BookDataDisplay.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/ProxyBookDataDisplay.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/basic/SplitBookDataDisplay.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/basic/TabbedBookDataDisplay.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/basic/TextPaneBookDataDisplay.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/passage/KeySidebar.java
trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/book/CommentaryPane.java
trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/display/jdtb/JDTBBookDataDisplay.java
trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/reference/ReferencedPane.java
trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/ser/BookDataCache.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/BookData.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/Books.java
trunk/jsword/src/main/java/org/crosswire/jsword/examples/StrongsAnalysis.java
Log:
Added the user functionality to pick more than one Bible for parallel viewing.
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleViewPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleViewPane.java 2007-06-03 01:52:41 UTC (rev 1380)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleViewPane.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -69,7 +69,7 @@
{
listeners = new EventListenerList();
pnlSelect = new DisplaySelectPane();
- KeySidebar sidebar = new KeySidebar(pnlSelect.getBook());
+ KeySidebar sidebar = new KeySidebar(pnlSelect.getBooks());
BookDataDisplay display = new TabbedBookDataDisplay();
pnlPassg = new SplitBookDataDisplay(sidebar, display);
pnlPassg.showSidebar(showSidebar);
@@ -104,7 +104,7 @@
*/
public void bookChosen(DisplaySelectEvent ev)
{
- pnlPassg.setBookData(ev.getBook(), ev.getKey());
+ pnlPassg.setBookData(ev.getBooks(), ev.getKey());
}
});
@@ -299,11 +299,7 @@
*/
public final void setKey(Key key)
{
- pnlPassg.setBookData(pnlSelect.getBook(), key);
-// if (saved == null)
-// {
-// fireTitleChanged(new TitleChangedEvent(BibleViewPane.this, getTitle()));
-// }
+ pnlPassg.setBookData(pnlSelect.getBooks(), key);
}
/**
Added: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BookSelectEvent.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BookSelectEvent.java (rev 0)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BookSelectEvent.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -0,0 +1,66 @@
+/**
+ * Distribution License:
+ * BibleDesktop is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, version 2 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * The License is available on the internet at:
+ * http://www.gnu.org/copyleft/gpl.html
+ * or by writing to:
+ * Free Software Foundation, Inc.
+ * 59 Temple Place - Suite 330
+ * Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2007
+ * The copyright to this program is held by it's authors.
+ *
+ * ID: $Id$
+ */
+package org.crosswire.bibledesktop.book;
+
+import java.util.EventObject;
+
+import org.crosswire.jsword.book.Book;
+
+/**
+ * A BookSelectEvent happens whenever a user selects a book.
+ *
+ * @see gnu.gpl.License for license details.
+ * The copyright to this program is held by it's authors.
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
+public class BookSelectEvent extends EventObject
+{
+ /**
+ * For when a command has been made
+ * @param source The thing that started this off
+ * @param books The selected books
+ */
+ public BookSelectEvent(Object source, Book[] books)
+ {
+ super(source);
+ this.books = books;
+ }
+
+ /**
+ * Get the type of command
+ * @return The type of command
+ */
+ public Book[] getBooks()
+ {
+ return books;
+ }
+
+ /**
+ * The new list of Books
+ */
+ private transient Book[] books;
+
+ /**
+ * Serialization ID
+ */
+ private static final long serialVersionUID = 6018474028417993389L;
+}
Property changes on: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BookSelectEvent.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BookSelectListener.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BookSelectListener.java (rev 0)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BookSelectListener.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -0,0 +1,40 @@
+/**
+ * Distribution License:
+ * BibleDesktop is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, version 2 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * The License is available on the internet at:
+ * http://www.gnu.org/copyleft/gpl.html
+ * or by writing to:
+ * Free Software Foundation, Inc.
+ * 59 Temple Place - Suite 330
+ * Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2007
+ * The copyright to this program is held by it's authors.
+ *
+ * ID: $Id$
+ */
+package org.crosswire.bibledesktop.book;
+
+import java.util.EventListener;
+
+/**
+ * Implement BookSelectListener to recieve notification that the list of selected books has been updated.
+ *
+ * @see gnu.gpl.License for license details.
+ * The copyright to this program is held by it's authors.
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
+public interface BookSelectListener extends EventListener
+{
+ /**
+ * Notify that the list of Books has changed.
+ * @param ev Describes the change
+ */
+ void booksChosen(BookSelectEvent ev);
+}
Property changes on: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BookSelectListener.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectEvent.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectEvent.java 2007-06-03 01:52:41 UTC (rev 1380)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectEvent.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -41,12 +41,12 @@
* @param key The selected Key
* @param book The selected book
*/
- public DisplaySelectEvent(Object source, Key key, Book book)
+ public DisplaySelectEvent(Object source, Key key, Book[] books)
{
super(source);
this.key = key;
- this.book = book;
+ this.books = books;
}
/**
@@ -62,9 +62,9 @@
* Get the type of command
* @return The type of command
*/
- public Book getBook()
+ public Book[] getBooks()
{
- return book;
+ return books;
}
/**
@@ -75,7 +75,7 @@
/**
* The new Book
*/
- private transient Book book;
+ private transient Book[] books;
/**
* Serialization ID
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java 2007-06-03 01:52:41 UTC (rev 1380)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -26,10 +26,6 @@
import java.awt.Insets;
import java.awt.SystemColor;
import java.awt.Toolkit;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.awt.event.ItemEvent;
-import java.awt.event.ItemListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.io.IOException;
@@ -37,7 +33,6 @@
import javax.swing.ImageIcon;
import javax.swing.JButton;
-import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
@@ -75,7 +70,7 @@
* The copyright to this program is held by it's authors.
* @author Joe Walker [joe at eireneh dot com]
*/
-public class DisplaySelectPane extends JPanel implements KeyChangeListener
+public class DisplaySelectPane extends JPanel implements KeyChangeListener, BookSelectListener
{
/**
* General constructor
@@ -107,15 +102,13 @@
};
// search() and version() rely on this returning only Books indexed by verses
- mdlBible = new BooksComboBoxModel(BookFilters.getBibles(), BookComparators.getInitialComparator());
- JComboBox cboBible = new JComboBox(mdlBible);
- cboBible.setPrototypeDisplayValue(" "); //$NON-NLS-1$
- selected = mdlBible.getSelectedBook();
- if (selected != null)
+ ParallelBookPicker picker = new ParallelBookPicker(BookFilters.getBibles(), BookComparators.getInitialComparator());
+ picker.addBookListener(this);
+ selected = picker.getBooks();
+ if (selected.length > 0)
{
- selected.addIndexStatusListener(isl);
- cboBible.setToolTipText(selected.toString());
- key = selected.createEmptyKeyList();
+ selected[0].addIndexStatusListener(isl);
+ key = selected[0].createEmptyKeyList();
}
else
{
@@ -124,32 +117,10 @@
// But here we don't have a book yet.
key = new RocketPassage();
}
- cboBible.setRenderer(new BookListCellRenderer(true));
- cboBible.addItemListener(new ItemListener()
- {
- /* (non-Javadoc)
- * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
- */
- public void itemStateChanged(ItemEvent ev)
- {
- if (ev.getStateChange() == ItemEvent.SELECTED)
- {
- changeVersion();
- JComboBox combo = (JComboBox) ev.getSource();
- combo.setToolTipText(combo.getSelectedItem().toString());
- }
- }
- });
- cboBible.addActionListener(new SelectedActionListener());
+
JLabel lblBible = actions.createJLabel(BIBLE);
- lblBible.setLabelFor(cboBible);
+ lblBible.setLabelFor(picker);
- /* LATER(JOE):
- JButton btnMenu = new JButton();
- btnMenu.setIcon(ICON_MENU);
- btnMenu.setBorderPainted(false);
- */
-
JLabel lblKey = actions.createJLabel(VIEW_LABEL);
txtKey = new JTextField();
txtKey.setAction(actions.getAction(PASSAGE_FIELD));
@@ -192,7 +163,7 @@
this.setLayout(new GridBagLayout());
this.add(lblBible, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
- this.add(cboBible, new GridBagConstraints(2, 0, 4, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
+ this.add(picker, new GridBagConstraints(2, 0, 4, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
this.add(lblKey, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 5), 0, 0));
this.add(txtKey, new GridBagConstraints(2, 1, 2, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(2, 0, 1, 2), 0, 0));
@@ -210,9 +181,9 @@
}
/**
- * What is the currently selected Book?
+ * What are the currently selected Books?
*/
- public Book getBook()
+ public Book[] getBooks()
{
return selected;
}
@@ -222,7 +193,7 @@
*/
public void clear()
{
- setKey(selected == null ? new RocketPassage() : selected.createEmptyKeyList());
+ setKey(selected.length == 0 ? new RocketPassage() : selected[0].createEmptyKeyList());
setTitle(CLEAR);
}
@@ -295,7 +266,7 @@
DefaultSearchModifier modifier = new DefaultSearchModifier();
modifier.setRanked(rank);
- Key results = selected.find(new DefaultSearchRequest(param, modifier));
+ Key results = selected[0].find(new DefaultSearchRequest(param, modifier));
int total = results.getCardinality();
int partial = total;
@@ -378,7 +349,7 @@
return;
}
- IndexResolver.scheduleIndex(selected, this);
+ IndexResolver.scheduleIndex(selected[0], this);
enableComponents();
}
@@ -414,7 +385,7 @@
try
{
- setKey(selected.getKey(newKey));
+ setKey(selected[0].getKey(newKey));
}
catch (NoSuchKeyException e)
{
@@ -428,7 +399,7 @@
{
if (!key.isEmpty())
{
- key = selected.createEmptyKeyList();
+ key = selected[0].createEmptyKeyList();
txtKey.setText(""); //$NON-NLS-1$
txtSearch.setText(""); //$NON-NLS-1$
@@ -451,28 +422,6 @@
}
/**
- * Sets the default name
- */
-// public void setTitle(String title)
-// {
-// this.title = title;
-// }
-
-// /**
-// * Sets the default name
-// */
-// public void setText(String text)
-// {
-// String currentText = txtKey.getText();
-// if (!currentText.equals(text))
-// {
-// txtKey.setText(text);
-// setTitle(text);
-// updateDisplay();
-// }
-// }
-//
- /**
* Gets the number of verses that should be shown when a search result is
* ranked. A value of 0 means show all.
* @return Returns the numRankedVerses.
@@ -523,32 +472,6 @@
maxNumRankedVerses = count;
}
- /**
- * Someone changed the version combo
- */
- public final void changeVersion()
- {
- Book newSelected = mdlBible.getSelectedBook();
-
- if (selected != null && selected != newSelected)
- {
- selected.removeIndexStatusListener(isl);
- newSelected.addIndexStatusListener(isl);
- }
-
- selected = newSelected;
-
- enableComponents();
-
- if (selected == null)
- {
- noBookInstalled();
- return;
- }
-
- fireVersionChanged(new DisplaySelectEvent(this, key, selected));
- }
-
private void setTitle(int newMode)
{
mode = newMode;
@@ -591,8 +514,8 @@
/*private*/ final void enableComponents()
{
boolean readable = selected != null;
- boolean searchable = readable && selected.getIndexStatus().equals(IndexStatus.DONE);
- boolean indexable = readable && selected.getIndexStatus().equals(IndexStatus.UNDONE);
+ boolean searchable = readable && selected[0].getIndexStatus().equals(IndexStatus.DONE);
+ boolean indexable = readable && selected[0].getIndexStatus().equals(IndexStatus.UNDONE);
txtSearch.setEnabled(searchable);
txtSearch.setBackground(searchable ? SystemColor.text : SystemColor.control);
@@ -626,6 +549,35 @@
}
/* (non-Javadoc)
+ * @see org.crosswire.bibledesktop.book.BookSelectListener#booksChosen(org.crosswire.bibledesktop.book.BookSelectEvent)
+ */
+ public void booksChosen(BookSelectEvent ev)
+ {
+ Book[] books = ev.getBooks();
+ assert books.length > 0;
+
+ Book newSelected = books[0];
+
+ if (selected.length > 0 && selected[0] != newSelected)
+ {
+ selected[0].removeIndexStatusListener(isl);
+ newSelected.addIndexStatusListener(isl);
+ }
+
+ selected = books;
+
+ enableComponents();
+
+ if (selected == null)
+ {
+ noBookInstalled();
+ return;
+ }
+
+ fireVersionChanged(new DisplaySelectEvent(this, key, selected));
+ }
+
+ /* (non-Javadoc)
* @see org.crosswire.bibledesktop.book.KeyChangeListener#keyChanged(org.crosswire.bibledesktop.book.KeyChangeEvent)
*/
public void keyChanged(KeyChangeEvent ev)
@@ -749,24 +701,6 @@
is.defaultReadObject();
}
- /**
- *
- */
- static final class SelectedActionListener implements ActionListener
- {
- /* (non-Javadoc)
- * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
- */
- public void actionPerformed(ActionEvent e)
- {
- JComboBox cbo = (JComboBox) e.getSource();
- if (cbo.getSelectedIndex() == -1 && cbo.getItemCount() > 0)
- {
- cbo.setSelectedIndex(0);
- }
- }
- }
-
// For the Passage card
private static final String VIEW_LABEL = "ViewLabel"; //$NON-NLS-1$
private static final String PASSAGE_FIELD = "PassageAction"; //$NON-NLS-1$
@@ -798,12 +732,11 @@
private transient ActionFactory actions;
- private transient Book selected;
+ private transient Book[] selected;
/*
* GUI Components
*/
- private BooksComboBoxModel mdlBible;
private PassageSelectionPane dlgSelect;
private JTextField txtKey;
private JTextField txtSearch;
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/MultiBookPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/MultiBookPane.java 2007-06-03 01:52:41 UTC (rev 1380)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/MultiBookPane.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -122,10 +122,18 @@
}
/* (non-Javadoc)
- * @see org.crosswire.bibledesktop.display.BookDataDisplay#setBookData(org.crosswire.jsword.book.Book, org.crosswire.jsword.passage.Key)
+ * @see org.crosswire.bibledesktop.display.BookDataDisplay#clearBookData()
*/
- public void setBookData(Book book, Key key)
+ public void clearBookData()
{
+ setBookData(null, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.crosswire.bibledesktop.display.BookDataDisplay#setBookData(org.crosswire.jsword.book.Book[], org.crosswire.jsword.passage.Key)
+ */
+ public void setBookData(Book[] books, Key key)
+ {
throw new UnsupportedOperationException();
}
@@ -178,11 +186,11 @@
}
/* (non-Javadoc)
- * @see org.crosswire.bibledesktop.display.BookDataDisplay#getBook()
+ * @see org.crosswire.bibledesktop.display.BookDataDisplay#getBooks()
*/
- public Book getBook()
+ public Book[] getBooks()
{
- return book;
+ return new Book[] {book};
}
/**
@@ -378,7 +386,7 @@
}
}
// Make sure that the display is emtpy.
- display.setBookData(null, null);
+ display.clearBookData();
Object selected = bookList.getSelectedValue();
if (selected != null)
@@ -440,7 +448,7 @@
}
Verse verse = set.getVerse();
- display.setBookData(selectedBook, verse);
+ display.setBookData(new Book[] {selectedBook}, verse);
}
/**
@@ -451,7 +459,7 @@
Key key = (Key) dictionaryKeyList.getSelectedValue();
if (key != null)
{
- display.setBookData(book, key);
+ display.setBookData(new Book[] {book}, key);
}
}
@@ -467,7 +475,7 @@
KeyTreeNode node = (KeyTreeNode) path.getLastPathComponent();
if (node != null)
{
- display.setBookData(book, node.getKey());
+ display.setBookData(new Book[] {book}, node.getKey());
}
}
Added: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/ParallelBookPicker.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/ParallelBookPicker.java (rev 0)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/ParallelBookPicker.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -0,0 +1,314 @@
+/**
+ * Distribution License:
+ * BibleDesktop is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, version 2 as published by
+ * the Free Software Foundation. This program is distributed in the hope
+ * that it will be useful, but WITHOUT ANY WARRANTY; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * The License is available on the internet at:
+ * http://www.gnu.org/copyleft/gpl.html
+ * or by writing to:
+ * Free Software Foundation, Inc.
+ * 59 Temple Place - Suite 330
+ * Boston, MA 02111-1307, USA
+ *
+ * Copyright: 2005
+ * The copyright to this program is held by it's authors.
+ *
+ * ID: $Id$
+ */
+package org.crosswire.bibledesktop.book;
+
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JPanel;
+import javax.swing.event.EventListenerList;
+
+import org.crosswire.common.swing.ActionFactory;
+import org.crosswire.common.swing.GuiUtil;
+import org.crosswire.jsword.book.Book;
+import org.crosswire.jsword.book.BookFilter;
+
+/**
+ * A picker of more than one book at a time.
+ *
+ * @see gnu.gpl.License for license details.
+ * The copyright to this program is held by it's authors.
+ * @author DM Smith [dmsmith555 at yahoo dot com]
+ */
+public class ParallelBookPicker extends JPanel
+{
+
+ /**
+ * General constructor
+ * @param filter the kinds of books to pick.
+ * @param comparator the order to put the books in
+ */
+ public ParallelBookPicker(BookFilter filter, Comparator comparator)
+ {
+ this.filter = filter;
+ this.comparator = comparator;
+ initialize();
+ }
+
+ /**
+ * Initialize the GUI
+ */
+ private void initialize()
+ {
+ selected = new ArrayList();
+ listeners = new EventListenerList();
+ actions = new ActionFactory(ParallelBookPicker.class, this);
+
+
+ // Add the first picker
+ doAddPicker();
+ doAddPicker();
+ }
+
+ /**
+ * Add an new picker.
+ */
+ public void doAddPicker()
+ {
+ JPanel pickerPanel = new JPanel();
+
+ int currentPickerCount = getComponentCount();
+
+ // If there is more than one picker, then we need to remove the buttons from the
+ // previous one, since we only want the last one to have the buttons.
+ Container lastPanel = null;
+ if (currentPickerCount > 0)
+ {
+ Component last = getComponent(currentPickerCount - 1);
+ if (last instanceof Container)
+ {
+ lastPanel = (Container) last;
+ }
+ }
+
+ BooksComboBoxModel mdlBook = new BooksComboBoxModel(filter, comparator);
+ JComboBox cboBook = new JComboBox(mdlBook);
+ cboBook.setRenderer(new BookListCellRenderer(true));
+ cboBook.addItemListener(new SelectedItemListener(currentPickerCount));
+ cboBook.addActionListener(new SelectedActionListener());
+ pickerPanel.add(cboBook);
+ add(pickerPanel);
+ currentPickerCount++;
+
+ // Before adding, we make sure that the previous entry's buttons are removed.
+ if (currentPickerCount > 1)
+ {
+ while (lastPanel.getComponentCount() > 1)
+ {
+ lastPanel.remove(1);
+ }
+ }
+
+ addButtons(pickerPanel, currentPickerCount);
+
+ Book book = mdlBook.getSelectedBook();
+ selected.add(book);
+ if (book != null)
+ {
+ cboBook.setToolTipText(book.getName());
+ }
+
+ GuiUtil.refresh(this);
+ }
+
+ /**
+ * Remove the last picker provided that there will be one that remains.
+ */
+ public void doRemovePicker()
+ {
+ int size = getComponentCount();
+ if (size > 1)
+ {
+ remove(size - 1);
+ size = getComponentCount();
+ Component comp = getComponent(size - 1);
+ if (comp instanceof JPanel)
+ {
+ addButtons((JPanel) comp, size - 1);
+ }
+ GuiUtil.refresh(this);
+ }
+
+ }
+
+ /**
+ * What are the currently selected Books?
+ */
+ public Book[] getBooks()
+ {
+ return (Book[]) selected.toArray(new Book[selected.size()]);
+ }
+
+ /**
+ * Add a BookSelectListener listener
+ */
+ public synchronized void addBookListener(BookSelectListener li)
+ {
+ listeners.add(BookSelectListener.class, li);
+ }
+
+ /**
+ * Remove a BookSelectListener listener
+ */
+ public synchronized void removeBookListener(BookSelectListener li)
+ {
+ listeners.remove(BookSelectListener.class, li);
+ }
+
+ /**
+ * Inform the version listeners
+ */
+ protected void fireBooksChosen(BookSelectEvent ev)
+ {
+ // Guaranteed to return a non-null array
+ Object[] contents = listeners.getListenerList();
+
+ // Process the listeners last to first, notifying
+ // those that are interested in this event
+ for (int i = contents.length - 2; i >= 0; i -= 2)
+ {
+ if (contents[i] == BookSelectListener.class)
+ {
+ ((BookSelectListener) contents[i + 1]).booksChosen(ev);
+ }
+ }
+ }
+
+ private void addButtons(JPanel pickerPanel, int currentPickerCount)
+ {
+ // If there are more than one picker, we allow a user to remove a picker
+ if (currentPickerCount > 0)
+ {
+ pickerPanel.add(new JButton(actions.getAction("RemovePicker"))); //$NON-NLS-1$
+ }
+
+ // Only allow the user to add a certain amount of pickers.
+ if (currentPickerCount < MAX_PICKERS)
+ {
+ pickerPanel.add(new JButton(actions.getAction("AddPicker"))); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * Serialization support.
+ *
+ * @param is
+ * @throws IOException
+ * @throws ClassNotFoundException
+ */
+ private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
+ {
+ // We don't serialize views
+ selected = null;
+
+ listeners = new EventListenerList();
+
+ is.defaultReadObject();
+ }
+
+ /**
+ * An ItemListener for a particular combo box that tracks it's selected item.
+ */
+ final class SelectedItemListener implements ItemListener
+ {
+ /**
+ * Track the selected item in the combo box indicated by index.
+ * @param index
+ */
+ public SelectedItemListener(int index)
+ {
+ this.index = index;
+ }
+
+ /* (non-Javadoc)
+ * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+ */
+ public void itemStateChanged(ItemEvent ev)
+ {
+ if (ev.getStateChange() == ItemEvent.SELECTED)
+ {
+ JComboBox combo = (JComboBox) ev.getSource();
+
+ selected.set(index, combo.getSelectedItem());
+
+ fireBooksChosen(new BookSelectEvent(this, getBooks()));
+ combo.setToolTipText(selected.toString());
+ }
+ }
+
+ private int index;
+ }
+
+ /**
+ * Ensures that something is always selected.
+ */
+ static final class SelectedActionListener implements ActionListener
+ {
+ /* (non-Javadoc)
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ */
+ public void actionPerformed(ActionEvent e)
+ {
+ JComboBox cbo = (JComboBox) e.getSource();
+ if (cbo.getSelectedIndex() == -1 && cbo.getItemCount() > 0)
+ {
+ cbo.setSelectedIndex(0);
+ }
+ }
+ }
+
+ /**
+ * The filter to apply
+ */
+ private BookFilter filter;
+
+ /**
+ * The comparator to order the books.
+ */
+ private Comparator comparator;
+
+ /**
+ * The selected items in each combo.
+ */
+ protected transient List selected;
+
+ /**
+ * Allow for adding and removing pickers.
+ */
+ private ActionFactory actions;
+
+ /**
+ * Who is interested in things this DisplaySelectPane does
+ */
+ private transient EventListenerList listeners;
+
+ /**
+ * What is the default maximum number of pickers.
+ */
+ private static final int MAX_PICKERS = 5;
+
+ /**
+ * Serialization ID
+ */
+ private static final long serialVersionUID = 1633401996774729671L;
+}
Property changes on: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/ParallelBookPicker.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Added: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/ParallelBookPicker.properties
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/ParallelBookPicker.properties (rev 0)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/ParallelBookPicker.properties 2007-06-04 19:23:52 UTC (rev 1381)
@@ -0,0 +1,19 @@
+AddPicker.Enabled=true
+AddPicker.Name=+
+AddPicker.ShortDescription=Add a parallel Bible
+AddPicker.LongDescription=Add a parallel Bible.
+AddPicker.SmallIcon=
+AddPicker.LargeIcon=
+AddPicker.MnemonicKey=
+AddPicker.AcceleratorKey=
+AddPicker.AcceleratorKey.Modifiers=
+
+RemovePicker.Enabled=true
+RemovePicker.Name=-
+RemovePicker.ShortDescription=Remove a parallel Bible
+RemovePicker.LongDescription=Remove a parallel Bible.
+RemovePicker.SmallIcon=
+RemovePicker.LargeIcon=
+RemovePicker.MnemonicKey=
+RemovePicker.AcceleratorKey=
+RemovePicker.AcceleratorKey.Modifiers=
Property changes on: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/ParallelBookPicker.properties
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java 2007-06-03 01:52:41 UTC (rev 1380)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -626,10 +626,10 @@
clearView = view;
continue;
}
- Book book = view.getSelectPane().getBook();
- if (book != null)
+ Book[] books = view.getSelectPane().getBooks();
+ if (books.length > 0)
{
- Key key = book.getKey(data);
+ Key key = books[0].getKey(data);
String dataPassage = key.getName();
if (view.getTitle().equals(dataPassage))
{
@@ -654,11 +654,11 @@
// Do we have an empty view we can use?
if (clearView != null)
{
- Book book = clearView.getSelectPane().getBook();
- if (book != null)
+ Book[] books = clearView.getSelectPane().getBooks();
+ if (books.length > 0)
{
- Key key = book.getKey(data);
- clearView.setKey(book.createEmptyKeyList()); // force it to be a clear view, if it is not really.
+ Key key = books[0].getKey(data);
+ clearView.setKey(books[0].createEmptyKeyList()); // force it to be a clear view, if it is not really.
clearView.setKey(key);
views.select(clearView);
}
@@ -669,10 +669,10 @@
// and load it up.
BibleViewPane view = (BibleViewPane) views.addView();
- Book book = view.getSelectPane().getBook();
- if (book != null)
+ Book[] books = view.getSelectPane().getBooks();
+ if (books.length > 0)
{
- Key key = book.getKey(data);
+ Key key = books[0].getKey(data);
view.setKey(key);
}
}
@@ -682,7 +682,8 @@
if (book != null && Books.installed().getBook(book.getName()) != null)
{
reference.selectBook(book);
- Key key = reference.getBook().getKey(data);
+ Book[] books = reference.getBooks();
+ Key key = books[0].getKey(data);
reference.setKey(key);
}
}
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/DesktopActions.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/DesktopActions.java 2007-06-03 01:52:41 UTC (rev 1380)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/DesktopActions.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -394,9 +394,9 @@
return;
}
- Book book = da.getBook();
+ Book[] books = da.getBooks();
- ViewSourcePane viewer = new ViewSourcePane(book, key);
+ ViewSourcePane viewer = new ViewSourcePane(books[0], key);
viewer.showInFrame(getDesktop());
}
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/BookDataDisplay.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/BookDataDisplay.java 2007-06-03 01:52:41 UTC (rev 1380)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/BookDataDisplay.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -58,15 +58,20 @@
Component getComponent();
/**
+ * Clear any BookData that is displayed.
+ */
+ void clearBookData();
+
+ /**
* 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.
- * @param book The Book to read data from
+ * @param books The Books to read data from
* @param key The key to read from the given book
*/
- void setBookData(Book book, Key key);
+ void setBookData(Book[] books, Key key);
/**
* Cause the BookData to be re-displayed.
@@ -81,9 +86,9 @@
Key getKey();
/**
- * Accessor for the Book used in the current display, or null if we are not
+ * Accessor for the Books used in the current display, or null if we are not
* displaying anything.
- * @return The current book
+ * @return The current books
*/
- Book getBook();
+ Book[] getBooks();
}
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/ProxyBookDataDisplay.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/ProxyBookDataDisplay.java 2007-06-03 01:52:41 UTC (rev 1380)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/ProxyBookDataDisplay.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -87,15 +87,23 @@
return proxy.getComponent();
}
- /*
- * @see org.crosswire.bibledesktop.display.BookDataDisplay#setBookData(Book, Key)
+ /* (non-Javadoc)
+ * @see org.crosswire.bibledesktop.display.BookDataDisplay#clearBookData()
*/
- public void setBookData(Book book, Key key)
+ public void clearBookData()
{
- proxy.setBookData(book, key);
+ setBookData(null, null);
}
/* (non-Javadoc)
+ * @see org.crosswire.bibledesktop.display.BookDataDisplay#setBookData(org.crosswire.jsword.book.Book[], org.crosswire.jsword.passage.Key)
+ */
+ public void setBookData(Book[] books, Key key)
+ {
+ proxy.setBookData(books, key);
+ }
+
+ /* (non-Javadoc)
* @see org.crosswire.bibledesktop.display.BookDataDisplay#refresh()
*/
public void refresh()
@@ -121,11 +129,11 @@
}
/* (non-Javadoc)
- * @see org.crosswire.bibledesktop.display.BookDataDisplay#getBook()
+ * @see org.crosswire.bibledesktop.display.BookDataDisplay#getBooks()
*/
- public Book getBook()
+ public Book[] getBooks()
{
- return getProxy().getBook();
+ return getProxy().getBooks();
}
/**
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/basic/SplitBookDataDisplay.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/basic/SplitBookDataDisplay.java 2007-06-03 01:52:41 UTC (rev 1380)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/basic/SplitBookDataDisplay.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -95,12 +95,12 @@
/* (non-Javadoc)
* @see org.crosswire.bibledesktop.display.BookDataDisplay#setBookData(org.crosswire.jsword.book.Book, org.crosswire.jsword.passage.Key)
*/
- public void setBookData(Book book, Key key)
+ public void setBookData(Book[] books, Key key)
{
boolean keyChanged = this.key == null || !this.key.equals(key);
- boolean bookChanged = this.book == null || !this.book.equals(book);
+ boolean bookChanged = this.books == null || !this.books.equals(books);
- this.book = book;
+ this.books = books;
this.key = key;
// Only set the passage if it has changed
@@ -114,9 +114,9 @@
{
if (bookChanged)
{
- log.debug("new bible chosen: " + book); //$NON-NLS-1$
+ log.debug("new bible chosen: " + books); //$NON-NLS-1$
}
- child.setBookData(book, key);
+ child.setBookData(books, key);
}
}
@@ -156,9 +156,9 @@
/**
* @return the book
*/
- public Book getBook()
+ public Book[] getBooks()
{
- return book;
+ return books;
}
/**
@@ -229,9 +229,9 @@
private transient List keyChangeListeners;
/**
- * What book are we currently viewing?
+ * What books are we currently viewing?
*/
- private transient Book book;
+ private transient Book[] books;
/**
* The log stream
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/basic/TabbedBookDataDisplay.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/basic/TabbedBookDataDisplay.java 2007-06-03 01:52:41 UTC (rev 1380)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/basic/TabbedBookDataDisplay.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -105,11 +105,19 @@
}
/* (non-Javadoc)
+ * @see org.crosswire.bibledesktop.display.BookDataDisplay#clearBookData()
+ */
+ public void clearBookData()
+ {
+ setBookData(null, null);
+ }
+
+ /* (non-Javadoc)
* @see org.crosswire.bibledesktop.display.BookDataDisplay#setBookData(org.crosswire.jsword.book.Book, org.crosswire.jsword.passage.Key)
*/
- public void setBookData(Book book, Key newkey)
+ public void setBookData(Book[] books, Key newkey)
{
- this.book = book;
+ this.books = books;
this.key = KeyUtil.getPassage(newkey);
// Tabbed view or not we should clear out the old tabs
@@ -146,7 +154,7 @@
// Create the first tab
BookDataDisplay pnlNew = createInnerDisplayPane();
- pnlNew.setBookData(book, first);
+ pnlNew.setBookData(books, first);
Component display = pnlNew.getComponent();
views.put(display, pnlNew);
@@ -158,7 +166,7 @@
}
else
{
- pnlView.setBookData(book, key);
+ pnlView.setBookData(books, key);
setCenterComponent(pnlView.getComponent());
}
@@ -194,9 +202,9 @@
/* (non-Javadoc)
* @see org.crosswire.bibledesktop.display.BookDataDisplay#getBook()
*/
- public Book getBook()
+ public Book[] getBooks()
{
- return book;
+ return books;
}
/* (non-Javadoc)
@@ -297,7 +305,7 @@
// Create a new tab
BookDataDisplay pnlNew = createInnerDisplayPane();
- pnlNew.setBookData(book, next);
+ pnlNew.setBookData(books, next);
Component display = pnlNew.getComponent();
views.put(display, pnlNew);
@@ -411,7 +419,7 @@
/**
* The version used for display
*/
- private Book book;
+ private Book[] books;
/**
* Are we using tabs?
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/basic/TextPaneBookDataDisplay.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/basic/TextPaneBookDataDisplay.java 2007-06-03 01:52:41 UTC (rev 1380)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/display/basic/TextPaneBookDataDisplay.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -85,11 +85,19 @@
}
/* (non-Javadoc)
- * @see org.crosswire.bibledesktop.display.BookDataDisplay#setBookData(org.crosswire.jsword.book.Book, org.crosswire.jsword.passage.Key)
+ * @see org.crosswire.bibledesktop.display.BookDataDisplay#clearBookData()
*/
- public void setBookData(Book book, Key key)
+ public void clearBookData()
{
- this.book = book;
+ setBookData(null, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.crosswire.bibledesktop.display.BookDataDisplay#setBookData(org.crosswire.jsword.book.Book[], org.crosswire.jsword.passage.Key)
+ */
+ public void setBookData(Book[] books, Key key)
+ {
+ this.books = books;
this.key = key;
refresh();
@@ -100,14 +108,14 @@
*/
public void refresh()
{
- if (book == null || key == null)
+ if (books == null || books.length == 0 || books[0] == null || key == null)
{
txtView.setText(""); //$NON-NLS-1$
return;
}
// Make sure Hebrew displays from Right to Left
- BookMetaData bmd = book.getBookMetaData();
+ BookMetaData bmd = books[0].getBookMetaData();
if (bmd == null)
{
txtView.setText(""); //$NON-NLS-1$
@@ -119,7 +127,7 @@
try
{
- BookData bdata = new BookData(book, key);
+ BookData bdata = new BookData(books, key);
SAXEventProvider osissep = bdata.getSAXEventProvider();
TransformingSAXEventProvider htmlsep = (TransformingSAXEventProvider) converter.convert(osissep);
@@ -146,7 +154,7 @@
* It appears that it is a line too long issue.
*/
/* Apply the fix if the text is too long and we are not Java 1.5 or greater */
- if (text.length() > 32768 && BookCategory.GENERAL_BOOK.equals(book.getBookCategory()))
+ if (text.length() > 32768 && BookCategory.GENERAL_BOOK.equals(books[0].getBookCategory()))
{
String javaVersion = System.getProperty("java.specification.version"); //$NON-NLS-1$
if (javaVersion == null || "1.5".compareTo(javaVersion) > 0) //$NON-NLS-1$
@@ -395,9 +403,9 @@
/* (non-Javadoc)
* @see org.crosswire.bibledesktop.display.BookDataDisplay#getBook()
*/
- public Book getBook()
+ public Book[] getBooks()
{
- return book;
+ return books;
}
// Strings for hyperlinks
@@ -412,9 +420,9 @@
protected static final Logger log = Logger.getLogger(TextPaneBookDataDisplay.class);
/**
- * The current book
+ * The current books
*/
- private Book book;
+ private Book[] books;
/**
* The current key
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/passage/KeySidebar.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/passage/KeySidebar.java 2007-06-03 01:52:41 UTC (rev 1380)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/passage/KeySidebar.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -59,9 +59,9 @@
/**
* Initialize the SplitBookDataDisplay
*/
- public KeySidebar(Book book)
+ public KeySidebar(Book[] books)
{
- this.book = book;
+ this.books = books;
init();
setActive();
}
@@ -264,7 +264,7 @@
if (selected.length > 0)
{
- partial = book.createEmptyKeyList();
+ partial = books[0].createEmptyKeyList();
for (int i = 0; i < selected.length; i++)
{
@@ -309,7 +309,7 @@
*/
public void bookChosen(DisplaySelectEvent ev)
{
- book = ev.getBook();
+ books = ev.getBooks();
}
/* (non-Javadoc)
@@ -384,9 +384,9 @@
private Key partial;
/**
- * The book who's keys we are looking at
+ * The books who's keys we are looking at
*/
- private transient Book book;
+ private transient Book[] books;
/**
* The listener for KeyChangeEvents
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/BookData.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/BookData.java 2007-06-03 01:52:41 UTC (rev 1380)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/BookData.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -59,21 +59,8 @@
this.key = key;
- Book defaultBible = Defaults.getBible();
- if (defaultBible != null
- && BookCategory.BIBLE.equals(book.getBookCategory())
- && !defaultBible.equals(book)
- )
- {
- books = new Book[2];
- books[0] = defaultBible;
- books[1] = book;
- }
- else
- {
- books = new Book[1];
- books[0] = book;
- }
+ books = new Book[1];
+ books[0] = book;
}
/**
@@ -106,7 +93,7 @@
}
/**
- * Check that a BibleData is valid.
+ * Check that a BookData is valid.
* Currently, this does nothing, and isn't used. it was broken when we used
* JAXB, however it wasn't much use then becuase JAXB did a lot to keep the
* document valid anyway. Under JDOM there is more point, but I don't think
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/Books.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/Books.java 2007-06-03 01:52:41 UTC (rev 1380)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/Books.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -194,7 +194,7 @@
}
/**
- * Add a Bible to the current list of Books.
+ * Add a Book to the current list of Books.
* This method should only be called by BibleDrivers, it is not a method for
* general consumption.
*/
@@ -207,7 +207,7 @@
}
/**
- * Remove a Bible from the current list of Books.
+ * Remove a Book from the current list of Books.
* This method should only be called by BibleDrivers, it is not a method for
* general consumption.
*/
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/examples/StrongsAnalysis.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/examples/StrongsAnalysis.java 2007-06-03 01:52:41 UTC (rev 1380)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/examples/StrongsAnalysis.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -12,7 +12,6 @@
import org.crosswire.jsword.book.BookException;
import org.crosswire.jsword.book.BookFilters;
import org.crosswire.jsword.book.Books;
-import org.crosswire.jsword.book.Defaults;
import org.crosswire.jsword.book.FeatureType;
import org.crosswire.jsword.book.OSISUtil;
import org.crosswire.jsword.book.study.StrongsMapSet;
Modified: trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/book/CommentaryPane.java
===================================================================
--- trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/book/CommentaryPane.java 2007-06-03 01:52:41 UTC (rev 1380)
+++ trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/book/CommentaryPane.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -130,7 +130,7 @@
try
{
Verse verse = set.getVerse();
- display.setBookData(book, verse);
+ display.setBookData(new Book[] {book}, verse);
}
catch (Exception ex)
{
@@ -155,18 +155,32 @@
}
/* (non-Javadoc)
- * @see org.crosswire.bibledesktop.display.BookDataDisplay#getBook()
+ * @see org.crosswire.bibledesktop.display.BookDataDisplay#getBooks()
*/
- public Book getBook()
+ public Book[] getBooks()
{
- return (Book) cboComments.getSelectedItem();
+ return new Book[] {(Book) cboComments.getSelectedItem()};
}
/* (non-Javadoc)
- * @see org.crosswire.bibledesktop.display.BookDataDisplay#setBookData(org.crosswire.jsword.book.Book, org.crosswire.jsword.passage.Key)
+ * @see org.crosswire.bibledesktop.display.BookDataDisplay#clearBookData()
*/
- public void setBookData(Book book, Key key)
+ public void clearBookData()
{
+ setBookData(null, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.crosswire.bibledesktop.display.BookDataDisplay#setBookData(org.crosswire.jsword.book.Book[], org.crosswire.jsword.passage.Key)
+ */
+ public void setBookData(Book[] books, Key key)
+ {
+ Book book = null;
+ if (books != null && books.length > 0)
+ {
+ book = books[0];
+ }
+
cboComments.setSelectedItem(book);
setKey(key);
Modified: trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/display/jdtb/JDTBBookDataDisplay.java
===================================================================
--- trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/display/jdtb/JDTBBookDataDisplay.java 2007-06-03 01:52:41 UTC (rev 1380)
+++ trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/display/jdtb/JDTBBookDataDisplay.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -56,11 +56,24 @@
}
/* (non-Javadoc)
- * @see org.crosswire.bibledesktop.display.BookDataDisplay#setBookData(org.crosswire.jsword.book.Book, org.crosswire.jsword.passage.Key)
+ * @see org.crosswire.bibledesktop.display.BookDataDisplay#clearBookData()
*/
- public void setBookData(Book book, Key key)
+ public void clearBookData()
{
- this.book = book;
+ setBookData(null, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.crosswire.bibledesktop.display.BookDataDisplay#setBookData(org.crosswire.jsword.book.Book[], org.crosswire.jsword.passage.Key)
+ */
+ public void setBookData(Book[] books, Key key)
+ {
+ this.book = null;
+ if (books != null && books.length > 0)
+ {
+ this.book = books[0];
+ }
+
this.key = key;
refresh();
@@ -148,25 +161,20 @@
}
/* (non-Javadoc)
- * @see org.crosswire.bibledesktop.display.BookDataDisplay#getBook()
+ * @see org.crosswire.bibledesktop.display.BookDataDisplay#getBooks()
*/
- public Book getBook()
+ public Book[] getBooks()
{
- return book;
+ return new Book[] {book};
}
/**
* The current book
*/
- private Book book = null;
+ private Book book;
/**
* The current key
*/
- private Key key = null;
-
- /**
- * The display component
- */
-// private WebBrowser txtView;
+ private Key key;
}
\ No newline at end of file
Modified: trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/reference/ReferencedPane.java
===================================================================
--- trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/reference/ReferencedPane.java 2007-06-03 01:52:41 UTC (rev 1380)
+++ trunk/jsword-limbo/src/main/java/org/crosswire/bibledesktop/reference/ReferencedPane.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -131,14 +131,22 @@
}
/* (non-Javadoc)
- * @see org.crosswire.bibledesktop.display.BookDataDisplay#setBookData(org.crosswire.jsword.book.Book, org.crosswire.jsword.passage.Key)
+ * @see org.crosswire.bibledesktop.display.BookDataDisplay#clearBookData()
*/
- public void setBookData(Book book, Key key)
+ public void clearBookData()
{
- throw new UnsupportedOperationException();
+ setBookData(null, null);
}
/* (non-Javadoc)
+ * @see org.crosswire.bibledesktop.display.BookDataDisplay#setBookData(org.crosswire.jsword.book.Book[], org.crosswire.jsword.passage.Key)
+ */
+ public void setBookData(Book[] books, Key key)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ /* (non-Javadoc)
* @see org.crosswire.bibledesktop.display.BookDataDisplay#refresh()
*/
public void refresh()
@@ -178,11 +186,11 @@
}
/* (non-Javadoc)
- * @see org.crosswire.bibledesktop.display.BookDataDisplay#getBook()
+ * @see org.crosswire.bibledesktop.display.BookDataDisplay#getBooks()
*/
- public Book getBook()
+ public Book[] getBooks()
{
- return book;
+ return new Book[] {book};
}
/* (non-Javadoc)
@@ -282,7 +290,7 @@
Key key = getKey();
if (key != null)
{
- txtDisplay.setBookData(book, key);
+ txtDisplay.setBookData(new Book[] {book}, key);
}
}
catch (Exception ex)
Modified: trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/ser/BookDataCache.java
===================================================================
--- trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/ser/BookDataCache.java 2007-06-03 01:52:41 UTC (rev 1380)
+++ trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/ser/BookDataCache.java 2007-06-04 19:23:52 UTC (rev 1381)
@@ -43,7 +43,7 @@
import org.crosswire.jsword.versification.BibleInfo;
/**
- * A cache of BibleData that can be shared amongst Bibles.
+ * A cache of BookData that can be shared amongst Books.
*
* @see gnu.lgpl.License for license details.
* The copyright to this program is held by it's authors.
More information about the jsword-svn
mailing list