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

jswordcvs at crosswire.org jswordcvs at crosswire.org
Tue Mar 22 05:39:58 MST 2005


Update of /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/book/install
In directory www.crosswire.org:/tmp/cvs-serv9891/java/main/org/crosswire/bibledesktop/book/install

Modified Files:
	Msg.java TextPaneBookMetaDataDisplay.java SitePane.properties 
	SitePane.java Msg.properties 
Log Message:
changed calls like book.getBookMetaData().xxx() to book.xxx().
Added a "Remove Index" button on the Book Installer.

Index: Msg.properties
===================================================================
RCS file: /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/book/install/Msg.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Msg.properties	19 Mar 2005 01:57:09 -0000	1.2
--- Msg.properties	22 Mar 2005 12:39:56 -0000	1.3
***************
*** 20,23 ****
--- 20,27 ----
  SitePane.AvailableDesc={0} books available for download.
  SitePane.NoneAvailableDesc=<html><b>Click ''Update Available Books'' to download an up to date book list.</b>
+ SitePane.ConfirmDeleteTitle=Delete Book
+ SitePane.ConfirmDeleteBook=Are you sure you want to delete {0}?
+ SitePane.ConfirmUninstallTitle=Remove Index for Book
+ SitePane.ConfirmUninstallBook=Are you sure you want to remove the index for {0}?
  
  EditSitePane.EditSitesTitle=Edit Update Sites
***************
*** 26,30 ****
  EditSitePane.NoSelectedSite=No selected site to edit
  EditSitePane.NoSite=No Site
! EditSitePane.ConfirmDeleteSite=Are you sure you want to delete {0}
  EditSitePane.DeleteSite=Delete Site?
  
--- 30,34 ----
  EditSitePane.NoSelectedSite=No selected site to edit
  EditSitePane.NoSite=No Site
! EditSitePane.ConfirmDeleteSite=Are you sure you want to delete {0}?
  EditSitePane.DeleteSite=Delete Site?
  

Index: SitePane.properties
===================================================================
RCS file: /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/book/install/SitePane.properties,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** SitePane.properties	19 Mar 2005 01:57:09 -0000	1.2
--- SitePane.properties	22 Mar 2005 12:39:56 -0000	1.3
***************
*** 31,39 ****
  
  Delete.Enabled=false
! Delete.Name=Delete
  Delete.ShortDescription=Delete a book.
  Delete.LongDescription=Delete the selected book
  Delete.MnemonicKey=D
  
  Install.Enabled=false
  Install.Name=Install
--- 31,45 ----
  
  Delete.Enabled=false
! Delete.Name=Delete Book
  Delete.ShortDescription=Delete a book.
  Delete.LongDescription=Delete the selected book
  Delete.MnemonicKey=D
  
+ Unindex.Enabled=false
+ Unindex.Name=Remove Index
+ Unindex.ShortDescription=Unindex a book.
+ Unindex.LongDescription=Remove the index of the selected book
+ Unindex.MnemonicKey=R
+ 
  Install.Enabled=false
  Install.Name=Install

Index: Msg.java
===================================================================
RCS file: /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/book/install/Msg.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Msg.java	19 Mar 2005 01:57:09 -0000	1.2
--- Msg.java	22 Mar 2005 12:39:56 -0000	1.3
***************
*** 39,42 ****
--- 39,46 ----
      static final Msg AVAILABLE_DESC = new Msg("SitePane.AvailableDesc"); //$NON-NLS-1$
      static final Msg NONE_AVAILABLE_DESC = new Msg("SitePane.NoneAvailableDesc"); //$NON-NLS-1$
+     static final Msg CONFIRM_DELETE_TITLE = new Msg("SitePane.ConfirmDeleteTitle"); //$NON-NLS-1$
+     static final Msg CONFIRM_DELETE_BOOK = new Msg("SitePane.ConfirmDeleteBook"); //$NON-NLS-1$
+     static final Msg CONFIRM_UNINSTALL_TITLE = new Msg("SitePane.ConfirmUninstallTitle"); //$NON-NLS-1$
+     static final Msg CONFIRM_UNINSTALL_BOOK = new Msg("SitePane.ConfirmUninstallBook"); //$NON-NLS-1$
  
      static final Msg EDIT_SITE_TITLE = new Msg("EditSitePane.EditSitesTitle"); //$NON-NLS-1$

Index: SitePane.java
===================================================================
RCS file: /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/book/install/SitePane.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** SitePane.java	20 Mar 2005 02:34:57 -0000	1.6
--- SitePane.java	22 Mar 2005 12:39:56 -0000	1.7
***************
*** 266,269 ****
--- 266,270 ----
          {
              panel.add(new JButton(actions.getAction(DELETE)));
+             panel.add(new JButton(actions.getAction(UNINDEX)));
          }
          return panel;
***************
*** 286,299 ****
          try
          {
!             book.getBookMetaData().getDriver().delete(book);
  
              IndexManager imanager = IndexManagerFactory.getIndexManager();
              if (imanager.isIndexed(book))
              {
!                 imanager.deleteIndex(book);
              }
! //            // unselect it and then remove from list.
! //            treAvailable.removeSelectionPath(path);
! //            ((DefaultTreeModel)treAvailable.getModel()).removeNodeFromParent((MutableTreeNode) last);
          }
          catch (BookException e)
--- 287,336 ----
          try
          {
!             if (JOptionPane.showConfirmDialog(this, Msg.CONFIRM_DELETE_BOOK.toString(new Object[] {book.getName()}),
!                             Msg.CONFIRM_DELETE_TITLE.toString(),
!                             JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)
!             {
!                 book.getDriver().delete(book);
! 
!                 IndexManager imanager = IndexManagerFactory.getIndexManager();
!                 if (imanager.isIndexed(book))
!                 {
!                     imanager.deleteIndex(book);
!                 }
!             }
!         }
!         catch (BookException e)
!         {
!             Reporter.informUser(this, e);
!         }
!     }
! 
!     /**
!      * Delete the current book
!      */
!     public void doUnindex()
!     {
!         TreePath path = treAvailable.getSelectionPath();
!         if (path == null)
!         {
!             return;
!         }
  
+         Object last = path.getLastPathComponent();
+         Book book = getBook(last);
+ 
+         try
+         {
              IndexManager imanager = IndexManagerFactory.getIndexManager();
              if (imanager.isIndexed(book))
              {
!                 if (JOptionPane.showConfirmDialog(this, Msg.CONFIRM_UNINSTALL_BOOK.toString(new Object[] {book.getName()}),
!                                 Msg.CONFIRM_UNINSTALL_TITLE.toString(),
!                                 JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)
!                 {
!                     imanager.deleteIndex(book);
!                 }
              }
!             actions.getAction(UNINDEX).setEnabled(imanager.isIndexed(book));
          }
          catch (BookException e)
***************
*** 344,356 ****
          {
              // Is the book already installed? Then nothing to do.
!             Book book = Books.installed().getBook(name.getBookMetaData().getName());
              if (book != null && !installer.isNewer(name))
              {
!                 Reporter.informUser(this, Msg.INSTALLED, name.getBookMetaData().getName());
                  return;
              }
  
              float size = NetUtil.getSize(installer.toRemoteURL(name)) / 1024.0F;
!             if (JOptionPane.showConfirmDialog(this, Msg.SIZE.toString(new Object[] {name.getBookMetaData().getName(), new Float(size)}),
                              Msg.CONFIRMATION_TITLE.toString(),
                              JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)
--- 381,393 ----
          {
              // Is the book already installed? Then nothing to do.
!             Book book = Books.installed().getBook(name.getName());
              if (book != null && !installer.isNewer(name))
              {
!                 Reporter.informUser(this, Msg.INSTALLED, name.getName());
                  return;
              }
  
              float size = NetUtil.getSize(installer.toRemoteURL(name)) / 1024.0F;
!             if (JOptionPane.showConfirmDialog(this, Msg.SIZE.toString(new Object[] {name.getName(), new Float(size)}),
                              Msg.CONFIRMATION_TITLE.toString(),
                              JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION)
***************
*** 408,412 ****
--- 445,451 ----
          display.setBook(book);
  
+         IndexManager imanager = IndexManagerFactory.getIndexManager();
          actions.getAction(DELETE).setEnabled(bookSelected && book.getDriver().isDeletable(book));
+         actions.getAction(UNINDEX).setEnabled(bookSelected && imanager.isIndexed(book));
          actions.getAction(INSTALL).setEnabled(bookSelected);
          actions.getAction(INSTALL_SEARCH).setEnabled(bookSelected && book.getType() == BookType.BIBLE);
***************
*** 448,451 ****
--- 487,491 ----
      private static final String INSTALL_SEARCH = "InstallSearch"; //$NON-NLS-1$
      private static final String DELETE = "Delete"; //$NON-NLS-1$
+     private static final String UNINDEX = "Unindex"; //$NON-NLS-1$
  
      /**

Index: TextPaneBookMetaDataDisplay.java
===================================================================
RCS file: /cvs/jsword/bibledesktop/java/main/org/crosswire/bibledesktop/book/install/TextPaneBookMetaDataDisplay.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** TextPaneBookMetaDataDisplay.java	19 Mar 2005 01:57:09 -0000	1.3
--- TextPaneBookMetaDataDisplay.java	22 Mar 2005 12:39:56 -0000	1.4
***************
*** 69,73 ****
          {
  
!             SAXEventProvider osissep = new JDOMSAXEventProvider(book.getBookMetaData().toOSIS());
              TransformingSAXEventProvider htmlsep = (TransformingSAXEventProvider) converter.convert(osissep);
              String text = XMLUtil.writeToString(htmlsep);
--- 69,73 ----
          {
  
!             SAXEventProvider osissep = new JDOMSAXEventProvider(book.toOSIS());
              TransformingSAXEventProvider htmlsep = (TransformingSAXEventProvider) converter.convert(osissep);
              String text = XMLUtil.writeToString(htmlsep);



More information about the jsword-svn mailing list