Hi list,
the attached patch adds generation of widget names for java.awt.CheckBox
and java.awt.Window objects. Its that way this is done in other widgets
in java.awt.
Ok to commit to trunk ?
Michael
2005-02-21 Michael Koch <konqueror@gmx.de>
* java/awt/Checkbox.java
(next_checkbox_number): New static variable.
(generateName): New method.
(getUniqueLong): Likewise.
* java/awt/Window.java
(next_window_number): New static variable.
(generateName): New method.
(getUniqueLong): Likewise.
-------------- next part --------------
Index: java/awt/Checkbox.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Checkbox.java,v
retrieving revision 1.15
diff -u -r1.15 Checkbox.java
--- java/awt/Checkbox.java 22 Jan 2005 01:48:27 -0000 1.15
+++ java/awt/Checkbox.java 21 Feb 2005 16:39:37 -0000
@@ -1,5 +1,5 @@
/* Checkbox.java -- An AWT checkbox widget
- Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -95,6 +95,11 @@
// The list of listeners for this object.
private transient ItemListener item_listeners;
+ /*
+ * The number used to generate the name returned by getName.
+ */
+ private static transient long next_checkbox_number;
+
/**
* This class provides accessibility support for the
* checkbox.
@@ -106,7 +111,6 @@
extends AccessibleAWTComponent
implements ItemListener, AccessibleAction, AccessibleValue
{
-
/**
* Serialization constant to match JDK 1.5
*/
@@ -627,4 +631,18 @@
return accessibleContext;
}
-} // class Checkbox
+ /**
+ * Generate a unique name for this checkbox.
+ *
+ * @return A unique name for this checkbox.
+ */
+ String generateName()
+ {
+ return "checkbox" + getUniqueLong();
+ }
+
+ private static synchronized long getUniqueLong()
+ {
+ return next_checkbox_number++;
+ }
+}
Index: java/awt/Window.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/Window.java,v
retrieving revision 1.44
diff -u -r1.44 Window.java
--- java/awt/Window.java 16 Feb 2005 10:39:26 -0000 1.44
+++ java/awt/Window.java 21 Feb 2005 16:39:37 -0000
@@ -92,6 +92,11 @@
private transient Component windowFocusOwner;
+ /*
+ * The number used to generate the name returned by getName.
+ */
+ private static transient long next_window_number;
+
protected class AccessibleAWTWindow extends AccessibleAWTContainer
{
public AccessibleRole getAccessibleRole()
@@ -945,4 +950,19 @@
getToolkit().getSystemEventQueue().postEvent(ce);
}
}
+
+ /**
+ * Generate a unique name for this window.
+ *
+ * @return A unique name for this window.
+ */
+ String generateName()
+ {
+ return "win" + getUniqueLong();
+ }
+
+ private static synchronized long getUniqueLong()
+ {
+ return next_window_number++;
+ }
}