diff -r 487e1aa949c4 -r ef327bd847c0 jdk/src/share/classes/java/awt/Component.java --- a/jdk/src/share/classes/java/awt/Component.java Tue Sep 29 09:02:00 2009 -0700 +++ b/jdk/src/share/classes/java/awt/Component.java Tue Sep 29 16:03:03 2009 -0700 @@ -60,7 +60,6 @@ import java.security.AccessController; import java.security.PrivilegedAction; import javax.accessibility.*; -import java.util.logging.*; import java.applet.Applet; import sun.security.action.GetPropertyAction; @@ -84,6 +83,7 @@ import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.*; import sun.awt.RequestFocusController; import sun.java2d.SunGraphicsEnvironment; +import sun.util.logging.PlatformLogger; /** * A component is an object having a graphical representation @@ -178,10 +178,10 @@ Serializable { - private static final Logger log = Logger.getLogger("java.awt.Component"); - private static final Logger eventLog = Logger.getLogger("java.awt.event.Component"); - private static final Logger focusLog = Logger.getLogger("java.awt.focus.Component"); - private static final Logger mixingLog = Logger.getLogger("java.awt.mixing.Component"); + private static final PlatformLogger log = PlatformLogger.getLogger("java.awt.Component"); + private static final PlatformLogger eventLog = PlatformLogger.getLogger("java.awt.event.Component"); + private static final PlatformLogger focusLog = PlatformLogger.getLogger("java.awt.focus.Component"); + private static final PlatformLogger mixingLog = PlatformLogger.getLogger("java.awt.mixing.Component"); /** * The peer of the component. The peer implements the component's @@ -4478,13 +4478,13 @@ // Check that this component belongs to this app-context AppContext compContext = appContext; if (compContext != null && !compContext.equals(AppContext.getAppContext())) { - if (eventLog.isLoggable(Level.FINE)) { - eventLog.log(Level.FINE, "Event " + e + " is being dispatched on the wrong AppContext"); - } - } - - if (eventLog.isLoggable(Level.FINEST)) { - eventLog.log(Level.FINEST, "{0}", e); + if (eventLog.isLoggable(PlatformLogger.FINE)) { + eventLog.fine("Event " + e + " is being dispatched on the wrong AppContext"); + } + } + + if (eventLog.isLoggable(PlatformLogger.FINEST)) { + eventLog.finest("{0}", e); } /* @@ -4519,8 +4519,8 @@ return; } } - if ((e instanceof FocusEvent) && focusLog.isLoggable(Level.FINEST)) { - focusLog.log(Level.FINEST, "" + e); + if ((e instanceof FocusEvent) && focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("" + e); } // MouseWheel may need to be retargeted here so that // AWTEventListener sees the event go to the correct @@ -4577,8 +4577,8 @@ if (inputContext != null) { inputContext.dispatchEvent(e); if (e.isConsumed()) { - if ((e instanceof FocusEvent) && focusLog.isLoggable(Level.FINEST)) { - focusLog.log(Level.FINEST, "3579: Skipping " + e); + if ((e instanceof FocusEvent) && focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("3579: Skipping " + e); } return; } @@ -4612,8 +4612,8 @@ if (p != null) { p.preProcessKeyEvent((KeyEvent)e); if (e.isConsumed()) { - if (focusLog.isLoggable(Level.FINEST)) { - focusLog.log(Level.FINEST, "Pre-process consumed event"); + if (focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("Pre-process consumed event"); } return; } @@ -4745,9 +4745,9 @@ // position relative to its parent. MouseWheelEvent newMWE; - if (eventLog.isLoggable(Level.FINEST)) { - eventLog.log(Level.FINEST, "dispatchMouseWheelToAncestor"); - eventLog.log(Level.FINEST, "orig event src is of " + e.getSource().getClass()); + if (eventLog.isLoggable(PlatformLogger.FINEST)) { + eventLog.finest("dispatchMouseWheelToAncestor"); + eventLog.finest("orig event src is of " + e.getSource().getClass()); } /* parent field for Window refers to the owning Window. @@ -4768,8 +4768,8 @@ } } - if (eventLog.isLoggable(Level.FINEST)) { - eventLog.log(Level.FINEST, "new event src is " + anc.getClass()); + if (eventLog.isLoggable(PlatformLogger.FINEST)) { + eventLog.finest("new event src is " + anc.getClass()); } if (anc != null && anc.eventEnabled(e)) { @@ -5264,11 +5264,11 @@ // Should only be called while holding the tree lock int numListening(long mask) { // One mask or the other, but not neither or both. - if (eventLog.isLoggable(Level.FINE)) { + if (eventLog.isLoggable(PlatformLogger.FINE)) { if ((mask != AWTEvent.HIERARCHY_EVENT_MASK) && (mask != AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK)) { - eventLog.log(Level.FINE, "Assertion failed"); + eventLog.fine("Assertion failed"); } } if ((mask == AWTEvent.HIERARCHY_EVENT_MASK && @@ -5305,9 +5305,9 @@ break; case HierarchyEvent.ANCESTOR_MOVED: case HierarchyEvent.ANCESTOR_RESIZED: - if (eventLog.isLoggable(Level.FINE)) { + if (eventLog.isLoggable(PlatformLogger.FINE)) { if (changeFlags != 0) { - eventLog.log(Level.FINE, "Assertion (changeFlags == 0) failed"); + eventLog.fine("Assertion (changeFlags == 0) failed"); } } if (hierarchyBoundsListener != null || @@ -5321,8 +5321,8 @@ break; default: // assert false - if (eventLog.isLoggable(Level.FINE)) { - eventLog.log(Level.FINE, "This code must never be reached"); + if (eventLog.isLoggable(PlatformLogger.FINE)) { + eventLog.fine("This code must never be reached"); } break; } @@ -7383,8 +7383,8 @@ CausedFocusEvent.Cause cause) { if (!isRequestFocusAccepted(temporary, focusedWindowChangeAllowed, cause)) { - if (focusLog.isLoggable(Level.FINEST)) { - focusLog.log(Level.FINEST, "requestFocus is not accepted"); + if (focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("requestFocus is not accepted"); } return false; } @@ -7395,8 +7395,8 @@ Component window = this; while ( (window != null) && !(window instanceof Window)) { if (!window.isVisible()) { - if (focusLog.isLoggable(Level.FINEST)) { - focusLog.log(Level.FINEST, "component is recurively invisible"); + if (focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("component is recurively invisible"); } return false; } @@ -7407,15 +7407,15 @@ Component heavyweight = (peer instanceof LightweightPeer) ? getNativeContainer() : this; if (heavyweight == null || !heavyweight.isVisible()) { - if (focusLog.isLoggable(Level.FINEST)) { - focusLog.log(Level.FINEST, "Component is not a part of visible hierarchy"); + if (focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("Component is not a part of visible hierarchy"); } return false; } peer = heavyweight.peer; if (peer == null) { - if (focusLog.isLoggable(Level.FINEST)) { - focusLog.log(Level.FINEST, "Peer is null"); + if (focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("Peer is null"); } return false; } @@ -7427,12 +7427,12 @@ if (!success) { KeyboardFocusManager.getCurrentKeyboardFocusManager (appContext).dequeueKeyEvents(time, this); - if (focusLog.isLoggable(Level.FINEST)) { - focusLog.log(Level.FINEST, "Peer request failed"); + if (focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("Peer request failed"); } } else { - if (focusLog.isLoggable(Level.FINEST)) { - focusLog.log(Level.FINEST, "Pass for " + this); + if (focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("Pass for " + this); } } return success; @@ -7443,24 +7443,24 @@ CausedFocusEvent.Cause cause) { if (!isFocusable() || !isVisible()) { - if (focusLog.isLoggable(Level.FINEST)) { - focusLog.log(Level.FINEST, "Not focusable or not visible"); + if (focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("Not focusable or not visible"); } return false; } ComponentPeer peer = this.peer; if (peer == null) { - if (focusLog.isLoggable(Level.FINEST)) { - focusLog.log(Level.FINEST, "peer is null"); + if (focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("peer is null"); } return false; } Window window = getContainingWindow(); if (window == null || !((Window)window).isFocusableWindow()) { - if (focusLog.isLoggable(Level.FINEST)) { - focusLog.log(Level.FINEST, "Component doesn't have toplevel"); + if (focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("Component doesn't have toplevel"); } return false; } @@ -7481,8 +7481,8 @@ // Controller is supposed to verify focus transfers and for this it // should know both from and to components. And it shouldn't verify // transfers from when these components are equal. - if (focusLog.isLoggable(Level.FINEST)) { - focusLog.log(Level.FINEST, "focus owner is null or this"); + if (focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("focus owner is null or this"); } return true; } @@ -7494,8 +7494,8 @@ // most recent focus owner. But most recent focus owner can be // changed by requestFocsuXXX() call only, so this transfer has // been already approved. - if (focusLog.isLoggable(Level.FINEST)) { - focusLog.log(Level.FINEST, "cause is activation"); + if (focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("cause is activation"); } return true; } @@ -7505,8 +7505,8 @@ temporary, focusedWindowChangeAllowed, cause); - if (focusLog.isLoggable(Level.FINEST)) { - focusLog.log(Level.FINEST, "RequestFocusController returns {0}", ret); + if (focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("RequestFocusController returns {0}", ret); } return ret; @@ -7597,7 +7597,7 @@ } boolean transferFocus(boolean clearOnFailure) { - if (focusLog.isLoggable(Level.FINER)) { + if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("clearOnFailure = " + clearOnFailure); } Component toFocus = getNextFocusCandidate(); @@ -7606,12 +7606,12 @@ res = toFocus.requestFocusInWindow(CausedFocusEvent.Cause.TRAVERSAL_FORWARD); } if (clearOnFailure && !res) { - if (focusLog.isLoggable(Level.FINER)) { + if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("clear global focus owner"); } KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner(); } - if (focusLog.isLoggable(Level.FINER)) { + if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("returning result: " + res); } return res; @@ -7626,19 +7626,19 @@ comp = rootAncestor; rootAncestor = comp.getFocusCycleRootAncestor(); } - if (focusLog.isLoggable(Level.FINER)) { + if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("comp = " + comp + ", root = " + rootAncestor); } Component candidate = null; if (rootAncestor != null) { FocusTraversalPolicy policy = rootAncestor.getFocusTraversalPolicy(); Component toFocus = policy.getComponentAfter(rootAncestor, comp); - if (focusLog.isLoggable(Level.FINER)) { + if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("component after is " + toFocus); } if (toFocus == null) { toFocus = policy.getDefaultComponent(rootAncestor); - if (focusLog.isLoggable(Level.FINER)) { + if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("default component is " + toFocus); } } @@ -7650,7 +7650,7 @@ } candidate = toFocus; } - if (focusLog.isLoggable(Level.FINER)) { + if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("Focus transfer candidate: " + candidate); } return candidate; @@ -7687,12 +7687,12 @@ } } if (!res) { - if (focusLog.isLoggable(Level.FINER)) { + if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("clear global focus owner"); } KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner(); } - if (focusLog.isLoggable(Level.FINER)) { + if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("returning result: " + res); } return res; @@ -9448,7 +9448,7 @@ checkTreeLock(); if (!areBoundsValid()) { - if (mixingLog.isLoggable(Level.FINE)) { + if (mixingLog.isLoggable(PlatformLogger.FINE)) { mixingLog.fine("this = " + this + "; areBoundsValid = " + areBoundsValid()); } return; @@ -9484,7 +9484,7 @@ } this.compoundShape = shape; Point compAbsolute = getLocationOnWindow(); - if (mixingLog.isLoggable(Level.FINER)) { + if (mixingLog.isLoggable(PlatformLogger.FINER)) { mixingLog.fine("this = " + this + "; compAbsolute=" + compAbsolute + "; shape=" + shape); } @@ -9618,7 +9618,7 @@ checkTreeLock(); Region s = getNormalShape(); - if (mixingLog.isLoggable(Level.FINE)) { + if (mixingLog.isLoggable(PlatformLogger.FINE)) { mixingLog.fine("this = " + this + "; normalShape=" + s); } @@ -9652,7 +9652,7 @@ } } - if (mixingLog.isLoggable(Level.FINE)) { + if (mixingLog.isLoggable(PlatformLogger.FINE)) { mixingLog.fine("currentShape=" + s); } @@ -9662,12 +9662,12 @@ void applyCurrentShape() { checkTreeLock(); if (!areBoundsValid()) { - if (mixingLog.isLoggable(Level.FINE)) { + if (mixingLog.isLoggable(PlatformLogger.FINE)) { mixingLog.fine("this = " + this + "; areBoundsValid = " + areBoundsValid()); } return; // Because applyCompoundShape() ignores such components anyway } - if (mixingLog.isLoggable(Level.FINE)) { + if (mixingLog.isLoggable(PlatformLogger.FINE)) { mixingLog.fine("this = " + this); } applyCompoundShape(calculateCurrentShape()); @@ -9676,7 +9676,7 @@ final void subtractAndApplyShape(Region s) { checkTreeLock(); - if (mixingLog.isLoggable(Level.FINE)) { + if (mixingLog.isLoggable(PlatformLogger.FINE)) { mixingLog.fine("this = " + this + "; s=" + s); } @@ -9723,7 +9723,7 @@ void mixOnShowing() { synchronized (getTreeLock()) { - if (mixingLog.isLoggable(Level.FINE)) { + if (mixingLog.isLoggable(PlatformLogger.FINE)) { mixingLog.fine("this = " + this); } if (!isMixingNeeded()) { @@ -9741,7 +9741,7 @@ // We cannot be sure that the peer exists at this point, so we need the argument // to find out whether the hiding component is (well, actually was) a LW or a HW. synchronized (getTreeLock()) { - if (mixingLog.isLoggable(Level.FINE)) { + if (mixingLog.isLoggable(PlatformLogger.FINE)) { mixingLog.fine("this = " + this + "; isLightweight = " + isLightweight); } if (!isMixingNeeded()) { @@ -9755,7 +9755,7 @@ void mixOnReshaping() { synchronized (getTreeLock()) { - if (mixingLog.isLoggable(Level.FINE)) { + if (mixingLog.isLoggable(PlatformLogger.FINE)) { mixingLog.fine("this = " + this); } if (!isMixingNeeded()) { @@ -9774,7 +9774,7 @@ boolean becameHigher = newZorder < oldZorder; Container parent = getContainer(); - if (mixingLog.isLoggable(Level.FINE)) { + if (mixingLog.isLoggable(PlatformLogger.FINE)) { mixingLog.fine("this = " + this + "; oldZorder=" + oldZorder + "; newZorder=" + newZorder + "; parent=" + parent); } @@ -9818,13 +9818,13 @@ final boolean isMixingNeeded() { if (SunToolkit.getSunAwtDisableMixing()) { - if (mixingLog.isLoggable(Level.FINEST)) { + if (mixingLog.isLoggable(PlatformLogger.FINEST)) { mixingLog.finest("this = " + this + "; Mixing disabled via sun.awt.disableMixing"); } return false; } if (!areBoundsValid()) { - if (mixingLog.isLoggable(Level.FINE)) { + if (mixingLog.isLoggable(PlatformLogger.FINE)) { mixingLog.fine("this = " + this + "; areBoundsValid = " + areBoundsValid()); } return false; @@ -9832,7 +9832,7 @@ Window window = getContainingWindow(); if (window != null) { if (!window.hasHeavyweightDescendants() || !window.hasLightweightDescendants()) { - if (mixingLog.isLoggable(Level.FINE)) { + if (mixingLog.isLoggable(PlatformLogger.FINE)) { mixingLog.fine("containing window = " + window + "; has h/w descendants = " + window.hasHeavyweightDescendants() + "; has l/w descendants = " + window.hasLightweightDescendants()); @@ -9840,8 +9840,8 @@ return false; } } else { - if (mixingLog.isLoggable(Level.FINE)) { - mixingLog.finest("this = " + this + "; containing window is null"); + if (mixingLog.isLoggable(PlatformLogger.FINE)) { + mixingLog.fine("this = " + this + "; containing window is null"); } return false; }