* FYI: New KeyboardFocusManager tests
@ 2006-07-26 21:06 Roman Kennke
0 siblings, 0 replies; only message in thread
From: Roman Kennke @ 2006-07-26 21:06 UTC (permalink / raw)
To: mauve-patches
[-- Attachment #1: Type: text/plain, Size: 518 bytes --]
Here come a couple of KeyboardFocusManager related tests that back up my
latest patch, and show that we are overly restrictive wrt
SecurityExceptions here.
2006-07-26 Roman Kennke <kennke@aicas.com>
* gnu/testlet/java/awt/KeyboardFocusManager/TestKeyboardFocusManager.java,
* gnu/testlet/java/awt/KeyboardFocusManager/getFocusOwner.java,
* gnu/testlet/java/awt/KeyboardFocusManager/getGlobalFocusOwner.java,
*
gnu/testlet/java/awt/KeyboardFocusManager/getGlobalPermanentFocusOwner.java:
New tests.
/Roman
[-- Attachment #2: patch.diff --]
[-- Type: text/x-patch, Size: 2268 bytes --]
Index: java/awt/KeyboardFocusManager.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/KeyboardFocusManager.java,v
retrieving revision 1.18
diff -u -1 -2 -r1.18 KeyboardFocusManager.java
--- java/awt/KeyboardFocusManager.java 26 Jul 2006 19:09:50 -0000 1.18
+++ java/awt/KeyboardFocusManager.java 26 Jul 2006 19:39:28 -0000
@@ -295,47 +295,41 @@
currentKeyboardFocusManagers.put (currentGroup, manager);
}
/**
* Retrieve the {@link Component} that has the keyboard focus, or
* null if the focus owner was not set by a thread in the current
* {@link java.lang.ThreadGroup}.
*
* @return the keyboard focus owner or null
*/
public Component getFocusOwner ()
{
- Component owner = (Component) getObject (currentFocusOwners);
- if (owner == null)
- owner = (Component) getObject (currentPermanentFocusOwners);
- return owner;
+ return (Component) getObject (currentFocusOwners);
}
/**
* Retrieve the {@link Component} that has the keyboard focus,
* regardless of whether or not it was set by a thread in the
* current {@link java.lang.ThreadGroup}. If there is no temporary
* focus owner in effect then this method will return the same value
* as {@link #getGlobalPermanentFocusOwner}.
*
* @return the keyboard focus owner
* @throws SecurityException if this is not the keyboard focus
* manager associated with the current {@link java.lang.ThreadGroup}
*/
protected Component getGlobalFocusOwner ()
{
- // Check if there is a temporary focus owner.
- Component focusOwner = (Component) getGlobalObject (currentFocusOwners);
-
- return (focusOwner == null) ? getGlobalPermanentFocusOwner () : focusOwner;
+ return (Component) getGlobalObject(currentFocusOwners);
}
/**
* Set the {@link Component} that will be returned by {@link
* #getFocusOwner} (when it is called from the current {@link
* java.lang.ThreadGroup}) and {@link #getGlobalFocusOwner}. This
* method does not actually transfer the keyboard focus.
*
* @param owner the Component to return from getFocusOwner and
* getGlobalFocusOwner
*
* @see Component#requestFocus()
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-07-26 21:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-26 21:06 FYI: New KeyboardFocusManager tests Roman Kennke
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).