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

jswordcvs at crosswire.org jswordcvs at crosswire.org
Sun Nov 28 14:34:21 MST 2004


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

Modified Files:
	UpperCaseDocument.java TextViewPanel.java DeckLayout.java 
	MoneyDocument.java 
Log Message:
intellij refactor - not critical

Index: UpperCaseDocument.java
===================================================================
RCS file: /cvs/jsword/jsword-support/java/limbo/org/crosswire/common/swing/UpperCaseDocument.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** UpperCaseDocument.java	25 Jun 2004 11:19:26 -0000	1.1
--- UpperCaseDocument.java	28 Nov 2004 21:34:19 -0000	1.2
***************
*** 1,3 ****
- 
  package org.crosswire.common.swing;
  
--- 1,2 ----
***************
*** 34,41 ****
  public class UpperCaseDocument extends PlainDocument
  {
-     // DEAD(DM): This class is not used. Find a use for it or delete it.
      /**
!     * Override insertString to force upper case
!     */
      public void insertString(int offs, String str, AttributeSet att) throws BadLocationException
      {
--- 33,39 ----
  public class UpperCaseDocument extends PlainDocument
  {
      /**
!      * Override insertString to force upper case
!      */
      public void insertString(int offs, String str, AttributeSet att) throws BadLocationException
      {
***************
*** 50,52 ****
          super.insertString(offs, new String(upper), att);
      }
! }
--- 48,55 ----
          super.insertString(offs, new String(upper), att);
      }
! 
!     /**
!      * Serialization ID
!      */
!     private static final long serialVersionUID = 4051324548165284660L;
! }
\ No newline at end of file

Index: DeckLayout.java
===================================================================
RCS file: /cvs/jsword/jsword-support/java/limbo/org/crosswire/common/swing/DeckLayout.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** DeckLayout.java	25 Sep 2004 21:27:13 -0000	1.3
--- DeckLayout.java	28 Nov 2004 21:34:19 -0000	1.4
***************
*** 1,12 ****
  package org.crosswire.common.swing;
  
- import java.awt.Insets;
- import java.awt.Dimension;
  import java.awt.Component;
  import java.awt.Container;
  import java.awt.LayoutManager2;
  import java.io.Serializable;
! import java.util.Hashtable;
! import java.util.Enumeration;
  
  /**
--- 1,13 ----
  package org.crosswire.common.swing;
  
  import java.awt.Component;
  import java.awt.Container;
+ import java.awt.Dimension;
+ import java.awt.Insets;
  import java.awt.LayoutManager2;
  import java.io.Serializable;
! import java.util.HashMap;
! import java.util.Iterator;
! import java.util.Map;
  
  /**
***************
*** 46,53 ****
  public class DeckLayout extends AbstractLayout implements LayoutManager2, Serializable
  {
!     protected Hashtable tab = new Hashtable();
!     protected int count = 0;
!     protected boolean wrap = false;
! 
      public DeckLayout()
      {
--- 47,53 ----
  public class DeckLayout extends AbstractLayout implements LayoutManager2, Serializable
  {
!     /**
!      * 
!      */
      public DeckLayout()
      {
***************
*** 55,58 ****
--- 55,61 ----
      }
  
+     /**
+      * @param wrap
+      */
      public DeckLayout(boolean wrap)
      {
***************
*** 60,63 ****
--- 63,70 ----
      }
  
+     /**
+      * @param hgap
+      * @param vgap
+      */
      public DeckLayout(int hgap, int vgap)
      {
***************
*** 65,68 ****
--- 72,80 ----
      }
  
+     /**
+      * @param hgap
+      * @param vgap
+      * @param wrap
+      */
      public DeckLayout(int hgap, int vgap, boolean wrap)
      {
***************
*** 72,84 ****
  
      /**
!     * Adds the specified component to this deck layout's internal
!     * table, by name. The object specified by constraints must be
!     * a string. The deck layout stores this string as a key-value
!     * pair that can be used for random access to a particular card.
!     * By calling the show method, an application can display the
!     * component with the specified name.
!     * @param comp The component to be added.
!     * @param constraints A name that identifies the component
!     */
      public void addLayoutComponent(Component comp, Object constraints)
      {
--- 84,96 ----
  
      /**
!      * Adds the specified component to this deck layout's internal
!      * table, by name. The object specified by constraints must be
!      * a string. The deck layout stores this string as a key-value
!      * pair that can be used for random access to a particular card.
!      * By calling the show method, an application can display the
!      * component with the specified name.
!      * @param comp The component to be added.
!      * @param constraints A name that identifies the component
!      */
      public void addLayoutComponent(Component comp, Object constraints)
      {
***************
*** 94,106 ****
  
      /**
!     * Removes the specified component from the layout.
!     * @param comp The component to be removed.
!     */
      public void removeLayoutComponent(Component comp)
      {
!         Enumeration enum = tab.keys();
!         while(enum.hasMoreElements())
          {
!             String key = (String)enum.nextElement();
              if (tab.get(key) == comp)
              {
--- 106,118 ----
  
      /**
!      * Removes the specified component from the layout.
!      * @param comp The component to be removed.
!      */
      public void removeLayoutComponent(Component comp)
      {
!         Iterator it = tab.keySet().iterator();
!         while(it.hasNext())
          {
!             String key = (String) it.next();
              if (tab.get(key) == comp)
              {
***************
*** 113,120 ****
  
      /**
!     * Calculates the preferred size for the specified panel.
!     * @param parent The name of the parent container
!     * @return minimum dimensions required to lay out the components.
!     */
      public Dimension preferredLayoutSize(Container parent)
      {
--- 125,132 ----
  
      /**
!      * Calculates the preferred size for the specified panel.
!      * @param parent The name of the parent container
!      * @return minimum dimensions required to lay out the components.
!      */
      public Dimension preferredLayoutSize(Container parent)
      {
***************
*** 143,150 ****
  
      /**
!     * Calculates the minimum size for the specified panel.
!     * @param parent The name of the parent container
!     * @return minimum dimensions required to lay out the components.
!     */
      public Dimension minimumLayoutSize(Container parent)
      {
--- 155,162 ----
  
      /**
!      * Calculates the minimum size for the specified panel.
!      * @param parent The name of the parent container
!      * @return minimum dimensions required to lay out the components.
!      */
      public Dimension minimumLayoutSize(Container parent)
      {
***************
*** 173,182 ****
  
      /**
!     * Lays out the specified container using this deck layout.
!     * Each component in the parent container is reshaped to be
!     * the same size as the container, minus insets, horizontal
!     * and vertical gaps.
!     * @param parent The name of the parent container
!     */
      public void layoutContainer(Container parent)
      {
--- 185,194 ----
  
      /**
!      * Lays out the specified container using this deck layout.
!      * Each component in the parent container is reshaped to be
!      * the same size as the container, minus insets, horizontal
!      * and vertical gaps.
!      * @param parent The name of the parent container
!      */
      public void layoutContainer(Container parent)
      {
***************
*** 196,202 ****
  
      /**
!     * Make sure that the Container really has this layout installed,
!     * to avoid serious problems.
!     */
      private void checkLayout(Container parent)
      {
--- 208,214 ----
  
      /**
!      * Make sure that the Container really has this layout installed,
!      * to avoid serious problems.
!      */
      private void checkLayout(Container parent)
      {
***************
*** 208,218 ****
  
      /**
!     * Enable or disable the specified component and all its children.
!     * This makes focus traversal function properly. The side effect
!     * is that all children are enabled or disabled and specific
!     * contexts are not maintained. You can get around this by
!     * intercepting setEnabled in your component to restore state
!     * if this is important in your context.
!     */
      private void setActive(Component comp, boolean enabled)
      {
--- 220,230 ----
  
      /**
!      * Enable or disable the specified component and all its children.
!      * This makes focus traversal function properly. The side effect
!      * is that all children are enabled or disabled and specific
!      * contexts are not maintained. You can get around this by
!      * intercepting setEnabled in your component to restore state
!      * if this is important in your context.
!      */
      private void setActive(Component comp, boolean enabled)
      {
***************
*** 231,237 ****
  
      /**
!     * Flips to the first card of the container.
!     * @param parent The name of the parent container
!     */
      public void first(Container parent)
      {
--- 243,249 ----
  
      /**
!      * Flips to the first card of the container.
!      * @param parent The name of the parent container
!      */
      public void first(Container parent)
      {
***************
*** 256,265 ****
  
      /**
!     * Flips to the next card of the specified container. If the
!     * currently visible card is the last one, this method flips
!     * to the first card in the layout.
!     * @param parent The name of the parent container
!     * @return Index of the selected component
!     */
      public int next(Container parent)
      {
--- 268,277 ----
  
      /**
!      * Flips to the next card of the specified container. If the
!      * currently visible card is the last one, this method flips
!      * to the first card in the layout.
!      * @param parent The name of the parent container
!      * @return Index of the selected component
!      */
      public int next(Container parent)
      {
***************
*** 287,296 ****
  
      /**
!     * Flips to the previous card of the specified container. If the
!     * currently visible card is the first one, this method flips to
!     * the last card in the layout.
!     * @param parent The name of the parent container
!     * @return Index of the selected component
!     */
      public int previous(Container parent)
      {
--- 299,308 ----
  
      /**
!      * Flips to the previous card of the specified container. If the
!      * currently visible card is the first one, this method flips to
!      * the last card in the layout.
!      * @param parent The name of the parent container
!      * @return Index of the selected component
!      */
      public int previous(Container parent)
      {
***************
*** 318,324 ****
  
      /**
!     * Flips to the last card of the container.
!     * @param parent The name of the parent container
!     */
      public void last(Container parent)
      {
--- 330,336 ----
  
      /**
!      * Flips to the last card of the container.
!      * @param parent The name of the parent container
!      */
      public void last(Container parent)
      {
***************
*** 343,351 ****
  
      /**
!     * Flips to the component that was added to this layout using
!     * the specified name. If no such component exists, nothing happens.
!     * @param parent The name of the parent container in which to do the layout.
!     * @param name The component name.
!     */
      public void show(Container parent, String name)
      {
--- 355,363 ----
  
      /**
!      * Flips to the component that was added to this layout using
!      * the specified name. If no such component exists, nothing happens.
!      * @param parent The name of the parent container in which to do the layout.
!      * @param name The component name.
!      */
      public void show(Container parent, String name)
      {
***************
*** 373,381 ****
  
      /**
!     * Flips to the component at the numbered position. If no such
!     * component exists, nothing happens.
!     * @param parent The name of the parent container in which to do the layout.
!     * @param index The index (between 0 and component count - 1)
!     */
      public void show(Container parent, int index)
      {
--- 385,393 ----
  
      /**
!      * Flips to the component at the numbered position. If no such
!      * component exists, nothing happens.
!      * @param parent The name of the parent container in which to do the layout.
!      * @param index The index (between 0 and component count - 1)
!      */
      public void show(Container parent, int index)
      {
***************
*** 402,405 ****
--- 414,421 ----
      }
  
+     /**
+      * @param name
+      * @return
+      */
      public Component getComponent(String name)
      {
***************
*** 407,422 ****
      }
  
      public String getName(Container parent, int index)
      {
          Component comp = parent.getComponent(index);
-         Enumeration keys = tab.keys();
-         Enumeration enum = tab.elements();
-         String key;
  
!         while (enum.hasMoreElements())
          {
!             key = (String) keys.nextElement();
!             if (comp == enum.nextElement())
                  return key;
          }
  
--- 423,444 ----
      }
  
+     /**
+      * @param parent
+      * @param index
+      * @return
+      */
      public String getName(Container parent, int index)
      {
          Component comp = parent.getComponent(index);
  
!         Iterator it = tab.keySet().iterator();
!         while (it.hasNext())
          {
!             String key = (String) it.next();
!             Object val = tab.get(key);
!             if (comp == val)
!             {
                  return key;
+             }
          }
  
***************
*** 424,427 ****
--- 446,454 ----
      }
  
+     /**
+      * @param parent
+      * @param name
+      * @return
+      */
      public int getIndex(Container parent, String name)
      {
***************
*** 435,437 ****
--- 462,473 ----
          return -1;
      }
+ 
+     protected Map tab = new HashMap();
+     protected int count = 0;
+     protected boolean wrap = false;
+ 
+     /**
+      * Serialization ID
+      */
+     private static final long serialVersionUID = 3256444715787105330L;
  }

Index: TextViewPanel.java
===================================================================
RCS file: /cvs/jsword/jsword-support/java/limbo/org/crosswire/common/swing/TextViewPanel.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** TextViewPanel.java	8 Aug 2004 11:39:35 -0000	1.2
--- TextViewPanel.java	28 Nov 2004 21:34:19 -0000	1.3
***************
*** 59,63 ****
  public class TextViewPanel extends JPanel
  {
!     /**
       * Construct a TextViewPanel by calling jbInit()
       */
--- 59,63 ----
  public class TextViewPanel extends JPanel
  {
! 	/**
       * Construct a TextViewPanel by calling jbInit()
       */
***************
*** 138,147 ****
      private void jbInit()
      {
!         scr_text.getViewport().add(txt_text, null);
!         txt_text.setEditable(false);
!         txt_text.setColumns(80);
!         txt_text.setRows(24);
  
!         btn_clipboard.addActionListener(new ActionListener()
          {
              public void actionPerformed(ActionEvent ev)
--- 138,147 ----
      private void jbInit()
      {
!         scrText.getViewport().add(txtText, null);
!         txtText.setEditable(false);
!         txtText.setColumns(80);
!         txtText.setRows(24);
  
!         btnClipboard.addActionListener(new ActionListener()
          {
              public void actionPerformed(ActionEvent ev)
***************
*** 150,162 ****
              }
          });
!         btn_clipboard.setText("Copy"); //$NON-NLS-1$
  
!         lay_buttons.setAlignment(FlowLayout.RIGHT);
!         pnl_buttons.setLayout(lay_buttons);
!         pnl_buttons.add(btn_clipboard, null);
  
          this.setLayout(new BorderLayout());
!         this.add(scr_text, BorderLayout.CENTER);
!         this.add(pnl_buttons, BorderLayout.SOUTH);
      }
  
--- 150,162 ----
              }
          });
!         btnClipboard.setText("Copy"); //$NON-NLS-1$
  
!         layButtons.setAlignment(FlowLayout.RIGHT);
!         pnlButtons.setLayout(layButtons);
!         pnlButtons.add(btnClipboard, null);
  
          this.setLayout(new BorderLayout());
!         this.add(scrText, BorderLayout.CENTER);
!         this.add(pnlButtons, BorderLayout.SOUTH);
      }
  
***************
*** 168,174 ****
          frame = new JDialog(parent, "Text Viewer"); //$NON-NLS-1$
  
!         btn_close = new JButton(Msg.CLOSE.toString());
!         btn_close.setMnemonic(Msg.CLOSE.toString().charAt(0));
!         btn_close.addActionListener(new ActionListener()
          {
              public void actionPerformed(ActionEvent ev)
--- 168,174 ----
          frame = new JDialog(parent, "Text Viewer"); //$NON-NLS-1$
  
!         btnClose = new JButton(Msg.CLOSE.toString());
!         btnClose.setMnemonic(Msg.CLOSE.toString().charAt(0));
!         btnClose.addActionListener(new ActionListener()
          {
              public void actionPerformed(ActionEvent ev)
***************
*** 178,182 ****
              }
          });
!         pnl_buttons.add(btn_close, null);
  
          this.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
--- 178,182 ----
              }
          });
!         pnlButtons.add(btnClose, null);
  
          this.setBorder(BorderFactory.createEmptyBorder(5, 5, 0, 5));
***************
*** 206,219 ****
      public void setHeader(String new_header)
      {
!         String old_header = lbl_main.getText();
!         lbl_main.setText(new_header);
  
          if (new_header != null)
          {
!             this.add(lbl_main, BorderLayout.NORTH);
          }
          else
          {
!             this.remove(lbl_main);
          }
  
--- 206,219 ----
      public void setHeader(String new_header)
      {
!         String old_header = lblMain.getText();
!         lblMain.setText(new_header);
  
          if (new_header != null)
          {
!             this.add(lblMain, BorderLayout.NORTH);
          }
          else
          {
!             this.remove(lblMain);
          }
  
***************
*** 227,231 ****
      public String getHeader()
      {
!         return lbl_main.getText();
      }
  
--- 227,231 ----
      public String getHeader()
      {
!         return lblMain.getText();
      }
  
***************
*** 235,239 ****
      public void setEditable(boolean editable)
      {
!         txt_text.setEditable(editable);
      }
  
--- 235,239 ----
      public void setEditable(boolean editable)
      {
!         txtText.setEditable(editable);
      }
  
***************
*** 243,247 ****
      public boolean isEditable()
      {
!         return txt_text.isEditable();
      }
  
--- 243,247 ----
      public boolean isEditable()
      {
!         return txtText.isEditable();
      }
  
***************
*** 252,258 ****
      public void setText(String new_text)
      {
!         String old_text = txt_text.getText();
!         txt_text.setText(new_text);
!         txt_text.setCaretPosition(0);
  
          if (frame != null)
--- 252,258 ----
      public void setText(String new_text)
      {
!         String old_text = txtText.getText();
!         txtText.setText(new_text);
!         txtText.setCaretPosition(0);
  
          if (frame != null)
***************
*** 328,332 ****
      public String getText()
      {
!         return txt_text.getText();
      }
  
--- 328,332 ----
      public String getText()
      {
!         return txtText.getText();
      }
  
***************
*** 354,388 ****
       * Optional header label
       */
!     private JLabel lbl_main = new JLabel();
  
      /**
       * Scroller for the text area
       */
!     private JScrollPane scr_text = new JScrollPane();
  
      /**
       * The main text area
       */
!     private JTextArea txt_text = new JTextArea();
  
      /**
       * The button bar
       */
!     private JPanel pnl_buttons = new JPanel();
  
      /**
       * Button bar layout
       */
!     private FlowLayout lay_buttons = new FlowLayout();
  
      /**
       * Copy text to clipboard button
       */
!     private JButton btn_clipboard = new JButton();
  
      /**
       * Close button
       */
!     private JButton btn_close = null;
  
      /**
--- 354,388 ----
       * Optional header label
       */
!     private JLabel lblMain = new JLabel();
  
      /**
       * Scroller for the text area
       */
!     private JScrollPane scrText = new JScrollPane();
  
      /**
       * The main text area
       */
!     private JTextArea txtText = new JTextArea();
  
      /**
       * The button bar
       */
!     private JPanel pnlButtons = new JPanel();
  
      /**
       * Button bar layout
       */
!     private FlowLayout layButtons = new FlowLayout();
  
      /**
       * Copy text to clipboard button
       */
!     private JButton btnClipboard = new JButton();
  
      /**
       * Close button
       */
!     private JButton btnClose = null;
  
      /**
***************
*** 395,397 ****
       */
      private transient PropertyChangeSupport listeners = new PropertyChangeSupport(this);
! }
\ No newline at end of file
--- 395,402 ----
       */
      private transient PropertyChangeSupport listeners = new PropertyChangeSupport(this);
! 
!     /**
!      * Serialization ID
!      */
!     private static final long serialVersionUID = 3616727167011206964L;
! }

Index: MoneyDocument.java
===================================================================
RCS file: /cvs/jsword/jsword-support/java/limbo/org/crosswire/common/swing/MoneyDocument.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** MoneyDocument.java	25 Sep 2004 21:27:13 -0000	1.3
--- MoneyDocument.java	28 Nov 2004 21:34:19 -0000	1.4
***************
*** 29,33 ****
  public class MoneyDocument extends PlainDocument
  {
!     public void insertString(int offs, String str, AttributeSet a) throws BadLocationException
      {
          if (str == null) return;
--- 29,36 ----
  public class MoneyDocument extends PlainDocument
  {
! 	/* (non-Javadoc)
! 	 * @see javax.swing.text.Document#insertString(int, java.lang.String, javax.swing.text.AttributeSet)
! 	 */
! 	public void insertString(int offs, String str, AttributeSet a) throws BadLocationException
      {
          if (str == null) return;
***************
*** 62,64 ****
--- 65,72 ----
          */
      }
+ 
+     /**
+      * Serialization ID
+      */
+     private static final long serialVersionUID = 3256722887951071028L;
  }



More information about the jsword-svn mailing list