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

Print this page




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


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