[jsword-svn] r2138 - in trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop: . book book/install desktop

dmsmith at crosswire.org dmsmith at crosswire.org
Wed Mar 16 15:10:11 MST 2011


Author: dmsmith
Date: 2011-03-16 15:10:11 -0700 (Wed, 16 Mar 2011)
New Revision: 2138

Modified:
   trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/BDMsg.java
   trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/AdvancedSearchPane.java
   trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java
   trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/BookTreeCellRenderer.java
   trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/DesktopActions.java
Log:
JS-181 Merge of BDMsg section names into JSMsg is finished within BD.

Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/BDMsg.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/BDMsg.java	2011-03-16 13:18:14 UTC (rev 2137)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/BDMsg.java	2011-03-16 22:10:11 UTC (rev 2138)
@@ -22,6 +22,7 @@
 
 package org.crosswire.bibledesktop;
 
+import org.crosswire.common.icu.NumberShaper;
 import org.crosswire.common.util.MsgBase;
 
 /**
@@ -32,6 +33,7 @@
  * @author DM Smith [dmsmith555 at yahoo dot com]
  */
  public final class BDMsg extends MsgBase {
+
     /**
      * get the title of the application
      * @return the title of the application
@@ -75,9 +77,7 @@
     }
 
     private static String getVersion() {
-        // TRANSLATOR: the current version of the application.
-        // When translating use digits 0-9. They will be shaped appropriately.
-        return BDMsg.gettext("1.6");
+        return VERSION;
     }
 
     /**
@@ -92,5 +92,14 @@
         return msg.lookup(key, params);
     }
 
+    // The shaper for the version number
+    private static NumberShaper shaper = new NumberShaper();
+
+    /**
+     * The current version of Bible Desktop. Adjust for each release.
+     * And increment after each release and append alpha, beta, ... to it.
+     */
+    private static String VERSION = shaper.shape("1.6.1beta");
+
     private static MsgBase msg = new BDMsg();
 }

Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/AdvancedSearchPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/AdvancedSearchPane.java	2011-03-16 13:18:14 UTC (rev 2137)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/AdvancedSearchPane.java	2011-03-16 22:10:11 UTC (rev 2138)
@@ -67,6 +67,7 @@
 import org.crosswire.common.swing.CWScrollPane;
 import org.crosswire.common.swing.GuiUtil;
 import org.crosswire.jsword.index.search.SearchType;
+import org.crosswire.jsword.versification.DivisionName;
 
 /**
  * An advanced search dialog.
@@ -80,35 +81,21 @@
      * This is the default constructor
      */
     public AdvancedSearchPane() {
-        // TODO(DMS): Migrate these to Versification.SectionNames
-        presets = new String[] {
-                // TRANSLATOR: A Label representing the range of the entire Bible 
-                BDMsg.gettext("The Whole Bible"),
-                // TRANSLATOR: A Label representing the range of the prophecy in the Bible
-                BDMsg.gettext("All Prophecy (Deu 28, Isa-Mal, Rev)"),
-                // TRANSLATOR: A Label representing the range of the New Testament
-                BDMsg.gettext("Old Testament (Gen-Mal)"),
-                // TRANSLATOR: A Label representing the range of the Old Testament
-                BDMsg.gettext("New Testament (Mat-Rev)"),
-                // TRANSLATOR: A Label representing the range of the books of Moses
-                BDMsg.gettext("The Pentateuch (Gen-Deu)"),
-                // TRANSLATOR: A Label representing the range of the history books of the Bible
-                BDMsg.gettext("History (Josh-Est)"),
-                // TRANSLATOR: A Label representing the range of the poetic books of the Bible
-                BDMsg.gettext("Poetry (Job-Song)"),
-                // TRANSLATOR: A Label representing the range of the major prophets of the Bible
-                BDMsg.gettext("Major Prophets (Isa-Dan)"),
-                // TRANSLATOR: A Label representing the range of the minor prophets of the Bible
-                BDMsg.gettext("Minor Prophets (Hos-Mal)"),
-                // TRANSLATOR: A Label representing the range of the Gospels and Acts of the Bible
-                BDMsg.gettext("Gospels and Acts (Mat-Act)"),
-                // TRANSLATOR: A Label representing the range of the NT letters to the church
-                BDMsg.gettext("Letters to People (Rom-Heb)"),
-                // TRANSLATOR: A Label representing the range of the NT letters within the church
-                BDMsg.gettext("Letters from People (Jam-Jude)"),
-                // TRANSLATOR: A Label representing a range of the Bible of the user's own choosing
-                // The user chooses by filling in a text box.
-                BDMsg.gettext("Custom")
+        // First entry is for nothing selected.
+        presets = new Object[] {
+                CUSTOM,
+                DivisionName.BIBLE,
+                DivisionName.PROPHECY,
+                DivisionName.OLD_TESTAMENT,
+                DivisionName.NEW_TESTAMENT,
+                DivisionName.PENTATEUCH,
+                DivisionName.HISTORY,
+                DivisionName.POETRY,
+                DivisionName.MAJOR_PROPHETS,
+                DivisionName.MINOR_PROPHETS,
+                DivisionName.GOSPELS_AND_ACTS,
+                DivisionName.PAULINE_LETTERS,
+                DivisionName.GENERAL_LETTERS,
         };
 
         initialize();
@@ -119,11 +106,6 @@
      */
     private void initialize() {
         shaper = new NumberShaper();
-        // TRANSLATOR: The start of the passage list for the division of the Bible
-        presetStart = BDMsg.gettext("(");
-        // TRANSLATOR: The end of the passage list for the division of the Bible
-        presetEnd = BDMsg.gettext(")");
-
         actions = new ActionFactory(this);
 
         // SystemColor.controlShadow
@@ -401,18 +383,17 @@
 
     public final void setLabelRank(int val) {
         if (val == 0) {
-            // TRANSLATOR: Dynamic label for prioritization slider on Advanced Search.
+            // TRANSLATOR: Dynamic label for priority slider on Advanced Search.
             // The user has chosen 0, which means to show all verses.
-            // This used to be "Show {0} verses:" and {0} was a placeholder for the English word "All".
-            lblRank.setText(shaper.shape(BDMsg.gettext("Show all verses:", "All")));
+            lblRank.setText(BDMsg.gettext("Show all verses:"));
         } else if (val == 1) {
-            // TRANSLATOR: Dynamic label for prioritization slider on Advanced Search.
+            // TRANSLATOR: Dynamic label for priority slider on Advanced Search.
             // The user has chosen 1, which means to show one verse, presumably the one that best satisfies the search.
-            lblRank.setText(shaper.shape(BDMsg.gettext("Show best verse:")));
+            lblRank.setText(BDMsg.gettext("Show best verse:"));
         } else {
-            // TRANSLATOR: Dynamic label for prioritization slider on Advanced Search.
+            // TRANSLATOR: Dynamic label for priority slider on Advanced Search.
             // The user has chosen a number other than 0 or 1. 
-            lblRank.setText(shaper.shape(BDMsg.gettext("Show {0} verses:", Integer.valueOf(val))));
+            lblRank.setText(BDMsg.gettext("Show {0} verses:", Integer.valueOf(val)));
         }
     }
 
@@ -508,7 +489,7 @@
         // TRANSLATOR: This is the title to the dialog allowing a user to select passages for a restricted search.
         String passg = dlgSelect.showInDialog(this, BDMsg.gettext("Select Passages to Restrict Search to"), true, txtRestrict.getText());
         if (passg != null) {
-            cboPresets.setSelectedItem(presets[presets.length - 1]);
+            cboPresets.setSelectedItem(CUSTOM);
             txtRestrict.setText(passg);
         }
     }
@@ -529,17 +510,12 @@
             return;
         }
 
-        String include = "";
-        String preset = (String) cboPresets.getSelectedItem();
-        if (preset != null) {
-            int open = preset.indexOf(presetStart);
-            int close = preset.indexOf(presetEnd, open + 1);
-
-            if (open != -1 && close != -1) {
-                include = preset.substring(open + 1, close);
-            }
+        String include = CUSTOM;
+        Object obj = cboPresets.getSelectedItem();
+        if (obj instanceof DivisionName) {
+            DivisionName preset = (DivisionName) obj;
+            include = preset.getRange();
         }
-
         txtRestrict.setText(include);
     }
 
@@ -609,65 +585,45 @@
         editingRestrict = true;
         boolean match = false;
         ComboBoxModel model = cboPresets.getModel();
-        String find = presetStart + restrict + presetEnd;
         for (int i = 0; !match && i < model.getSize(); i++) {
-            String element = (String) model.getElementAt(i);
-            if (element.indexOf(find) != -1) {
-                cboPresets.setSelectedIndex(i);
-                match = true;
+            Object obj = model.getElementAt(i);
+            if (obj instanceof DivisionName) {
+                DivisionName element = (DivisionName) obj;
+                if (element.getRange().equalsIgnoreCase(restrict)) {
+                    cboPresets.setSelectedIndex(i);
+                    match = true;
+                }
             }
         }
 
         if (!match) {
-            cboPresets.setSelectedItem(presets[presets.length - 1]);
+            cboPresets.setSelectedItem(CUSTOM);
         }
 
         editingRestrict = false;
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @seejavax.swing.event.DocumentListener#changedUpdate(javax.swing.event.
-     * DocumentEvent)
+    /* (non-Javadoc)
+     * @see javax.swing.event.DocumentListener#changedUpdate(javax.swing.event.DocumentEvent)
      */
     public void changedUpdate(DocumentEvent ev) {
         updateSearchString();
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @seejavax.swing.event.DocumentListener#insertUpdate(javax.swing.event.
-     * DocumentEvent)
+    /* (non-Javadoc)
+     * @see javax.swing.event.DocumentListener#insertUpdate(javax.swing.event.DocumentEvent)
      */
     public void insertUpdate(DocumentEvent ev) {
         updateSearchString();
     }
 
-    /*
-     * (non-Javadoc)
-     * 
-     * @seejavax.swing.event.DocumentListener#removeUpdate(javax.swing.event.
-     * DocumentEvent)
+    /* (non-Javadoc)
+     * @see javax.swing.event.DocumentListener#removeUpdate(javax.swing.event.DocumentEvent)
      */
     public void removeUpdate(DocumentEvent ev) {
         updateSearchString();
     }
 
-    // /**
-    // * Temporary driver.
-    // * @param args The command line arguments
-    // */
-    // public static void main(String[] args)
-    // {
-    // LookAndFeelUtil.initialize();
-    // AdvancedSearchPane adv = new AdvancedSearchPane();
-    //        String reply = adv.showInDialog(null, "Advanced Search", true, "test");
-    // log.debug(reply);
-    // System.exit(0);
-    // }
-
     /**
      * Create the internationalized labels for the slider.
      * 
@@ -700,10 +656,11 @@
      */
     private static final String SPACE = " ";
 
-    private String presetEnd;
+    /**
+     * The first entry means that the user has either no selection or a custom one.
+     */
+    private static final String CUSTOM = "";
 
-    private String presetStart;
-
     /**
      * If escape was pressed we don't want to update the parent
      */
@@ -720,9 +677,9 @@
     private NumberShaper shaper;
 
     /**
-     * The entries in the restrictions preset
+     * The entries in the restrictions preset. It is object so that a blank entry can be in the list.
      */
-    private String[] presets;
+    private Object[] presets;
 
     /**
      * If we are editing the restrict text box, ignore preset updates

Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java	2011-03-16 13:18:14 UTC (rev 2137)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/DisplaySelectPane.java	2011-03-16 22:10:11 UTC (rev 2138)
@@ -218,19 +218,19 @@
         buf.append("</b><br>");
         // TRANSLATOR: Tip for using search keywords ||, OR. You can use any example you want.
         // You may use balanced HTML markup.
-        buf.append(BDMsg.gettext("You can use || to join phrases, for example \"<code>balaam || balak</code>\" finds passages containing Balak OR Balaam"));
+        buf.append(BDMsg.gettext("You can use || to join phrases, for example <code>balaam || balak</code> finds passages containing Balak OR Balaam"));
         buf.append("<br>");
         // TRANSLATOR: Tip for using search keywords &&, AND. You can use any example you want. 
         // You may use balanced HTML markup.
-        buf.append(BDMsg.gettext("Using && requires both words, e.g. \"<code>aaron && moses</code>\" finds passages containing both Aaron AND Moses"));
+        buf.append(BDMsg.gettext("Using && requires both words, e.g. <code>aaron && moses</code> finds passages containing both Aaron AND Moses"));
         buf.append("<br>");
         // TRANSLATOR: Tip for using search keywords !, BUT NOT. You can use any example you want. 
         // You may use balanced HTML markup.
-        buf.append(BDMsg.gettext("Using a ! removes words from the result e.g. \"<code>lord ! jesus</code>\" is passages containing Lord BUT NOT Jesus"));
+        buf.append(BDMsg.gettext("Using a ! removes words from the result e.g. <code>lord ! jesus</code> is passages containing Lord BUT NOT Jesus"));
         buf.append("<br>");
         // TRANSLATOR: Tip for using search keyword ~n. You can use any example you want. 
         // You may use balanced HTML markup.
-        buf.append(BDMsg.gettext("Using ~2 widens the passage by 2 verses either side on any match. So \"<code>amminadab ~1 perez</code>\" finds verses containting Amminadab within 1 verse of mention of Perez."));
+        buf.append(BDMsg.gettext("Using ~2 widens the passage by 2 verses either side on any match. So <code>amminadab ~1 perez</code> finds verses containting Amminadab within 1 verse of mention of Perez."));
         buf.append("<br>");
         // TRANSLATOR: Tip for using search keyword +[...]. You can use any example you want. 
         // You may use balanced HTML markup.

Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/BookTreeCellRenderer.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/BookTreeCellRenderer.java	2011-03-16 13:18:14 UTC (rev 2137)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/install/BookTreeCellRenderer.java	2011-03-16 22:10:11 UTC (rev 2138)
@@ -26,6 +26,7 @@
 
 import org.crosswire.bibledesktop.BDMsg;
 import org.crosswire.jsword.book.Book;
+import org.crosswire.jsword.book.BookCategory;
 
 /**
  * Provides appropriate icons for books.
@@ -49,8 +50,7 @@
                 setLeafIcon(BookIcon.getIcon(book));
 
                 if (book.isQuestionable()) {
-                    // TRANSLATOR: The book is categorized as either the work of a cult, or it is unorthodox or it is otherwise questionable.
-                    tooltip = BDMsg.gettext("Cult / Unorthodox / Questionable");
+                    tooltip = BookCategory.QUESTIONABLE.toString();
                 }
 
                 if (!book.isSupported()) {

Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/DesktopActions.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/DesktopActions.java	2011-03-16 13:18:14 UTC (rev 2137)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/DesktopActions.java	2011-03-16 22:10:11 UTC (rev 2138)
@@ -423,7 +423,7 @@
     public void doContents() {
         StringBuilder buf = new StringBuilder(200);
         // TRANSLATOR: Someday we'll have real help but for now this points them to the Bible Desktop web site.
-        buf.append(BDMsg.gettext("Currently on-line help is only available via the Bible Desktop's website"));
+        buf.append(BDMsg.gettext("Currently on-line help is only available via the Bible Desktop's website:"));
         buf.append("\nhttp://www.crosswire.org/bibledesktop");
         CWOptionPane.showMessageDialog(getDesktop(), buf.toString());
     }




More information about the jsword-svn mailing list