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

Kaffe CVS cvs-commits at kaffe.org
Sat Jun 11 14:41:16 PDT 2005


PatchSet 6632 
Date: 2005/06/11 21:37:10
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: awt and swing fixes

Members: 
	ChangeLog:1.4158->1.4159 
	libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c:1.3->1.4 
	libraries/javalib/javax/swing/JFrame.java:1.6->1.7 
	libraries/javalib/javax/swing/JLabel.java:1.8->1.9 
	libraries/javalib/javax/swing/JTree.java:1.16->1.17 
	libraries/javalib/javax/swing/plaf/basic/BasicButtonListener.java:1.7->1.8 
	libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java:1.13->1.14 
	libraries/javalib/javax/swing/text/DefaultFormatter.java:INITIAL->1.1 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.4158 kaffe/ChangeLog:1.4159
--- kaffe/ChangeLog:1.4158	Sat Jun 11 21:25:20 2005
+++ kaffe/ChangeLog	Sat Jun 11 21:37:10 2005
@@ -1,6 +1,60 @@
 2005-06-11  Dalibor Topic  <robilad at kaffe.org>
 
 	Resynced with GNU Classpath.
+
+	2005-06-06  Sven de Marothy <sven at physto.se>
+
+	* javax/swing/JLabel.java
+	(JLabel): Horizontal justification changed to default to LEADING.
+
+	2005-06-06  Roman Kennke  <roman at kennke.org>
+
+	* javax/swing/text/DefaultFormatter.java:
+	Implemented new class.
+	
+	2005-06-06  Roman Kennke  <roman at kennke.org>
+
+	* javax/swing/JFrame.java:
+	Added the two missing constructors that take
+	java.awt.GraphicsConfiguration objects as arguments.
+
+	2005-06-06  Roman Kennke  <roman at kennke.org>
+
+	* javax/swing/JTree.java
+	(removeDescendantSelectedPaths): Implemented new method.
+
+	2005-06-06  Roman Kennke  <roman at kennke.org>
+
+	* javax/swing/plaf/basic/BasicButtonListener.java
+	(focusLost): Don't unarm button on focus lost. This behaviour is
+	not documented anywhere and disturbs correct event processing
+	in buttons.
+
+	2005-06-06  Roman Kennke  <roman at kennke.org>
+
+	* javax/swing/plaf/basic/BasicTextUI.java
+	(getKeymapName): Removed debug statement.
+
+	2005-06-06  Roman Kennke  <roman at kennke.org>
+
+	* javax/swing/plaf/basic/BasicTextUI.java
+	(getKeymapName): Added API documentation comments.
+
+	2005-06-06  Roman Kennke  <roman at kennke.org>
+
+	* javax/swing/plaf/basic/BasicTextUI.java
+	(getKeymapName): Reimplemented to return the classname of
+	itself. This way subclasses don't have to override this
+	method.
+
+	2005-06-06  Sven de Marothy <sven at physto.se>
+
+	* native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
+	(gtkWidgetSetForeground): Avoid setting black-on-black selection color
+	
+2005-06-11  Dalibor Topic  <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
 	
 	2005-06-05  Tom Tromey  <tromey at redhat.com>
 
Index: kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c
diff -u kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c:1.3 kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c:1.4
--- kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c:1.3	Mon Sep 27 17:40:59 2004
+++ kaffe/libraries/clib/awt/classpath-gtk/gtk-peer/gnu_java_awt_peer_gtk_GtkTextFieldPeer.c	Sat Jun 11 21:37:12 2005
@@ -39,6 +39,12 @@
 #include "gtkpeer.h"
 #include "gnu_java_awt_peer_gtk_GtkTextFieldPeer.h"
 
+/* the color used for highlighting when the foreground is black,
+   since black highlights aren't a Good Idea. */
+#define BB_RED    16962
+#define BB_GREEN  26985
+#define BB_BLUE   31611
+
 static jint
 get_border_width (GtkWidget *entry);
 
@@ -94,10 +100,17 @@
   color.red = (red / 255.0) * 65535;
   color.green = (green / 255.0) * 65535;
   color.blue = (blue / 255.0) * 65535;
-
+  
   gdk_threads_enter ();
 
   gtk_widget_modify_text (GTK_WIDGET (ptr), GTK_STATE_NORMAL, &color);
+
+  if ( red == 0 && green == 0 && blue == 0)
+    {
+      color.red = BB_RED;
+      color.green = BB_GREEN;
+      color.blue = BB_BLUE;
+    }
   gtk_widget_modify_base (GTK_WIDGET (ptr), GTK_STATE_SELECTED, &color);
 
   gdk_threads_leave ();
Index: kaffe/libraries/javalib/javax/swing/JFrame.java
diff -u kaffe/libraries/javalib/javax/swing/JFrame.java:1.6 kaffe/libraries/javalib/javax/swing/JFrame.java:1.7
--- kaffe/libraries/javalib/javax/swing/JFrame.java:1.6	Wed Jan 26 13:40:05 2005
+++ kaffe/libraries/javalib/javax/swing/JFrame.java	Sat Jun 11 21:37:12 2005
@@ -45,6 +45,7 @@
 import java.awt.Dimension;
 import java.awt.Frame;
 import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
 import java.awt.LayoutManager;
 import java.awt.event.KeyEvent;
 import java.awt.event.WindowEvent;
@@ -76,6 +77,37 @@
   public JFrame(String title)
   {
     super(title);
+    frameInit();
+  }
+
+  /**
+   * Creates a new JFrame in the specified {@link GraphicsConfiguration}
+   * and with an empty title.
+   *
+   * @param gc the <code>GraphicsConfiguration</code> that is used for
+   *     the new <code>JFrame</code>
+   *
+   * @see Frame(GraphicsConfiguration)
+   */
+  public JFrame(GraphicsConfiguration gc)
+  {
+    super(gc);
+    frameInit();
+  }
+
+  /**
+   * Creates a new JFrame in the specified {@link GraphicsConfiguration}
+   * and with the specified title.
+   *
+   * @param title the title for the new <code>JFrame</code>
+   * @param gc the <code>GraphicsConfiguration</code> that is used for
+   *     the new <code>JFrame</code>
+   *
+   * @see Frame(String, GraphicsConfiguration)
+   */
+  public JFrame(String title, GraphicsConfiguration gc)
+  {
+    super(title, gc);
     frameInit();
   }
 
Index: kaffe/libraries/javalib/javax/swing/JLabel.java
diff -u kaffe/libraries/javalib/javax/swing/JLabel.java:1.8 kaffe/libraries/javalib/javax/swing/JLabel.java:1.9
--- kaffe/libraries/javalib/javax/swing/JLabel.java:1.8	Thu Jan 27 14:07:11 2005
+++ kaffe/libraries/javalib/javax/swing/JLabel.java	Sat Jun 11 21:37:12 2005
@@ -92,23 +92,23 @@
   private transient int iconTextGap = 4;
 
   /**
-   * Creates a new horizontally and vertically centered JLabel object with no
-   * text and no icon.
+   * Creates a new vertically centered, horizontally on the leading edge
+   * JLabel object with text and no icon.
    */
   public JLabel()
   {
-    this(null, null, CENTER);
+    this(null, null, LEADING);
   }
 
   /**
-   * Creates a new horizontally and vertically centered JLabel object with no
-   * text and the given icon.
+   * Creates a new vertically centered, horizontally on the leading edge
+   * JLabel object with no text and the given icon.
    *
    * @param image The icon to use with the label.
    */
   public JLabel(Icon image)
   {
-    this(null, image, CENTER);
+    this(null, image, LEADING);
   }
 
   /**
@@ -125,14 +125,14 @@
   }
 
   /**
-   * Creates a new horizontally and vertically centered JLabel object with no
-   * icon and the given text.
+   * Creates a new horizontally leading and vertically centered JLabel 
+   * object with no icon and the given text.
    *
    * @param text The text to use with the label.
    */
   public JLabel(String text)
   {
-    this(text, null, CENTER);
+    this(text, null, LEADING);
   }
 
   /**
Index: kaffe/libraries/javalib/javax/swing/JTree.java
diff -u kaffe/libraries/javalib/javax/swing/JTree.java:1.16 kaffe/libraries/javalib/javax/swing/JTree.java:1.17
--- kaffe/libraries/javalib/javax/swing/JTree.java:1.16	Fri Jun 10 19:51:08 2005
+++ kaffe/libraries/javalib/javax/swing/JTree.java	Sat Jun 11 21:37:12 2005
@@ -1780,4 +1780,37 @@
       }
     return foundPath;
   }
+
+  /**
+   * Removes any paths in the current set of selected paths that are
+   * descendants of <code>path</code>. If <code>includePath</code> is
+   * set to <code>true</code> and <code>path</code> itself is selected,
+   * then it will be removed too.
+   *
+   * @param path the path from which selected descendants are to be
+   *     removed
+   * @param includePath if <code>true</code> then <code>path</code>
+   *     itself will also be remove if it's selected
+   *
+   * @return <code>true</code> if something has been removed,
+   *     <code>false</code> otherwise
+   *
+   * @since 1.3
+   */
+  protected boolean removeDescendantSelectedPaths(TreePath path,
+                                                    boolean includeSelected)
+  {
+    boolean removedSomething = false;
+    TreePath[] selected = getSelectionPaths();
+    for (int index = 0; index < selected.length; index++)
+      {
+        if ((selected[index] == path && includeSelected)
+            || (selected[index].isDescendant(path)))
+          {
+            removeSelectionPath(selected[index]);
+            removedSomething = true;
+          }
+      }
+    return removedSomething;
+  }
 }
Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicButtonListener.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicButtonListener.java:1.7 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicButtonListener.java:1.8
--- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicButtonListener.java:1.7	Sun May 15 10:13:28 2005
+++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicButtonListener.java	Sat Jun 11 21:37:13 2005
@@ -87,9 +87,6 @@
     if (e.getSource() instanceof AbstractButton)
       {
         AbstractButton button = (AbstractButton) e.getSource();
-        ButtonModel model = button.getModel();
-        model.setArmed(false);
-
         if (button.isFocusPainted())
           button.repaint();   
       }
Index: kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java
diff -u kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java:1.13 kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java:1.14
--- kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java:1.13	Sat Jun 11 20:59:50 2005
+++ kaffe/libraries/javalib/javax/swing/plaf/basic/BasicTextUI.java	Sat Jun 11 21:37:13 2005
@@ -352,9 +352,21 @@
       doc.addDocumentListener(documentHandler);
   }
 
+  /**
+   * Returns the name of the keymap for this type of TextUI.
+   * 
+   * This is implemented so that the classname of this TextUI
+   * without the package prefix is returned. This way subclasses
+   * don't have to override this method.
+   * 
+   * @return the name of the keymap for this TextUI
+   */
   protected String getKeymapName()
   {
-    return "BasicTextUI";
+    String fullClassName = getClass().getName();
+    int index = fullClassName.lastIndexOf('.');
+    String className = fullClassName.substring(index + 1);
+    return className;
   }
 
   protected Keymap createKeymap()
===================================================================
Checking out kaffe/libraries/javalib/javax/swing/text/DefaultFormatter.java
RCS:  /home/cvs/kaffe/kaffe/libraries/javalib/javax/swing/text/DefaultFormatter.java,v
VERS: 1.1
***************
--- /dev/null	Sun Aug  4 19:57:58 2002
+++ kaffe/libraries/javalib/javax/swing/text/DefaultFormatter.java	Sat Jun 11 21:41:16 2005
@@ -0,0 +1,429 @@
+/* DefaultFormatter.java --
+Copyright (C) 2005  Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING.  If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library.  Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module.  An independent module is a module which is not derived from
+or based on this library.  If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so.  If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.swing.text;
+
+import java.io.Serializable;
+import java.lang.reflect.Constructor;
+import java.text.ParseException;
+
+import javax.swing.JFormattedTextField;
+
+/**
+ * The <code>DefaultFormatter</code> is a concrete formatter for use in
+ * {@link JFormattedTextField}s.
+ *
+ * It can format arbitrary values by invoking
+ * their {@link Object#toString} method.
+ *
+ * In order to convert a String back to
+ * a value, the value class must provide a single argument constructor that
+ * takes a String object as argument value. If no such constructor is found,
+ * the String itself is passed back by #stringToValue.
+ *  
+ * @author Roman Kennke (roman at kennke.org)
+ */
+public class DefaultFormatter
+  extends JFormattedTextField.AbstractFormatter
+  implements Cloneable, Serializable
+{
+
+  /**
+   * A {@link DocumentFilter} that intercepts modification of the
+   * JFormattedTextField's Document and commits the value depending
+   * on the value of the <code>commitsOnValidEdit</code> property.
+   *
+   */
+  // FIXME: Handle allowsInvalid and overwriteMode properties
+  private class FormatterDocumentFilter
+    extends DocumentFilter
+  {
+    /**
+     * Invoked when text is removed from a text component.
+     *
+     * @param bypass the FilterBypass to use to mutate the document
+     * @param offset the start position of the modification
+     * @param length the length of the removed text
+     *
+     * @throws BadLocationException if offset or lenght are invalid in
+     *     the Document
+     */
+    public void remove(DocumentFilter.FilterBypass bypass, int offset,
+                        int length)
+      throws BadLocationException
+    {
+      super.remove(bypass, offset, length);
+      checkValidInput();
+      commitIfAllowed();
+    }
+    
+    /**
+     * Invoked when text is inserted into a text component.
+     *
+     * @param bypass the FilterBypass to use to mutate the document
+     * @param offset the start position of the modification
+     * @param text the inserted text
+     * @param attributes the attributes of the inserted text
+     *
+     * @throws BadLocationException if offset or lenght are invalid in
+     *     the Document
+     */
+    public void insertString(DocumentFilter.FilterBypass bypass, int offset,
+                              String text, AttributeSet attributes)
+      throws BadLocationException
+    {
+      if (overwriteMode == true)
+        replace(bypass, offset, text.length(), text, attributes);
+      else
+        super.insertString(bypass, offset, text, attributes);
+      checkValidInput();
+      commitIfAllowed();
+    }
+
+    /**
+     * Invoked when text is replaced in a text component.
+     * 
+     * @param bypass the FilterBypass to use to mutate the document
+     * @param offset the start position of the modification
+     * @param length the length of the removed text
+     * @param text the inserted text
+     * @param attributes the attributes of the inserted text
+     *
+     * @throws BadLocationException if offset or lenght are invalid in
+     *     the Document
+     */
+    public void replace(DocumentFilter.FilterBypass bypass, int offset,
+                         int length, String text, AttributeSet attributes)
+      throws BadLocationException
+    {
+      super.replace(bypass, offset, length, text, attributes);
+      checkValidInput();
+      commitIfAllowed();
+    }
+
+    /**
+     * Commits the value to the JTextTextField if the property
+     * <code>commitsOnValidEdit</code> is set to <code>true</code>.
+     */
+    private void commitIfAllowed()
+    {
+      if (commitsOnValidEdit == true)
+        try
+          {
+            getFormattedTextField().commitEdit();
+          }
+        catch (ParseException ex)
+          {
+            // ignore invalid edits
+          }
+    }
+
+    /**
+     * Checks if the value in the input field is valid. If the
+     * property allowsInvalid is set to <code>false</code>, then
+     * the string in the input field is not allowed to be entered.
+     *
+     * @param doc the document of the input field
+     * @param value the current (old) value of the input field
+     */
+    private void checkValidInput()
+    {
+      JFormattedTextField ftf = getFormattedTextField();
+      try
+        {
+          Object newval = stringToValue(ftf.getText());
+        }
+      catch (ParseException ex)
+        {
+          if (!allowsInvalid)
+            {
+              // roll back the input if invalid edits are not allowed
+              try
+                {
+                  ftf.setText(valueToString(ftf.getValue()));
+                }
+              catch (ParseException pe)
+                {
+                  // if that happens, something serious must be wrong
+                  throw new AssertionError("values must be parseable");
+                }
+            }
+        }
+    }
+  }
+
+  /** The serialVersoinUID. */
+  private static final long serialVersionUID = -7369196326612908900L;
+
+  /**
+   * Indicates if the value should be committed after every
+   * valid modification of the Document.
+   */
+  boolean commitsOnValidEdit;
+
+  /**
+   * If <code>true</code> newly inserted characters overwrite existing
+   * values, otherwise insertion is done the normal way.
+   */
+  boolean overwriteMode;
+
+  /**
+   * If <code>true</code> invalid edits are allowed for a limited
+   * time.
+   */
+  boolean allowsInvalid;
+
+  /**
+   * The class that is used for values.
+   */
+  Class valueClass;
+
+  /**
+   * Creates a new instance of <code>DefaultFormatter</code>.
+   */
+  public DefaultFormatter()
+  {
+    commitsOnValidEdit = true;
+    overwriteMode = true;
+    allowsInvalid = true;
+    valueClass = Object.class;
+  }
+
+  /**
+   * Installs the formatter on the specified {@link JFormattedTextField}.
+   *
+   * This method does the following things:
+   * <ul>
+   * <li>Display the value of #valueToString in the
+   *  <code>JFormattedTextField</code></li>
+   * <li>Install the Actions from #getActions on the <code>JTextField</code>
+   * </li>
+   * <li>Install the DocumentFilter returned by #getDocumentFilter</li>
+   * <li>Install the NavigationFilter returned by #getNavigationFilter</li>
+   * </ul>
+   *
+   * This method is typically not overridden by subclasses. Instead override
+   * one of the mentioned methods in order to customize behaviour.
+   *
+   * @param ftf the {@link JFormattedTextField} in which this formatter
+   *     is installed 
+   */
+  public void install(JFormattedTextField ftf)
+  {
+    super.install(ftf);
+  }
+
+  /**
+   * Returns <code>true</code> if the value should be committed after
+   * each valid modification of the input field, <code>false</code> if
+   * it should never be committed by this formatter.
+   *
+   * @return the state of the <code>commitsOnValidEdit</code> property
+   *
+   * @see #setCommitsOnValidEdit
+   */
+  public boolean getCommitsOnValidEdit()
+  {
+    return commitsOnValidEdit;
+  }
+
+  /**
+   * Sets the value of the <code>commitsOnValidEdit</code> property.
+   *
+   * @param commitsOnValidEdit the new state of the
+   *     <code>commitsOnValidEdit</code> property
+   *
+   * @see #getCommitsOnValidEdit
+   */
+  public void setCommitsOnValidEdit(boolean commitsOnValidEdit)
+  {
+    this.commitsOnValidEdit = commitsOnValidEdit;
+  }
+
+  /**
+   * Returns the value of the <code>overwriteMode</code> property.
+   * If that is set to <code>true</code> then newly inserted characters
+   * overwrite existing values, otherwise the characters are inserted like
+   * normal. The default is <code>true</code>.
+   *
+   * @return the value of the <code>overwriteMode</code> property
+   */
+  public boolean getOverwriteMode()
+  {
+    return overwriteMode;
+  }
+
+  /**
+   * Sets the value of the <code>overwriteMode</code> property.
+   * 
+   * If that is set to <code>true</code> then newly inserted characters
+   * overwrite existing values, otherwise the characters are inserted like
+   * normal. The default is <code>true</code>.
+   *
+   * @param overwriteMode the new value for the <code>overwriteMode</code>
+   *     property
+   */
+  public void setOverwriteMode(boolean overwriteMode)
+  {
+    this.overwriteMode = overwriteMode;
+  }
+
+  /**
+   * Returns whether or not invalid edits are allowed or not. If invalid
+   * edits are allowed, the JFormattedTextField may temporarily contain invalid
+   * characters.
+   *
+   * @return the value of the allowsInvalid property
+   */
+  public boolean getAllowsInvalid()
+  {
+    return allowsInvalid;
+  }
+
+  /**
+   * Sets the value of the <code>allowsInvalid</code> property.
+   *
+   * @param allowsInvalid the new value for the property
+   *
+   * @see #getAllowsInvalid()
+   */
+  public void setAllowsInvalid(boolean allowsInvalid)
+  {
+    this.allowsInvalid = allowsInvalid;
+  }
+
+  /**
+   * Returns the class that is used for values. When Strings are converted
+   * back to values, this class is used to create new value objects.
+   *
+   * @return the class that is used for values
+   */
+  public Class getValueClass()
+  {
+    return valueClass;
+  }
+
+  /**
+   * Sets the class that is used for values.
+   *
+   * @param valueClass the class that is used for values
+   *
+   * @see #getValueClass()
+   */
+  public void setValueClass(Class valueClass)
+  {
+    this.valueClass = valueClass;
+  }
+
+  /**
+   * Converts a String (from the JFormattedTextField input) to a value.
+   * In order to achieve this, the formatter tries to instantiate an object
+   * of the class returned by #getValueClass() using a single argument
+   * constructor that takes a String argument. If such a constructor cannot
+   * be found, the String itself is returned.
+   *
+   * @param string the string to convert
+   *
+   * @return the value for the string
+   *
+   * @throws ParseException if the string cannot be converted into
+   *     a value object (e.g. invalid input)
+   */
+  public Object stringToValue(String string)
+    throws ParseException
+  {
+    Object value = string;
+    Class valueClass = getValueClass();
+    if (valueClass == null)
+      valueClass = getFormattedTextField().getValue().getClass();
+    if (valueClass != null)
+      try
+        {
+          Constructor constr = valueClass.getConstructor
+                                             (new Class[]{String.class});
+          value = constr.newInstance(new Object[]{ string });
+        }
+      catch (NoSuchMethodException ex)
+        {
+          // leave value as string
+        }
+      catch (Exception ex)
+        {
+          throw new ParseException(string, 0);
+        }
+    return value;
+  }
+
+  /**
+   * Converts a value object into a String. This is done by invoking the
+   * {@link Object#toString()} method on the value.
+   *
+   * @param value the value to be converted
+   *
+   * @return the string representation of the value
+   *
+   * @throws ParseException if the value cannot be converted
+   */
+  public String valueToString(Object value)
+    throws ParseException
+  {
+    return value.toString();
+  }
+
+  /**
+   * Creates and returns a clone of this DefaultFormatter.
+   *
+   * @return a clone of this object
+   *
+   * @throws CloneNotSupportedException not thrown here
+   */
+  public Object clone()
+    throws CloneNotSupportedException
+  {
+    return super.clone();
+  }
+
+  /**
+   * Returns the DocumentFilter that is used to restrict input.
+   *
+   * @return the DocumentFilter that is used to restrict input
+   */
+  protected DocumentFilter getDocumentFilter()
+  {
+    return new FormatterDocumentFilter();
+  }
+}



More information about the kaffe mailing list