[jsword-svn] jsword/java/jsword/org/crosswire/jsword/book s

jswordcvs at crosswire.org jswordcvs at crosswire.org
Tue Jan 3 06:25:36 MST 2006


Update of /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book
In directory www.crosswire.org:/tmp/cvs-serv24436/java/jsword/org/crosswire/jsword/book

Modified Files:
	BookFilters.java Defaults.java BookCategory.java Books.java 
Log Message:
Unify Daily Devotions and Readings into a single behavior.

Index: Defaults.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/Defaults.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** Defaults.java	2 Jan 2006 03:40:08 -0000	1.36
--- Defaults.java	3 Jan 2006 13:25:34 -0000	1.37
***************
*** 27,31 ****
  
  import org.crosswire.common.config.ChoiceFactory;
- import org.crosswire.jsword.book.readings.ReadingsBookDriver;
  
  /**
--- 27,30 ----
***************
*** 202,205 ****
--- 201,244 ----
       * @see org.crosswire.jsword.book.DefaultBook#setDefault(org.crosswire.jsword.book.Book)
       */
+     public static void setDailyDevotional(Book book)
+     {
+         dictionaryDeft.setDefault(book);
+     }
+ 
+     /* (non-Javadoc)
+      * @see org.crosswire.jsword.book.DefaultBook#unsetDefault()
+      */
+     protected static void unsetDailyDevotional()
+     {
+         dailyDevotionalDeft.unsetDefault();
+     }
+ 
+     /* (non-Javadoc)
+      * @see org.crosswire.jsword.book.DefaultBook#getDefault()
+      */
+     public static Book getDailyDevotional()
+     {
+         return dailyDevotionalDeft.getDefault();
+     }
+ 
+     /* (non-Javadoc)
+      * @see org.crosswire.jsword.book.DefaultBook#getDefaultName()
+      */
+     public static String getDailyDevotionalByName()
+     {
+         return dailyDevotionalDeft.getDefaultName();
+     }
+ 
+     /* (non-Javadoc)
+      * @see org.crosswire.jsword.book.DefaultBook#setDefaultByName(java.lang.String)
+      */
+     public static void setDailyDevotionalByName(String name)
+     {
+         dailyDevotionalDeft.setDefaultByName(name);
+     }
+ 
+     /* (non-Javadoc)
+      * @see org.crosswire.jsword.book.DefaultBook#setDefault(org.crosswire.jsword.book.Book)
+      */
      public static void setGreekDefinitions(Book book)
      {
***************
*** 374,377 ****
--- 413,421 ----
      }
  
+     protected static DefaultBook getDefaultDailyDevotional()
+     {
+         return dailyDevotionalDeft;
+     }
+ 
      protected static DefaultBook getDefaultGreekDefinitions()
      {
***************
*** 408,411 ****
--- 452,460 ----
          ChoiceFactory.getDataMap().put(DICTIONARY_KEY, dnames);
  
+         // Create the array of DailyDevotionals
+         String[] rnames = getFullNameArray(BookFilters.getDailyDevotionals());
+         ChoiceFactory.getDataMap().put(DAILY_DEVOTIONALS_KEY, rnames);
+         //ChoiceFactory.getDataMap().put(DAILY_DEVOTIONALS_KEY, ReadingsBookDriver.getInstalledReadingsSets());
+ 
          // Create the array of Dictionaries
          String[] greekDef = getFullNameArray(BookFilters.getGreekDefinitions());
***************
*** 423,429 ****
          String[] hebrewParse = getFullNameArray(BookFilters.getHebrewParse());
          ChoiceFactory.getDataMap().put(HEBREWPARSE_KEY, hebrewParse);
- 
-         // Create the array of readings sets
-         ChoiceFactory.getDataMap().put(READINGS_KEY, ReadingsBookDriver.getInstalledReadingsSets());
      }
  
--- 472,475 ----
***************
*** 453,456 ****
--- 499,503 ----
          commentaryDeft.setDefaultConditionally(book);
          dictionaryDeft.setDefaultConditionally(book);
+         dailyDevotionalDeft.setDefaultConditionally(book);
          greekDefinitionsDeft.setDefaultConditionally(book);
          greekParseDeft.setDefaultConditionally(book);
***************
*** 500,503 ****
--- 547,551 ----
              getDefaultBible().unsetDefaultConditionally(book);
              getDefaultCommentary().unsetDefaultConditionally(book);
+             getDefaultDailyDevotional().unsetDefaultConditionally(book);
              getDefaultDictionary().unsetDefaultConditionally(book);
              getDefaultGreekDefinitions().unsetDefaultConditionally(book);
***************
*** 511,515 ****
      private static final String COMMENTARY_KEY = "commentary-names"; //$NON-NLS-1$
      private static final String DICTIONARY_KEY = "dictionary-names"; //$NON-NLS-1$
!     private static final String READINGS_KEY = "readings"; //$NON-NLS-1$
      private static final String GREEKDEF_KEY = "greekdef-names"; //$NON-NLS-1$
      private static final String HEBREWDEF_KEY = "hebrewdef-names"; //$NON-NLS-1$
--- 559,563 ----
      private static final String COMMENTARY_KEY = "commentary-names"; //$NON-NLS-1$
      private static final String DICTIONARY_KEY = "dictionary-names"; //$NON-NLS-1$
!     private static final String DAILY_DEVOTIONALS_KEY = "daily-devotional-names"; //$NON-NLS-1$
      private static final String GREEKDEF_KEY = "greekdef-names"; //$NON-NLS-1$
      private static final String HEBREWDEF_KEY = "hebrewdef-names"; //$NON-NLS-1$
***************
*** 533,536 ****
--- 581,589 ----
  
      /**
+      * The default DailyDevotional
+      */
+     private static DefaultBook dailyDevotionalDeft = new DefaultBook(Books.installed(), BookFilters.getDailyDevotionals());
+ 
+     /**
       * The default Dictionary
       */

Index: BookFilters.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/BookFilters.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** BookFilters.java	2 Jan 2006 03:40:08 -0000	1.18
--- BookFilters.java	3 Jan 2006 13:25:34 -0000	1.19
***************
*** 114,119 ****
              BookCategory category = book.getBookCategory();
              return category.equals(BookCategory.DICTIONARY)
!                  || category.equals(BookCategory.GLOSSARY)
!                  || category.equals(BookCategory.DAILY_DEVOTIONS);
          }
      }
--- 114,143 ----
              BookCategory category = book.getBookCategory();
              return category.equals(BookCategory.DICTIONARY)
!                  || category.equals(BookCategory.GLOSSARY);
!         }
!     }
! 
!     /**
!      * A filter that accepts everything that implements DailyDevotionals
!      */
!     public static BookFilter getDailyDevotionals()
!     {
!         return dailyDevotionalsBookFilter;
!     }
! 
!     /**
!      * Filter for all dictionaries
!      */
!     private static BookFilter dailyDevotionalsBookFilter = new DailyDevotionalsBookFilter();
! 
!     /**
!      * Filter for all dictionaries
!      */
!     private static class DailyDevotionalsBookFilter implements BookFilter
!     {
!         public boolean test(Book book)
!         {
!             BookCategory category = book.getBookCategory();
!             return category.equals(BookCategory.DAILY_DEVOTIONS);
          }
      }

Index: BookCategory.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/BookCategory.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** BookCategory.java	2 Jan 2006 03:40:08 -0000	1.3
--- BookCategory.java	3 Jan 2006 13:25:34 -0000	1.4
***************
*** 34,38 ****
   * @author DM Smith [dmsmith555 at yahoo dot com]
   */
! public final class BookCategory implements Serializable
  {
      /**
--- 34,38 ----
   * @author DM Smith [dmsmith555 at yahoo dot com]
   */
! public final class BookCategory implements Serializable, Comparable
  {
      /**
***************
*** 98,101 ****
--- 98,110 ----
      }
  
+     /* (non-Javadoc)
+      * @see java.lang.Comparable#compareTo(java.lang.Object)
+      */
+     public int compareTo(Object o)
+     {
+         BookCategory that = (BookCategory) o;
+         return this.name.compareTo(that.name);
+     }
+ 
      /**
       * Prevent subclasses from overriding canonical identity based Object methods

Index: Books.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/Books.java,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** Books.java	27 Jul 2005 23:25:46 -0000	1.46
--- Books.java	3 Jan 2006 13:25:34 -0000	1.47
***************
*** 24,28 ****
  import java.lang.reflect.Method;
  import java.util.ArrayList;
- import java.util.Collections;
  import java.util.HashSet;
  import java.util.Iterator;
--- 24,27 ----
***************
*** 55,59 ****
      private Books()
      {
!         books = new ArrayList();
          drivers = new HashSet();
          listeners = new EventListenerList();
--- 54,58 ----
      private Books()
      {
!         books = new BookSet();
          drivers = new HashSet();
          listeners = new EventListenerList();
***************
*** 77,81 ****
      public synchronized List getBooks()
      {
!         return Collections.unmodifiableList(books);
      }
  
--- 76,80 ----
      public synchronized List getBooks()
      {
!         return new BookSet(books);
      }
  
***************
*** 136,140 ****
      {
          List temp = CollectionUtil.createList(new BookFilterIterator(getBooks().iterator(), filter));
!         return Collections.unmodifiableList(temp);
      }
  
--- 135,139 ----
      {
          List temp = CollectionUtil.createList(new BookFilterIterator(getBooks().iterator(), filter));
!         return new BookSet(temp);
      }
  
***************
*** 422,426 ****
       * The list of Books
       */
!     private List books;
  
      /**
--- 421,425 ----
       * The list of Books
       */
!     private BookSet books;
  
      /**



More information about the jsword-svn mailing list