[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: various swing fixes

Kaffe CVS cvs-commits at kaffe.org
Wed Jan 5 09:31:44 PST 2005


PatchSet 5754 
Date: 2005/01/05 17:27:35
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: various swing fixes

Members: 
	ChangeLog:1.3298->1.3299 
	libraries/javalib/javax/swing/JFormattedTextField.java:1.5->1.6 
	libraries/javalib/javax/swing/JWindow.java:1.4->1.5 
	libraries/javalib/javax/swing/UIDefaults.java:1.5->1.6 
	libraries/javalib/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java:1.3->1.4 
	libraries/javalib/javax/swing/plaf/basic/BasicSliderUI.java:1.6->1.7 
	libraries/javalib/javax/swing/plaf/basic/BasicTabbedPaneUI.java:1.5->1.6 
	libraries/javalib/javax/swing/plaf/basic/BasicTextPaneUI.java:1.1->1.2 
	libraries/javalib/javax/swing/plaf/basic/BasicToolBarUI.java:1.6->1.7 
	libraries/javalib/javax/swing/text/JTextComponent.java:1.9->1.10 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3298 kaffe/ChangeLog:1.3299
--- kaffe/ChangeLog:1.3298	Wed Jan  5 17:14:04 2005
+++ kaffe/ChangeLog	Wed Jan  5 17:27:35 2005
@@ -1,4 +1,47 @@
-2005-01-05  Dalibor Topic  <topic at notebox>
+2005-01-05  Dalibor Topic  <robilad at kaffe.org>
+
+	* libraries/javalib/javax/swing/JFormattedTextField.java,
+	libraries/javalib/javax/swing/JWindow.java,
+	libraries/javalib/javax/swing/UIDefaults.java,
+	libraries/javalib/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java,
+	libraries/javalib/javax/swing/plaf/basic/BasicSliderUI.java,
+	libraries/javalib/javax/swing/plaf/basic/BasicTabbedPaneUI.java,
+	libraries/javalib/javax/swing/plaf/basic/BasicTextPaneUI.java,
+	libraries/javalib/javax/swing/plaf/basic/BasicToolBarUI.java,
+	libraries/javalib/javax/swing/text/JTextComponent.java:
+	Resynced with GNU Classpath.
+
+	2004-12-24  Michael Koch  <konqueror at gmx.de>
+
+	* javax/swing/JFormattedTextField.java: Implemented.
+	* javax/swing/JWindow.java
+	(JWindow): New constructors.
+	(initWindow): Renamed from initFrame.
+	* javax/swing/UIDefaults.java
+	(ActiveValue): Made interface static.
+	(LazyValue): Likewise.
+	* javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+	(TitlePaneLayout.TitlePaneLayout): New constructor.
+	* javax/swing/plaf/basic/BasicSliderUI.java
+	(ChangeHandler): Made public.
+	(FocusHandler): Likewise.
+	(PropertyChangeHandler): Likewise.
+	(ScrollListener): Likewise.
+	* javax/swing/plaf/basic/BasicTabbedPaneUI.java
+	(FocusHandler): Likewise.
+	(MouseHandler): Likewise.
+	* javax/swing/plaf/basic/BasicTextPaneUI.java
+	(BasicTextPaneUI): Extend BasicEditorPaneUI.
+	* javax/swing/plaf/basic/BasicToolBarUI.java
+	(BasicToolBarUI): Simplified. Reworked javadoc.
+	(canDock): Simplified. Make public.
+	(DockingListener): Made public.
+	* javax/swing/text/JTextComponent.java
+	(navigationFilter): New field.
+	(getNavigationFilter): New method.
+	(setNavigationFilter): Likewise.
+
+2005-01-05  Dalibor Topic  <robilad at kaffe.org>
 
 	* THIRDPARTY: Removed GNU JAXP and GNU regexp notices
 	since both are merged in into GNU Classpath now.
Index: kaffe/libraries/javalib/javax/swing/JFormattedTextField.java
diff -u kaffe/libraries/javalib/javax/swing/JFormattedTextField.java:1.5 kaffe/libraries/javalib/javax/swing/JFormattedTextField.java:1.6
--- kaffe/libraries/javalib/javax/swing/JFormattedTextField.java:1.5	Fri Dec  3 15:11:57 2004
+++ kaffe/libraries/javalib/javax/swing/JFormattedTextField.java	Wed Jan  5 17:27:37 2005
@@ -43,6 +43,8 @@
 import java.text.Format;
 import java.text.ParseException;
 
+import javax.swing.event.DocumentEvent;
+import javax.swing.event.DocumentListener;
 import javax.swing.text.Document;
 import javax.swing.text.DocumentFilter;
 import javax.swing.text.NavigationFilter;
@@ -59,6 +61,8 @@
   {
     private static final long serialVersionUID = -5193212041738979680L;
     
+    private JFormattedTextField textField;
+    
     public AbstractFormatter ()
     {
       //Do nothing here.
@@ -72,7 +76,7 @@
 
     protected Action[] getActions ()
     {
-      throw new InternalError ("not implemented");
+      return textField.getActions();
     }
 
     protected DocumentFilter getDocumentFilter ()
@@ -82,32 +86,35 @@
 
     protected JFormattedTextField getFormattedTextField ()
     {
-      throw new InternalError ("not implemented");
+      return textField;
     }
 
     protected NavigationFilter getNavigationFilter ()
     {
-      throw new InternalError ("not implemented");
+      return textField.getNavigationFilter();
     }
 
-    public void install (JFormattedTextField ftf)
+    public void install(JFormattedTextField textField)
     {
-      throw new InternalError ("not implemented");
+      if (this.textField != null)
+	uninstall();
+      
+      this.textField = textField;
     }
 
     public void uninstall ()
     {
-      throw new InternalError ("not implemented");
+      this.textField = null;
     }
 
     protected void invalidEdit ()
     {
-      throw new InternalError ("not implemented");
+      textField.invalidEdit();
     }
 
     protected void setEditValid (boolean valid)
     {
-      throw new InternalError ("not implemented");
+      textField.editValid = valid;
     }
 
     public abstract Object stringToValue (String text)
@@ -127,16 +134,34 @@
     public abstract AbstractFormatter getFormatter (JFormattedTextField tf);
   }
 
+  static class FormatterFactoryWrapper extends AbstractFormatterFactory
+  {
+    AbstractFormatter formatter;
+
+    public FormatterFactoryWrapper(AbstractFormatter formatter)
+    {
+      this.formatter = formatter;
+    }
+
+    public AbstractFormatter getFormatter(JFormattedTextField tf)
+    {
+      return formatter;
+    }
+  }
+
   public static final int COMMIT = 0;
   public static final int COMMIT_OR_REVERT = 1;
   public static final int REVERT = 2;
   public static final int PERSIST = 3;
 
   private Object value;
+  private int focusLostBehavior = COMMIT_OR_REVERT;
+  private AbstractFormatterFactory formatterFactory;
+  private boolean editValid = true;
   
   public JFormattedTextField ()
   {
-    this((AbstractFormatterFactory) null);
+    this((AbstractFormatterFactory) null, null);
   }
 
   public JFormattedTextField (Format format)
@@ -146,7 +171,7 @@
 
   public JFormattedTextField (AbstractFormatter formatter)
   {
-    throw new InternalError ("not implemented");
+    this(new FormatterFactoryWrapper(formatter), null);
   }
 
   public JFormattedTextField (AbstractFormatterFactory factory)
@@ -156,7 +181,8 @@
 
   public JFormattedTextField (AbstractFormatterFactory factory, Object value)
   {
-    throw new InternalError ("not implemented");
+    this.formatterFactory = factory;
+    this.value = value;
   }
 
   public JFormattedTextField (Object value)
@@ -177,17 +203,20 @@
 
   public int getFocusLostBehaviour ()
   {
-    throw new InternalError ("not implemented");
+    return focusLostBehavior;
   }
 
   public AbstractFormatter getFormatter ()
   {
-    throw new InternalError ("not implemented");
+    if (formatterFactory == null)
+      return null;
+    
+    return formatterFactory.getFormatter(this);
   }
 
   public AbstractFormatterFactory getFormatterFactory ()
   {
-    throw new InternalError ("not implemented");
+    return formatterFactory;
   }
 
   public String getUIClassID ()
@@ -202,12 +231,12 @@
 
   protected void invalidEdit ()
   {
-    throw new InternalError ("not implemented");
+    UIManager.getLookAndFeel().provideErrorFeedback(this);
   }
 
   public boolean isEditValid ()
   {
-    throw new InternalError ("not implemented");
+    return editValid;
   }
 
   protected void processFocusEvent (FocusEvent evt)
@@ -215,33 +244,58 @@
     throw new InternalError ("not implemented");
   }
 
-  public void setDocument(Document newdoc)
+  public void setDocument(Document newDocument)
   {
-    Document olddoc = getDocument();
+    Document oldDocument = getDocument();
 
-    if (olddoc == newdoc)
+    if (oldDocument == newDocument)
       return;
     
-    super.setDocument(newdoc);
+    super.setDocument(newDocument);
   }
 
   public void setLostFocusBehavior (int behavior)
   {
-    throw new InternalError ("not implemented");
+    if (behavior != COMMIT
+	&& behavior != COMMIT_OR_REVERT
+	&& behavior != PERSIST
+	&& behavior != REVERT)
+      throw new IllegalArgumentException("invalid behavior");
+
+    this.focusLostBehavior = behavior;
   }
 
   protected void setFormatter (AbstractFormatter formatter)
   {
-    throw new InternalError ("not implemented");
+    AbstractFormatter oldFormatter = null;
+    
+    if (formatterFactory != null)
+      oldFormatter = formatterFactory.getFormatter(this);
+
+    if (oldFormatter == formatter)
+      return;
+
+    setFormatterFactory(new FormatterFactoryWrapper(formatter));
+    firePropertyChange("formatter", oldFormatter, formatter);
   }
 
   public void setFormatterFactory (AbstractFormatterFactory factory)
   {
-    throw new InternalError ("not implemented");
+    if (formatterFactory == factory)
+      return;
+    
+    AbstractFormatterFactory oldFactory = formatterFactory;
+    formatterFactory = factory;
+    firePropertyChange("formatterFactory", oldFactory, factory);
   }
 
   public void setValue (Object newValue)
   {
+    if (value == newValue)
+      return;
+    
+    Object oldValue = value;
     value = newValue;
+    firePropertyChange("value", oldValue, newValue);
   }
 }
Index: kaffe/libraries/javalib/javax/swing/JWindow.java
diff -u kaffe/libraries/javalib/javax/swing/JWindow.java:1.4 kaffe/libraries/javalib/javax/swing/JWindow.java:1.5
--- kaffe/libraries/javalib/javax/swing/JWindow.java:1.4	Thu Dec 23 00:40:21 2004
+++ kaffe/libraries/javalib/javax/swing/JWindow.java	Wed Jan  5 17:27:37 2005
@@ -44,6 +44,7 @@
 import java.awt.Dimension;
 import java.awt.Frame;
 import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
 import java.awt.LayoutManager;
 import java.awt.Window;
 import java.awt.event.KeyEvent;
@@ -62,22 +63,42 @@
 {
   private static final long serialVersionUID = 5420698392125238833L;
   
+  private boolean checking;
+  
+  protected JRootPane rootPane;
   protected AccessibleContext accessibleContext;
 
   public JWindow()
   {
     super(SwingUtilities.getOwnerFrame());
+    windowInit();
   }
 
-  public JWindow(Frame f)
+  public JWindow(GraphicsConfiguration gc)
   {
-    super(f);
+    super(SwingUtilities.getOwnerFrame(), gc);
+    windowInit();
+  }
+  
+  public JWindow(Frame owner)
+  {
+    super(owner);
+    windowInit();
   }
 
-  private boolean checking;
-  protected JRootPane rootPane;
+  public JWindow(Window owner)
+  {
+    super(owner);
+    windowInit();
+  }
+
+  public JWindow(Window owner, GraphicsConfiguration gc)
+  {
+    super(owner, gc);
+    windowInit();
+  }
 
-  protected void frameInit()
+  protected void windowInit()
   {
     super.setLayout(new BorderLayout(1, 1));
     getRootPane(); // will do set/create
Index: kaffe/libraries/javalib/javax/swing/UIDefaults.java
diff -u kaffe/libraries/javalib/javax/swing/UIDefaults.java:1.5 kaffe/libraries/javalib/javax/swing/UIDefaults.java:1.6
--- kaffe/libraries/javalib/javax/swing/UIDefaults.java:1.5	Sun Oct 24 13:39:15 2004
+++ kaffe/libraries/javalib/javax/swing/UIDefaults.java	Wed Jan  5 17:27:37 2005
@@ -68,7 +68,7 @@
   private Locale defaultLocale;
   private PropertyChangeSupport propertyChangeSupport;
 
-  public interface ActiveValue
+  public static interface ActiveValue
   {
     Object createValue(UIDefaults table);
   }
@@ -92,7 +92,7 @@
     }
   }
 
-  public interface LazyValue
+  public static interface LazyValue
   {
     Object createValue(UIDefaults table);
   }
Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java:1.3 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java:1.4
--- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java:1.3	Sun Oct 24 13:39:19 2004
+++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java	Wed Jan  5 17:27:38 2005
@@ -288,6 +288,14 @@
   protected class TitlePaneLayout implements LayoutManager
   {
     /**
+     * Creates a new <code>TitlePaneLayout</code> object.
+     */
+    public TitlePaneLayout()
+    {
+      // Do nothing.
+    }
+
+    /**
      * This method is called when adding a Component to the Container.
      *
      * @param name The name to reference the added Component by.
Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicSliderUI.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicSliderUI.java:1.6 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicSliderUI.java:1.7
--- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicSliderUI.java:1.6	Sun Oct 24 13:39:20 2004
+++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicSliderUI.java	Wed Jan  5 17:27:38 2005
@@ -139,7 +139,7 @@
   /**
    * Helper class that listens to the {@link JSlider}'s model for changes.
    */
-  protected class ChangeHandler implements ChangeListener
+  public class ChangeHandler implements ChangeListener
   {
     /**
      * Called when the slider's model has been altered. The UI delegate should
@@ -182,7 +182,7 @@
   /**
    * Helper class that listens for focus events.
    */
-  protected class FocusHandler implements FocusListener
+  public class FocusHandler implements FocusListener
   {
     /**
      * Called when the {@link JSlider} has gained focus.  It should repaint
@@ -211,7 +211,7 @@
    * Helper class that listens for changes to the properties of the {@link
    * JSlider}.
    */
-  protected class PropertyChangeHandler implements PropertyChangeListener
+  public class PropertyChangeHandler implements PropertyChangeListener
   {
     /**
      * Called when one of the properties change. The UI should recalculate any
@@ -247,7 +247,7 @@
    * for listening to the timer and moving the thumb in the proper direction
    * every interval.
    */
-  protected class ScrollListener implements ActionListener
+  public class ScrollListener implements ActionListener
   {
     /** Indicates which direction the thumb should scroll. */
     private transient int direction;
Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTabbedPaneUI.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTabbedPaneUI.java:1.5 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTabbedPaneUI.java:1.6
--- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTabbedPaneUI.java:1.5	Sun Oct 24 10:44:37 2004
+++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTabbedPaneUI.java	Wed Jan  5 17:27:38 2005
@@ -84,7 +84,7 @@
   /**
    * A helper class that handles focus.
    */
-  protected class FocusHandler extends FocusAdapter
+  public class FocusHandler extends FocusAdapter
   {
     /**
      * This method is called when the component gains focus.
@@ -112,7 +112,7 @@
    * sets the index appropriately. In SCROLL_TAB_MODE, this class also
    * handles the mouse clicks on the scrolling buttons.
    */
-  protected class MouseHandler extends MouseAdapter
+  public class MouseHandler extends MouseAdapter
   {
     /**
      * This method is called when the mouse is pressed. The index cannot
Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextPaneUI.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextPaneUI.java:1.1 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextPaneUI.java:1.2
--- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextPaneUI.java:1.1	Sat Nov 13 04:02:09 2004
+++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextPaneUI.java	Wed Jan  5 17:27:38 2005
@@ -46,15 +46,16 @@
 import javax.swing.text.PlainView;
 import javax.swing.text.View;
 
-public class BasicTextPaneUI extends BasicTextUI
+public class BasicTextPaneUI extends BasicEditorPaneUI
 {
-  public static ComponentUI createUI(JComponent comp)
+  public BasicTextPaneUI()
   {
-    return new BasicTextPaneUI();
+    // Do nothing here.
   }
 
-  public BasicTextPaneUI()
+  public static ComponentUI createUI(JComponent comp)
   {
+    return new BasicTextPaneUI();
   }
 
   public View create(Element elem)
Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicToolBarUI.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicToolBarUI.java:1.6 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicToolBarUI.java:1.7
--- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicToolBarUI.java:1.6	Sun Oct 24 13:39:20 2004
+++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicToolBarUI.java	Wed Jan  5 17:27:38 2005
@@ -152,11 +152,11 @@
   private transient int cachedOrientation;
 
   /**
-   * This method creates a new BasicToolBarUI object for the given JToolBar.
+   * This method creates a new <code>BasicToolBarUI</code> object for the given JToolBar.
    */
   public BasicToolBarUI()
   {
-    super();
+    // Do nothing here.
   }
 
   /**
@@ -168,12 +168,9 @@
    *
    * @return Whether the JToolBar can dock.
    */
-  protected boolean canDock(Component c, Point p)
+  public boolean canDock(Component c, Point p)
   {
-    if (areaOfClick(c, p) != -1)
-      return true;
-
-    return false;
+    return areaOfClick(c, p) != -1;
   }
 
   /**
@@ -937,7 +934,7 @@
    * This is the MouseHandler class that allows the user to drag the JToolBar
    * in and out of the parent and dock it if it can.
    */
-  protected class DockingListener implements MouseInputListener
+  public class DockingListener implements MouseInputListener
   {
     /** Whether the JToolBar is being dragged. */
     protected boolean isDragging;
Index: kaffe/libraries/javalib/javax/swing/text/JTextComponent.java
diff -u kaffe/libraries/javalib/javax/swing/text/JTextComponent.java:1.9 kaffe/libraries/javalib/javax/swing/text/JTextComponent.java:1.10
--- kaffe/libraries/javalib/javax/swing/text/JTextComponent.java:1.9	Thu Dec 16 15:54:45 2004
+++ kaffe/libraries/javalib/javax/swing/text/JTextComponent.java	Wed Jan  5 17:27:38 2005
@@ -651,6 +651,7 @@
   private static Hashtable keymaps = new Hashtable();
   private Keymap keymap;
   private char focusAccelerator = '\0';
+  private NavigationFilter navigationFilter;
   
   /**
    * Get a Keymap from the global keymap table, by name.
@@ -970,6 +971,7 @@
       }
     catch (BadLocationException e)
       {
+	// This can never happen.
       }
   }
 
@@ -1510,5 +1512,21 @@
   public char getFocusAccelerator()
   {
     return focusAccelerator;
+  }
+
+  /**
+   * @since 1.4
+   */
+  public NavigationFilter getNavigationFilter()
+  {
+    return navigationFilter;
+  }
+
+  /**
+   * @since 1.4
+   */
+  public void setNavigationFilter(NavigationFilter filter)
+  {
+    navigationFilter = filter;
   }
 }




More information about the kaffe mailing list