classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] Patch: FYI: Basic plaf fixlets


From: Tom Tromey
Subject: [cp-patches] Patch: FYI: Basic plaf fixlets
Date: 04 Jun 2005 13:11:51 -0600
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

This fixes a number of minor issues with the 'basic' swing plaf
pointed out by JAPI.  Mostly these are permissions problems but there
are one or two other little things as well.  I've also added a bunch
of comments explaining the protected/public problem for various
classes.

One idea, if this is an important source of bugs, is that once the
generics branch is merged is that we could add our own
'gnu.classpath.Protected' annotation and mark these classes
'@Protected' -- and then change the free compilers to warn if they are
used incorrectly.  I.E., work around the original problem in a nice
way.

There's still one unfinished buglet here, which is that
BasicOptionPaneUI.ButtonAreaLayout ought to be 'static'.
This would require not using 'optionPane' from its methods though.

Tom

Index: ChangeLog
from  Tom Tromey  <address@hidden>

        * javax/swing/plaf/basic/BasicListUI.java (focusListener): Use
        correct type.
        (listDataListener, listSelectionListener, mouseInputListener,
        propertyChangeListener): Likewise.
        * javax/swing/plaf/basic/BasicMenuUI.java (ChangeHandler): Now
        public and deprecated.
        * javax/swing/plaf/basic/BasicTabbedPaneUI.java
        (TabbedPaneLayout): Now public.
        * javax/swing/plaf/basic/BasicOptionPaneUI.java
        (ButtonActionListener): Now public.
        (PropertyChangeHandler): Likewise.
        (ButtonAreaLayout): Likewise.
        * javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
        (TitlePaneLayout): Now public.
        (PropertyChangeHandler): Likewise.
        * javax/swing/plaf/basic/BasicCheckBoxUI.java
        (getPropertyPrefix): New method.
        * javax/swing/plaf/basic/BasicProgressBarUI.java (ChangeHandler):
        Now public.
        * javax/swing/plaf/basic/BasicSliderUI.java (ComponentHandler):
        Now public.
        * javax/swing/plaf/basic/BasicSplitPaneUI.java
        (BasicVerticalLayoutManager): Now public.
        (FocusHandler): Likewise.
        (BasicHorizontalLayoutManager): Likewise.
        * javax/swing/plaf/basic/BasicFileChooserUI.java
        (AcceptAllFileFilter): New public constructor.
        (BasicFileView): Likewise.
        * javax/swing/plaf/basic/BasicInternalFrameUI.java
        (BorderListener.RESIZE_NONE): Now final.

Index: javax/swing/plaf/basic/BasicCheckBoxUI.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicCheckBoxUI.java,v
retrieving revision 1.6
diff -u -r1.6 BasicCheckBoxUI.java
--- javax/swing/plaf/basic/BasicCheckBoxUI.java 14 Feb 2004 21:42:56 -0000 1.6
+++ javax/swing/plaf/basic/BasicCheckBoxUI.java 4 Jun 2005 19:07:48 -0000
@@ -1,5 +1,5 @@
 /* BasicCheckBoxUI.java
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -59,7 +59,13 @@
   
   public void installUI(final JComponent c)  {
     super.installUI(c);
-  }  
+  }
+
+  // Overridden to change method access.
+  public String getPropertyPrefix()
+  {
+    return super.getPropertyPrefix();
+  }
 }
 
 
Index: javax/swing/plaf/basic/BasicFileChooserUI.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicFileChooserUI.java,v
retrieving revision 1.3
diff -u -r1.3 BasicFileChooserUI.java
--- javax/swing/plaf/basic/BasicFileChooserUI.java 1 Jun 2005 11:02:15 -0000 1.3
+++ javax/swing/plaf/basic/BasicFileChooserUI.java 4 Jun 2005 19:07:48 -0000
@@ -101,6 +101,10 @@
    */
   protected class AcceptAllFileFilter extends FileFilter
   {
+    public AcceptAllFileFilter()
+    {
+    }
+    
     /**
      * DOCUMENT ME!
      *
@@ -168,6 +172,10 @@
     /** DOCUMENT ME! */
     protected Hashtable iconCache = new Hashtable();
 
+    public BasicFileView()
+    {
+    }
+
     /**
      * DOCUMENT ME!
      *
Index: javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java,v
retrieving revision 1.7
diff -u -r1.7 BasicInternalFrameTitlePane.java
--- javax/swing/plaf/basic/BasicInternalFrameTitlePane.java 20 May 2005 
12:35:47 -0000 1.7
+++ javax/swing/plaf/basic/BasicInternalFrameTitlePane.java 4 Jun 2005 19:07:48 
-0000
@@ -77,6 +77,10 @@
 {
   /**
    * The Action responsible for closing the JInternalFrame.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class CloseAction extends AbstractAction
   {
@@ -102,6 +106,10 @@
 
   /**
    * This Action is responsible for iconifying the JInternalFrame.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class IconifyAction extends AbstractAction
   {
@@ -128,6 +136,10 @@
 
   /**
    * This Action is responsible for maximizing the JInternalFrame.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class MaximizeAction extends AbstractAction
   {
@@ -154,6 +166,10 @@
 
   /**
    * This Action is responsible for dragging the JInternalFrame.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class MoveAction extends AbstractAction
   {
@@ -171,6 +187,10 @@
   /**
    * This Action is responsible for restoring the JInternalFrame. Restoring
    * the JInternalFrame is the same as setting the maximum property to false.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class RestoreAction extends AbstractAction
   {
@@ -197,6 +217,10 @@
 
   /**
    * This action is responsible for sizing the JInternalFrame.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class SizeAction extends AbstractAction
   {
@@ -214,8 +238,12 @@
   /**
    * This class is responsible for handling property change events from the
    * JInternalFrame and adjusting the Title Pane as necessary.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
-  protected class PropertyChangeHandler implements PropertyChangeListener
+  public class PropertyChangeHandler implements PropertyChangeListener
   {
     /**
      * This method is called when a PropertyChangeEvent is received by the
@@ -236,6 +264,10 @@
   /**
    * This class acts as the MenuBar for the TitlePane. Clicking on the Frame
    * Icon in the top left corner will activate it.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class SystemMenuBar extends JMenuBar
   {
@@ -284,8 +316,12 @@
 
   /**
    * This class acts as the Layout Manager for the TitlePane.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
-  protected class TitlePaneLayout implements LayoutManager
+  public class TitlePaneLayout implements LayoutManager
   {
     /**
      * Creates a new <code>TitlePaneLayout</code> object.
Index: javax/swing/plaf/basic/BasicInternalFrameUI.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicInternalFrameUI.java,v
retrieving revision 1.6
diff -u -r1.6 BasicInternalFrameUI.java
--- javax/swing/plaf/basic/BasicInternalFrameUI.java 22 Oct 2004 12:44:00 -0000 
1.6
+++ javax/swing/plaf/basic/BasicInternalFrameUI.java 4 Jun 2005 19:07:48 -0000
@@ -1,5 +1,5 @@
 /* BasicInternalFrameUI.java --
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -162,7 +162,7 @@
     implements SwingConstants
   {
     /** FIXME: Use for something. */
-    protected int RESIZE_NONE;
+    protected final int RESIZE_NONE = 0;
 
     /** The x offset from the top left corner of the JInternalFrame. */
     private transient int xOffset = 0;
Index: javax/swing/plaf/basic/BasicListUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicListUI.java,v
retrieving revision 1.17
diff -u -r1.17 BasicListUI.java
--- javax/swing/plaf/basic/BasicListUI.java 3 Jun 2005 14:36:55 -0000 1.17
+++ javax/swing/plaf/basic/BasicListUI.java 4 Jun 2005 19:07:48 -0000
@@ -304,19 +304,20 @@
   }
 
   /** The current focus listener. */
-  protected FocusHandler focusListener;
+  protected FocusListener focusListener;
 
   /** The data listener listening to the model. */
-  protected ListDataHandler listDataListener;
+  protected ListDataListener listDataListener;
 
   /** The selection listener listening to the selection model. */
-  protected ListSelectionHandler listSelectionListener;
+  protected ListSelectionListener listSelectionListener;
 
   /** The mouse listener listening to the list. */
-  protected MouseInputHandler mouseInputListener;
+  protected MouseInputListener mouseInputListener;
 
   /** The property change listener listening to the list. */
-  protected PropertyChangeHandler propertyChangeListener;
+  protected PropertyChangeListener propertyChangeListener;
+
 
   /** The component listener that receives notification for resizing the
    * JList component.*/
Index: javax/swing/plaf/basic/BasicMenuUI.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicMenuUI.java,v
retrieving revision 1.7
diff -u -r1.7 BasicMenuUI.java
--- javax/swing/plaf/basic/BasicMenuUI.java 12 Apr 2005 21:15:31 -0000 1.7
+++ javax/swing/plaf/basic/BasicMenuUI.java 4 Jun 2005 19:07:48 -0000
@@ -1,5 +1,5 @@
 /* BasicMenuUI.java
-   Copyright (C) 2002, 2004  Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2005  Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -424,7 +424,10 @@
     }
   }
 
-  protected class ChangeHandler implements ChangeListener
+  /**
+   * @deprecated
+   */
+  public class ChangeHandler implements ChangeListener
   {
     public void stateChanged(ChangeEvent e)
     {
Index: javax/swing/plaf/basic/BasicOptionPaneUI.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicOptionPaneUI.java,v
retrieving revision 1.16
diff -u -r1.16 BasicOptionPaneUI.java
--- javax/swing/plaf/basic/BasicOptionPaneUI.java 13 May 2005 13:49:40 -0000 
1.16
+++ javax/swing/plaf/basic/BasicOptionPaneUI.java 4 Jun 2005 19:07:49 -0000
@@ -85,8 +85,12 @@
   /**
    * This is a helper class that listens to the buttons located at the bottom
    * of the JOptionPane.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
-  protected class ButtonActionListener implements ActionListener
+  public class ButtonActionListener implements ActionListener
   {
     /** The index of the option this button represents. */
     protected int buttonIndex;
@@ -152,8 +156,13 @@
    * This helper layout manager is responsible for the layout of the button
    * area. The button area is the panel that holds the buttons which
    * represent the options.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
-  protected class ButtonAreaLayout implements LayoutManager
+  // FIXME: should be static
+  public class ButtonAreaLayout implements LayoutManager
   {
     /** Whether this layout will center the buttons. */
     protected boolean centersChildren = true;
@@ -366,6 +375,10 @@
 
   /**
    * This helper class handles property change events from the JOptionPane.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class PropertyChangeHandler implements PropertyChangeListener
   {
@@ -453,19 +466,15 @@
   private transient Border buttonBorder;
 
   /** The string used to describe OK buttons. */
-  // FIXME: wrong name for a constant.
   private static final String OK_STRING = "OK";
 
   /** The string used to describe Yes buttons. */
-  // FIXME: wrong name for a constant.
   private static final String YES_STRING = "Yes";
 
   /** The string used to describe No buttons. */
-  // FIXME: wrong name for a constant.
   private static final String NO_STRING = "No";
 
   /** The string used to describe Cancel buttons. */
-  // FIXME: wrong name for a constant.
   private static final String CANCEL_STRING = "Cancel";
 
   /** The container for the message area.
Index: javax/swing/plaf/basic/BasicProgressBarUI.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicProgressBarUI.java,v
retrieving revision 1.10
diff -u -r1.10 BasicProgressBarUI.java
--- javax/swing/plaf/basic/BasicProgressBarUI.java 20 May 2005 12:25:35 -0000 
1.10
+++ javax/swing/plaf/basic/BasicProgressBarUI.java 4 Jun 2005 19:07:49 -0000
@@ -75,8 +75,12 @@
   /**
    * A helper class that listens for ChangeEvents 
    * from the progressBar's model.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
-  protected class ChangeHandler implements ChangeListener
+  public class ChangeHandler implements ChangeListener
   {
     /**
      * Called every time the state of the model changes.
Index: javax/swing/plaf/basic/BasicSliderUI.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicSliderUI.java,v
retrieving revision 1.13
diff -u -r1.13 BasicSliderUI.java
--- javax/swing/plaf/basic/BasicSliderUI.java 26 Apr 2005 18:56:19 -0000 1.13
+++ javax/swing/plaf/basic/BasicSliderUI.java 4 Jun 2005 19:07:49 -0000
@@ -138,6 +138,10 @@
 {
   /**
    * Helper class that listens to the address@hidden JSlider}'s model for 
changes.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class ChangeHandler implements ChangeListener
   {
@@ -160,8 +164,12 @@
 
   /**
    * Helper class that listens for resize events.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
-  protected class ComponentHandler extends ComponentAdapter
+  public class ComponentHandler extends ComponentAdapter
   {
     /**
      * Called when the size of the component changes. The UI delegate should
@@ -181,6 +189,10 @@
 
   /**
    * Helper class that listens for focus events.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class FocusHandler implements FocusListener
   {
@@ -246,6 +258,10 @@
    * Helper class that listens to our swing timer. This class is responsible
    * for listening to the timer and moving the thumb in the proper direction
    * every interval.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class ScrollListener implements ActionListener
   {
@@ -320,6 +336,10 @@
 
   /**
    * Helper class that listens for mouse events.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class TrackListener extends MouseInputAdapter
   {
Index: javax/swing/plaf/basic/BasicSplitPaneUI.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java,v
retrieving revision 1.8
diff -u -r1.8 BasicSplitPaneUI.java
--- javax/swing/plaf/basic/BasicSplitPaneUI.java 25 May 2005 08:37:05 -0000 1.8
+++ javax/swing/plaf/basic/BasicSplitPaneUI.java 4 Jun 2005 19:07:50 -0000
@@ -1,5 +1,5 @@
 /* BasicSplitPaneUI.java --
-   Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -71,8 +71,12 @@
   /**
    * This Layout Manager controls the position and size of the components when
    * the JSplitPane's orientation is HORIZONTAL_SPLIT.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
-  protected class BasicHorizontalLayoutManager implements LayoutManager2
+  public class BasicHorizontalLayoutManager implements LayoutManager2
   {
     // 3 components at a time.
     // LEFT/TOP = 0
@@ -485,8 +489,12 @@
   /**
    * This class is the Layout Manager for the JSplitPane when the orientation
    * is VERTICAL_SPLIT.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
-  protected class BasicVerticalLayoutManager
+  public class BasicVerticalLayoutManager
     extends BasicHorizontalLayoutManager
   {
     /**
@@ -653,8 +661,12 @@
 
   /**
    * This class handles FocusEvents from the JComponent.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
-  protected class FocusHandler extends FocusAdapter
+  public class FocusHandler extends FocusAdapter
   {
     /**
      * This method is called when the JSplitPane gains focus.
@@ -680,6 +692,10 @@
   /**
    * This is a deprecated class. It is supposed to be used for handling down
    * and right key presses.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class KeyboardDownRightHandler implements ActionListener
   {
@@ -697,6 +713,10 @@
   /**
    * This is a deprecated class. It is supposed to be used for handling end
    * key presses.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class KeyboardEndHandler implements ActionListener
   {
@@ -714,6 +734,10 @@
   /**
    * This is a deprecated class. It is supposed to be used for handling home
    * key presses.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class KeyboardHomeHandler implements ActionListener
   {
@@ -731,6 +755,10 @@
   /**
    * This is a deprecated class. It is supposed to be used for handling resize
    * toggles.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class KeyboardResizeToggleHandler implements ActionListener
   {
@@ -748,6 +776,10 @@
   /**
    * This is a deprecated class. It is supposed to be used for handler up and
    * left key presses.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class KeyboardUpLeftHandler implements ActionListener
   {
@@ -765,6 +797,10 @@
   /**
    * This helper class handles PropertyChangeEvents from the JSplitPane. When
    * a property changes, this will update the UI accordingly.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class PropertyHandler implements PropertyChangeListener
   {
Index: javax/swing/plaf/basic/BasicTabbedPaneUI.java
===================================================================
RCS file: 
/cvsroot/classpath/classpath/javax/swing/plaf/basic/BasicTabbedPaneUI.java,v
retrieving revision 1.20
diff -u -r1.20 BasicTabbedPaneUI.java
--- javax/swing/plaf/basic/BasicTabbedPaneUI.java 26 Apr 2005 18:56:20 -0000 
1.20
+++ javax/swing/plaf/basic/BasicTabbedPaneUI.java 4 Jun 2005 19:07:50 -0000
@@ -83,6 +83,10 @@
 {
   /**
    * A helper class that handles focus.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class FocusHandler extends FocusAdapter
   {
@@ -111,6 +115,10 @@
    * A helper class for determining if mouse presses occur inside tabs and
    * sets the index appropriately. In SCROLL_TAB_MODE, this class also
    * handles the mouse clicks on the scrolling buttons.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class MouseHandler extends MouseAdapter
   {
@@ -173,6 +181,10 @@
 
   /**
    * This class handles PropertyChangeEvents fired from the JTabbedPane.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class PropertyChangeHandler implements PropertyChangeListener
   {
@@ -205,8 +217,12 @@
    * A LayoutManager responsible for placing all the tabs and the visible
    * component inside the JTabbedPane. This class is only used for
    * WRAP_TAB_LAYOUT.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
-  protected class TabbedPaneLayout implements LayoutManager
+  public class TabbedPaneLayout implements LayoutManager
   {
     /**
      * This method is called when a component is added to the JTabbedPane.
@@ -1101,6 +1117,10 @@
 
   /**
    * This class handles ChangeEvents from the JTabbedPane.
+   *
+   * @specnote Apparently this class was intended to be protected,
+   *           but was made public by a compiler bug and is now
+   *           public for compatibility.
    */
   public class TabSelectionHandler implements ChangeListener
   {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]