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

jswordcvs at crosswire.org jswordcvs at crosswire.org
Sun Mar 20 19:37:30 MST 2005


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

Modified Files:
	ConfigEntryTable.java SwordDictionary.java 
	SwordBookMetaData.java ConfigEntry.java 
Log Message:
Fixed BD-34. Clicking a Strong's link now switches books and selects the key.

Index: ConfigEntry.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/sword/ConfigEntry.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** ConfigEntry.java	6 Mar 2005 20:21:47 -0000	1.10
--- ConfigEntry.java	21 Mar 2005 02:37:28 -0000	1.11
***************
*** 182,185 ****
--- 182,204 ----
  
      /**
+      * Determine whether this Config entry matches the value.
+      * 
+      * @param search the value to match against
+      * @return true if this ConfigEntry matches the value
+      */
+     public boolean match(Object search)
+     {
+         if (value != null)
+         {
+             return value.equals(search);
+         }
+         if (values != null)
+         {
+             return values.contains(search);
+         }
+         Object def = type.getDefault();
+         return def != null && def.equals(search);
+     }
+     /**
       * Add a value to the list of values for this ConfigEntry
       */

Index: SwordBookMetaData.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/sword/SwordBookMetaData.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** SwordBookMetaData.java	20 Mar 2005 02:34:44 -0000	1.39
--- SwordBookMetaData.java	21 Mar 2005 02:37:28 -0000	1.40
***************
*** 11,14 ****
--- 11,15 ----
  
  import org.crosswire.jsword.book.BookType;
+ import org.crosswire.jsword.book.FeatureType;
  import org.crosswire.jsword.book.basic.AbstractBookMetaData;
  import org.crosswire.jsword.book.filter.Filter;
***************
*** 199,202 ****
--- 200,211 ----
      }
  
+     /* (non-Javadoc)
+      * @see org.crosswire.jsword.book.BookMetaData#hasFeature(org.crosswire.jsword.book.FeatureType)
+      */
+     public boolean hasFeature(FeatureType feature)
+     {
+         return cet.match(ConfigEntryType.FEATURE, feature.toString());
+     }
+ 
      private void buildProperties()
      {

Index: SwordDictionary.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/sword/SwordDictionary.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** SwordDictionary.java	5 Mar 2005 22:08:06 -0000	1.39
--- SwordDictionary.java	21 Mar 2005 02:37:28 -0000	1.40
***************
*** 229,234 ****
          }
  
!         char firstDigit = text.charAt(1);
! 
          // Get the number after the G or H
          int strongsNumber = Integer.parseInt(text.substring(1));
--- 229,238 ----
          }
  
!         // Hack alert!!! NASB has trailing letters!!!!
!         int pos = text.length() - 1;
!         if (Character.isLetter(text.charAt(pos)))
!         {
!             text = text.substring(0, pos);
!         }
          // Get the number after the G or H
          int strongsNumber = Integer.parseInt(text.substring(1));
***************
*** 236,244 ****
          Key key = null;
          String internalName = sbmd.getInitials();
!         if (internalName.equals("StrongsGreek") && firstDigit != '0') //$NON-NLS-1$
          {
              key = (Key) map.get(ZERO_PAD.format(strongsNumber));
          }
!         else if (internalName.equals("StrongsHebrew") && firstDigit == '0') //$NON-NLS-1$
          {
              key = (Key) map.get(ZERO_PAD.format(strongsNumber));
--- 240,248 ----
          Key key = null;
          String internalName = sbmd.getInitials();
!         if (internalName.equals("StrongsGreek")) //$NON-NLS-1$
          {
              key = (Key) map.get(ZERO_PAD.format(strongsNumber));
          }
!         else if (internalName.equals("StrongsHebrew")) //$NON-NLS-1$
          {
              key = (Key) map.get(ZERO_PAD.format(strongsNumber));
***************
*** 267,271 ****
  
      // This should move along with getStrongsKey
!     private static final Pattern STRONGS_PATTERN = Pattern.compile("^[GH]\\d+$"); //$NON-NLS-1$
      private static final DecimalFormat ZERO_PAD = new DecimalFormat("00000"); //$NON-NLS-1$
  
--- 271,275 ----
  
      // This should move along with getStrongsKey
!     private static final Pattern STRONGS_PATTERN = Pattern.compile("^[GH]\\d+[a-z]?$"); //$NON-NLS-1$
      private static final DecimalFormat ZERO_PAD = new DecimalFormat("00000"); //$NON-NLS-1$
  

Index: ConfigEntryTable.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/sword/ConfigEntryTable.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ConfigEntryTable.java	6 Mar 2005 20:21:47 -0000	1.3
--- ConfigEntryTable.java	21 Mar 2005 02:37:28 -0000	1.4
***************
*** 109,112 ****
--- 109,126 ----
  
      /**
+      * Determine whether this ConfigEntryTable has the ConfigEntry
+      * and it matches the value.
+      * 
+      * @param type The kind of ConfigEntry to look for
+      * @param search the value to match against
+      * @return true if there is a matching ConfigEntry matching the value
+      */
+     public boolean match(ConfigEntryType type, Object search)
+     {
+         ConfigEntry ce = (ConfigEntry) table.get(type);
+         return ce != null && ce.match(search);
+     }
+ 
+     /**
       * Sort the keys for a more meaningful presentation order.
       * TODO(DM): Replace this with a conversion of the properties to XML and then by XSLT to HTML.



More information about the jsword-svn mailing list