src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java

Print this page




 115                                        boolean temporary,
 116                                        boolean focusedWindowChangeAllowed,
 117                                        long time,
 118                                        CausedFocusEvent.Cause cause,
 119                                        Component currentFocusOwner) // provided by the descendant peers
 120     {
 121         if (lightweightChild == null) {
 122             lightweightChild = (Component)target;
 123         }
 124 
 125         Component currentOwner = currentFocusOwner;
 126         if (currentOwner != null && currentOwner.getPeer() == null) {
 127             currentOwner = null;
 128         }
 129         if (currentOwner != null) {
 130             FocusEvent fl = new CausedFocusEvent(currentOwner, FocusEvent.FOCUS_LOST,
 131                                                  false, lightweightChild, cause);
 132 
 133             if (focusLog.isLoggable(PlatformLogger.FINER))
 134                 focusLog.finer("Posting focus event: " + fl);
 135             SunToolkit.postPriorityEvent(fl);
 136         }
 137 
 138         FocusEvent fg = new CausedFocusEvent(lightweightChild, FocusEvent.FOCUS_GAINED,
 139                                              false, currentOwner, cause);
 140 
 141         if (focusLog.isLoggable(PlatformLogger.FINER))
 142             focusLog.finer("Posting focus event: " + fg);
 143         SunToolkit.postPriorityEvent(fg);
 144         return true;
 145     }
 146 
 147     // WARNING: Don't call it on the Toolkit thread.
 148     public static boolean requestFocusFor(Component target, CausedFocusEvent.Cause cause) {
 149         return AWTAccessor.getComponentAccessor().requestFocus(target, cause);
 150     }
 151 
 152     // WARNING: Don't call it on the Toolkit thread.
 153     public static int shouldNativelyFocusHeavyweight(Component heavyweight,
 154                                                      Component descendant,
 155                                                      boolean temporary,
 156                                                      boolean focusedWindowChangeAllowed,
 157                                                      long time,
 158                                                      CausedFocusEvent.Cause cause)
 159     {
 160         return kfmAccessor.shouldNativelyFocusHeavyweight(
 161             heavyweight, descendant, temporary, focusedWindowChangeAllowed, time, cause);
 162     }
 163 


 115                                        boolean temporary,
 116                                        boolean focusedWindowChangeAllowed,
 117                                        long time,
 118                                        CausedFocusEvent.Cause cause,
 119                                        Component currentFocusOwner) // provided by the descendant peers
 120     {
 121         if (lightweightChild == null) {
 122             lightweightChild = (Component)target;
 123         }
 124 
 125         Component currentOwner = currentFocusOwner;
 126         if (currentOwner != null && currentOwner.getPeer() == null) {
 127             currentOwner = null;
 128         }
 129         if (currentOwner != null) {
 130             FocusEvent fl = new CausedFocusEvent(currentOwner, FocusEvent.FOCUS_LOST,
 131                                                  false, lightweightChild, cause);
 132 
 133             if (focusLog.isLoggable(PlatformLogger.FINER))
 134                 focusLog.finer("Posting focus event: " + fl);
 135             SunToolkit.postEvent(SunToolkit.targetToAppContext(currentOwner), fl);
 136         }
 137 
 138         FocusEvent fg = new CausedFocusEvent(lightweightChild, FocusEvent.FOCUS_GAINED,
 139                                              false, currentOwner, cause);
 140 
 141         if (focusLog.isLoggable(PlatformLogger.FINER))
 142             focusLog.finer("Posting focus event: " + fg);
 143         SunToolkit.postEvent(SunToolkit.targetToAppContext(lightweightChild), fg);
 144         return true;
 145     }
 146 
 147     // WARNING: Don't call it on the Toolkit thread.
 148     public static boolean requestFocusFor(Component target, CausedFocusEvent.Cause cause) {
 149         return AWTAccessor.getComponentAccessor().requestFocus(target, cause);
 150     }
 151 
 152     // WARNING: Don't call it on the Toolkit thread.
 153     public static int shouldNativelyFocusHeavyweight(Component heavyweight,
 154                                                      Component descendant,
 155                                                      boolean temporary,
 156                                                      boolean focusedWindowChangeAllowed,
 157                                                      long time,
 158                                                      CausedFocusEvent.Cause cause)
 159     {
 160         return kfmAccessor.shouldNativelyFocusHeavyweight(
 161             heavyweight, descendant, temporary, focusedWindowChangeAllowed, time, cause);
 162     }
 163