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

Print this page




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


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