[jsword-svn] bibledesktop/java/main/org/crosswire/bibledesktop/passage s

jswordcvs at crosswire.org jswordcvs at crosswire.org
Sat Jun 4 20:46:45 MST 2005


Update of /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/passage
In directory www.crosswire.org:/tmp/cvs-serv6631/java/main/org/crosswire/bibledesktop/passage

Modified Files:
	KeySidebar.java 
Log Message:
Improved blurring.

Index: KeySidebar.java
===================================================================
RCS file: /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/passage/KeySidebar.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** KeySidebar.java	17 May 2005 00:44:31 -0000	1.11
--- KeySidebar.java	5 Jun 2005 03:46:43 -0000	1.12
***************
*** 25,28 ****
--- 25,30 ----
  import java.awt.FlowLayout;
  import java.util.ArrayList;
+ import java.util.Arrays;
+ import java.util.Iterator;
  import java.util.List;
  
***************
*** 39,42 ****
--- 41,45 ----
  import org.crosswire.bibledesktop.book.DisplaySelectListener;
  import org.crosswire.common.swing.ActionFactory;
+ import org.crosswire.common.swing.GuiUtil;
  import org.crosswire.common.util.Reporter;
  import org.crosswire.jsword.book.Book;
***************
*** 138,148 ****
      /**
       * Blur (expand) the current key action by amount verses on each side.
!      * This bound by the boundaries of the Chapter.
       * @param amount The amount of blurring
       */
      private void doBlur(int amount)
      {
!         key.blur(amount, RestrictionType.CHAPTER);
!         fireKeyChanged(new KeyChangeEvent(this, key));
      }
  
--- 141,200 ----
      /**
       * Blur (expand) the current key action by amount verses on each side.
!      * This bound by the default Blur Restriction.
       * @param amount The amount of blurring
       */
      private void doBlur(int amount)
      {
!         // Remember what was selected
!         List selected = new ArrayList(Arrays.asList(list.getSelectedValues()));
! 
!         // Make sure that key changes are not visible until blur is done.
!         Key copy = (Key) key.clone();
! 
!         // Either blur the entire unselected list or just the selected elements.
!         if (selected.isEmpty())
!         {
!             copy.blur(amount, RestrictionType.getDefaultBlurRestriction());
!         }
!         else
!         {
!             Iterator iter = selected.iterator();
!             while (iter.hasNext())
!             {
!                 Key k = (Key) iter.next();
!                 // Create a copy so the selection can be restored
!                 Key keyCopy = (Key) k.clone();
!                 keyCopy.blur(amount, RestrictionType.getDefaultBlurRestriction());
!                 copy.addAll(keyCopy);
!             }
!         }
!         fireKeyChanged(new KeyChangeEvent(this, copy));
! 
!         // Restore the selection
!         int total = model.getSize();
!         for (int i = 0; i < total; i++)
!         {
!             Key listedKey = (Key) model.getElementAt(i);
!             
!             // As keys are found, remove them
!             Iterator iter = selected.iterator();
!             while (iter.hasNext())
!             {
!                 Key selectedKey = (Key) iter.next();
!                 if (listedKey.contains(selectedKey))
!                 {
!                     list.addSelectionInterval(i, i);
!                     iter.remove();
!                 }
!             }
!             
!             // If the list is empty then we are done.
!             if (selected.size() == 0)
!             {
!                 break;
!             }
!         }
! 
!         GuiUtil.refresh(this);
      }
  
***************
*** 188,191 ****
--- 240,244 ----
          model.setPassage((Passage) key);
          fireKeyChanged(new KeyChangeEvent(this, key));
+         setActive();
      }
  



More information about the jsword-svn mailing list