[jsword-svn] common/java/swing/org/crosswire/common/swing s

jswordcvs at crosswire.org jswordcvs at crosswire.org
Sun May 8 18:28:44 MST 2005


Update of /cvs/jsword/common/java/swing/org/crosswire/common/swing
In directory www.crosswire.org:/tmp/cvs-serv5945/java/swing/org/crosswire/common/swing

Modified Files:
	ExceptionShelf.java GuiUtil.java ExceptionPane.java 
	QuickHelpDialog.java GuiConvert.java 
Removed Files:
	DebugContainerListener.java MapTable.java RowTable.java 
	RowColumns.java RowTableModel.java MapCellRenderer.java 
	ListListModel.java SortRenderer.java 
Log Message:
Moved unused code to limbo.
Upgraded support-tools: checkstyle, pmd and findbugs to most recent.
Addressed over 100 issues reported by findbugs and checkstyle.
Resulted in major refactoring of GBFFilter.
Net result is that code size is significantly smaller.

--- RowTableModel.java DELETED ---

--- DebugContainerListener.java DELETED ---

--- RowColumns.java DELETED ---

--- MapTable.java DELETED ---

Index: ExceptionShelf.java
===================================================================
RCS file: /cvs/jsword/common/java/swing/org/crosswire/common/swing/ExceptionShelf.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ExceptionShelf.java	6 Mar 2005 20:21:59 -0000	1.7
--- ExceptionShelf.java	9 May 2005 01:28:42 -0000	1.8
***************
*** 416,431 ****
          public void reportException(final ReporterEvent ev)
          {
!             SwingUtilities.invokeLater(new Runnable()
!             {
!                 public void run()
!                 {
!                     Iterator it = SHELVES.iterator();
!                     while (it.hasNext())
!                     {
!                         ExceptionShelf es = (ExceptionShelf) it.next();
!                         es.addException(ev.getException());
!                     }
!                 }
!             });
          }
  
--- 416,420 ----
          public void reportException(final ReporterEvent ev)
          {
!             SwingUtilities.invokeLater(new ExceptionRunner(ev));
          }
  
***************
*** 435,451 ****
          public void reportMessage(final ReporterEvent ev)
          {
!             SwingUtilities.invokeLater(new Runnable()
              {
!                 public void run()
!                 {
!                     Iterator it = SHELVES.iterator();
!                     while (it.hasNext())
!                     {
!                         ExceptionShelf es = (ExceptionShelf) it.next();
!                         es.addException(new Exception(ev.getMessage()));
!                     }
!                 }
!             });
          }
      }
  }
--- 424,487 ----
          public void reportMessage(final ReporterEvent ev)
          {
!             SwingUtilities.invokeLater(new MessageRunner(ev));
!         }
!     }
! 
!     /**
!      *
!      */
!     private static final class ExceptionRunner implements Runnable
!     {
!         /**
!          * @param ev
!          */
!         public ExceptionRunner(ReporterEvent ev)
!         {
!             event = ev;
!         }
! 
!         /* (non-Javadoc)
!          * @see java.lang.Runnable#run()
!          */
!         public void run()
!         {
!             Iterator it = SHELVES.iterator();
!             while (it.hasNext())
              {
!                 ExceptionShelf es = (ExceptionShelf) it.next();
!                 es.addException(event.getException());
!             }
          }
+ 
+         private ReporterEvent event;
+     }
+ 
+     /**
+      *
+      */
+     private static final class MessageRunner implements Runnable
+     {
+         /**
+          * @param ev
+          */
+         public MessageRunner(ReporterEvent ev)
+         {
+             event = ev;
+         }
+ 
+         /* (non-Javadoc)
+          * @see java.lang.Runnable#run()
+          */
+         public void run()
+         {
+             Iterator it = SHELVES.iterator();
+             while (it.hasNext())
+             {
+                 ExceptionShelf es = (ExceptionShelf) it.next();
+                 es.addException(new Exception(event.getMessage()));
+             }
+         }
+ 
+         private ReporterEvent event;
      }
  }

Index: GuiConvert.java
===================================================================
RCS file: /cvs/jsword/common/java/swing/org/crosswire/common/swing/GuiConvert.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** GuiConvert.java	21 Sep 2004 17:45:47 -0000	1.4
--- GuiConvert.java	9 May 2005 01:28:42 -0000	1.5
***************
*** 70,74 ****
      public static String font2String(Font font)
      {
!         if (font == null || font.equals("")) //$NON-NLS-1$
          {
              return ""; //$NON-NLS-1$
--- 70,74 ----
      public static String font2String(Font font)
      {
!         if (font == null)
          {
              return ""; //$NON-NLS-1$

Index: ExceptionPane.java
===================================================================
RCS file: /cvs/jsword/common/java/swing/org/crosswire/common/swing/ExceptionPane.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** ExceptionPane.java	19 Mar 2005 18:45:07 -0000	1.10
--- ExceptionPane.java	9 May 2005 01:28:42 -0000	1.11
***************
*** 13,16 ****
--- 13,17 ----
  import java.io.File;
  import java.io.FileReader;
+ import java.io.IOException;
  import java.io.LineNumberReader;
  import java.util.ArrayList;
***************
*** 106,116 ****
  
          detail = new JCheckBox();
!         detail.addItemListener(new ItemListener()
!         {
!             public void itemStateChanged(ItemEvent ev)
!             {
!                 changeDetail();
!             }
!         });
          detail.setText(Msg.DETAILS.toString());
  
--- 107,111 ----
  
          detail = new JCheckBox();
!         detail.addItemListener(new SelectedItemListener(this));
          detail.setText(Msg.DETAILS.toString());
  
***************
*** 146,159 ****
          Throwable[] exs = (Throwable[]) causes.toArray(new Throwable[causes.size()]);
  
!         final JComboBox traces = new JComboBox();
          traces.setModel(new DefaultComboBoxModel(exs));
!         traces.addActionListener(new ActionListener()
!         {
!             public void actionPerformed(ActionEvent ev)
!             {
!                 Throwable th = (Throwable) traces.getSelectedItem();
!                 setDisplayedException(th);
!             }
!         });
  
          JPanel heading = new JPanel(new BorderLayout());
--- 141,147 ----
          Throwable[] exs = (Throwable[]) causes.toArray(new Throwable[causes.size()]);
  
!         JComboBox traces = new JComboBox();
          traces.setModel(new DefaultComboBoxModel(exs));
!         traces.addActionListener(new SelectActionListener(this, traces));
  
          JPanel heading = new JPanel(new BorderLayout());
***************
*** 161,164 ****
--- 149,154 ----
  
          JSplitPane split = new FixedSplitPane();
+         // Make the top 20% of the total
+         split.setResizeWeight(0.2D);
          split.setOrientation(JSplitPane.VERTICAL_SPLIT);
          split.setContinuousLayout(true);
***************
*** 351,358 ****
  
      /**
       * List listener to update the contents of the text area
       * whenever someone clicks in the list
       */
!     static class CustomLister implements ListSelectionListener
      {
          /**
--- 341,400 ----
  
      /**
+      *
+      */
+     private static final class SelectedItemListener implements ItemListener
+     {
+         /**
+          * @param ep
+          */
+         public SelectedItemListener(ExceptionPane ep)
+         {
+             pane = ep;
+         }
+ 
+         /* (non-Javadoc)
+          * @see java.awt.event.ItemListener#itemStateChanged(java.awt.event.ItemEvent)
+          */
+         public void itemStateChanged(ItemEvent ev)
+         {
+             pane.changeDetail();
+         }
+ 
+         private ExceptionPane pane;
+     }
+ 
+     /**
+      *
+      */
+     private static final class SelectActionListener implements ActionListener
+     {
+         /**
+          * @param ep
+          * @param cb
+          */
+         public SelectActionListener(ExceptionPane ep, JComboBox cb)
+         {
+             pane = ep;
+             traces = cb;
+         }
+ 
+         /* (non-Javadoc)
+          * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+          */
+         public void actionPerformed(ActionEvent ev)
+         {
+             Throwable th = (Throwable) traces.getSelectedItem();
+             pane.setDisplayedException(th);
+         }
+ 
+         private ExceptionPane pane;
+         private JComboBox traces;
+     }
+ 
+     /**
       * List listener to update the contents of the text area
       * whenever someone clicks in the list
       */
!     private static final class CustomLister implements ListSelectionListener
      {
          /**
***************
*** 412,420 ****
                      int selection_end = 0;
  
                      try
                      {
                          String found = Msg.SOURCE_FOUND.toString(new Object[] { errorLine, file.getCanonicalPath() });
                          mylabel.setText(found);
!                         LineNumberReader in = new LineNumberReader(new FileReader(file));
                          while (true)
                          {
--- 454,463 ----
                      int selection_end = 0;
  
+                     LineNumberReader in = null;
                      try
                      {
                          String found = Msg.SOURCE_FOUND.toString(new Object[] { errorLine, file.getCanonicalPath() });
                          mylabel.setText(found);
!                         in = new LineNumberReader(new FileReader(file));
                          while (true)
                          {
***************
*** 441,444 ****
--- 484,501 ----
                          data.append(ex.getMessage());
                      }
+                     finally
+                     {
+                         if (in != null)
+                         {
+                             try
+                             {
+                                 in.close();
+                             }
+                             catch (IOException e)
+                             {
+                                 data.append(e.getMessage());
+                             }
+                         }
+                     }
  
                      // Actually set the text
***************
*** 482,486 ****
       * The ExceptionPane instance that we add to the Log
       */
!     static class ExceptionPaneReporterListener implements ReporterListener
      {
          /**
--- 539,543 ----
       * The ExceptionPane instance that we add to the Log
       */
!     private static final class ExceptionPaneReporterListener implements ReporterListener
      {
          /**
***************
*** 488,508 ****
           * @param ev The event describing the Exception
           */
!         public void reportException(final ReporterEvent ev)
          {
              // This faf is to ensure that we don't break any SwingThread rules
!             SwingUtilities.invokeLater(new Runnable()
!             {
!                 public void run()
!                 {
!                     if (ev.getSource() instanceof Component)
!                     {
!                         ExceptionPane.showExceptionDialog((Component) ev.getSource(), ev.getException());
!                     }
!                     else
!                     {
!                         ExceptionPane.showExceptionDialog(null, ev.getException());
!                     }
!                 }
!             });
          }
  
--- 545,552 ----
           * @param ev The event describing the Exception
           */
!         public void reportException(ReporterEvent ev)
          {
              // This faf is to ensure that we don't break any SwingThread rules
!             SwingUtilities.invokeLater(new ExceptionRunner(ev));
          }
  
***************
*** 511,535 ****
           * @param ev The event describing the message
           */
!         public void reportMessage(final ReporterEvent ev)
          {
              // This faf is to ensure that we don't break any SwingThread rules
!             SwingUtilities.invokeLater(new Runnable()
!             {
!                 public void run()
!                 {
!                     if (ev.getSource() instanceof Component)
!                     {
!                         JOptionPane.showMessageDialog((Component) ev.getSource(), ev.getMessage());
!                     }
!                     else
!                     {
!                         JOptionPane.showMessageDialog(null, ev.getMessage());
!                     }
!                 }
!             });
          }
      }
  
      /**
       * The exception we are displaying
       */
--- 555,627 ----
           * @param ev The event describing the message
           */
!         public void reportMessage(ReporterEvent ev)
          {
              // This faf is to ensure that we don't break any SwingThread rules
!             SwingUtilities.invokeLater(new MessageRunner(ev));
          }
      }
  
      /**
+     *
+     */
+    private static final class ExceptionRunner implements Runnable
+    {
+        /**
+         * @param ev
+         */
+        public ExceptionRunner(ReporterEvent ev)
+        {
+            event = ev;
+        }
+ 
+        /* (non-Javadoc)
+         * @see java.lang.Runnable#run()
+         */
+        public void run()
+        {
+            if (event.getSource() instanceof Component)
+            {
+                showExceptionDialog((Component) event.getSource(), event.getException());
+            }
+            else
+            {
+                showExceptionDialog(null, event.getException());
+            }
+        }
+ 
+        private ReporterEvent event;
+    }
+ 
+    /**
+      *
+      */
+     private static final class MessageRunner implements Runnable
+     {
+         /**
+          * @param ev
+          */
+         public MessageRunner(ReporterEvent ev)
+         {
+             event = ev;
+         }
+ 
+         /* (non-Javadoc)
+          * @see java.lang.Runnable#run()
+          */
+         public void run()
+         {
+             if (event.getSource() instanceof Component)
+             {
+                 JOptionPane.showMessageDialog((Component) event.getSource(), event.getMessage());
+             }
+             else
+             {
+                 JOptionPane.showMessageDialog(null, event.getMessage());
+             }
+         }
+ 
+         private ReporterEvent event;
+     }
+     /**
       * The exception we are displaying
       */

--- SortRenderer.java DELETED ---

Index: GuiUtil.java
===================================================================
RCS file: /cvs/jsword/common/java/swing/org/crosswire/common/swing/GuiUtil.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** GuiUtil.java	3 Apr 2005 04:07:36 -0000	1.8
--- GuiUtil.java	9 May 2005 01:28:42 -0000	1.9
***************
*** 403,409 ****
       * @param win The window to be packed
       * @param maxx The maximum fraction (0.0 to 1.0) of the screen to be taken
!      * up horizontally (-1 means no restrictions to the horizontal alterations)
       * @param maxy The maximum fraction (0.0 to 1.0) of the screen to be taken
!      * up vertically (-1 means no restrictions to the vertical alterations)
       * @see GuiUtil#restrainedRePack(Window)
       */
--- 403,409 ----
       * @param win The window to be packed
       * @param maxx The maximum fraction (0.0 to 1.0) of the screen to be taken
!      * up horizontally
       * @param maxy The maximum fraction (0.0 to 1.0) of the screen to be taken
!      * up vertically
       * @see GuiUtil#restrainedRePack(Window)
       */
***************
*** 415,419 ****
  
          // If the window is wider than the screen, clip it
!         if (maxx != -1 && win.getSize().width > (screen_dim.width * maxx))
          {
              win.setSize((int) (screen_dim.width * maxx), win.getSize().height);
--- 415,419 ----
  
          // If the window is wider than the screen, clip it
!         if (win.getSize().width > (screen_dim.width * maxx))
          {
              win.setSize((int) (screen_dim.width * maxx), win.getSize().height);
***************
*** 421,425 ****
  
          // If the window is taller than the screen, clip it
!         if (maxy != -1 && win.getSize().height > (screen_dim.height * maxy))
          {
              win.setSize(win.getSize().width, (int) (screen_dim.height * maxy));
--- 421,425 ----
  
          // If the window is taller than the screen, clip it
!         if (win.getSize().height > (screen_dim.height * maxy))
          {
              win.setSize(win.getSize().width, (int) (screen_dim.height * maxy));

Index: QuickHelpDialog.java
===================================================================
RCS file: /cvs/jsword/common/java/swing/org/crosswire/common/swing/QuickHelpDialog.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** QuickHelpDialog.java	6 Mar 2005 20:21:59 -0000	1.3
--- QuickHelpDialog.java	9 May 2005 01:28:42 -0000	1.4
***************
*** 137,141 ****
      private static final String OK = "OK"; //$NON-NLS-1$
  
!     private ActionFactory actions;
  
      private JEditorPane txtHelp;
--- 137,141 ----
      private static final String OK = "OK"; //$NON-NLS-1$
  
!     private transient ActionFactory actions;
  
      private JEditorPane txtHelp;

--- MapCellRenderer.java DELETED ---

--- ListListModel.java DELETED ---

--- RowTable.java DELETED ---



More information about the jsword-svn mailing list