harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r588705 - /harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/MenuKeyBindingProcessor.java
Date Fri, 26 Oct 2007 16:35:50 GMT
Author: ayza
Date: Fri Oct 26 09:35:49 2007
New Revision: 588705

URL: http://svn.apache.org/viewvc?rev=588705&view=rev
Log:
Committing the fix for KeyEvent handling issue described in HARMONY-5006 (
[classlib][EIOffice]menu selection problem)

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/MenuKeyBindingProcessor.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/MenuKeyBindingProcessor.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/MenuKeyBindingProcessor.java?rev=588705&r1=588704&r2=588705&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/MenuKeyBindingProcessor.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/plaf/basic/MenuKeyBindingProcessor.java
Fri Oct 26 09:35:49 2007
@@ -22,8 +22,11 @@
 
 import java.awt.Component;
 import java.awt.KeyEventDispatcher;
+import java.awt.Toolkit;
+import java.awt.AWTEvent;
 import java.awt.event.ActionEvent;
 import java.awt.event.KeyEvent;
+import java.awt.event.AWTEventListener;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.HashMap;
@@ -326,10 +329,22 @@
     }
 
     public boolean dispatchKeyEvent(final KeyEvent e) {
-        if (e.getID() != KeyEvent.KEY_PRESSED) {
+        if (e.getID() != KeyEvent.KEY_PRESSED || e.isConsumed()) {
             return false;
         }
 
+        // dispatch event to user listeners
+        for (AWTEventListener listener :
+                Toolkit.getDefaultToolkit().getAWTEventListeners(
+                    AWTEvent.KEY_EVENT_MASK)) {
+            listener.eventDispatched(e);
+        }
+        
+        if (e.isConsumed()) {
+            // consumed by user listener
+            return true;
+        }
+        
         final JPopupMenu activePopupMenu = getActivePopupMenu();
         if (activePopupMenu == null) {
             return false;
@@ -340,6 +355,7 @@
         if (action == null) {
             return false;
         }
+        
         SwingUtilities.notifyAction(action, ks, e, activePopupMenu, e.getModifiersEx());
         return true;
     }



Mime
View raw message