[jsword-svn] r1744 - in trunk: bibledesktop/src/main/java/org/crosswire/bibledesktop/book bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop common/src/main/java/org/crosswire/common/config jsword/src/main/java/org/crosswire/jsword/book
dmsmith at www.crosswire.org
dmsmith at www.crosswire.org
Sat Feb 2 09:31:37 MST 2008
Author: dmsmith
Date: 2008-02-02 09:31:33 -0700 (Sat, 02 Feb 2008)
New Revision: 1744
Modified:
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleViewPane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java
trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java
trunk/common/src/main/java/org/crosswire/common/config/Config.java
trunk/jsword/src/main/java/org/crosswire/jsword/book/Defaults.java
Log:
Make BD show what the quick picker has selected at start up.
Fix a config bug.
Improve comments.
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleViewPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleViewPane.java 2008-02-02 15:48:16 UTC (rev 1743)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BibleViewPane.java 2008-02-02 16:31:33 UTC (rev 1744)
@@ -80,6 +80,9 @@
pnlSelect.addTitleChangedListener(this);
pnlPassg.addKeyChangeListener(sidebar);
init();
+
+ // Display the text initial book/verse selection
+ pnlSelect.doInitialTextDisplay();
}
/**
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java 2008-02-02 15:48:16 UTC (rev 1743)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java 2008-02-02 16:31:33 UTC (rev 1744)
@@ -130,7 +130,7 @@
JComboBox cboBooks = new JComboBox();
JComboBox cboChaps = new JComboBox();
- BibleComboBoxModelSet quickSet = new BibleComboBoxModelSet(cboBooks, cboChaps, null);
+ quickSet = new BibleComboBoxModelSet(cboBooks, cboChaps, null);
quickSet.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent ev)
@@ -213,7 +213,30 @@
enableComponents();
GuiUtil.applyDefaultOrientation(this);
+
}
+
+ /**
+ * During view creation, allow firing off an event to display the initial book/chapter.
+ * This is copied from quickSet.addActionListener().
+ */
+ public void doInitialTextDisplay()
+ {
+ Verse start = quickSet.getVerse();
+ int book = start.getBook();
+ int chapter = start.getChapter();
+ try
+ {
+ VerseRange range = new VerseRange(start, new Verse(book, chapter, BibleInfo.versesInChapter(book, chapter)));
+ txtSearch.setText(""); //$NON-NLS-1$
+ txtKey.setText(range.getName());
+ doGoPassage();
+ }
+ catch (NoSuchVerseException ex)
+ {
+ assert false : ex;
+ }
+ }
/**
* What are the currently selected Books?
@@ -784,6 +807,7 @@
/*
* GUI Components
*/
+ private BibleComboBoxModelSet quickSet;
private PassageSelectionPane dlgSelect;
private ParallelBookPicker biblePicker;
protected JTextField txtKey;
Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java 2008-02-02 15:48:16 UTC (rev 1743)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java 2008-02-02 16:31:33 UTC (rev 1744)
@@ -153,14 +153,13 @@
// The first thing that has to be done is to set the locale.
Translations.instance().setLocale();
- // Load the configuration.
+ // Load the configuration. And create the lists of installed books.
// This has to be done before any gui components are created
// (Including the splash).
// This includes code that is invoked by it.
// This has to be done after setting the locale.
generateConfig();
-
// Make this be the root frame of optiondialogs
JOptionPane.setRootFrame(this);
@@ -170,20 +169,22 @@
// Splash screen
URI predictURI = PROJECT.getWritablePropertiesURI(SPLASH_PROPS);
Progress startJob = JobManager.createJob(Msg.STARTUP_TITLE.toString(), predictURI, true);
-
//startJob.setProgress(Msg.STARTUP_CONFIG.toString());
// Create the Desktop Actions
actions = new DesktopActions(this);
+ // Create the GUI components
startJob.setSectionName(Msg.STARTUP_GENERATE.toString());
createComponents();
- // Configuration
+ // If necessary, make changes to the UI to help with debugging
+ debug();
+
+ // Create the GUI layout with panes and panels,
+ // and create a few other GUI things
startJob.setSectionName(Msg.STARTUP_GENERAL_CONFIG.toString());
- // GUI setup
- debug();
- init();
+ createLayout();
// ReflectionBus.plug(this);
@@ -243,7 +244,7 @@
/**
* Initialize the GUI, and display it.
*/
- private void init()
+ private void createLayout()
{
addWindowListener(new WindowAdapter()
{
@@ -816,6 +817,7 @@
*/
public final void generateConfig()
{
+ // Get the list of books for each book type.
fillChoiceFactory();
config = new Config(Msg.CONFIG_TITLE.toString());
@@ -1031,6 +1033,7 @@
*/
/*private*/ final void fillChoiceFactory()
{
+ // Get the list of books for each book type.
refreshBooks();
Translations.instance().register();
@@ -1052,6 +1055,8 @@
*/
protected final void refreshBooks()
{
+ // Instantiating Defaults finds all of the installed books.
+ // Calling refreshBooks() gets the list of books for each book type.
Defaults.refreshBooks();
// Has the number of reference books changed?
Modified: trunk/common/src/main/java/org/crosswire/common/config/Config.java
===================================================================
--- trunk/common/src/main/java/org/crosswire/common/config/Config.java 2008-02-02 15:48:16 UTC (rev 1743)
+++ trunk/common/src/main/java/org/crosswire/common/config/Config.java 2008-02-02 16:31:33 UTC (rev 1744)
@@ -269,14 +269,14 @@
String key = (String) iter.next();
Choice choice = getChoice(key);
- String oldValue = choice.getString();
+ String oldValue = choice.getString(); // never returns null
String newValue = local.getProperty(key);
// The new value shouldn't really be blank - obviously this
// choice has just been added, substitute the default.
- if (newValue == null || newValue.length() == 0)
+ if ((newValue == null) || (newValue.length() == 0))
{
- if (oldValue == null)
+ if ((oldValue == null) || (oldValue.length() == 0))
{
continue;
}
Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/Defaults.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/Defaults.java 2008-02-02 15:48:16 UTC (rev 1743)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/Defaults.java 2008-02-02 16:31:33 UTC (rev 1744)
@@ -446,6 +446,9 @@
return hebrewParseDeft;
}
+ /**
+ * Create book lists for every type of book.
+ */
public static void refreshBooks()
{
// Create the array of Bibles
More information about the jsword-svn
mailing list