This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: javax.swing.InputVerifier


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi list,


I just commited thhe attached patch to improve InputVerifier support.


Michael


2004-09-13  Michael Koch  <konqueror@gmx.de>

	* javax/swing/InputVerifier.java:
	Re-formatted.
	* javax/swing/JComponent.java
	(inputVerifier): New property field.
	(getInputVerifier): New method.
	(setInputVerifier): Likewise.
- -- 
Homepage: http://www.worldforge.org/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBRZ/fWSOgCCdjSDsRAnsKAKCVVAYyPxA6zM+tSzNoh2nR36QO2wCfZVIH
9fkBD6HlB6sGYCtTF6m9KRA=
=2p/C
-----END PGP SIGNATURE-----
Index: javax/swing/InputVerifier.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/InputVerifier.java,v
retrieving revision 1.1
diff -u -r1.1 InputVerifier.java
--- javax/swing/InputVerifier.java	9 Aug 2002 04:26:10 -0000	1.1
+++ javax/swing/InputVerifier.java	13 Sep 2004 13:12:44 -0000
@@ -1,5 +1,5 @@
 /* InputVerifier.java --
-   Copyright (C) 2002 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -37,43 +37,39 @@
 
 package javax.swing;
 
+
 /**
  * InputVerifier
- * @author	Andrew Selkirk
- * @version	1.0
+ * @author Andrew Selkirk
+ * @version 1.0
  */
-public abstract class InputVerifier {
-
-	//-------------------------------------------------------------
-	// Initialization ---------------------------------------------
-	//-------------------------------------------------------------
-
-	/**
-	 * Constructor InputVerifier
-	 */
-	public InputVerifier() {
-	} // InputVerifier()
-
-
-	//-------------------------------------------------------------
-	// Methods ----------------------------------------------------
-	//-------------------------------------------------------------
-
-	/**
-	 * verify
-	 * @param component TODO
-	 * @returns boolean
-	 */
-	public abstract boolean verify(JComponent component);
-
-	/**
-	 * shouldYieldFocus
-	 * @param component TODO
-	 * @returns boolean
-	 */
-	public boolean shouldYieldFocus(JComponent component) {
-		return verify(component);
-	} // shouldYieldFocus()
-
-
-} // InputVerifier
+public abstract class InputVerifier
+{
+  /**
+   * Creates a <code>InputVerifier</code>
+   */
+  public InputVerifier()
+  {
+  }
+
+  /**
+   * verify
+   *
+   * @param component the component to verify
+   *
+   * @return <code>true</code> if valid, <code>false</code> otherwise.
+   */
+  public abstract boolean verify(JComponent component);
+
+  /**
+   * shouldYieldFocus
+   *
+   * @param component the component to verify
+   *
+   * @return <code>true</code> if valid, <code>false</code> otherwise.
+   */
+  public boolean shouldYieldFocus(JComponent component)
+  {
+    return verify(component);
+  }
+}
Index: javax/swing/JComponent.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/javax/swing/JComponent.java,v
retrieving revision 1.7.2.18
diff -u -r1.7.2.18 JComponent.java
--- javax/swing/JComponent.java	13 Sep 2004 12:30:07 -0000	1.7.2.18
+++ javax/swing/JComponent.java	13 Sep 2004 13:12:44 -0000
@@ -323,6 +323,7 @@
   private InputMap inputMap_whenAncestorOfFocused;
   private InputMap inputMap_whenInFocusedWindow;
   private ActionMap actionMap;
+  private InputVerifier inputVerifier;
 
   /** 
    * A lock held during recursive painting; this is used to serialize
@@ -2134,4 +2135,26 @@
   {
     defaultLocale = l;
   }
+  
+  /**
+   * Returns the currently set input verifier for this component.
+   *
+   * @return the input verifier, or <code>null</code> if none
+   */
+  public InputVerifier getInputVerifier()
+  {
+    return inputVerifier;
+  }
+
+  /**
+   * Sets the input verifier to use by this component.
+   *
+   * @param verifier the input verifier, or <code>null</code>
+   */
+  public void setInputVerifier(InputVerifier verifier)
+  {
+    InputVerifier oldVerifier = inputVerifier;
+    inputVerifier = verifier;
+    firePropertyChange("inputVerifier", oldVerifier, verifier);
+  }
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]