[jsword-svn] r1351 - in trunk: bibledesktop/src/main/java/org/crosswire/bibledesktop/book jsword/src/main/java/org/crosswire/jsword/book jsword/src/main/java/org/crosswire/jsword/book/basic jsword/src/test/java/org/crosswire/jsword/book jsword-limbo/src/historic/java/org/crosswire/jsword/view/cli jsword-limbo/src/main/java/org/crosswire/jsword/book/basic jsword-web/src/web

dmsmith at www.crosswire.org dmsmith at www.crosswire.org
Fri May 25 09:34:16 MST 2007


Author: dmsmith
Date: 2007-05-25 09:34:16 -0700 (Fri, 25 May 2007)
New Revision: 1351

Modified:
   trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BookListCellRenderer.java
   trunk/jsword-limbo/src/historic/java/org/crosswire/jsword/view/cli/Model.java
   trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/basic/AbstractLocalURLBook.java
   trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/basic/LocalURLBookDriver.java
   trunk/jsword-web/src/web/design.html
   trunk/jsword/src/main/java/org/crosswire/jsword/book/Book.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/BookMetaData.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/DefaultBook.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/Defaults.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBook.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBookMetaData.java
   trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/DefaultBookMetaData.java
   trunk/jsword/src/test/java/org/crosswire/jsword/book/BookMetaDataTest.java
   trunk/jsword/src/test/java/org/crosswire/jsword/book/BooksTest.java
   trunk/jsword/src/test/java/org/crosswire/jsword/book/ReadEverything.java
Log:
Improved the displaying of Book's names.

Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BookListCellRenderer.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BookListCellRenderer.java	2007-05-25 15:31:57 UTC (rev 1350)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/book/BookListCellRenderer.java	2007-05-25 16:34:16 UTC (rev 1351)
@@ -137,7 +137,7 @@
             }
             else
             {
-                String displayName = book.toString();
+                String displayName = book.getName();
                 setText(displayName);
                 setToolTipText(displayName);
             }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/Book.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/Book.java	2007-05-25 15:31:57 UTC (rev 1350)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/Book.java	2007-05-25 16:34:16 UTC (rev 1351)
@@ -177,14 +177,7 @@
      */
     String getOsisID();
 
-    /**
-     * Calculated field: The full name of the book, for example
-     * The format is "name, (Driver)"
-     * @return The full name of this book
-     */
-    String getFullName();
-
-    /**
+   /**
      * Return the likelihood that we have a match.
      * This allows for calling the book different things
      * and still be found.

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/BookMetaData.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/BookMetaData.java	2007-05-25 15:31:57 UTC (rev 1350)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/BookMetaData.java	2007-05-25 16:34:16 UTC (rev 1351)
@@ -92,13 +92,6 @@
     String getOsisID();
 
     /**
-     * Calculated field: The full name of the book, for example
-     * The format is "name, (Driver)"
-     * @return The full name of this book
-     */
-    String getFullName();
-
-    /**
      * Indicate whether this book is supported by JSword.
      * Since the expectation is that all books are supported,
      * abstract implementations should return true and let

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/DefaultBook.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/DefaultBook.java	2007-05-25 15:31:57 UTC (rev 1350)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/DefaultBook.java	2007-05-25 16:34:16 UTC (rev 1351)
@@ -98,7 +98,7 @@
     }
 
     /**
-     * This method is identical to <code>getDefault().getFullName()</code>
+     * This method is identical to <code>getDefault().getName()</code>
      * and is only used by Config which works best with strings under reflection.
      */
     public String getDefaultName()
@@ -108,7 +108,7 @@
             return null;
         }
 
-        return book.getFullName();
+        return book.getName();
     }
 
     /**

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/Defaults.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/Defaults.java	2007-05-25 15:31:57 UTC (rev 1350)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/Defaults.java	2007-05-25 16:34:16 UTC (rev 1351)
@@ -449,35 +449,35 @@
     public static void refreshBooks()
     {
         // Create the array of Bibles
-        String[] bnames = getFullNameArray(BookFilters.getOnlyBibles());
+        String[] bnames = getNameArray(BookFilters.getOnlyBibles());
         ChoiceFactory.getDataMap().put(BIBLE_KEY, bnames);
 
         // Create the array of Commentaries
-        String[] cnames = getFullNameArray(BookFilters.getCommentaries());
+        String[] cnames = getNameArray(BookFilters.getCommentaries());
         ChoiceFactory.getDataMap().put(COMMENTARY_KEY, cnames);
 
         // Create the array of Dictionaries
-        String[] dnames = getFullNameArray(BookFilters.getDictionaries());
+        String[] dnames = getNameArray(BookFilters.getDictionaries());
         ChoiceFactory.getDataMap().put(DICTIONARY_KEY, dnames);
 
         // Create the array of DailyDevotionals
-        String[] rnames = getFullNameArray(BookFilters.getDailyDevotionals());
+        String[] rnames = getNameArray(BookFilters.getDailyDevotionals());
         ChoiceFactory.getDataMap().put(DAILY_DEVOTIONALS_KEY, rnames);
 
         // Create the array of Dictionaries
-        String[] greekDef = getFullNameArray(BookFilters.getGreekDefinitions());
+        String[] greekDef = getNameArray(BookFilters.getGreekDefinitions());
         ChoiceFactory.getDataMap().put(GREEKDEF_KEY, greekDef);
 
         // Create the array of Dictionaries
-        String[] hebrewDef = getFullNameArray(BookFilters.getHebrewDefinitions());
+        String[] hebrewDef = getNameArray(BookFilters.getHebrewDefinitions());
         ChoiceFactory.getDataMap().put(HEBREWDEF_KEY, hebrewDef);
 
         // Create the array of Dictionaries
-        String[] greekParse = getFullNameArray(BookFilters.getGreekParse());
+        String[] greekParse = getNameArray(BookFilters.getGreekParse());
         ChoiceFactory.getDataMap().put(GREEKPARSE_KEY, greekParse);
 
         // Create the array of Dictionaries
-        String[] hebrewParse = getFullNameArray(BookFilters.getHebrewParse());
+        String[] hebrewParse = getNameArray(BookFilters.getHebrewParse());
         ChoiceFactory.getDataMap().put(HEBREWPARSE_KEY, hebrewParse);
     }
 
@@ -516,7 +516,7 @@
     /**
      * Convert a filter into an array of names of Books that pass the filter.
      */
-    private static String[] getFullNameArray(BookFilter filter)
+    private static String[] getNameArray(BookFilter filter)
     {
         List names = new ArrayList();
 
@@ -524,7 +524,7 @@
         while (iter.hasNext())
         {
             Book book = (Book) iter.next();
-            names.add(book.getFullName());
+            names.add(book.getName());
         }
 
         return (String[]) names.toArray(new String[names.size()]);

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBook.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBook.java	2007-05-25 15:31:57 UTC (rev 1350)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBook.java	2007-05-25 16:34:16 UTC (rev 1351)
@@ -141,14 +141,6 @@
     }
 
     /* (non-Javadoc)
-     * @see org.crosswire.jsword.book.BookMetaData#getFullName()
-     */
-    public String getFullName()
-    {
-        return bmd.getFullName();
-    }
-
-    /* (non-Javadoc)
      * @see org.crosswire.jsword.book.Book#match(java.lang.String)
      */
     public boolean match(String name)
@@ -165,14 +157,6 @@
         {
             return true;
         }
-        if (name.equals(getFullName()))
-        {
-            return true;
-        }
-        if (name.equals(toString()))
-        {
-            return true;
-        }
         if (name.equalsIgnoreCase(getInitials()))
         {
             return true;
@@ -181,14 +165,6 @@
         {
             return true;
         }
-        if (name.equalsIgnoreCase(getFullName()))
-        {
-            return true;
-        }
-        if (name.equalsIgnoreCase(toString()))
-        {
-            return true;
-        }
         if (name.startsWith(getInitials()))
         {
             return true;
@@ -197,14 +173,6 @@
         {
             return true;
         }
-        if (name.startsWith(getFullName()))
-        {
-            return true;
-        }
-        if (name.startsWith(toString()))
-        {
-            return true;
-        }
         return false;
     }
 

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBookMetaData.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBookMetaData.java	2007-05-25 15:31:57 UTC (rev 1350)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/AbstractBookMetaData.java	2007-05-25 16:34:16 UTC (rev 1351)
@@ -80,34 +80,6 @@
     }
 
     /* (non-Javadoc)
-     * @see org.crosswire.jsword.book.BookMetaData#getFullName()
-     */
-    public String getFullName()
-    {
-        if (fullName == null)
-        {
-            fullName = computeFullName();
-        }
-        return fullName;
-    }
-
-    /**
-     * 
-     */
-    private String computeFullName()
-    {
-//        StringBuffer buf = new StringBuffer(getName());
-//
-//        if (getDriver() != null)
-//        {
-//            buf.append(" (").append(getDriverName()).append(')'); //$NON-NLS-1$
-//        }
-//
-//        return buf.toString();
-        return getName();
-    }
-
-    /* (non-Javadoc)
      * @see org.crosswire.jsword.book.BookMetaData#isSupported()
      */
     public boolean isSupported()
@@ -339,15 +311,7 @@
      */
     public String toString()
     {
-        if (displayName == null)
-        {
-            StringBuffer buf = new StringBuffer("["); //$NON-NLS-1$
-            buf.append(getInitials());
-            buf.append("] - "); //$NON-NLS-1$
-            buf.append(getFullName());
-            displayName = buf.toString();
-        }
-        return displayName;
+        return getName();
     }
 
     /**
@@ -356,7 +320,5 @@
     private Map prop = new LinkedHashMap();
 
     private BookDriver driver;
-    private String fullName;
-    private String displayName;
     private IndexStatus indexStatus = IndexStatus.UNDONE;
 }

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/DefaultBookMetaData.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/DefaultBookMetaData.java	2007-05-25 15:31:57 UTC (rev 1350)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/book/basic/DefaultBookMetaData.java	2007-05-25 16:34:16 UTC (rev 1351)
@@ -207,7 +207,7 @@
         OSISUtil.OSISFactory factory = OSISUtil.factory();
         Element ele = factory.createTable();
         addRow(ele, "Initials", getInitials()); //$NON-NLS-1$
-        addRow(ele, "Description", getFullName()); //$NON-NLS-1$
+        addRow(ele, "Description", getName()); //$NON-NLS-1$
         addRow(ele, "Key", getBookCategory().toString()); //$NON-NLS-1$
         addRow(ele, "Language", getLanguage()); //$NON-NLS-1$
         return new Document(ele);

Modified: trunk/jsword/src/test/java/org/crosswire/jsword/book/BookMetaDataTest.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/book/BookMetaDataTest.java	2007-05-25 15:31:57 UTC (rev 1350)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/book/BookMetaDataTest.java	2007-05-25 16:34:16 UTC (rev 1351)
@@ -83,7 +83,7 @@
         test(v1.getName(), "a");
         test(v1.getEdition(), "b");
         test(v1.getFirstPublished(), new Date(631152000000L)); // 1 1 1990
-        test(v1.getFullName(), "a,b");
+        test(v1.getName(), "a,b");
         test(v1.getInitials(), "initials");
         test(v1.getLicense(), new URL("http://localhost/file.txt"));
         test(v1.getOpenness(), Version.STATUS_PD);
@@ -91,7 +91,7 @@
         test(v1.getName(), "a");
         test(v1.getEdition(), "");
         test(v1.getFirstPublished(), null);
-        test(v1.getFullName(), "a");
+        test(v1.getName(), "a");
         test(v1.getInitials(), "i");
         test(v1.getLicense(), null);
         test(v1.getOpenness(), Version.STATUS_UNKNOWN);
@@ -99,7 +99,7 @@
         test(v1.getName(), "abcabc");
         test(v1.getEdition(), "");
         test(v1.getFirstPublished(), null);
-        test(v1.getFullName(), "abcabc");
+        test(v1.getName(), "abcabc");
         test(v1.getInitials(), "a");
         test(v1.getLicense(), null);
         test(v1.getOpenness(), Version.STATUS_UNKNOWN);
@@ -129,11 +129,11 @@
         test(VersionFactory.getEdition(" ab , b "), "b");
         test(VersionFactory.getEdition(" ab "), "");
 
-        log("VersionFactory.getFullName(String, String)");
-        test(VersionFactory.getFullName("a", "b"), "a,b");
-        test(VersionFactory.getFullName("a", null), "a");
-        test(VersionFactory.getFullName("a", ""), "a");
-        test(VersionFactory.getFullName("a", " "), "a");
+        log("VersionFactory.getName(String, String)");
+        test(VersionFactory.getName("a", "b"), "a,b");
+        test(VersionFactory.getName("a", null), "a");
+        test(VersionFactory.getName("a", ""), "a");
+        test(VersionFactory.getName("a", " "), "a");
         */
     }
 }

Modified: trunk/jsword/src/test/java/org/crosswire/jsword/book/BooksTest.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/book/BooksTest.java	2007-05-25 15:31:57 UTC (rev 1350)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/book/BooksTest.java	2007-05-25 16:34:16 UTC (rev 1351)
@@ -105,13 +105,10 @@
         {
             BookMetaData bmd = bmds[i];
 
-            assertTrue(bmd.getFullName() != null);
-            assertTrue(bmd.getFullName().length() > 0);
             assertTrue(bmd.getInitials() != null);
             assertTrue(bmd.getInitials().length() > 0);
             assertTrue(bmd.getName() != null);
             assertTrue(bmd.getName().length() > 0);
-            assertTrue(bmd.getFullName().length() > bmd.getName().length());
             assertTrue(bmd.getName().length() > bmd.getInitials().length());
         }
     }

Modified: trunk/jsword/src/test/java/org/crosswire/jsword/book/ReadEverything.java
===================================================================
--- trunk/jsword/src/test/java/org/crosswire/jsword/book/ReadEverything.java	2007-05-25 15:31:57 UTC (rev 1350)
+++ trunk/jsword/src/test/java/org/crosswire/jsword/book/ReadEverything.java	2007-05-25 16:34:16 UTC (rev 1351)
@@ -107,7 +107,7 @@
     {
         DataPolice.setBook(book.getBookMetaData());
 
-        //log.info("Testing: "+bmd.getInitials()+"="+bmd.getFullName());
+        //log.info("Testing: "+bmd.getInitials()+"="+bmd.getName());
         long start = System.currentTimeMillis();
         int entries = 0;
 

Modified: trunk/jsword-limbo/src/historic/java/org/crosswire/jsword/view/cli/Model.java
===================================================================
--- trunk/jsword-limbo/src/historic/java/org/crosswire/jsword/view/cli/Model.java	2007-05-25 15:31:57 UTC (rev 1350)
+++ trunk/jsword-limbo/src/historic/java/org/crosswire/jsword/view/cli/Model.java	2007-05-25 16:34:16 UTC (rev 1351)
@@ -126,7 +126,7 @@
         for (Iterator it = list.iterator(); it.hasNext();)
         {
             Book book = (Book) it.next();
-            buffer.append(book.getFullName());
+            buffer.append(book.getName());
             
             if (it.hasNext())
             {

Modified: trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/basic/AbstractLocalURLBook.java
===================================================================
--- trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/basic/AbstractLocalURLBook.java	2007-05-25 15:31:57 UTC (rev 1350)
+++ trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/basic/AbstractLocalURLBook.java	2007-05-25 16:34:16 UTC (rev 1351)
@@ -41,7 +41,7 @@
         try
         {
             Properties wprop = new Properties();
-            wprop.put("Version", getFullName());
+            wprop.put("Version", getName());
 
             URL prop_url = NetUtil.lengthenURL(getURL(), "bible.properties");
             OutputStream prop_out = NetUtil.getOutputStream(prop_url);

Modified: trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/basic/LocalURLBookDriver.java
===================================================================
--- trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/basic/LocalURLBookDriver.java	2007-05-25 15:31:57 UTC (rev 1350)
+++ trunk/jsword-limbo/src/main/java/org/crosswire/jsword/book/basic/LocalURLBookDriver.java	2007-05-25 16:34:16 UTC (rev 1351)
@@ -88,7 +88,7 @@
 
         try
         {
-            String base = source.getFullName();
+            String base = source.getName();
             URL url = createUniqueDirectory(base);
 
             AbstractLocalURLBook dest = (AbstractLocalURLBook) bibleclass.newInstance();

Modified: trunk/jsword-web/src/web/design.html
===================================================================
--- trunk/jsword-web/src/web/design.html	2007-05-25 15:31:57 UTC (rev 1350)
+++ trunk/jsword-web/src/web/design.html	2007-05-25 16:34:16 UTC (rev 1351)
@@ -84,7 +84,6 @@
     String getName();
     String getInitials();
     String getOsisID();
-    String getFullName();
 
     // Get general info about any Book
     BookCategory getBookCategory();
@@ -121,7 +120,6 @@
     String getName()
     String getInitials()
     String getOsisID()
-    String getFullName()
 
     // Get general info about any Book
     BookCategory getBookCategory();




More information about the jsword-svn mailing list