[jsword-svn] r2151 - trunk/jsword/src/main/java/org/crosswire/jsword/passage

dmsmith at crosswire.org dmsmith at crosswire.org
Sat Apr 9 09:11:15 MST 2011


Author: dmsmith
Date: 2011-04-09 09:11:15 -0700 (Sat, 09 Apr 2011)
New Revision: 2151

Modified:
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractPassage.java
   trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageEvent.java
Log:
JS-141 Added EventType enum to PassageEvent

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractPassage.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractPassage.java	2011-04-09 15:59:27 UTC (rev 2150)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/AbstractPassage.java	2011-04-09 16:11:15 UTC (rev 2151)
@@ -798,7 +798,7 @@
         }
 
         // Create Event
-        PassageEvent ev = new PassageEvent(source, PassageEvent.VERSES_ADDED, start, end);
+        PassageEvent ev = new PassageEvent(source, PassageEvent.EventType.ADDED, start, end);
 
         // Copy listener vector so it won't change while firing
         List<PassageListener> temp;
@@ -833,7 +833,7 @@
         }
 
         // Create Event
-        PassageEvent ev = new PassageEvent(source, PassageEvent.VERSES_REMOVED, start, end);
+        PassageEvent ev = new PassageEvent(source, PassageEvent.EventType.REMOVED, start, end);
 
         // Copy listener vector so it won't change while firing
         List<PassageListener> temp;
@@ -868,7 +868,7 @@
         }
 
         // Create Event
-        PassageEvent ev = new PassageEvent(source, PassageEvent.VERSES_CHANGED, start, end);
+        PassageEvent ev = new PassageEvent(source, PassageEvent.EventType.CHANGED, start, end);
 
         // Copy listener vector so it won't change while firing
         List<PassageListener> temp;

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageEvent.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageEvent.java	2011-04-09 15:59:27 UTC (rev 2150)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/passage/PassageEvent.java	2011-04-09 16:11:15 UTC (rev 2151)
@@ -35,22 +35,40 @@
  * @author Joe Walker [joe at eireneh dot com]
  */
 public class PassageEvent extends EventObject {
+
+    public enum EventType {
+        /**
+         * Identifies one or more changes in the lists contents.
+         */
+       CHANGED,
+
+        /**
+         * Identifies the addition of one or more contiguous items to the list
+         */
+       ADDED,
+
+        /**
+         * Identifies the removal of one or more contiguous items from the list
+         */
+        REMOVED,
+    }
+
     /**
      * Constructs a PassageEvent object.
      * 
      * @param source
      *            the source Object (typically <code>this</code>)
-     * @param type
+     * @param versesChanged
      *            an int specifying VERSES_CHANGED, VERSES_ADDED, VERSES_REMOVED
      * @param lower
      *            an int specifying the bottom of a range
      * @param upper
      *            an int specifying the top of a range
      */
-    public PassageEvent(Object source, int type, Verse lower, Verse upper) {
+    public PassageEvent(Object source, EventType versesChanged, Verse lower, Verse upper) {
         super(source);
 
-        this.type = type;
+        this.type = versesChanged;
         this.lower = lower;
         this.upper = upper;
 
@@ -72,7 +90,7 @@
      * 
      * @return an int representing the type value
      */
-    public int getType() {
+    public EventType getType() {
         return type;
     }
 
@@ -97,21 +115,6 @@
     }
 
     /**
-     * Identifies one or more changes in the lists contents.
-     */
-    public static final int VERSES_CHANGED = 0;
-
-    /**
-     * Identifies the addition of one or more contiguous items to the list
-     */
-    public static final int VERSES_ADDED = 1;
-
-    /**
-     * Identifies the removal of one or more contiguous items from the list
-     */
-    public static final int VERSES_REMOVED = 2;
-
-    /**
      * When the lower verse is null
      */
     public static final Verse VERSE_LOWEST = new Verse(BibleBook.GEN, 1, 1, true);
@@ -124,7 +127,7 @@
     /**
      * The type of change
      */
-    private int type;
+    private EventType type;
 
     /**
      * The lowest numbered element to have changed




More information about the jsword-svn mailing list