--- old/glass/glass/src/com/sun/glass/ui/accessible/AccessibleLogger.java 2013-06-07 09:29:57.000000000 -0700 +++ new/glass/glass/src/com/sun/glass/ui/accessible/AccessibleLogger.java 2013-06-07 09:29:57.000000000 -0700 @@ -26,43 +26,31 @@ import java.security.AccessController; import java.security.PrivilegedAction; + import sun.util.logging.PlatformLogger; +import sun.util.logging.PlatformLogger.Level; public class AccessibleLogger { private static final PlatformLogger logger = initLogger(); - private static final int logLevel = logger.getLevel(); private static PlatformLogger initLogger() { PlatformLogger logger = PlatformLogger.getLogger("accessible"); String levelString = AccessController.doPrivileged( new PrivilegedAction() { public String run() { - return System.getProperty("log.accessible"); + return System.getProperty("log.accessible", "SEVERE").toUpperCase(); } }); - int level = PlatformLogger.SEVERE; - if (levelString != null) { - try { - level = Integer.parseInt(levelString); - } catch (NumberFormatException nfe) { - try { - level = PlatformLogger.class - .getField(levelString.toUpperCase()) - .getInt(null); - } catch (Exception e) { } - } + try { + logger.setLevel(Level.valueOf(levelString)); + } catch (Exception e) { + logger.setLevel(Level.SEVERE); } - logger.setLevel(level); return logger; } public static PlatformLogger getLogger() { return logger; } - - public static boolean isLogging(int level) { - return level >= logLevel; - } - } --- old/glass/glass/src/com/sun/glass/ui/lens/LensApplication.java 2013-06-07 09:29:58.000000000 -0700 +++ new/glass/glass/src/com/sun/glass/ui/lens/LensApplication.java 2013-06-07 09:29:58.000000000 -0700 @@ -50,7 +50,7 @@ import com.sun.glass.ui.Timer; import com.sun.glass.ui.View; import com.sun.glass.ui.Window; -import sun.util.logging.PlatformLogger; +import sun.util.logging.PlatformLogger.Level; final class LensApplication extends Application { @@ -555,7 +555,7 @@ } @Override void dispatch() { - if (LensLogger.isLogging(PlatformLogger.FINEST)) { + if (LensLogger.getLogger().isLoggable(Level.FINEST)) { LensLogger.getLogger().finest("processing drag " + action); } switch (action) { @@ -662,7 +662,7 @@ @Override protected Object _enterNestedEventLoop() { - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine("_enterNestedEventLoop"); } @@ -672,7 +672,7 @@ // start our nested loop, which will block until that exits Object ret = _runLoop(); - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine("Resuming event loop"); } @@ -683,7 +683,7 @@ @Override protected void _leaveNestedEventLoop(Object retValue) { - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine("_leaveNestedEventLoop"); } @@ -700,7 +700,7 @@ // blocked nesting call. current.release = retValue; - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine("_leaveNestedEventLoop"); } @@ -716,7 +716,7 @@ //push this new instance on the stack activeRunLoops.push(control); - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine("Starting event loop"); } @@ -737,7 +737,7 @@ event = eventList.removeFirst(); } - if (LensLogger.isLogging(PlatformLogger.FINEST)) { + if (LensLogger.getLogger().isLoggable(Level.FINEST)) { LensLogger.getLogger().fine("Processing " + event); } @@ -748,7 +748,7 @@ } } - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine("Leaving event loop"); } @@ -900,7 +900,7 @@ protected void notifyWindowResize(LensWindow window, int eventType, int width, int height) { - if (LensLogger.isLogging(PlatformLogger.INFO)) { + if (LensLogger.getLogger().isLoggable(Level.INFO)) { LensLogger.getLogger().info( "notifyResize with "+WindowEvent.getEventName(eventType)+ " event "+ window + " to " + width + "x" + height); @@ -926,7 +926,7 @@ * @param y new Y Coordinate of the window */ protected void notifyWindowMove(LensWindow window, int x, int y) { - if (LensLogger.isLogging(PlatformLogger.INFO)) { + if (LensLogger.getLogger().isLoggable(Level.INFO)) { LensLogger.getLogger().info( "Move " + window + " to " + x + "," + y); } @@ -946,9 +946,9 @@ * @param windowEvent the event type as defined in WindowEvent * class. */ - protected void notifyWindowEvent(LensWindow window, int windowEvent) { + protected void notifyWindowEvent(LensWindow window, int windowEvent) { + - LensWindowEvent.EType etype = null; switch (windowEvent) { case WindowEvent.FOCUS_GAINED: @@ -972,9 +972,9 @@ return; } - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine( - "notifyWindowEvent eventType = " + + "notifyWindowEvent eventType = " + WindowEvent.getEventName(windowEvent)); } @@ -985,7 +985,7 @@ protected void windowExpose(LensWindow window, int x, int y, int width, int height) { - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine( "Expose " + window + " " + x + "," + y + "+" + width + "x" + height); @@ -1013,7 +1013,7 @@ private void notifyKeyEvent(LensView view, int type , int keyCode, int modifiers, char[] chars) { try { - if (LensLogger.isLogging(PlatformLogger.FINER)) { + if (LensLogger.getLogger().isLoggable(Level.FINER)) { LensLogger.getLogger().finer("Key event on " + view); } postEvent(new LensKeyEvent(view, type, keyCode, @@ -1047,7 +1047,7 @@ boolean isPopupTrigger, boolean isSynthesized) { try { - if (LensLogger.isLogging(PlatformLogger.FINEST)) { + if (LensLogger.getLogger().isLoggable(Level.FINEST)) { LensLogger.getLogger().finest("Mouse event on " + view); } @@ -1145,19 +1145,19 @@ if (eventType == MouseEvent.DOWN && cachedButtonPressed == MouseEvent.BUTTON_NONE) { //save the button that might have strated the drag event cachedButtonPressed = button; - if (LensLogger.isLogging(PlatformLogger.FINEST)) { + if (LensLogger.getLogger().isLoggable(Level.FINEST)) { LensLogger.getLogger().finest("Caching mouse button - " + button); } } else if (eventType == MouseEvent.UP && button == cachedButtonPressed) { //reset cached button on mouse up cachedButtonPressed = MouseEvent.BUTTON_NONE; - if (LensLogger.isLogging(PlatformLogger.FINEST)) { + if (LensLogger.getLogger().isLoggable(Level.FINEST)) { LensLogger.getLogger().finest("reset mouse button cache " + button); } if (dragStarted) { //drag button has been released while drag is active = drop - if (LensLogger.isLogging(PlatformLogger.FINEST)) { + if (LensLogger.getLogger().isLoggable(Level.FINEST)) { LensLogger.getLogger().finest("notifying drag DROP"); } postEvent(new LensDragEvent(view, x, y, absx, absy, DragActions.DROP)); @@ -1187,7 +1187,7 @@ //first notification postEvent(new LensDragEvent(view, x, y, absx, absy, DragActions.ENTER)); dragActionsPreformed |= DragActions.ENTER.getValue(); - if (LensLogger.isLogging(PlatformLogger.FINEST)) { + if (LensLogger.getLogger().isLoggable(Level.FINEST)) { LensLogger.getLogger().finest("Notifying DragEnter"); } } else if (dragView == view && @@ -1196,7 +1196,7 @@ //now we need to send DragOver notification postEvent(new LensDragEvent(view, x, y, absx, absy, DragActions.OVER)); dragActionsPreformed |= DragActions.OVER.getValue(); - if (LensLogger.isLogging(PlatformLogger.FINEST)) { + if (LensLogger.getLogger().isLoggable(Level.FINEST)) { LensLogger.getLogger().finest("Notifying DragOver"); } } else if (dragView != view) { @@ -1204,12 +1204,12 @@ //reset the actions flags and dragView, //also notify the new view for dragEnter - if (LensLogger.isLogging(PlatformLogger.FINEST)) { + if (LensLogger.getLogger().isLoggable(Level.FINEST)) { LensLogger.getLogger().finest("Notifying DragLeave old view"); } postEvent(new LensDragEvent(dragView, x, y, absx, absy, DragActions.LEAVE)); - if (LensLogger.isLogging(PlatformLogger.FINEST)) { + if (LensLogger.getLogger().isLoggable(Level.FINEST)) { LensLogger.getLogger().finest("Notifying DragEnter new view"); } postEvent(new LensDragEvent(view, x, y, absx, absy, DragActions.ENTER)); @@ -1224,7 +1224,7 @@ //cache the view that the drag started on dragView = view; } - if (LensLogger.isLogging(PlatformLogger.FINEST)) { + if (LensLogger.getLogger().isLoggable(Level.FINEST)) { LensLogger.getLogger().finest("Drag detected - sending DRAG event"); } postEvent(new LensMouseEvent(view, eventType, @@ -1269,7 +1269,7 @@ double yMultiplier) { try { - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine("Scroll event on " + view); } @@ -1299,7 +1299,7 @@ int x, int y, int absX, int absY) { try { - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine("Touch event " + state + " at " + x + "," + y @@ -1326,7 +1326,7 @@ */ private void notifyViewEvent(LensView view, int viewEventType, int x, int y, int width, int height) { - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine( "Notify event type " + ViewEvent.getTypeString(viewEventType) @@ -1339,7 +1339,7 @@ private void notifyMenuEvent(LensView view, int x, int y, int xAbs, int yAbs, boolean isKeyboardTrigger) { - if (LensLogger.isLogging(PlatformLogger.FINER)) { + if (LensLogger.getLogger().isLoggable(Level.FINER)) { LensLogger.getLogger().finer( "Notify menu event " + "x=" + x + ", y=" + y + ", xAbs=" + xAbs + ", yAbs=" + yAbs + @@ -1349,7 +1349,7 @@ if (view != null) { postEvent(new LensMenuEvent(view, x, y, xAbs, yAbs, isKeyboardTrigger)); } else { - if (LensLogger.isLogging(PlatformLogger.FINER)) { + if (LensLogger.getLogger().isLoggable(Level.FINER)) { LensLogger.getLogger().finer("view is null, skipping event"); } } @@ -1363,7 +1363,7 @@ * @param attach true is the device was attached, false if it was detached. */ private void notifyDeviceEvent(int flags, boolean attach) { - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine( "Notify device event attach=" + attach + ", flags=0x" + Integer.toHexString(flags)); @@ -1502,7 +1502,7 @@ @Override protected void _invokeAndWait(Runnable runnable) { - if (LensLogger.isLogging(PlatformLogger.FINEST)) { + if (LensLogger.getLogger().isLoggable(Level.FINEST)) { LensLogger.getLogger().fine("invokeAndWait " + runnable); } synchronized (invokeAndWaitLock) { @@ -1524,7 +1524,7 @@ @Override protected void _invokeLater(Runnable runnable) { - if (LensLogger.isLogging(PlatformLogger.FINEST)) { + if (LensLogger.getLogger().isLoggable(Level.FINEST)) { LensLogger.getLogger().fine("invokeLater " + runnable); } synchronized (eventList) { --- old/glass/glass/src/com/sun/glass/ui/lens/LensClipboardDelegate.java 2013-06-07 09:30:01.000000000 -0700 +++ new/glass/glass/src/com/sun/glass/ui/lens/LensClipboardDelegate.java 2013-06-07 09:30:00.000000000 -0700 @@ -28,7 +28,7 @@ import com.sun.glass.ui.Clipboard; import com.sun.glass.ui.delegate.ClipboardDelegate; -import sun.util.logging.PlatformLogger; +import sun.util.logging.PlatformLogger.Level; final class LensClipboardDelegate implements ClipboardDelegate { @@ -40,7 +40,7 @@ //We may support Selection clipboard in the future, but others systems //are not seem to use it at this point - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine("LensClipboardDelegate::createClipboard("+clipboardName+")"); } if (Clipboard.DND.equals(clipboardName)) { --- old/glass/glass/src/com/sun/glass/ui/lens/LensDnDClipboard.java 2013-06-07 09:30:02.000000000 -0700 +++ new/glass/glass/src/com/sun/glass/ui/lens/LensDnDClipboard.java 2013-06-07 09:30:02.000000000 -0700 @@ -31,13 +31,13 @@ import com.sun.glass.ui.SystemClipboard; import com.sun.glass.ui.Application; -import sun.util.logging.PlatformLogger; +import sun.util.logging.PlatformLogger.Level; final class LensDnDClipboard extends SystemClipboard { public LensDnDClipboard() { super(Clipboard.DND); - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine("constructor called"); } } @@ -48,7 +48,7 @@ * @param action mask of actions from Clipboard */ public void actionPerformed(int action) { - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine("action = ["+ Integer.toHexString(action)+"]"); } @@ -58,7 +58,7 @@ protected boolean isOwner() { //called many time while the hovering over target node //So reduced log level to finest in order to reduce log clutter - if (LensLogger.isLogging(PlatformLogger.FINEST)) { + if (LensLogger.getLogger().isLoggable(Level.FINEST)) { LensLogger.getLogger().finest("returns true"); } return true;//For DnD its always true @@ -70,11 +70,11 @@ * events */ protected void pushToSystem(HashMap cacheData, int supportedActions) { - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine("handling drag"); } - if (LensLogger.isLogging(PlatformLogger.FINER)) { + if (LensLogger.getLogger().isLoggable(Level.FINER)) { LensLogger.getLogger().finer("data =[cachedData = "+ cacheData+ " supportedActions= "+Integer.toHexString(supportedActions)); } @@ -82,13 +82,13 @@ LensApplication lensApp = (LensApplication)Application.GetApplication(); lensApp.notifyDragStart(); - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine("starting nested event loop"); } lensApp.enterDnDEventLoop(); // The loop is exited in LensApplication.LensDragEvent.dispatch() - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine("nested event loop finished"); LensLogger.getLogger().fine("Drag done - notifying actionPreformed"); } @@ -105,7 +105,7 @@ protected void pushTargetActionToSystem(int actionDone) { LensLogger.getLogger().warning("Not supported"); - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine("actionDone = "+ Integer.toHexString(actionDone)); } @@ -114,7 +114,7 @@ protected Object popFromSystem(String mimeType) { LensLogger.getLogger().warning("Not supported"); - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine("mimeType="+mimeType); } return null; --- old/glass/glass/src/com/sun/glass/ui/lens/LensLogger.java 2013-06-07 09:30:04.000000000 -0700 +++ new/glass/glass/src/com/sun/glass/ui/lens/LensLogger.java 2013-06-07 09:30:03.000000000 -0700 @@ -28,42 +28,29 @@ import java.security.AccessController; import java.security.PrivilegedAction; import sun.util.logging.PlatformLogger; +import sun.util.logging.PlatformLogger.Level; final class LensLogger { private static final PlatformLogger logger = initLogger(); - private static final int logLevel = logger.getLevel(); private static PlatformLogger initLogger() { PlatformLogger logger = PlatformLogger.getLogger("lens"); String levelString = AccessController.doPrivileged( new PrivilegedAction() { public String run() { - return System.getProperty("log.lens"); + return System.getProperty("log.lens", "SEVERE").toUpperCase(); } }); - int level = PlatformLogger.SEVERE; - if (levelString != null) { - try { - level = Integer.parseInt(levelString); - } catch (NumberFormatException nfe) { - try { - level = PlatformLogger.class - .getField(levelString.toUpperCase()) - .getInt(null); - } catch (Exception e) { } - } + try { + logger.setLevel(Level.valueOf(levelString)); + } catch (Exception e) { + logger.setLevel(Level.SEVERE); } - logger.setLevel(level); return logger; } public static PlatformLogger getLogger() { return logger; } - - public static boolean isLogging(int level) { - return level >= logLevel; - } - } --- old/glass/glass/src/com/sun/glass/ui/lens/LensSystemClipboard.java 2013-06-07 09:30:05.000000000 -0700 +++ new/glass/glass/src/com/sun/glass/ui/lens/LensSystemClipboard.java 2013-06-07 09:30:05.000000000 -0700 @@ -29,9 +29,8 @@ import com.sun.glass.ui.Clipboard; import com.sun.glass.ui.SystemClipboard; -import com.sun.glass.ui.Application; -import sun.util.logging.PlatformLogger; +import sun.util.logging.PlatformLogger.Level; /** * Current supported embedded system doesn't have native clipboard, therefore @@ -43,7 +42,7 @@ public LensSystemClipboard() { super(Clipboard.SYSTEM); - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine("LensSystemClipboard created"); } } @@ -59,7 +58,7 @@ int supportedActions) { //no-op as there is no system clipboard - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine("LensSystemClipboard::pushToSystem " + "cacheData = " + cacheData + "supportedActions: " + @@ -70,7 +69,7 @@ protected void pushTargetActionToSystem(int actionDone) { //no-op as there is no system clipboard - if (LensLogger.isLogging(PlatformLogger.FINE)) { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { LensLogger.getLogger().fine("LensSystemClipboard::pushTargetActionToSystem " + "actionDone: " + getActionString(actionDone)); @@ -101,4 +100,5 @@ return new String[0]; } -} + +} \ No newline at end of file --- old/glass/glass/src/com/sun/glass/ui/lens/LensWindow.java 2013-06-07 09:30:07.000000000 -0700 +++ new/glass/glass/src/com/sun/glass/ui/lens/LensWindow.java 2013-06-07 09:30:06.000000000 -0700 @@ -34,7 +34,6 @@ import com.sun.glass.ui.Screen; import com.sun.glass.ui.View; import com.sun.glass.ui.Window; -import sun.util.logging.PlatformLogger; final class LensWindow extends Window { @@ -173,10 +172,8 @@ x = Math.min(screenWidth - width, x); y = Math.min(screenHeight - height, y); - if (LensLogger.isLogging(PlatformLogger.FINE)) { - LensLogger.getLogger().fine("Setting bounds to "+ x + "," + y + - "+" + width + "x" + height); - } + LensLogger.getLogger().fine("Setting bounds to "+ x + "," + y + + "+" + width + "x" + height); } setBoundsImpl(nativeWindowPointer, x, y, width, height, @@ -212,7 +209,7 @@ } if (view != null && result) { // the system assumes a resize notification to set the View - // sizes and to get the Scene to layout correctly. + // sizes and to get the Scene to layout correctly. ((LensView)view)._notifyResize(getWidth(), getHeight()); } return result; @@ -340,7 +337,7 @@ // wrappers so Application run loop can get where it needs to go protected void _notifyClose() { //This event is called by LensWindowManager when a window needs to be - //closed, so this is a synthetic way to emulate platform window manager + //closed, so this is a synthetic way to emulate platform window manager //window close event notifyClose(); close(); --- old/javafx-beans/src/com/sun/javafx/binding/SelectBinding.java 2013-06-07 09:30:10.000000000 -0700 +++ new/javafx-beans/src/com/sun/javafx/binding/SelectBinding.java 2013-06-07 09:30:10.000000000 -0700 @@ -45,9 +45,9 @@ import com.sun.javafx.collections.annotations.ReturnsUnmodifiableCollection; import com.sun.javafx.property.JavaBeanAccessHelper; import sun.util.logging.PlatformLogger; +import sun.util.logging.PlatformLogger.Level; import com.sun.javafx.property.PropertyReference; import java.util.Arrays; -import javafx.beans.property.adapter.ReadOnlyJavaBeanObjectPropertyBuilder; /** * A binding used to get a member, such as a.b.c. The value of the @@ -493,7 +493,7 @@ return null; } catch (RuntimeException ex) { final PlatformLogger logger = Logging.getLogger(); - if (logger.isLoggable(PlatformLogger.WARNING)) { + if (logger.isLoggable(Level.WARNING)) { Logging.getLogger().warning("Exception while evaluating select-binding " + stepsToString()); if (ex instanceof IllegalStateException) { logger.warning("Property '" + propertyNames[i] + "' does not exist in " + obj.getClass(), ex); --- old/javafx-beans/test/com/sun/javafx/binding/SelectBindingTest.java 2013-06-07 09:30:12.000000000 -0700 +++ new/javafx-beans/test/com/sun/javafx/binding/SelectBindingTest.java 2013-06-07 09:30:11.000000000 -0700 @@ -42,8 +42,7 @@ import javafx.beans.binding.StringBinding; import javafx.binding.Variable; import javafx.collections.ObservableList; -import org.junit.Ignore; -import sun.util.logging.PlatformLogger; +import sun.util.logging.PlatformLogger.Level; import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; @@ -161,7 +160,7 @@ pojoC.setNext(person2); assertEquals(person2, objectBinding.get()); } - + @Test public void testPOJOObject_3() { final POJOPerson person1 = new POJOPerson("P1"); @@ -221,7 +220,7 @@ public void testPOJODouble() { POJONext pojoA = new POJONext(); pojoA.setNext(b); - + final Person person = new Person(); person.setSomething(-Math.E); @@ -554,8 +553,8 @@ @Test public void stressTestRandomOperationsResultInCorrectListenersInstalled() { - final int logLevel = Logging.getLogger().getLevel(); - Logging.getLogger().setLevel(PlatformLogger.SEVERE); + final Level logLevel = Logging.getLogger().level(); + Logging.getLogger().setLevel(Level.SEVERE); List steps = new ArrayList(); Random rand = new Random(System.currentTimeMillis()); --- old/javafx-ui-common/src/com/sun/javafx/accessible/AccessibleNode.java 2013-06-07 09:30:13.000000000 -0700 +++ new/javafx-ui-common/src/com/sun/javafx/accessible/AccessibleNode.java 2013-06-07 09:30:13.000000000 -0700 @@ -37,15 +37,16 @@ import com.sun.javafx.accessible.utils.PropertyIds; import com.sun.javafx.accessible.utils.Rect; import sun.util.logging.PlatformLogger; +import sun.util.logging.PlatformLogger.Level; public class AccessibleNode implements AccessibleProvider { Object accElement ; // the Glass peer - Node node ; // scene graph node + Node node ; // scene graph node AccessibleNode parent; // parent of this child in accessible graph AccessibleStage accController ; // not sure if this can be worked arnd in future List children; // if this control has children - + public AccessibleNode(Node n) { this.node = n ; @@ -58,12 +59,12 @@ { return this.accElement ; } - + public void fireEvent(int EventId) { accController.stage.impl_getPeer().accessibleFireEvent(accElement, EventId); // accElement.fireEvent(EventId); } - + public void firePropertyChange(int propertyId, int oldProperty, int newProperty) { accController.stage.impl_getPeer().accessibleFirePropertyChange(accElement, propertyId, oldProperty, newProperty); // accElement.firePropertyChange(propertyId, oldProperty, newProperty); @@ -73,15 +74,15 @@ accController.stage.impl_getPeer().accessibleFirePropertyChange(accElement, propertyId, oldProperty, newProperty); // accElement.firePropertyChange(propertyId, oldProperty, newProperty); } - - + + // Summary: // Gets a base provider for this element. // // Returns: // The base provider, or null. @Override - public AccessibleProvider hostRawElementProvider() + public AccessibleProvider hostRawElementProvider() { return this ; } @@ -122,17 +123,17 @@ else return null; } - + ////////////////////////////// // AccessibleProvider ////////////////////////////// - + /** * Get the bounding rectangle of this element. * * @return the bounding rectangle, in screen coordinates. */ - + @Override public Rect boundingRectangle() { Scene scene = node.getScene(); @@ -147,24 +148,24 @@ scene.getWindow().getY() + scene.getY() + bounds.getMinY(); - + PlatformLogger logger = Logging.getAccessibilityLogger(); - if (logger.isLoggable(PlatformLogger.FINER)) { - logger.finer(this.toString()+ "MinX="+ bounds.getMinX() + "MinY="+bounds.getMinY() + + if (logger.isLoggable(Level.FINER)) { + logger.finer(this.toString()+ "MinX="+ bounds.getMinX() + "MinY="+bounds.getMinY() + "Width="+ bounds.getWidth() +"Height="+ bounds.getHeight()); } return new Rect(x, y, bounds.getWidth(), bounds.getHeight()); } - + public boolean contains(double x, double y) { Bounds bounds = node.getBoundsInParent() ; return bounds.contains(x, y); } - + /** * Get the root node of the fragment. - * + * * @return the root node. */ @Override @@ -175,7 +176,7 @@ /** * Get an array of fragment roots that are embedded in the UI Automation * element tree rooted at the current element. - * + * * @return an array of root fragments, or null. */ @Override @@ -185,7 +186,7 @@ /** * Get the runtime identifier of an element. - * + * * @return the unique run-time identifier of the element. */ @Override @@ -195,16 +196,16 @@ /** * Get the UI Automation element in a specified direction within the tree. - * + * * @param direction the direction in which to navigate. - * + * * @return the element in the specified direction, or null if there is no element * in that direction */ @Override public Object navigate(NavigateDirection direction) { // this is not focussed driven PlatformLogger logger = Logging.getAccessibilityLogger(); - if (logger.isLoggable(PlatformLogger.FINER)) { + if (logger.isLoggable(Level.FINER)) { logger.finer("this: " + this.toString()); logger.finer("navigate direction: " + direction); } @@ -216,7 +217,7 @@ else // return Controllers FragmentRoot as parent return accController.accRoot ; break; - case NextSibling: + case NextSibling: case PreviousSibling: if(( parent != null) &&( parent.children.size() > 0 ) ) { @@ -224,7 +225,7 @@ // This should never happen so should we just remove this // or raise an exception? if (idx == -1) { - if (logger.isLoggable(PlatformLogger.FINER)) { + if (logger.isLoggable(Level.FINER)) { logger.finer(this.toString()+ " children.indexOf returned -1"); } } @@ -241,7 +242,7 @@ // This should never happen so should we just remove this // or raise an exception? if (idx == -1) { - if (logger.isLoggable(PlatformLogger.FINER)) { + if (logger.isLoggable(Level.FINER)) { logger.finer(this.toString()+ " children.indexOf returned -1"); } } @@ -252,18 +253,18 @@ if( (idx >= 0) && (idx < accController.accChildren.size()) ) accTemp = accController.accChildren.get(idx); } - + break; case FirstChild: - if( children.size() > 0 ) + if( children.size() > 0 ) accTemp = children.get(0) ; break; case LastChild: - if( children.size() > 0 ) + if( children.size() > 0 ) accTemp = children.get(children.size()-1) ; break; } - if (logger.isLoggable(PlatformLogger.FINER)) { + if (logger.isLoggable(Level.FINER)) { if (accTemp != null) { logger.finer("returning: " + accTemp.accElement); } else { @@ -276,7 +277,7 @@ return null; } } - + /** * Set the focus to this element. */ @@ -284,7 +285,7 @@ public void setFocus() { // node.getScene().setImpl_focusOwner(node); PlatformLogger logger = Logging.getAccessibilityLogger(); - if (logger.isLoggable(PlatformLogger.FINER)) { + if (logger.isLoggable(Level.FINER)) { logger.finer(this.toString()+ "In AccessibleNode.setFocus"); } node.requestFocus(); --- old/javafx-ui-common/src/com/sun/javafx/accessible/AccessibleStage.java 2013-06-07 09:30:15.000000000 -0700 +++ new/javafx-ui-common/src/com/sun/javafx/accessible/AccessibleStage.java 2013-06-07 09:30:15.000000000 -0700 @@ -28,6 +28,7 @@ import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; + import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import javafx.scene.Node; @@ -35,6 +36,7 @@ import javafx.scene.Scene; import javafx.stage.Screen; import javafx.stage.Stage; + import com.sun.javafx.Logging; import com.sun.javafx.accessible.providers.AccessibleProvider; import com.sun.javafx.accessible.providers.AccessibleStageProvider; @@ -42,10 +44,11 @@ import com.sun.javafx.accessible.utils.PropertyIds; import com.sun.javafx.accessible.utils.Rect; import sun.util.logging.PlatformLogger; +import sun.util.logging.PlatformLogger.Level; /** * - * Maintains the correspondence of native object to node + * Maintains the correspondence of native object to node * Walks through the scene graph and initializes the accessible hierarchy */ @@ -55,10 +58,10 @@ Scene scene ; Object accRoot ; // corresponding glass object List accChildren ; - + /** * Constructor - * + * * @param stage The FX stage. */ public AccessibleStage(Stage stage) @@ -67,26 +70,26 @@ this.stage = stage; this.scene = stage.getScene(); initialize(); - } + } /** AccessibleStage : Initialize () - * On instantiation it initializes the Accessible Hierarchy for all Nodes in the Scene + * On instantiation it initializes the Accessible Hierarchy for all Nodes in the Scene * graphs associated with the Window->Stage->Scene. - * For native object handle it makes a down call to bridge to create its + * For native object handle it makes a down call to bridge to create its * associated native accessible component and enters its value in the AccessibleMap. - * Based upon the type of control it instantiates its accessible behavior - * class and enters it into AccessibleMap. The behavior classes are singleton + * Based upon the type of control it instantiates its accessible behavior + * class and enters it into AccessibleMap. The behavior classes are singleton * objects for a type of control. * Attaches a listener for any new nodes being added to the scene graph. - * Attaches a listener for any new Stage, Scene added to the window, which + * Attaches a listener for any new Stage, Scene added to the window, which * in return will add a listener to Scene for new node additions. * Attaches a Focus listener for tracking change of Focus. - */ + */ private void initialize() { - Parent pRoot = scene.getRoot() ; + Parent pRoot = scene.getRoot() ; accRoot = stage.impl_getPeer().accessibleCreateStageProvider(this); - + // Note move it to a func later or redo the logic for first , the same is being used when scene graph is modified too // Rethink this logic in future AccessibleNode dummyRoot = new AccessibleNode(pRoot.getChildrenUnmodifiable().get(0)); @@ -99,21 +102,21 @@ // Hence assign it here for( int idx=0;idx() { @Override public void onChanged(Change c) { - // Destroy first ? or only add and modify the new ones ? + // Destroy first ? or only add and modify the new ones ? // Worth creating dynamic updatable tree if we plan to stick to this model - // If the ally implementation will be added on the controls directly + // If the ally implementation will be added on the controls directly // Leave this as is for now : based upon above decision // Destroy and recreate for now /* destroyHierarchy(accChildren); - + Parent pRoot = scene.getRoot() ; // Note move it to a func later or redo the logic for first AccessibleNode dummyRoot = new AccessibleNode(pRoot.getChildrenUnmodifiable().get(0)); @@ -122,42 +125,42 @@ } catch (Exception ex) {} accChildren = dummyRoot.children; setParent(accChildren); - * + * */ } }); } - + // TODO: This method is not currently in use. When it is in use should its // access be package-private like it currently is? void destroyHierarchy(List currChildren) { PlatformLogger logger = Logging.getAccessibilityLogger(); for (int idx=0; idx currChildren) { - PlatformLogger logger = Logging.getAccessibilityLogger(); + PlatformLogger logger = Logging.getAccessibilityLogger(); for (int idx=0; idx currChildren = new ArrayList(); AccessibleNode curaccNode = null; ObservableList nodes = pRoot.getChildrenUnmodifiable(); - PlatformLogger logger = Logging.getAccessibilityLogger(); - if (logger.isLoggable(PlatformLogger.FINER)) { + PlatformLogger logger = Logging.getAccessibilityLogger(); + if (logger.isLoggable(Level.FINER)) { logger.finer(this.toString()+ "initAccessibleHierarchy1: pRoot=" + pRoot + " parent=" + parent); } if (nodes.isEmpty()) { - if (logger.isLoggable(PlatformLogger.FINEST)) { + if (logger.isLoggable(Level.FINEST)) { logger.finer(this.toString()+ "initAccessibleHierarchy: no child, pRoot=" + pRoot); } return; } for (int idx = 0; idx < nodes.size(); idx++) { n = nodes.get(idx); - if (logger.isLoggable(PlatformLogger.FINER)) { + if (logger.isLoggable(Level.FINER)) { logger.finer(this.toString()+ "initAccessibleHierarchy: idx=" + idx + " node= " + n); } - // use the logic for instanceof later when public API is reviewed. For now use reflection + // use the logic for instanceof later when public API is reviewed. For now use reflection try { Method method = n.getClass().getMethod("impl_getAccessible"); if( method != null) @@ -197,7 +200,7 @@ * Accessible aN = (Accessible)n; curaccNode = (AccessibleNode)aN.impl_getAccessible() ; */ if ( curaccNode != null ) { // Control has an accessible implementation - if (logger.isLoggable(PlatformLogger.FINER)) { + if (logger.isLoggable(Level.FINER)) { logger.finer(this.toString()+ "initAccessibleHierarchy: Found Accessible."); logger.finer(this.toString()+ " node= " + n + " curaccNode=" + curaccNode); logger.finer(this.toString()+ " control type=" + curaccNode.getPropertyValue(PropertyIds.CONTROL_TYPE)); @@ -213,17 +216,17 @@ if (curaccNode == null) { curaccNode = parent; } - if (logger.isLoggable(PlatformLogger.FINER)) { + if (logger.isLoggable(Level.FINER)) { logger.finer(this.toString()+ "initAccessibleHierarchy: idx=" + idx + " accNode.children= " + curaccNode); } try { - initAccessibleHierarchy((Parent)n, curaccNode); + initAccessibleHierarchy((Parent)n, curaccNode); } catch (Exception ex) {} } } if (!currChildren.isEmpty()) { if (!parent.children.isEmpty()) { - parent.children.addAll(currChildren); + parent.children.addAll(currChildren); } else { parent.children = currChildren; } @@ -231,11 +234,11 @@ currChildren.get(idx).parent = parent ; } } - if (logger.isLoggable(PlatformLogger.FINER)) { + if (logger.isLoggable(Level.FINER)) { logger.finer(this.toString()+ "initAccessibleHierarchy: parent.children= " + parent.children ); } } - + private void setParent(List accTempChild) { if( accTempChild.size() <=0 ) return ; @@ -248,14 +251,14 @@ } } } - + /** * Gets a base provider for this element. * * @return the base provider, or null. */ @Override - public AccessibleProvider hostRawElementProvider() + public AccessibleProvider hostRawElementProvider() { return this ; } @@ -265,7 +268,7 @@ * element. * * @param patternId identifier of the pattern. - * + * * @return Object that implements the pattern interface, or null if the pattern is not * supported. */ @@ -277,9 +280,9 @@ /** * Retrieves the value of a property supported by the UI Automation provider. - * + * * @param propertyId The property identifier. - * + * * @return The property value, or a null if the property is not supported by this * provider, or System.Windows.Automation.AutomationElementIdentifiers.NotSupported * if it is not supported at all. @@ -296,18 +299,18 @@ ////////////////////////////// // AccessibleProvider ////////////////////////////// - + /** * Get the bounding rectangle of this element. * * @return the bounding rectangle, in screen coordinates. */ - + @Override public Rect boundingRectangle() { // The scene's x/y is window relative so need to get the window and ask for // its x/y and then calculate the scene's screen coordinates. These are - // relative to the upper left corner. Some platforms, like OS X, use an + // relative to the upper left corner. Some platforms, like OS X, use an // origin of the lower left corner so adjustments may be required depeding // on the plaform. // Should the y value include the scene offset (the offset below the title bar). @@ -317,22 +320,22 @@ Screen.getPrimary().getBounds().getMinY() + stage.getY() + scene.getY(); return new Rect(x, y, scene.getWidth(), scene.getHeight()); } - + /** * Get the root node of the fragment. - * + * * @return the root node. */ @Override // public AccessibleStageProvider fragmentRoot() { public Object fragmentRoot() { - return accRoot; + return accRoot; } /** * Get an array of fragment roots that are embedded in the UI Automation * element tree rooted at the current element. - * + * * @return an array of root fragments, or null. */ @Override @@ -342,26 +345,26 @@ /** * Get the runtime identifier of an element. - * + * * @return the unique run-time identifier of the element. */ @Override public int[] getRuntimeId() { return null; // add code } - + /** * Get the UI Automation element in a specified direction within the tree. - * + * * @param direction the direction in which to navigate. - * + * * @return the element in the specified direction, or null if there is no element * in that direction */ @Override public Object navigate(NavigateDirection direction) { PlatformLogger logger = Logging.getAccessibilityLogger(); - if (logger.isLoggable(PlatformLogger.FINER)) { + if (logger.isLoggable(Level.FINER)) { logger.finer("this: " + this.toString()); logger.finer("navigate direction: " + direction); } @@ -380,12 +383,12 @@ accTemp = accChildren.get(accChildren.size()-1) ; break; } - if (logger.isLoggable(PlatformLogger.FINER)) { + if (logger.isLoggable(Level.FINER)) { logger.finer("returning: " + accTemp.accElement); } return accTemp.accElement; } - + /** * Set the focus to this element. */ @@ -394,7 +397,7 @@ // stage.getScene().setImpl_focusOwner(stage.getScene().getRoot()); stage.getScene().getRoot().requestFocus(); } - + ////////////////////////////////// // AccessibleStageProvider ////////////////////////////////// @@ -405,14 +408,14 @@ if(accTempChild.get(0).children.size() == 0 ) // no children { tmpY = y - accTempChild.get(0).boundingRectangle().getMaxY() ; - if(accTempChild.get(0).contains(x, tmpY)) - // if(accTempChild.get(0).contains(x, y)) + if(accTempChild.get(0).contains(x, tmpY)) + // if(accTempChild.get(0).contains(x, y)) return accTempChild.get(0) ; } for (int idx=0; idx 0 ) // has children { @@ -422,7 +425,7 @@ return null ; } - + @Override public Object elementProviderFromPoint(double x, double y) { // hit testing @@ -430,16 +433,16 @@ PlatformLogger logger = Logging.getAccessibilityLogger(); AccessibleNode aNode = getProviderFromPoint( accChildren, x, y ) ; if( aNode !=null) - { - if (logger.isLoggable(PlatformLogger.FINER)) { + { + if (logger.isLoggable(Level.FINER)) { logger.finer(this.toString()+ "Accessible Stage: elementProviderFromPoint x=" + x + " y=" + y +"Node"+ aNode.accElement); } - Object aBase = aNode.getAccessibleElement(); + Object aBase = aNode.getAccessibleElement(); return aBase ; } return null; } - + /* return the glass object that has focus */ @Override public Object getFocus() { @@ -453,9 +456,9 @@ AccessibleProvider accNode = (AccessibleProvider)method.invoke(node); if( accNode instanceof AccessibleNode) return ((AccessibleNode)accNode).accElement ; } catch (Exception ex) {} - return null ; + return null ; } - + public Object getStageAccessible() { return accRoot ; } --- old/javafx-ui-common/src/com/sun/javafx/css/StyleConverterImpl.java 2013-06-07 09:30:16.000000000 -0700 +++ new/javafx-ui-common/src/com/sun/javafx/css/StyleConverterImpl.java 2013-06-07 09:30:16.000000000 -0700 @@ -25,20 +25,18 @@ package com.sun.javafx.css; -import com.sun.javafx.css.converters.EnumConverter; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; -import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; import javafx.css.CssMetaData; import javafx.css.StyleConverter; import javafx.css.Styleable; -import javafx.scene.Node; import com.sun.javafx.Logging; import sun.util.logging.PlatformLogger; +import sun.util.logging.PlatformLogger.Level; /** * Converter converts ParsedValueImpl<F,T> from type F to type T. @@ -59,7 +57,7 @@ return null; } - protected StyleConverterImpl() { + protected StyleConverterImpl() { super(); } @@ -74,7 +72,7 @@ // map of StyleConverter class name to StyleConverter private static Map> tmap; - @SuppressWarnings("rawtypes") + @SuppressWarnings("rawtypes") public static StyleConverter readBinary(DataInputStream is, String[] strings) throws IOException { @@ -82,17 +80,17 @@ String cname = strings[index]; if (cname == null || cname.isEmpty()) return null; - + if (cname.startsWith("com.sun.javafx.css.converters.EnumConverter")) { return (StyleConverter)com.sun.javafx.css.converters.EnumConverter.readBinary(is, strings); - } + } // Make a new entry in tmap, if necessary if (tmap == null || !tmap.containsKey(cname)) { StyleConverter converter = getInstance(cname); if (converter == null) { final PlatformLogger logger = Logging.getCSSLogger(); - if (logger.isLoggable(PlatformLogger.SEVERE)) { + if (logger.isLoggable(Level.SEVERE)) { logger.severe("could not deserialize " + cname); } } @@ -111,7 +109,7 @@ StyleConverter styleConverter = null; - switch(converterClass) { + switch(converterClass) { case "com.sun.javafx.css.converters.BooleanConverter" : styleConverter = com.sun.javafx.css.converters.BooleanConverter.getInstance(); break; @@ -149,7 +147,7 @@ case "com.sun.javafx.css.converters.InsetsConverter$SequenceConverter" : styleConverter = com.sun.javafx.css.converters.InsetsConverter.SequenceConverter.getInstance(); break; - + case "com.sun.javafx.css.converters.PaintConverter" : styleConverter = com.sun.javafx.css.converters.PaintConverter.getInstance(); break; @@ -162,14 +160,14 @@ case "com.sun.javafx.css.converters.PaintConverter$RadialGradientConverter" : styleConverter = com.sun.javafx.css.converters.PaintConverter.RadialGradientConverter.getInstance(); break; - + case "com.sun.javafx.css.converters.SizeConverter" : styleConverter = com.sun.javafx.css.converters.SizeConverter.getInstance(); break; case "com.sun.javafx.css.converters.SizeConverter$SequenceConverter" : styleConverter = com.sun.javafx.css.converters.SizeConverter.SequenceConverter.getInstance(); break; - + case "com.sun.javafx.css.converters.StringConverter" : styleConverter = com.sun.javafx.css.converters.StringConverter.getInstance(); break; @@ -182,7 +180,7 @@ case "com.sun.javafx.css.converters.URLConverter$SequenceConverter" : styleConverter = com.sun.javafx.css.converters.URLConverter.SequenceConverter.getInstance(); break; - + // Region stuff case "com.sun.javafx.scene.layout.region.BackgroundPositionConverter" : styleConverter = com.sun.javafx.scene.layout.region.BackgroundPositionConverter.getInstance(); @@ -232,7 +230,7 @@ case "com.sun.javafx.scene.layout.region.Margins$SequenceConverter" : styleConverter = com.sun.javafx.scene.layout.region.Margins.SequenceConverter.getInstance(); break; - + // parser stuff case "com.sun.javafx.css.parser.DeriveColorConverter" : styleConverter = com.sun.javafx.css.parser.DeriveColorConverter.getInstance(); @@ -249,7 +247,7 @@ default : final PlatformLogger logger = Logging.getCSSLogger(); - if (logger.isLoggable(PlatformLogger.SEVERE)) { + if (logger.isLoggable(Level.SEVERE)) { logger.severe("StyleConverterImpl : converter Class is null for : "+converterClass); } break; --- old/javafx-ui-common/src/com/sun/javafx/css/StyleManager.java 2013-06-07 09:30:18.000000000 -0700 +++ new/javafx-ui-common/src/com/sun/javafx/css/StyleManager.java 2013-06-07 09:30:18.000000000 -0700 @@ -68,6 +68,7 @@ import javafx.scene.image.Image; import javafx.stage.PopupWindow; import sun.util.logging.PlatformLogger; +import sun.util.logging.PlatformLogger.Level; /** * Contains the stylesheet state for a single scene. This includes both the @@ -126,21 +127,21 @@ /** * Return the StyleManager instance. */ - public static StyleManager getInstance() { + public static StyleManager getInstance() { return InstanceHolder.INSTANCE; } - + /** - * + * * @param styleable * @return * @deprecated Use {@link javafx.css.Styleable#getCssMetaData()} */ // TODO: is this used anywhere? @Deprecated public static List> getStyleables(final Styleable styleable) { - - return styleable != null - ? styleable.getCssMetaData() + + return styleable != null + ? styleable.getCssMetaData() : Collections.>emptyList(); } @@ -152,15 +153,15 @@ */ // TODO: is this used anywhere? @Deprecated public static List> getStyleables(final Node node) { - - return node != null - ? node.getCssMetaData() + + return node != null + ? node.getCssMetaData() : Collections.>emptyList(); } - - private StyleManager() { + + private StyleManager() { } - + /** * Each Scene has its own cache. If a scene is closed, * then StyleManager is told to forget the scene and it's cache is annihilated. @@ -168,33 +169,33 @@ private static final Map cacheContainerMap = new WeakHashMap(); - /** + /** * StyleHelper uses this cache but it lives here so it can be cleared * when style-sheets change. */ - public Map getStyleCache(Scene scene) { - + public Map getStyleCache(Scene scene) { + if (scene == null) return null; - + CacheContainer container = cacheContainerMap.get(scene); if (container == null) { container = new CacheContainer(); cacheContainerMap.put(scene, container); } - + return container.getStyleCache(); } - + public StyleMap getStyleMap(Scene scene, int smapId) { - + if (scene == null || smapId == -1) return StyleMap.EMPTY_MAP; - + CacheContainer container = cacheContainerMap.get(scene); if (container == null) return StyleMap.EMPTY_MAP; - + return container.getStyleMap(smapId); } - + /** * This stylesheet represents the "default" set of styles for the entire * platform. This is typically only set by the UI Controls module, and @@ -202,26 +203,26 @@ * setDefaultUserAgentStylesheet function call) then we will end up clearing * all of the caches. */ - private final List userAgentStylesheets = + private final List userAgentStylesheets = new ArrayList(); - + //////////////////////////////////////////////////////////////////////////// // // stylesheet handling // //////////////////////////////////////////////////////////////////////////// - + /* * A container for stylesheets and the Parents or Scenes that use them. * If a stylesheet is removed, then all other Parents or Scenes * that use that stylesheet should get new styles if the * stylesheet is added back in since the stylesheet may have been - * removed and re-added because it was edited (typical of SceneBuilder). + * removed and re-added because it was edited (typical of SceneBuilder). * This container provides the hooks to get back to those Parents or Scenes. * * StylesheetContainer are created and added to stylesheetContainerMap * in the method gatherParentStylesheets. - * + * * StylesheetContainer are created and added to sceneStylesheetMap in * the method updateStylesheets */ @@ -233,24 +234,24 @@ // the parents or scenes that use this stylesheet. Typically, this list // should be very small. final SelectorPartitioning selectorPartitioning; - // who uses this stylesheet? + // who uses this stylesheet? final RefList sceneUsers; final RefList parentUsers; // the keys for finding Cache entries that use this stylesheet. // This list should also be fairly small final RefList keys; - + // RT-24516 -- cache images coming from this stylesheet. - // This just holds a hard reference to the image. + // This just holds a hard reference to the image. final List imageCache; - + final int hash; StylesheetContainer(String fname, Stylesheet stylesheet) { - + this.fname = fname; hash = (fname != null) ? fname.hashCode() : 127; - + this.stylesheet = stylesheet; if (stylesheet != null) { selectorPartitioning = new SelectorPartitioning(); @@ -268,15 +269,15 @@ } } - + } else { selectorPartitioning = null; } - + this.sceneUsers = new RefList(); this.parentUsers = new RefList(); this.keys = new RefList(); - + // this just holds a hard reference to the image this.imageCache = new ArrayList(); } @@ -300,17 +301,17 @@ } return true; } - + @Override public String toString() { return fname; } - + } /* - * A list that holds references. Used by StylesheetContainer. + * A list that holds references. Used by StylesheetContainer. * We only ever add to this list, or the whole container gets thrown - * away. + * away. */ private static class RefList { @@ -338,19 +339,19 @@ } /** - * A map from String => Stylesheet. If a stylesheet for the + * A map from String => Stylesheet. If a stylesheet for the * given URL has already been loaded then we'll simply reuse the stylesheet * rather than loading a duplicate. */ - private final Map stylesheetContainerMap + private final Map stylesheetContainerMap = new HashMap(); - + /** * called from Window when the scene is closed. */ public void forget(Scene scene) { - + final CacheContainer cacheContainer = cacheContainerMap.remove(scene); if (cacheContainer != null) { cacheContainer.clearCache(); @@ -362,84 +363,84 @@ // Set> stylesheetContainers = stylesheetContainerMap.entrySet(); Iterator> iter = stylesheetContainers.iterator(); - + while(iter.hasNext()) { - + Entry entry = iter.next(); StylesheetContainer container = entry.getValue(); - + Iterator> sceneIter = container.sceneUsers.list.iterator(); while (sceneIter.hasNext()) { - + Reference ref = sceneIter.next(); Scene _scene = ref.get(); - + if (_scene == scene || _scene == null) { sceneIter.remove(); - } + } } - + Iterator> parentIter = container.parentUsers.list.iterator(); while (parentIter.hasNext()) { - + Reference ref = parentIter.next(); Parent _parent = ref.get(); if (_parent == null || _parent.getScene() == scene || _parent.getScene() == null) { parentIter.remove(); - } + } } - + if (container.sceneUsers.list.isEmpty() && container.parentUsers.list.isEmpty()) { iter.remove(); } } - + } - + /** * called from Parent's or Scene's stylesheets property's onChanged method */ public void stylesheetsChanged(Scene scene, Change c) { // annihilate the cache? - boolean annihilate = false; + boolean annihilate = false; final boolean isPopup = scene.getWindow() instanceof PopupWindow; - + c.reset(); while (c.next()) { - + // - // don't care about adds from popups since popup scene gets its + // don't care about adds from popups since popup scene gets its // stylesheets from the scene of its root window. // if (isPopup == false && c.wasAdded()) { // // if a stylesheet is added, then the cache should be cleared - // only if that stylesheet isn't already in the + // only if that stylesheet isn't already in the // stylesheetContainerMap. Just because one scene adds the // same stylesheet as another doesn't mean that the other - // scene's CSS is invalid. + // scene's CSS is invalid. // final List addedSubList = c.getAddedSubList(); for (int n=0, nMax=addedSubList.size(); n> iter = container.sceneUsers.list.iterator(); while (iter.hasNext()) { @@ -452,94 +453,94 @@ if (s == null) iter.remove(); } } - + } - + if (annihilate) { // - // Once we know we are going to nuke the cache, + // Once we know we are going to nuke the cache, // there is no need to look at other adds. - // + // break; } - + } - + } else if (c.wasRemoved()) { - + if (isPopup == false) { // // If a stylesheet was removed from the scene, then the styles - // will need to be remapped. + // will need to be remapped. // annihilate = true; break; - + } else /* isPopup == true */ { // // If the scene is from a popup, then styles don't need to // be remapped but the popup scene needs to be removed from // the containers. - // + // final List removedList = c.getRemoved(); for (int n=0, nMax=removedList.size(); n> refList = sc.sceneUsers.list; + + final List> refList = sc.sceneUsers.list; for(int r=refList.size()-1; 0 <= r; --r) { - + final Reference ref = refList.get(r); final Scene s = (ref != null) ? ref.get() : null; - + if (s == scene) { refList.remove(r); break; } - + } - + if (refList.isEmpty()) { stylesheetContainerMap.remove(rkey); } - + } } - } + } } } - + if (isPopup == false) { - + if (annihilate) { CacheContainer container = cacheContainerMap.get(scene); if (container != null) container.clearCache(); } - + processChange(c); } - + } - + /** * called from Parent's or Scene's stylesheets property's onChanged method */ public void stylesheetsChanged(Parent parent, Change c) { processChange(c); } - + /** * called from Parent's or Scene's stylesheets property's onChanged method */ private void processChange(Change c) { - + // make sure we start from the beginning should this Change // have been used before entering this method. - c.reset(); - + c.reset(); + while (c.next()) { // RT-22565 @@ -579,7 +580,7 @@ // RT-22565: only wasRemoved matters. If the logic was applied to // wasAdded, then the stylesheet would be reparsed each time a // a Parent added it. - + } } @@ -589,13 +590,13 @@ if (sc == null) return; - // clean up image cache by removing images from the cache that + // clean up image cache by removing images from the cache that // might have come from this stylesheet cleanUpImageCache(sc.fname); - + final List> sceneList = sc.sceneUsers.list; final List> parentList = sc.parentUsers.list; - + for (int n=sceneList.size()-1; 0<=n; --n) { final Reference ref = sceneList.remove(n); @@ -604,10 +605,10 @@ if (scene == null) { continue; } - + scene.getRoot().impl_reapplyCSS(); } - + for (int n=parentList.size()-1; 0<=n; --n) { final Reference ref = parentList.remove(n); @@ -616,53 +617,53 @@ if (parent == null || parent.getScene() == null) { continue; } - + // // tell parent it needs to reapply css - // No harm is done if parent is in a scene that has had + // No harm is done if parent is in a scene that has had // impl_reapplyCSS called on the root. - // + // parent.impl_reapplyCSS(); } } - + //////////////////////////////////////////////////////////////////////////// // // Image caching // //////////////////////////////////////////////////////////////////////////// - + Map imageCache = new HashMap(); - + public Image getCachedImage(String url) { - + Image image = imageCache.get(url); if (image == null) { - + try { image = new Image(url); imageCache.put(url, image); - + } catch (IllegalArgumentException iae) { - // url was empty! + // url was empty! final PlatformLogger logger = getLogger(); - if (logger != null && logger.isLoggable(PlatformLogger.WARNING)) { + if (logger != null && logger.isLoggable(Level.WARNING)) { LOGGER.warning(iae.getLocalizedMessage()); } } catch (NullPointerException npe) { // url was null! final PlatformLogger logger = getLogger(); - if (logger != null && logger.isLoggable(PlatformLogger.WARNING)) { + if (logger != null && logger.isLoggable(Level.WARNING)) { LOGGER.warning(npe.getLocalizedMessage()); } } - } - + } + return image; } - + private void cleanUpImageCache(String fname) { if (fname == null && imageCache.isEmpty()) return; @@ -671,29 +672,29 @@ int len = fname.lastIndexOf('/'); final String path = (len > 0) ? fname.substring(0,len) : fname; final int plen = path.length(); - + final String[] entriesToRemove = new String[imageCache.size()]; int count = 0; - + final Set> entrySet = imageCache.entrySet(); for(Entry entry : entrySet) { - + final String key = entry.getKey(); len = key.lastIndexOf('/'); final String kpath = (len > 0) ? key.substring(0, len) : key; final int klen = kpath.length(); - + // if the longer path begins with the shorter path, // then assume the image came from this path. boolean match = (klen > plen) ? kpath.startsWith(path) : path.startsWith(kpath); if (match) entriesToRemove[count++] = key; } - + for (int n=0; n 0) { StylesheetContainer sc = userAgentStylesheets.get(index); userAgentStylesheets.remove(index); @@ -1091,19 +1092,19 @@ } return; } - + // RT-20643 CssError.setCurrentScene(scene); Stylesheet ua_stylesheet = loadStylesheet(fname); StylesheetContainer sc = new StylesheetContainer(fname, ua_stylesheet); - + if (userAgentStylesheets.isEmpty()) { userAgentStylesheets.add(sc); } else { userAgentStylesheets.set(0,sc); } - + if (ua_stylesheet != null) { ua_stylesheet.setOrigin(StyleOrigin.USER_AGENT); userAgentStylesheetsChanged(); @@ -1119,18 +1120,18 @@ * the platform */ public void setDefaultUserAgentStylesheet(Stylesheet stylesheet) { - + if (stylesheet == null ) { throw new IllegalArgumentException("null arg ua_stylesheet"); } - + final URL url = stylesheet.getUrl(); final String fname = url != null ? url.toExternalForm() : ""; - + // if this stylesheet has been added already, move it to first element int index = getIndex(fname); if (index != -1) { - + if (index > 0) { StylesheetContainer sc = userAgentStylesheets.get(index); userAgentStylesheets.remove(index); @@ -1138,15 +1139,15 @@ } return; } - + StylesheetContainer sc = new StylesheetContainer(fname, stylesheet); - + if (userAgentStylesheets.isEmpty()) { userAgentStylesheets.add(sc); } else { userAgentStylesheets.set(0,sc); } - + stylesheet.setOrigin(StyleOrigin.USER_AGENT); userAgentStylesheetsChanged(); } @@ -1157,9 +1158,9 @@ private void userAgentStylesheetsChanged() { for (CacheContainer container : cacheContainerMap.values()) { - container.clearCache(); + container.clearCache(); } - + final Iterator windows = AccessController.doPrivileged( new PrivilegedAction>() { @@ -1234,9 +1235,9 @@ return list; } - + + // // - // // private List gatherSceneStylesheets(Scene scene) { @@ -1250,16 +1251,16 @@ return Collections.emptyList(); } - final List list = + final List list = new ArrayList(sceneStylesheets.size()); // RT-20643 CssError.setCurrentScene(scene); for (int n = 0, nMax = sceneStylesheets.size(); n < nMax; n++) { - + final String fname = sceneStylesheets.get(n); - + StylesheetContainer container = null; if (stylesheetContainerMap.containsKey(fname)) { container = stylesheetContainerMap.get(fname); @@ -1284,7 +1285,7 @@ return list; } - + // reuse key to avoid creation of numerous small objects private Key key = null; @@ -1292,43 +1293,43 @@ * Finds matching styles for this Node. */ public StyleMap findMatchingStyles(Node node, Set[] triggerStates) { - + final Scene scene = node.getScene(); if (scene == null) { return StyleMap.EMPTY_MAP; } - + CacheContainer cacheContainer = cacheContainerMap.get(scene); if (cacheContainer == null) { cacheContainer = new CacheContainer(); cacheContainerMap.put(scene, cacheContainer); } - final Parent parent = - (node instanceof Parent) + final Parent parent = + (node instanceof Parent) ? (Parent) node : node.getParent(); - + final List parentStylesheets = gatherParentStylesheets(parent); - + final boolean hasParentStylesheets = parentStylesheets.isEmpty() == false; - + final List sceneStylesheets = gatherSceneStylesheets(scene); - + boolean hasSceneStylesheets = sceneStylesheets.isEmpty() == false; - + // // Are there any stylesheets at all? // If not, then there is nothing to match and the // resulting StyleMap is going to end up empty - // - if (hasParentStylesheets == false + // + if (hasParentStylesheets == false && hasSceneStylesheets == false && userAgentStylesheets.isEmpty()) { return StyleMap.EMPTY_MAP; } - + final String name = node.getClass().getName(); final int dotPos = name.lastIndexOf('.'); final String cname = name.substring(dotPos+1); // want Foo, not bada.bing.Foo @@ -1338,7 +1339,7 @@ if (key == null) { key = new Key(); } - + key.className = cname; key.id = id; for(int n=0, nMax=styleClasses.size(); n cacheMap = cacheContainer.getCacheMap(parentStylesheets); - + Cache cache = cacheMap.get(key); - + if (cache != null) { // key will be reused, so clear the styleClasses for next use key.styleClasses.clear(); @@ -1360,7 +1361,7 @@ // If the cache is null, then we need to create a new Cache and // add it to the cache map - + // Construct the list of Rules that could possibly apply final List rules = new ArrayList(); @@ -1368,15 +1369,15 @@ if (userAgentStylesheets.isEmpty() == false) { for(int n=0, nMax=userAgentStylesheets.size(); n matchingRules = + final List matchingRules = container.selectorPartitioning.match(id, cname, key.styleClasses); rules.addAll(matchingRules); } } } - + // Scene stylesheets come next since declarations from // parent stylesheets should take precedence. if (sceneStylesheets.isEmpty() == false) { @@ -1384,7 +1385,7 @@ final StylesheetContainer container = sceneStylesheets.get(n); if (container != null && container.selectorPartitioning != null) { container.keys.add(key); // remember that this stylesheet was used in this cache - final List matchingRules = + final List matchingRules = container.selectorPartitioning.match(id, cname, key.styleClasses); rules.addAll(matchingRules); } @@ -1398,27 +1399,27 @@ final StylesheetContainer container = parentStylesheets.get(n); container.keys.add(key); // remember that this stylesheet was used in this cache if (container.selectorPartitioning != null) { - final List matchingRules = + final List matchingRules = container.selectorPartitioning.match(id, cname, key.styleClasses); rules.addAll(matchingRules); } } } - + // create a new Cache from these rules. - cache = new Cache(rules); + cache = new Cache(rules); cacheMap.put(key, cache); - + // cause a new Key to be created the next time this method is called key = null; } // - // Create a style helper for this node from the styles that match. + // Create a style helper for this node from the styles that match. // StyleMap smap = cache.getStyleMap(cacheContainer, node, triggerStates); - - return smap; + + return smap; } //////////////////////////////////////////////////////////////////////////// @@ -1426,7 +1427,7 @@ // CssError reporting // //////////////////////////////////////////////////////////////////////////// - + private static ObservableList errors = null; /** * Errors that may have occurred during css processing. @@ -1451,7 +1452,7 @@ public static ObservableList getErrors() { return errors; } - + //////////////////////////////////////////////////////////////////////////// // // Classes and routines for mapping styles to a Node @@ -1467,7 +1468,7 @@ if (styleCache == null) styleCache = new HashMap(); return styleCache; } - + private Map getCacheMap(List parentStylesheets) { if (cacheMap == null) { @@ -1509,12 +1510,12 @@ } } - + private List getStyleMapList() { if (styleMapList == null) styleMapList = new ArrayList(); return styleMapList; } - + private int nextSmapId() { styleMapId = baseStyleMapId + getStyleMapList().size(); return styleMapId; @@ -1535,41 +1536,41 @@ return StyleMap.EMPTY_MAP; } - + private void clearCache() { if (cacheMap != null) cacheMap.clear(); if (styleCache != null) styleCache.clear(); if (styleMapList != null) styleMapList.clear(); - + baseStyleMapId = styleMapId; // 7/8ths is totally arbitrary if (baseStyleMapId > Integer.MAX_VALUE*7/8) { baseStyleMapId = styleMapId = 0; } } - + private Map styleCache; private Map, Map> cacheMap; - + private List styleMapList; /* - * A simple counter used to generate a unique id for a StyleMap. - * This unique id is used by StyleHelper in figuring out which + * A simple counter used to generate a unique id for a StyleMap. + * This unique id is used by StyleHelper in figuring out which * style cache to use. */ private int styleMapId = 0; - - // When the cache is cleared, styleMapId counting begins here. + + // When the cache is cleared, styleMapId counting begins here. // If a StyleHelper calls getStyleMap with an id less than the // baseStyleMapId, then that StyleHelper is working with an old // cache and is no longer valid. private int baseStyleMapId = 0; - + } - + /** * Creates and caches maps of styles, reusing them as often as practical. */ @@ -1581,7 +1582,7 @@ Key(long[] key) { this.key = key; } - + @Override public int hashCode() { int hash = 3; @@ -1603,7 +1604,7 @@ } return true; } - + } // this must be initialized to the appropriate possible rules when // the helper cache is created by the StylesheetContainer @@ -1616,15 +1617,15 @@ } private StyleMap getStyleMap(CacheContainer cacheContainer, Node node, Set[] triggerStates) { - - if (rules == null || rules.isEmpty()) { + + if (rules == null || rules.isEmpty()) { return StyleMap.EMPTY_MAP; } // // Since the list of rules is found by matching only the - // rightmost selector, the set of rules may larger than those + // rightmost selector, the set of rules may larger than those // rules that actually match the node. The following loop // whittles the list down to those rules that apply. // @@ -1638,27 +1639,27 @@ int count = 0; int index = 0; for (int r = 0, rMax = rules.size(); r < rMax; r++) { - + final Rule rule = rules.get(r); // // This particular flavor of applies takes a PseudoClassState[] - // fills in the pseudo-class states from the selectors where + // fills in the pseudo-class states from the selectors where // they apply to a node. This is an expedient to looking the // applies loopa second time on the matching rules. This has to // be done ahead of the cache lookup since not all nodes that - // have the same set of rules will have the same node hierarchy. - // + // have the same set of rules will have the same node hierarchy. + // // For example, if I have .foo:hover:focused .bar:selected {...} // and the "bar" node is 4 away from the root and the foo // node is two away from the root, pseudoclassBits would be // [selected, 0, hover:focused, 0] // Note that the states run from leaf to root. This is how - // the code in StyleHelper expects things. + // the code in StyleHelper expects things. // Note also that, if the rule does not apply, the triggerStates - // is unchanged. + // is unchanged. // - + final int nSelectors = rule.getSelectors().size(); if ((count + nSelectors) > Long.SIZE) { final long[] temp = new long[key.length+1]; @@ -1667,25 +1668,25 @@ ++index; count = 0; } - + long mask = rule.applies(node, triggerStates); - + if (mask != 0) { key[index] |= mask << count; applicableRules[r] = rule; } else { applicableRules[r] = null; } - - count += rule.getSelectors().size(); - + + count += rule.getSelectors().size(); + } - + // nothing matched! if (key.length == 1 && key[0] == 0) { return StyleMap.EMPTY_MAP; } - + final Key keyObj = new Key(key); if (cache.containsKey(keyObj)) { Integer id = cache.get(keyObj); @@ -1694,39 +1695,39 @@ } int ordinal = 0; - - // if there isn't a map in cache already, create one. - // + + // if there isn't a map in cache already, create one. + // // We know the rules apply, so they should also match. A rule // might have more than one selector and match will return the - // selector that matches. Matches is more expensive than applies, - // so we pay for it here, but only for the first time the + // selector that matches. Matches is more expensive than applies, + // so we pay for it here, but only for the first time the // cache is created. // final List styles = new ArrayList(); - + for (int r = 0, rMax = applicableRules.length; r matches = rule.matches(node); if (matches == null || matches.isEmpty()) { continue; } - + for (int m=0, mMax=matches.size(); m> smap = new HashMap>(); - + for (int i=0, max=styles.size(); i list = smap.get(property); if (list == null) { @@ -1776,7 +1777,7 @@ } } - + /** * The key used in the cacheMap of the StylesheetContainer */ @@ -1793,7 +1794,7 @@ private Key() { styleClasses = new StyleClassSet(); } - + @Override public boolean equals(Object o) { if (this == o) { @@ -1801,7 +1802,7 @@ } if (o instanceof Key) { Key other = (Key)o; - + if (className == null ? other.className != null : (className.equals(other.className) == false)) { return false; } @@ -1825,6 +1826,6 @@ } } - + } --- old/javafx-ui-common/src/com/sun/javafx/css/converters/EnumConverter.java 2013-06-07 09:30:21.000000000 -0700 +++ new/javafx-ui-common/src/com/sun/javafx/css/converters/EnumConverter.java 2013-06-07 09:30:20.000000000 -0700 @@ -39,6 +39,7 @@ import com.sun.javafx.Logging; import sun.util.logging.PlatformLogger; +import sun.util.logging.PlatformLogger.Level; public final class EnumConverter> extends StyleConverterImpl { @@ -76,21 +77,21 @@ os.writeShort(index); } - + public static StyleConverter readBinary(DataInputStream is, String[] strings) throws IOException { - + short index = is.readShort(); String ename = 0 <= index && index <= strings.length ? strings[index] : null; - + if (ename == null || ename.isEmpty()) return null; - + if (converters == null || converters.containsKey(ename) == false) { StyleConverter converter = getInstance(ename); if (converter == null) { final PlatformLogger logger = Logging.getCSSLogger(); - if (logger.isLoggable(PlatformLogger.SEVERE)) { + if (logger.isLoggable(Level.SEVERE)) { logger.severe("could not deserialize EnumConverter for " + ename); } } @@ -162,9 +163,9 @@ converter = new EnumConverter(javafx.scene.text.FontWeight.class); break; case "javafx.scene.text.TextAlignment" : - converter = new EnumConverter(javafx.scene.text.TextAlignment.class); + converter = new EnumConverter(javafx.scene.text.TextAlignment.class); break; - + default : // // Enum types that are not in the javafx-ui-common source tree. @@ -173,7 +174,7 @@ // outside of the javafx-ui-common package, I don't expect these // EnumConverters to have been persisted. For example, the // -fx-text-overrun and -fx-content-display properties, will yield - // a ParsedValue with a null converter. + // a ParsedValue with a null converter. // // If assertions are disabled, then null is returned. The StyleHelper // code will use the StyleableProperty's converter in this case. @@ -181,7 +182,7 @@ assert false : "EnumConverter<"+ ename + "> not expected"; final PlatformLogger logger = Logging.getCSSLogger(); - if (logger.isLoggable(PlatformLogger.SEVERE)) { + if (logger.isLoggable(Level.SEVERE)) { logger.severe("EnumConverter : converter Class is null for : "+ename); } break; @@ -189,7 +190,7 @@ return converter; } - + @Override public boolean equals(Object other) { --- old/javafx-ui-common/src/com/sun/javafx/css/parser/CSSParser.java 2013-06-07 09:30:23.000000000 -0700 +++ new/javafx-ui-common/src/com/sun/javafx/css/parser/CSSParser.java 2013-06-07 09:30:22.000000000 -0700 @@ -82,6 +82,7 @@ import com.sun.javafx.css.converters.StringConverter; import com.sun.javafx.css.converters.URLConverter; import sun.util.logging.PlatformLogger; +import sun.util.logging.PlatformLogger.Level; import com.sun.javafx.scene.layout.region.BackgroundPositionConverter; import com.sun.javafx.scene.layout.region.BackgroundSizeConverter; import com.sun.javafx.scene.layout.region.BorderImageSliceConverter; @@ -119,54 +120,55 @@ // stylesheet as a string from parse method. This will be null if the // stylesheet is being parsed from a file; otherwise, the parser is parsing - // a string and this is that string. + // a string and this is that string. private String stylesheetAsText; - + // the url of the stylesheet file, or the docbase of an applet. This will // be null if the source is not a file or from an applet. - private URL sourceOfStylesheet; - + private URL sourceOfStylesheet; + // the Styleable from the node with an in-line style. This will be null // unless the source of the styles is a Node's styleProperty. In this case, // the stylesheetString will also be set. private Styleable sourceOfInlineStyle; - + // source is a file private void setInputSource(URL url) { setInputSource(url, null); } - + // source is a file private void setInputSource(URL url, String str) { stylesheetAsText = str; - sourceOfStylesheet = url; + sourceOfStylesheet = url; sourceOfInlineStyle = null; } - + // source as string only private void setInputSource(String str) { stylesheetAsText = str; - sourceOfStylesheet = null; - sourceOfInlineStyle = null; + sourceOfStylesheet = null; + sourceOfInlineStyle = null; } - + // source is in-line style private void setInputSource(Styleable styleable) { stylesheetAsText = styleable != null ? styleable.getStyle() : null; sourceOfStylesheet = null; sourceOfInlineStyle = styleable; } - + private static final PlatformLogger LOGGER; static { LOGGER = com.sun.javafx.Logging.getCSSLogger(); - final int level = LOGGER.getLevel(); - if (level > PlatformLogger.WARNING && - level != PlatformLogger.OFF) { - LOGGER.setLevel(PlatformLogger.WARNING); + final Level level = LOGGER.level(); + if (level == null || ( + level.compareTo(Level.WARNING) > 0 && + level != Level.OFF)) { + LOGGER.setLevel(Level.WARNING); } } - + private static final class ParseException extends Exception { ParseException(String message) { this(message,null,null); @@ -209,7 +211,7 @@ } return stylesheet; } - + /** * Creates a stylesheet from a CSS document string using docbase as * the base URL for resolving references within stylesheet. @@ -237,7 +239,7 @@ *@throws IOException */ public Stylesheet parse(final URL url) throws IOException { - + final Stylesheet stylesheet = new Stylesheet(url); if (url != null) { setInputSource(url); @@ -258,9 +260,9 @@ reader.close(); } catch (IOException ioe) { } catch (Exception ex) { - // Sometimes bad syntax causes an exception. The code should be - // fixed to handle the bad syntax, but the fallback is - // to handle the exception here. Uncaught, the exception can cause + // Sometimes bad syntax causes an exception. The code should be + // fixed to handle the bad syntax, but the fallback is + // to handle the exception here. Uncaught, the exception can cause // problems like RT-20311 reportException(ex); } @@ -269,9 +271,9 @@ /** Parse an in-line style from a Node */ public Stylesheet parseInlineStyle(final Styleable node) { - + Stylesheet stylesheet = new Stylesheet(); - + final String stylesheetText = (node != null) ? node.getStyle() : null; if (stylesheetText != null && !stylesheetText.trim().isEmpty()) { setInputSource(node); @@ -293,9 +295,9 @@ reader.close(); } catch (IOException ioe) { } catch (Exception ex) { - // Sometimes bad syntax causes an exception. The code should be - // fixed to handle the bad syntax, but the fallback is - // to handle the exception here. Uncaught, the exception can cause + // Sometimes bad syntax causes an exception. The code should be + // fixed to handle the bad syntax, but the fallback is + // to handle the exception here. Uncaught, the exception can cause // problems like RT-20311 reportException(ex); } @@ -328,13 +330,13 @@ reader.close(); } catch (IOException ioe) { } catch (ParseException e) { - if (LOGGER.isLoggable(PlatformLogger.WARNING)) { + if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning("\"" +property + ": " + expr + "\" " + e.toString()); } } catch (Exception ex) { - // Sometimes bad syntax causes an exception. The code should be - // fixed to handle the bad syntax, but the fallback is - // to handle the exception here. Uncaught, the exception can cause + // Sometimes bad syntax causes an exception. The code should be + // fixed to handle the bad syntax, but the fallback is + // to handle the exception here. Uncaught, the exception can cause // problems like RT-20311 reportException(ex); } @@ -425,12 +427,12 @@ return buf.toString(); } - + } private CssError createError(String msg) { - - CssError error = null; + + CssError error = null; if (sourceOfStylesheet != null) { error = new CssError.StylesheetParsingError(sourceOfStylesheet, msg); } else if (sourceOfInlineStyle != null) { @@ -440,14 +442,14 @@ } return error; } - + private void reportError(CssError error) { List errors = null; if ((errors = StyleManager.getErrors()) != null) { errors.add(error); } } - + private void error(final Term root, final String msg) throws ParseException { final Token token = root != null ? root.token : null; @@ -457,11 +459,11 @@ } private void reportException(Exception exception) { - - if (LOGGER.isLoggable(PlatformLogger.WARNING)) { + + if (LOGGER.isLoggable(Level.WARNING)) { final StackTraceElement[] stea = exception.getStackTrace(); if (stea.length > 0) { - final StringBuilder buf = + final StringBuilder buf = new StringBuilder("Please report "); buf.append(exception.getClass().getName()) .append(" at:"); @@ -478,9 +480,9 @@ } } } - + private String formatDeprecatedMessage(final Term root, final String syntax) { - final StringBuilder buf = + final StringBuilder buf = new StringBuilder("Using deprecated syntax for "); buf.append(syntax); if (sourceOfStylesheet != null){ @@ -495,7 +497,7 @@ buf.append(". Refer to the CSS Reference Guide."); return buf.toString(); } - + // Assumes string is not a lookup! private ParsedValueImpl colorValueOfString(String str) { @@ -620,7 +622,7 @@ trim = 5; break; default: - if (LOGGER.isLoggable(PlatformLogger.FINEST)) { + if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest("Expected \'\'"); } ParseException re = new ParseException("Expected \'\'",token, this); @@ -804,7 +806,7 @@ String str = null; int ttype = -1; final Token token = root.token; - + if (root.token == null || ((ttype = root.token.getType()) != CSSLexer.STRING && ttype != CSSLexer.IDENT) @@ -812,7 +814,7 @@ || str.isEmpty()) { error(root, "Expected STRING or IDENT"); } - return new ParsedValueImpl(stripQuotes(str), null, false); + return new ParsedValueImpl(stripQuotes(str), null, false); } return parse(root); } @@ -1083,10 +1085,10 @@ error(root, msg); } - if (LOGGER.isLoggable(PlatformLogger.WARNING)) { + if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning(formatDeprecatedMessage(root, "ladder")); } - + Term term = root; if ((term = term.nextInSeries) == null) error(root, "Expected \'\'"); @@ -1139,8 +1141,8 @@ return new ParsedValueImpl(values, LadderConverter.getInstance()); } - - // = ladder(, [, ]+ ) + + // = ladder(, [, ]+ ) private ParsedValueImpl parseLadder(final Term root) throws ParseException { // first term in the chain is the function name... @@ -1157,7 +1159,7 @@ Term prev = term; - if ((term = term.nextArg) == null) + if ((term = term.nextArg) == null) error(prev, "Expected \'[, ]+\'"); ParsedValueImpl[] stops = parseColorStops(term); @@ -1166,7 +1168,7 @@ values[0] = color; System.arraycopy(stops, 0, values, 1, stops.length); return new ParsedValueImpl(values, LadderConverter.getInstance()); - } + } // parse (, )+ // root.token should be a size @@ -1311,7 +1313,7 @@ } } } - + ParsedValueImpl[] stops = new ParsedValueImpl[nArgs]; for (int n=0; n( @@ -1326,7 +1328,7 @@ return stops; } - + // parse (, ) private ParsedValueImpl[] point(final Term root) throws ParseException { @@ -1549,7 +1551,7 @@ error(root, msg); } - if (LOGGER.isLoggable(PlatformLogger.WARNING)) { + if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning(formatDeprecatedMessage(root, "linear gradient")); } @@ -1642,17 +1644,17 @@ // Based off http://dev.w3.org/csswg/css3-images/#linear-gradients // // = linear-gradient( - // [ [from to ] | [ to ] ] ,]? [ [ repeat | reflect ] ,]? - // [, ]+ - // ) + // [ [from to ] | [ to ] ] ,]? [ [ repeat | reflect ] ,]? + // [, ]+ + // ) // // - // = | - // = [left | right] || [top | bottom] + // = | + // = [left | right] || [top | bottom] // - // If neither repeat nor reflect are given, then the CycleMethod defaults "NO_CYCLE". - // If neither [from to ] nor [ to ] are given, - // then the gradient direction defaults to 'to bottom'. + // If neither repeat nor reflect are given, then the CycleMethod defaults "NO_CYCLE". + // If neither [from to ] nor [ to ] are given, + // then the gradient direction defaults to 'to bottom'. // Stops are per http://dev.w3.org/csswg/css3-images/#color-stop-syntax. private ParsedValueImpl parseLinearGradient(final Term root) throws ParseException { @@ -1668,7 +1670,7 @@ if ((arg = root.firstArg) == null || arg.token == null || arg.token.getText().isEmpty()) { - error(root, + error(root, "Expected \'from to \' or \'to \' " + "or \'\' or \'\'"); } @@ -1712,7 +1714,7 @@ prev = arg; arg = arg.nextArg; - + } else if("to".equalsIgnoreCase(arg.token.getText())) { prev = arg; @@ -1798,7 +1800,7 @@ error (prev, "Expected \'\'"); } } - + startPt = new ParsedValueImpl[] { new ParsedValueImpl(new Size(startX, SizeUnits.PERCENT), null), @@ -1875,10 +1877,10 @@ error(root, msg); } - if (LOGGER.isLoggable(PlatformLogger.WARNING)) { + if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning(formatDeprecatedMessage(root, "radial gradient")); } - + Term term = root; Term prev = root; @@ -2013,13 +2015,13 @@ // Based off http://dev.w3.org/csswg/css3-images/#radial-gradients // - // = radial-gradient( - // [ focus-angle , ]? - // [ focus-distance , ]? - // [ center , ]? + // = radial-gradient( + // [ focus-angle , ]? + // [ focus-distance , ]? + // [ center , ]? // radius , - // [ [ repeat | reflect ] ,]? - // [, ]+ ) + // [ [ repeat | reflect ] ,]? + // [, ]+ ) // // Stops are per http://dev.w3.org/csswg/css3-images/#color-stop-syntax. private ParsedValueImpl parseRadialGradient(final Term root) throws ParseException { @@ -2036,8 +2038,8 @@ if ((arg = root.firstArg) == null || arg.token == null || arg.token.getText().isEmpty()) { - error(root, - "Expected \'focus-angle \' " + + error(root, + "Expected \'focus-angle \' " + "or \'focus-distance \' " + "or \'center \' " + "or \'radius [ | ]\'"); @@ -2075,7 +2077,7 @@ "or \'radius [ | ]\'"); } - + if ("focus-distance".equalsIgnoreCase(arg.token.getText())) { prev = arg; @@ -2100,7 +2102,7 @@ "or \'radius \'"); } - + if ("center".equalsIgnoreCase(arg.token.getText())) { prev = arg; @@ -2114,12 +2116,12 @@ ParsedValueImpl ptY = parseSize(arg); centerPoint = new ParsedValueImpl[] { ptX, ptY }; - + prev = arg; if ((arg = arg.nextArg) == null) error(prev, "Expected \'radius [ | ]\'"); } - + if ("radius".equalsIgnoreCase(arg.token.getText())) { prev = arg; @@ -2127,11 +2129,11 @@ !isSize(arg.token)) error(prev, "Expected \'[ | ]\'"); radius = parseSize(arg); - + prev = arg; if ((arg = arg.nextArg) == null) error(prev, "Expected \'radius [ | ]\'"); - } + } CycleMethod cycleMethod = CycleMethod.NO_CYCLE; if ("reflect".equalsIgnoreCase(arg.token.getText())) { @@ -2162,9 +2164,9 @@ values[index++] = new ParsedValueImpl(cycleMethod.name(), new EnumConverter(CycleMethod.class)); for (int n=0; n(values, PaintConverter.RadialGradientConverter.getInstance()); - + } - + // Based off ImagePattern constructor // // image-pattern([,,,,[,]?]?) @@ -2398,7 +2400,7 @@ private static boolean isPositionKeyWord(String value) { return "center".equalsIgnoreCase(value) || "top".equalsIgnoreCase(value) || "bottom".equalsIgnoreCase(value) || "left".equalsIgnoreCase(value) || "right".equalsIgnoreCase(value); } - + /* * http://www.w3.org/TR/css3-background/#the-background-position * @@ -2441,14 +2443,14 @@ // 2 values filled String v1 = valueOne.getText(); String v2 = valueTwo.getText(); - if( ("top".equals(v1) || "bottom".equals(v1)) + if( ("top".equals(v1) || "bottom".equals(v1)) && ("left".equals(v2) || "right".equals(v2) || "center".equals(v2)) ) { { Token tmp = valueTwo; valueTwo = valueOne; valueOne = tmp; } - + { Term tmp = termTwo; termTwo = termOne; @@ -2460,7 +2462,7 @@ Token[] tokeArray = null; // 4 values filled if( valueFour != null ) { - if( ("top".equals(valueOne.getText()) || "bottom".equals(valueOne.getText())) + if( ("top".equals(valueOne.getText()) || "bottom".equals(valueOne.getText())) && ("left".equals(valueThree.getText()) || "right".equals(valueThree.getText())) ) { // e.g. top 50 left 20 termArray = new Term[] { termThree, termFour, termOne, termTwo }; @@ -2471,29 +2473,29 @@ if( ("left".equals(valueTwo.getText()) || "right".equals(valueTwo.getText())) ) { // e.g. top left 50 termArray = new Term[] { termTwo, termThree, termOne, null }; - tokeArray = new Token[] { valueTwo, valueThree, valueOne, null }; + tokeArray = new Token[] { valueTwo, valueThree, valueOne, null }; } else { // e.g. top 50 left termArray = new Term[] { termThree, termOne, termTwo, null }; tokeArray = new Token[] { valueThree, valueOne, valueTwo, null }; } - } + } } - + if( termArray != null ) { termOne = termArray[0]; termTwo = termArray[1]; termThree = termArray[2]; termFour = termArray[3]; - + valueOne = tokeArray[0]; valueTwo = tokeArray[1]; valueThree = tokeArray[2]; valueFour = tokeArray[3]; } } - - + + ParsedValueImpl top, right, bottom, left; top = right = bottom = left = ZERO_PERCENT; { @@ -2502,39 +2504,39 @@ } else if( valueOne != null && valueTwo == null && valueThree == null && valueFour == null ) { // Only one value String v1 = valueOne.getText(); - + if( "center".equals(v1) ) { left = FIFTY_PERCENT; right = ZERO_PERCENT; - + top = FIFTY_PERCENT; bottom = ZERO_PERCENT; - + } else if("left".equals(v1)) { left = ZERO_PERCENT; right = ZERO_PERCENT; - + top = FIFTY_PERCENT; bottom = ZERO_PERCENT; - + } else if( "right".equals(v1) ) { left = ONE_HUNDRED_PERCENT; right = ZERO_PERCENT; - + top = FIFTY_PERCENT; bottom = ZERO_PERCENT; - + } else if( "top".equals(v1) ) { left = FIFTY_PERCENT; right = ZERO_PERCENT; - + top = ZERO_PERCENT; bottom = ZERO_PERCENT; - + } else if( "bottom".equals(v1) ) { left = FIFTY_PERCENT; right = ZERO_PERCENT; - + top = ONE_HUNDRED_PERCENT; bottom = ZERO_PERCENT; } else { @@ -2547,11 +2549,11 @@ // 2 values String v1 = valueOne.getText().toLowerCase(); String v2 = valueTwo.getText().toLowerCase(); - + if( ! isPositionKeyWord(v1) ) { left = parseSize(termOne); right = ZERO_PERCENT; - + if( "top".equals(v2) ) { top = ZERO_PERCENT; bottom = ZERO_PERCENT; @@ -2570,7 +2572,7 @@ } else if( v1.equals("left") || v1.equals("right") ) { left = v1.equals("right") ? ONE_HUNDRED_PERCENT : ZERO_PERCENT; right = ZERO_PERCENT; - + if( ! isPositionKeyWord(v2) ) { top = parseSize(termTwo); bottom = ZERO_PERCENT; @@ -2591,7 +2593,7 @@ } else if( v1.equals("center") ) { left = FIFTY_PERCENT; right = ZERO_PERCENT; - + if( v2.equals("top") ) { top = ZERO_PERCENT; bottom = ZERO_PERCENT; @@ -2612,17 +2614,17 @@ String v1 = valueOne.getText().toLowerCase(); String v2 = valueTwo.getText().toLowerCase(); String v3 = valueThree.getText().toLowerCase(); - + if( ! isPositionKeyWord(v1) || "center".equals(v1) ) { // 1 is horizontal // means 2 & 3 are vertical if( "center".equals(v1) ) { - left = FIFTY_PERCENT; + left = FIFTY_PERCENT; } else { left = parseSize(termOne); } right = ZERO_PERCENT; - + if( !isPositionKeyWord(v3) ) { if( "top".equals(v2) ) { top = parseSize(termThree); @@ -2632,7 +2634,7 @@ bottom = parseSize(termThree); } else { error(termTwo,"Expected 'top' or 'bottom'"); - } + } } else { error(termThree,"Expected "); } @@ -2647,7 +2649,7 @@ left = ZERO_PERCENT; right = parseSize(termTwo); } - + if( "top".equals(v3) ) { top = ZERO_PERCENT; bottom = ZERO_PERCENT; @@ -2670,7 +2672,7 @@ left = ONE_HUNDRED_PERCENT; right = ZERO_PERCENT; } - + if( ! isPositionKeyWord(v3) ) { if( "top".equals(v2) ) { top = parseSize(termThree); @@ -2691,7 +2693,7 @@ String v2 = valueTwo.getText().toLowerCase(); String v3 = valueThree.getText().toLowerCase(); String v4 = valueFour.getText().toLowerCase(); - + if( (v1.equals("left") || v1.equals("right")) && (v3.equals("top") || v3.equals("bottom") ) && ! isPositionKeyWord(v2) && ! isPositionKeyWord(v4) ) { if( v1.equals("left") ) { left = parseSize(termTwo); @@ -2700,7 +2702,7 @@ left = ZERO_PERCENT; right = parseSize(termTwo); } - + if( v3.equals("top") ) { top = parseSize(termFour); bottom = ZERO_PERCENT; @@ -2708,7 +2710,7 @@ top = ZERO_PERCENT; bottom = parseSize(termFour); } - + } else { error(term,"Expected 'left' or 'right' followed by followed by 'top' or 'bottom' followed by "); } @@ -3667,7 +3669,7 @@ (token.getType() == CSSLexer.WS) || (token.getType() == CSSLexer.NL)); - if (LOGGER.isLoggable(PlatformLogger.FINEST)) { + if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest(token.toString()); } @@ -3697,11 +3699,11 @@ (currentToken.getType() != CSSLexer.LBRACE)) { final int line = currentToken != null ? currentToken.getLine() : -1; final int pos = currentToken != null ? currentToken.getOffset() : -1; - final String msg = + final String msg = MessageFormat.format("Expected LBRACE at [{0,number,#},{1,number,#}]", - line,pos); + line,pos); CssError error = createError(msg); - if (LOGGER.isLoggable(PlatformLogger.WARNING)) { + if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning(error.toString()); } reportError(error); @@ -3719,11 +3721,11 @@ (currentToken.getType() != CSSLexer.RBRACE)) { final int line = currentToken.getLine(); final int pos = currentToken.getOffset(); - final String msg = + final String msg = MessageFormat.format("Expected RBRACE at [{0,number,#},{1,number,#}]", line,pos); - CssError error = createError(msg); - if (LOGGER.isLoggable(PlatformLogger.WARNING)) { + CssError error = createError(msg); + if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning(error.toString()); } reportError(error); @@ -3753,7 +3755,7 @@ // ignore all but "src" if ("src".equalsIgnoreCase(key)) { while(true) { - if((currentToken != null) && + if((currentToken != null) && (currentToken.getType() != CSSLexer.SEMI) && (currentToken.getType() != CSSLexer.RBRACE) && (currentToken.getType() != Token.EOF)) { @@ -3781,21 +3783,21 @@ if (urlSb.charAt(start) == '/' || urlSb.charAt(start) == '\\') start ++; if (urlSb.charAt(end-1) == '\'' || urlSb.charAt(end-1) == '\"') end --; final String urlStr = urlSb.substring(start,end); - + URL url = null; try { url = new URL(sourceOfStylesheet, urlStr); } catch (MalformedURLException malf) { - + final int line = currentToken.getLine(); final int pos = currentToken.getOffset(); final String msg = MessageFormat.format("Could not resolve @font-face url [{2}] at [{0,number,#},{1,number,#}]",line,pos,urlStr); CssError error = createError(msg); - if (LOGGER.isLoggable(PlatformLogger.WARNING)) { + if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning(error.toString()); } reportError(error); - + // skip the rest. while(currentToken != null) { int ttype = currentToken.getType(); @@ -3818,12 +3820,12 @@ } } else if (ttype == CSSLexer.IDENT || ttype == CSSLexer.STRING) { - + format = Utils.stripQuotes(currentToken.getText()); } else if (ttype == CSSLexer.RPAREN) { continue; } else { - break; + break; } } @@ -3853,7 +3855,7 @@ final int pos = currentToken.getOffset(); final String msg = MessageFormat.format("Unknown @font-face src type ["+currentToken.getText()+")] at [{0,number,#},{1,number,#}]",line,pos); CssError error = createError(msg); - if (LOGGER.isLoggable(PlatformLogger.WARNING)) { + if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning(error.toString()); } reportError(error); @@ -3867,7 +3869,7 @@ final int pos = currentToken.getOffset(); final String msg = MessageFormat.format("Unexpected TOKEN ["+currentToken.getText()+"] at [{0,number,#},{1,number,#}]",line,pos); CssError error = createError(msg); - if (LOGGER.isLoggable(PlatformLogger.WARNING)) { + if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning(error.toString()); } reportError(error); @@ -3996,7 +3998,7 @@ String isel = ""; // id selector List csels = null; // class selector List pclasses = null; // pseudoclasses - + while (true) { final int ttype = @@ -4034,7 +4036,7 @@ if (currentToken != null && pclasses == null) { pclasses = new ArrayList(); } - + if (currentToken.getType() == CSSLexer.IDENT) { pclasses.add(currentToken.getText()); } else if (currentToken.getType() == CSSLexer.FUNCTION){ @@ -4048,7 +4050,7 @@ return null; } break; - + case CSSLexer.NL: case CSSLexer.WS: case CSSLexer.COMMA: @@ -4062,16 +4064,16 @@ } - + // get the next token, but don't skip whitespace // since it may be a combinator currentToken = lexer.nextToken(); - if (LOGGER.isLoggable(PlatformLogger.FINEST)) { + if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest(currentToken.toString()); } } } - + // From http://www.w3.org/TR/selectors/#grammar // functional_pseudo // : FUNCTION S* expression ')' @@ -4084,34 +4086,34 @@ private String functionalPseudo(CSSLexer lexer) { // TODO: This is not how we should handle functional pseudo-classes in the long-run! - + StringBuilder pclass = new StringBuilder(currentToken.getText()); - + while(true) { - + currentToken = nextToken(lexer); - + switch(currentToken.getType()) { - + // TODO: lexer doesn't really scan right and isn't CSS3, // so PLUS, '-', NUMBER, etc are all useless at this point. case CSSLexer.STRING: case CSSLexer.IDENT: pclass.append(currentToken.getText()); break; - + case CSSLexer.RPAREN: pclass.append(')'); return pclass.toString(); - + default: currentToken = Token.INVALID_TOKEN; return null; } } - + } - + private Combinator combinator(CSSLexer lexer) { Combinator combinator = null; @@ -4151,7 +4153,7 @@ // get the next token, but don't skip whitespace currentToken = lexer.nextToken(); - if (LOGGER.isLoggable(PlatformLogger.FINEST)) { + if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest(currentToken.toString()); } } @@ -4208,15 +4210,15 @@ if ((currentToken == null) || (currentToken.getType() != CSSLexer.IDENT)) { -// -// RT-16547: this warning was misleading because an empty rule +// +// RT-16547: this warning was misleading because an empty rule // not invalid. Some people put in empty rules just as placeholders. -// +// // if (LOGGER.isLoggable(PlatformLogger.WARNING)) { // final int line = currentToken != null ? currentToken.getLine() : -1; // final int pos = currentToken != null ? currentToken.getOffset() : -1; -// final String url = -// (stylesheet != null && stylesheet.getUrl() != null) ? +// final String url = +// (stylesheet != null && stylesheet.getUrl() != null) ? // stylesheet.getUrl().toExternalForm() : "?"; // LOGGER.warning("Expected IDENT at {0}[{1,number,#},{2,number,#}]", // url,line,pos); @@ -4232,11 +4234,11 @@ (currentToken.getType() != CSSLexer.COLON)) { final int line = currentToken.getLine(); final int pos = currentToken.getOffset(); - final String msg = + final String msg = MessageFormat.format("Expected COLON at [{0,number,#},{1,number,#}]", line,pos); CssError error = createError(msg); - if (LOGGER.isLoggable(PlatformLogger.WARNING)) { + if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning(error.toString()); } reportError(error); @@ -4253,11 +4255,11 @@ Token badToken = re.tok; final int line = badToken != null ? badToken.getLine() : -1; final int pos = badToken != null ? badToken.getOffset() : -1; - final String msg = + final String msg = MessageFormat.format("{2} while parsing ''{3}'' at [{0,number,#},{1,number,#}]", line,pos,re.getMessage(),property); CssError error = createError(msg); - if (LOGGER.isLoggable(PlatformLogger.WARNING)) { + if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning(error.toString()); } reportError(error); @@ -4281,7 +4283,7 @@ // if current is null, then term returned null final int ttype = - (current != null && currentToken != null) + (current != null && currentToken != null) ? currentToken.getType() : Token.INVALID; if (ttype == Token.INVALID) { @@ -4304,21 +4306,21 @@ } } - + private void skipExpr(CSSLexer lexer) { - + while(true) { - + currentToken = nextToken(lexer); final int ttype = (currentToken != null) ? currentToken.getType() : Token.INVALID; - + if (ttype == CSSLexer.SEMI || ttype == CSSLexer.RBRACE || ttype == Token.EOF) { return; - } + } } } @@ -4387,11 +4389,11 @@ final int line = currentToken != null ? currentToken.getLine() : -1; final int pos = currentToken != null ? currentToken.getOffset() : -1; final String text = currentToken != null ? currentToken.getText() : ""; - final String msg = + final String msg = MessageFormat.format("Unexpected token {0}{1}{0} at [{2,number,#},{3,number,#}]", "\'",text,line,pos); CssError error = createError(msg); - if (LOGGER.isLoggable(PlatformLogger.WARNING)) { + if (LOGGER.isLoggable(Level.WARNING)) { LOGGER.warning(error.toString()); } reportError(error); --- old/javafx-ui-common/src/com/sun/javafx/scene/layout/region/Margins.java 2013-06-07 09:30:24.000000000 -0700 +++ new/javafx-ui-common/src/com/sun/javafx/scene/layout/region/Margins.java 2013-06-07 09:30:24.000000000 -0700 @@ -30,9 +30,9 @@ import com.sun.javafx.css.Size; import com.sun.javafx.css.SizeUnits; import com.sun.javafx.css.StyleConverterImpl; -import java.text.MessageFormat; import javafx.css.ParsedValue; import sun.util.logging.PlatformLogger; +import sun.util.logging.PlatformLogger.Level; /** * Similar to Insets but with flag denoting values are proportional. @@ -95,28 +95,28 @@ Size rightSz = (sides.length > 1) ? sides[1].convert(font) : topSz; Size bottomSz = (sides.length > 2) ? sides[2].convert(font) : topSz; Size leftSz = (sides.length > 3) ? sides[3].convert(font) : rightSz; - + // assume proportional if any units are percent - boolean proportional = + boolean proportional = (topSz.getUnits() == SizeUnits.PERCENT) || (rightSz.getUnits() == SizeUnits.PERCENT) || (bottomSz.getUnits() == SizeUnits.PERCENT) || (leftSz.getUnits() == SizeUnits.PERCENT); - - // if any of the units is percent, then make sure they all are. - boolean unitsMatch = + + // if any of the units is percent, then make sure they all are. + boolean unitsMatch = !proportional || ((topSz.getUnits() == SizeUnits.PERCENT) && (rightSz.getUnits() == SizeUnits.PERCENT) && (bottomSz.getUnits() == SizeUnits.PERCENT) && (leftSz.getUnits() == SizeUnits.PERCENT)); - - // unitsMatch will only be false if proportional is true and + + // unitsMatch will only be false if proportional is true and // not all of the units are percent. if (unitsMatch == false) { final PlatformLogger LOGGER = com.sun.javafx.Logging.getCSSLogger(); - if (LOGGER.isLoggable(PlatformLogger.WARNING)) { - final String msg = + if (LOGGER.isLoggable(Level.WARNING)) { + final String msg = new StringBuilder("units do no match: ") .append(topSz.toString()) .append(" ,").append(rightSz.toString()) @@ -126,8 +126,8 @@ LOGGER.warning(msg); } } - - proportional = proportional && unitsMatch; + + proportional = proportional && unitsMatch; double top = topSz.pixels(font); double right = rightSz.pixels(font); --- old/javafx-ui-common/src/com/sun/javafx/scene/traversal/ContainerTabOrder.java 2013-06-07 09:30:25.000000000 -0700 +++ new/javafx-ui-common/src/com/sun/javafx/scene/traversal/ContainerTabOrder.java 2013-06-07 09:30:25.000000000 -0700 @@ -32,6 +32,7 @@ import javafx.scene.Parent; import com.sun.javafx.Logging; import sun.util.logging.PlatformLogger; +import sun.util.logging.PlatformLogger.Level; import static com.sun.javafx.scene.traversal.Direction.*; @@ -47,7 +48,7 @@ Node newNode = null; int newNodeIndex = -1; - if (focusLogger.isLoggable(PlatformLogger.FINER)) { + if (focusLogger.isLoggable(Level.FINER)) { focusLogger.finer("old focus owner : "+node+", bounds : "+engine.getBounds(node)); } @@ -70,7 +71,7 @@ } - if (focusLogger.isLoggable(PlatformLogger.FINER)) { + if (focusLogger.isLoggable(Level.FINER)) { if (newNode != null) { focusLogger.finer("new focus owner : "+newNode+", bounds : "+engine.getBounds(newNode)); } @@ -87,7 +88,7 @@ Node newNode = null; List parentNodes = findPeers(startNode); if (parentNodes == null) { - if (focusLogger.isLoggable(PlatformLogger.FINER)) { + if (focusLogger.isLoggable(Level.FINER)) { focusLogger.finer("can't find peers for a node without a parent"); } return null; @@ -96,12 +97,12 @@ int ourIndex = parentNodes.indexOf(startNode); if (ourIndex == -1) { - if (focusLogger.isLoggable(PlatformLogger.FINER)) { + if (focusLogger.isLoggable(Level.FINER)) { focusLogger.finer("index not founds, no focus transfer"); } return null; } - + newNode = findNextFocusableInList(parentNodes, ourIndex+1); /* @@ -122,7 +123,7 @@ } startNode = parent; } - + if (newNode == null) { /* ** find the top-most parent which is not at it's end-of-list @@ -136,14 +137,14 @@ parentNodes = parent.getChildrenUnmodifiable(); newNode = findNextFocusableInList(parentNodes, 0); } - + return newNode; } private Node findNextParent(Node node) { return null; } - + private Node findNextFocusableInList(List nodeList, int startIndex) { Node newNode = null; @@ -175,12 +176,12 @@ int ourIndex = parentNodes.indexOf(startNode); if (ourIndex == -1) { - if (focusLogger.isLoggable(PlatformLogger.FINER)) { + if (focusLogger.isLoggable(Level.FINER)) { focusLogger.finer("index not founds, no focus transfer"); } return null; } - + newNode = findPreviousFocusableInList(parentNodes, ourIndex-1); /* @@ -201,7 +202,7 @@ } startNode = parent; } - + if (newNode == null) { /* ** find the top-most parent which is not at it's end-of-list @@ -216,7 +217,7 @@ parentNodes = parent.getChildrenUnmodifiable(); newNode = findPreviousFocusableInList(parentNodes, parentNodes.size()-1); } - + return newNode; } --- old/javafx-ui-common/src/com/sun/javafx/scene/traversal/Hueristic2D.java 2013-06-07 09:30:27.000000000 -0700 +++ new/javafx-ui-common/src/com/sun/javafx/scene/traversal/Hueristic2D.java 2013-06-07 09:30:27.000000000 -0700 @@ -35,6 +35,7 @@ import javafx.scene.Parent; import com.sun.javafx.Logging; import sun.util.logging.PlatformLogger; +import sun.util.logging.PlatformLogger.Level; import static com.sun.javafx.scene.traversal.Direction.*; @@ -53,7 +54,7 @@ cacheTraversal(node, dir, engine); - if (focusLogger.isLoggable(PlatformLogger.FINER)) { + if (focusLogger.isLoggable(Level.FINER)) { focusLogger.finer("old focus owner : "+node+", bounds : "+engine.getBounds(node)); } @@ -100,7 +101,7 @@ } } - if (focusLogger.isLoggable(PlatformLogger.FINER)) { + if (focusLogger.isLoggable(Level.FINER)) { if (newNode != null) { focusLogger.finer("new focus owner : "+newNode+", bounds : "+engine.getBounds(newNode)); } @@ -128,7 +129,7 @@ Node newNode = null; List parentNodes = findPeers(startNode); if (parentNodes == null) { - if (focusLogger.isLoggable(PlatformLogger.FINER)) { + if (focusLogger.isLoggable(Level.FINER)) { focusLogger.finer("can't find peers for a node without a parent"); } return null; @@ -137,12 +138,12 @@ int ourIndex = parentNodes.indexOf(startNode); if (ourIndex == -1) { - if (focusLogger.isLoggable(PlatformLogger.FINER)) { + if (focusLogger.isLoggable(Level.FINER)) { focusLogger.finer("index not founds, no focus transfer"); } return null; } - + newNode = findNextFocusableInList(parentNodes, ourIndex+1); /* @@ -163,7 +164,7 @@ } startNode = parent; } - + if (newNode == null) { /* ** find the top-most parent which is not at it's end-of-list @@ -177,14 +178,14 @@ parentNodes = parent.getChildrenUnmodifiable(); newNode = findNextFocusableInList(parentNodes, 0); } - + return newNode; } private Node findNextParent(Node node) { return null; } - + private Node findNextFocusableInList(List nodeList, int startIndex) { Node newNode = null; @@ -216,12 +217,12 @@ int ourIndex = parentNodes.indexOf(startNode); if (ourIndex == -1) { - if (focusLogger.isLoggable(PlatformLogger.FINER)) { + if (focusLogger.isLoggable(Level.FINER)) { focusLogger.finer("index not founds, no focus transfer"); } return null; } - + newNode = findPreviousFocusableInList(parentNodes, ourIndex-1); /* @@ -242,7 +243,7 @@ } startNode = parent; } - + if (newNode == null) { /* ** find the top-most parent which is not at it's end-of-list @@ -256,7 +257,7 @@ parentNodes = parent.getChildrenUnmodifiable(); newNode = findPreviousFocusableInList(parentNodes, parentNodes.size()-1); } - + return newNode; } @@ -488,7 +489,7 @@ final double cosd = cornerSideDistance(Direction.UP, biasedB, targetBounds); reversingTargetNode.biased2DMetric = 100000 + outdB*outdB + 9*cosd*cosd; } - + /* ** closest current : simple 2d */ @@ -521,16 +522,16 @@ double biasTopRightToTargetMidDistance = currentTopRight2D.distance(targetBounds.getMinX()+(originB.getWidth()/2), targetBounds.getMaxY()); double biasMidToTargetBottomRightDistance = currentMid2D.distance(originB.getMaxX(), targetBounds.getMaxY()); - reversingTargetNode.averageDistance = - (reversingTargetNode.bottomLeftDistance+biasTopLeftToTargetMidDistance+biasTopLeftToTargetBottomRightDistance+ + reversingTargetNode.averageDistance = + (reversingTargetNode.bottomLeftDistance+biasTopLeftToTargetMidDistance+biasTopLeftToTargetBottomRightDistance+ currentTopRightToTargetBottomLeftDistance+reversingTargetNode.bottomRightDistance+biasTopRightToTargetMidDistance+reversingTargetNode.midDistance)/7; - + reversingTargetNode.biasShortestDistance = findMin9(reversingTargetNode.bottomLeftDistance, biasTopLeftToTargetMidDistance, biasTopLeftToTargetBottomRightDistance, currentTopRightToTargetBottomLeftDistance, biasTopRightToTargetMidDistance, reversingTargetNode.bottomRightDistance, currentMidToTargetBottomLeftDistance, reversingTargetNode.midDistance, biasMidToTargetBottomRightDistance); - reversingTargetNode.shortestDistance = + reversingTargetNode.shortestDistance = findMin9(reversingTargetNode.bottomLeftDistance, currentTopLeftToTargetMidDistance, currentTopLeftToTargetBottomRightDistance, currentTopRightToTargetBottomLeftDistance, currentTopRightToTargetMidDistance, currentTopRightToTargetBottomRightDistance, currentMidToTargetBottomLeftDistance, currentMidToTargetMidDistance, currentMidToTargetBottomRightDistance); @@ -541,9 +542,9 @@ Bounds targetBounds = nodes.get(nodeIndex).localToScene(nodes.get(nodeIndex).getLayoutBounds()); /* - ** check that the target node starts after we start target.minX > origin.minX + ** check that the target node starts after we start target.minX > origin.minX ** and the target node ends after we end target.maxX > origin.maxX - */ + */ if ((currentB.getMinY() > targetBounds.getMaxY())) { targetNode.node = nodes.get(nodeIndex); @@ -592,9 +593,9 @@ double biasTopLeftToTargetBottomRightDistance = currentTopLeft2D.distance(originB.getMaxX(), targetBounds.getMaxY()); double biasTopRightToTargetMidDistance = currentTopRight2D.distance(targetBounds.getMinX()+(originB.getWidth()/2), targetBounds.getMaxY()); double biasMidToTargetBottomRightDistance = currentMid2D.distance(originB.getMaxX(), targetBounds.getMaxY()); - + targetNode.averageDistance = - (targetNode.bottomLeftDistance+biasTopLeftToTargetMidDistance+biasTopLeftToTargetBottomRightDistance+ + (targetNode.bottomLeftDistance+biasTopLeftToTargetMidDistance+biasTopLeftToTargetBottomRightDistance+ currentTopRightToTargetBottomLeftDistance+targetNode.bottomRightDistance+biasTopRightToTargetMidDistance+targetNode.midDistance)/7; targetNode.biasShortestDistance = @@ -602,11 +603,11 @@ currentTopRightToTargetBottomLeftDistance, biasTopRightToTargetMidDistance, targetNode.bottomRightDistance, currentMidToTargetBottomLeftDistance, targetNode.midDistance, biasMidToTargetBottomRightDistance); - targetNode.shortestDistance = + targetNode.shortestDistance = findMin9(targetNode.bottomLeftDistance, currentTopLeftToTargetMidDistance, currentTopLeftToTargetBottomRightDistance, currentTopRightToTargetBottomLeftDistance, currentTopRightToTargetMidDistance, currentTopRightToTargetBottomRightDistance, currentMidToTargetBottomLeftDistance, currentMidToTargetMidDistance, currentMidToTargetBottomRightDistance); - + /* ** closest biased : simple 2d */ @@ -672,7 +673,7 @@ if (nearestNodeAverageUp == null || nearestNodeAverageUp.averageDistance > targetNode.averageDistance) { if (((originB.getMinX() >= currentB.getMinX()) && (targetBounds.getMinX() >= currentB.getMinX())) || ((originB.getMinX() <= currentB.getMinX()) && (targetBounds.getMinX() <= currentB.getMinX()))) { - + if (nearestNodeAverageUp == null) { nearestNodeAverageUp = new TargetNode(); } @@ -724,7 +725,7 @@ nearestNodeAnythingAnywhereUp.originTopLeftDistance = originTopLeft2D.distance(nearestNodeAnythingAnywhereUp.bounds.getMinX(), nearestNodeAnythingAnywhereUp.bounds.getMaxY()); } - if (focusLogger.isLoggable(PlatformLogger.FINER)) { + if (focusLogger.isLoggable(Level.FINER)) { if (reversingTargetNode != null) { focusLogger.finer("reversingTargetNode.node : "+reversingTargetNode.node); } @@ -797,7 +798,7 @@ } } } - + } else { if (nearestNodeOnOriginX == null && nearestNodeOnCurrentX == null && nearestNodeCurrentSimple2D != null) { @@ -858,7 +859,7 @@ } /* ** There isn't a clear winner, just go to the one nearest the current - ** focus owner, or if invalid then try the other contenders. + ** focus owner, or if invalid then try the other contenders. */ if (nearestNodeOnOriginX != null) { return nearestNodeOnOriginX.node; @@ -883,7 +884,7 @@ protected Node getNearestNodeDown(Bounds currentB, Bounds originB, TraversalEngine engine, Node node, Node reversingNode) { - + List nodes = engine.getAllTargetNodes(); Bounds biasedB = new BoundingBox(originB.getMinX(), currentB.getMinY(), originB.getWidth(), currentB.getHeight()); @@ -958,17 +959,17 @@ double biasBottomRightToTargetMidDistance = currentBottomRight2D.distance(targetBounds.getMinX()+(originB.getWidth()/2), targetBounds.getMinY()); double biasMidToTargetTopRightDistance = currentMid2D.distance(originB.getMaxX(), targetBounds.getMinY()); - reversingTargetNode.averageDistance = - (reversingTargetNode.topLeftDistance+biasBottomLeftToTargetMidDistance+biasBottomLeftToTargetTopRightDistance+ + reversingTargetNode.averageDistance = + (reversingTargetNode.topLeftDistance+biasBottomLeftToTargetMidDistance+biasBottomLeftToTargetTopRightDistance+ currentBottomRightToTargetTopLeftDistance+reversingTargetNode.topRightDistance+biasBottomRightToTargetMidDistance+reversingTargetNode.midDistance)/7; - reversingTargetNode.biasShortestDistance = - findMin9(reversingTargetNode.topLeftDistance, biasBottomLeftToTargetMidDistance, biasBottomLeftToTargetTopRightDistance, + reversingTargetNode.biasShortestDistance = + findMin9(reversingTargetNode.topLeftDistance, biasBottomLeftToTargetMidDistance, biasBottomLeftToTargetTopRightDistance, currentBottomRightToTargetTopLeftDistance, biasBottomRightToTargetMidDistance, reversingTargetNode.topRightDistance, currentMidToTargetTopLeftDistance, reversingTargetNode.midDistance, biasMidToTargetTopRightDistance); - reversingTargetNode.shortestDistance = - findMin9(reversingTargetNode.topLeftDistance, currentBottomLeftToTargetMidDistance, currentBottomLeftToTargetTopRightDistance, + reversingTargetNode.shortestDistance = + findMin9(reversingTargetNode.topLeftDistance, currentBottomLeftToTargetMidDistance, currentBottomLeftToTargetTopRightDistance, currentBottomRightToTargetTopLeftDistance, currentBottomRightToTargetMidDistance, currentBottomRightToTargetTopRightDistance, currentMidToTargetTopLeftDistance, currentMidToTargetMidDistance, currentMidToTargetTopRightDistance); @@ -978,9 +979,9 @@ Bounds targetBounds = nodes.get(nodeIndex).localToScene(nodes.get(nodeIndex).getLayoutBounds()); /* - ** check that the target node starts after we start target.minX > origin.minX + ** check that the target node starts after we start target.minX > origin.minX ** and the target node ends after we end target.maxX > origin.maxX - */ + */ if ((currentB.getMaxY() < targetBounds.getMinY())) { targetNode.node = nodes.get(nodeIndex); @@ -1030,16 +1031,16 @@ double biasMidToTargetTopRightDistance = currentMid2D.distance(originB.getMaxX(), targetBounds.getMinY()); targetNode.averageDistance = - (targetNode.topLeftDistance+biasBottomLeftToTargetMidDistance+biasBottomLeftToTargetTopRightDistance+ + (targetNode.topLeftDistance+biasBottomLeftToTargetMidDistance+biasBottomLeftToTargetTopRightDistance+ currentBottomRightToTargetTopLeftDistance+targetNode.topRightDistance+biasBottomRightToTargetMidDistance+targetNode.midDistance)/7; - targetNode.biasShortestDistance = - findMin9(targetNode.topLeftDistance, biasBottomLeftToTargetMidDistance, biasBottomLeftToTargetTopRightDistance, + targetNode.biasShortestDistance = + findMin9(targetNode.topLeftDistance, biasBottomLeftToTargetMidDistance, biasBottomLeftToTargetTopRightDistance, currentBottomRightToTargetTopLeftDistance, biasBottomRightToTargetMidDistance, targetNode.topRightDistance, currentMidToTargetTopLeftDistance, targetNode.midDistance, biasMidToTargetTopRightDistance); - targetNode.shortestDistance = - findMin9(targetNode.topLeftDistance, currentBottomLeftToTargetMidDistance, currentBottomLeftToTargetTopRightDistance, + targetNode.shortestDistance = + findMin9(targetNode.topLeftDistance, currentBottomLeftToTargetMidDistance, currentBottomLeftToTargetTopRightDistance, currentBottomRightToTargetTopLeftDistance, currentBottomRightToTargetMidDistance, currentBottomRightToTargetTopRightDistance, currentMidToTargetTopLeftDistance, currentMidToTargetMidDistance, currentMidToTargetTopRightDistance); @@ -1073,7 +1074,7 @@ */ if ((originB.getMaxX() > targetBounds.getMinX()) && (targetBounds.getMaxX() > originB.getMinX())) { if (nearestNodeOnOriginX == null || nearestNodeOnOriginX.biasShortestDistance > targetNode.biasShortestDistance) { - + if (nearestNodeOnOriginX == null) { nearestNodeOnOriginX = new TargetNode(); } @@ -1153,7 +1154,7 @@ nearestNodeAnythingAnywhereDown.originBottomLeftDistance = originBottomLeft2D.distance(nearestNodeAnythingAnywhereDown.bounds.getMinX(), nearestNodeAnythingAnywhereDown.bounds.getMinY()); } - if (focusLogger.isLoggable(PlatformLogger.FINER)) { + if (focusLogger.isLoggable(Level.FINER)) { if (reversingTargetNode != null) { focusLogger.finer("reversingTargetNode.node : "+reversingTargetNode.node); } @@ -1277,13 +1278,13 @@ (nearestNodeCurrentSimple2D.node == nearestNodeAnythingAnywhereDown.node)) { return nearestNodeCurrentSimple2D.node; } - + if (nearestNodeOnOriginX != null && (nearestNodeOnCurrentX == null || (nearestNodeOnOriginX.topRightDistance < nearestNodeOnCurrentX.topRightDistance))) { return nearestNodeOnOriginX.node; } /* ** There isn't a clear winner, just go to the one nearest the current - ** focus owner, or if invalid then try the other contenders. + ** focus owner, or if invalid then try the other contenders. */ if (nearestNodeOnOriginX != null) { return nearestNodeOnOriginX.node; @@ -1307,7 +1308,7 @@ } protected Node getNearestNodeLeft(Bounds currentB, Bounds originB, TraversalEngine engine, Node node, Node reversingNode) { - + List nodes = engine.getAllTargetNodes(); Bounds biasedB = new BoundingBox(currentB.getMinX(), originB.getMinY(), currentB.getWidth(), originB.getHeight()); @@ -1381,7 +1382,7 @@ double biasBottomLeftToTargetMidDistance = currentBottomLeft2D.distance(targetBounds.getMaxX(), targetBounds.getMinY()+(originB.getHeight()/2)); double biasMidToTargetBottomRightDistance = currentMid2D.distance(originB.getMaxX(), targetBounds.getMaxY()); - reversingTargetNode.averageDistance = + reversingTargetNode.averageDistance = (reversingTargetNode.topRightDistance+biasTopLeftToTargetBottomRightDistance+biasTopLeftToTargetMidDistance+ currentBottomLeftToTargetTopRightDistance+reversingTargetNode.bottomRightDistance+biasBottomLeftToTargetMidDistance)/7; @@ -1399,9 +1400,9 @@ Bounds targetBounds = nodes.get(nodeIndex).localToScene(nodes.get(nodeIndex).getLayoutBounds()); /* - ** check that the target node starts after we start target.minX > origin.minX + ** check that the target node starts after we start target.minX > origin.minX ** and the target node ends after we end target.maxX > origin.maxX - */ + */ if (currentB.getMinX() > targetBounds.getMinX()) { targetNode.node = nodes.get(nodeIndex); @@ -1454,17 +1455,17 @@ (targetNode.topRightDistance+biasTopLeftToTargetBottomRightDistance+biasTopLeftToTargetMidDistance+ currentBottomLeftToTargetTopRightDistance+targetNode.bottomRightDistance+biasBottomLeftToTargetMidDistance)/7; - targetNode.biasShortestDistance = + targetNode.biasShortestDistance = findMin9(targetNode.topRightDistance, biasTopLeftToTargetBottomRightDistance, biasTopLeftToTargetMidDistance, currentBottomLeftToTargetTopRightDistance, targetNode.bottomRightDistance, biasBottomLeftToTargetMidDistance, currentMidToTargetTopRightDistance, biasMidToTargetBottomRightDistance, targetNode.midDistance); - targetNode.shortestDistance = + targetNode.shortestDistance = findMin9(targetNode.topRightDistance, currentTopLeftToTargetBottomRightDistance, currentTopLeftToTargetMidDistance, currentBottomLeftToTargetTopRightDistance, currentBottomLeftToTargetBottomRightDistance, currentBottomLeftToTargetMidDistance, currentMidToTargetTopRightDistance, currentMidToTargetBottomRightDistance, currentMidToTargetMidDistance); - + /* ** closest biased : simple 2d */ @@ -1523,9 +1524,9 @@ } nearestNodeTopLeft.copy(targetNode); } - + if (nearestNodeAverageLeft == null || nearestNodeAverageLeft.averageDistance > targetNode.averageDistance) { - + if (nearestNodeAverageLeft == null) { nearestNodeAverageLeft = new TargetNode(); } @@ -1576,7 +1577,7 @@ traversalNodeStack.clear(); } - if (focusLogger.isLoggable(PlatformLogger.FINER)) { + if (focusLogger.isLoggable(Level.FINER)) { if (reversingTargetNode != null) { focusLogger.finer("reversingTargetNode.node : "+reversingTargetNode.node); } @@ -1638,7 +1639,7 @@ } if (nearestNodeOnCurrentY != null && nearestNodeOnCurrentY.biasShortestDistance < Double.MAX_VALUE) { - if (nearestNodeOnOriginY == null || + if (nearestNodeOnOriginY == null || (nearestNodeOnCurrentY.bottomRightDistance < nearestNodeOnOriginY.bottomRightDistance) && (nearestNodeOnCurrentY.originTopRightDistance < nearestNodeOnOriginY.originTopRightDistance) && (nearestNodeOnCurrentY.bounds.getMinY() - currentTopLeft2D.getY()) < (nearestNodeOnOriginY.bounds.getMinY() - currentTopLeft2D.getY()) ) { @@ -1664,7 +1665,7 @@ nearestNodeAverageLeft.biasShortestDistance == nearestNodeTopLeft.biasShortestDistance && nearestNodeAverageLeft.biasShortestDistance == nearestNodeAnythingAnywhereLeft.biasShortestDistance && nearestNodeAverageLeft.biasShortestDistance < Double.MAX_VALUE) { - + if (nearestNodeOnOriginY != null && nearestNodeOnOriginY.originTopRightDistance < nearestNodeAverageLeft.originTopRightDistance) { return nearestNodeOnOriginY.node; } @@ -1714,7 +1715,7 @@ } /* ** There isn't a clear winner, just go to the one nearest the current - ** focus owner, or if invalid then try the other contenders. + ** focus owner, or if invalid then try the other contenders. */ if (nearestNodeOnOriginY != null) { return nearestNodeOnOriginY.node; @@ -1738,7 +1739,7 @@ } protected Node getNearestNodeRight(Bounds currentB, Bounds originB, TraversalEngine engine, Node node, Node reversingNode) { - + List nodes = engine.getAllTargetNodes(); Bounds biasedB = new BoundingBox(currentB.getMinX(), originB.getMinY(), currentB.getWidth(), originB.getHeight()); @@ -1797,7 +1798,7 @@ reversingTargetNode.topLeftDistance = currentTopRight2D.distance(targetBounds.getMinX(), targetBounds.getMinY()); reversingTargetNode.midDistance = currentMid2D.distance(targetBounds.getMinX(), targetBounds.getMinY()+(originB.getHeight()/2)); reversingTargetNode.bottomLeftDistance = currentBottomRight2D.distance(originB.getMinX(), targetBounds.getMaxY()); - + double currentTopRightToTargetBottomLeftDistance = currentTopRight2D.distance(targetBounds.getMinX(), targetBounds.getMaxY()); double currentTopRightToTargetMidDistance = currentTopRight2D.distance(targetBounds.getMinX(), targetBounds.getMinY()+(targetBounds.getHeight()/2)); double currentBottomRightToTargetTopLeftDistance = currentBottomRight2D.distance(targetBounds.getMinX(), targetBounds.getMinY()); @@ -1812,12 +1813,12 @@ double biasBottomRightToTargetMidDistance = currentBottomRight2D.distance(targetBounds.getMinX(), targetBounds.getMinY()+(originB.getHeight()/2)); double biasMidToTargetBottomLeftDistance = currentMid2D.distance(originB.getMinX(), targetBounds.getMaxY()); - reversingTargetNode.averageDistance = + reversingTargetNode.averageDistance = (reversingTargetNode.topLeftDistance+biasTopRightToTargetBottomLeftDistance+biasTopRightToTargetMidDistance+ currentBottomRightToTargetTopLeftDistance+reversingTargetNode.bottomLeftDistance+biasBottomRightToTargetMidDistance)/7; - - - reversingTargetNode.biasShortestDistance = + + + reversingTargetNode.biasShortestDistance = findMin9(reversingTargetNode.topLeftDistance, biasTopRightToTargetBottomLeftDistance, biasTopRightToTargetMidDistance, currentBottomRightToTargetTopLeftDistance, reversingTargetNode.bottomLeftDistance, biasBottomRightToTargetMidDistance, currentMidToTargetTopLeftDistance, biasMidToTargetBottomLeftDistance, reversingTargetNode.midDistance); @@ -1833,9 +1834,9 @@ Bounds targetBounds = nodes.get(nodeIndex).localToScene(nodes.get(nodeIndex).getLayoutBounds()); /* - ** check that the target node starts after we start target.minX > origin.minX + ** check that the target node starts after we start target.minX > origin.minX ** and the target node ends after we end target.maxX > origin.maxX - */ + */ if (currentB.getMaxX() < targetBounds.getMaxX()) { targetNode.node = nodes.get(nodeIndex); @@ -1884,20 +1885,20 @@ double biasBottomRightToTargetMidDistance = currentBottomRight2D.distance(targetBounds.getMinX(), targetBounds.getMinY()+(originB.getHeight()/2)); double biasMidToTargetBottomLeftDistance = currentMid2D.distance(originB.getMinX(), targetBounds.getMaxY()); - targetNode.averageDistance = + targetNode.averageDistance = (targetNode.topLeftDistance+biasTopRightToTargetBottomLeftDistance+biasTopRightToTargetMidDistance+ currentBottomRightToTargetTopLeftDistance+targetNode.bottomLeftDistance+biasBottomRightToTargetMidDistance)/7; - targetNode.biasShortestDistance = + targetNode.biasShortestDistance = findMin9(targetNode.topLeftDistance, biasTopRightToTargetBottomLeftDistance, biasTopRightToTargetMidDistance, currentBottomRightToTargetTopLeftDistance, targetNode.bottomLeftDistance, biasBottomRightToTargetMidDistance, currentMidToTargetTopLeftDistance, biasMidToTargetBottomLeftDistance, targetNode.midDistance); - targetNode.shortestDistance = + targetNode.shortestDistance = findMin9(targetNode.topLeftDistance, currentTopRightToTargetBottomLeftDistance, currentTopRightToTargetMidDistance, currentBottomRightToTargetTopLeftDistance, currentBottomRightToTargetBottomLeftDistance, currentBottomRightToTargetMidDistance, currentMidToTargetTopLeftDistance, currentMidToTargetBottomLeftDistance, currentMidToTargetMidDistance); - + /* ** closest biased : simple 2d @@ -1928,7 +1929,7 @@ */ if ((originB.getMaxY() > targetBounds.getMinY()) && (targetBounds.getMaxY() > originB.getMinY())) { if (nearestNodeOnOriginY == null || nearestNodeOnOriginY.topLeftDistance > targetNode.topLeftDistance) { - + if (nearestNodeOnOriginY == null) { nearestNodeOnOriginY = new TargetNode(); } @@ -2008,7 +2009,7 @@ traversalNodeStack.clear(); } - if (focusLogger.isLoggable(PlatformLogger.FINER)) { + if (focusLogger.isLoggable(Level.FINER)) { if (reversingTargetNode != null) { focusLogger.finer("reversingTargetNode.node : "+reversingTargetNode.node); } @@ -2069,7 +2070,7 @@ } if (nearestNodeOnCurrentY != null && nearestNodeOnCurrentY.biasShortestDistance < Double.MAX_VALUE) { - if (nearestNodeOnOriginY == null || + if (nearestNodeOnOriginY == null || (nearestNodeOnCurrentY.topLeftDistance < nearestNodeOnOriginY.topLeftDistance) && (nearestNodeOnCurrentY.originTopLeftDistance < nearestNodeOnOriginY.originTopLeftDistance) && (nearestNodeOnCurrentY.bounds.getMinY() - currentTopRight2D.getY()) < (nearestNodeOnOriginY.bounds.getMinY() - currentTopRight2D.getY()) ) { @@ -2103,7 +2104,7 @@ return nearestNodeAverageRight.node; } } - } + } /* ** is the average closer? */ @@ -2142,7 +2143,7 @@ } /* ** There isn't a clear winner, just go to the one nearest the current - ** focus owner, or if invalid then try the other contenders. + ** focus owner, or if invalid then try the other contenders. */ if (nearestNodeOnOriginY != null) { return nearestNodeOnOriginY.node; @@ -2186,7 +2187,7 @@ double originTopRightDistance = Double.MAX_VALUE; double originBottomLeftDistance = Double.MAX_VALUE; double originBottomRightDistance = Double.MAX_VALUE; - + void copy(TargetNode source) { node = source.node; bounds = source.bounds; --- old/javafx-ui-common/src/com/sun/javafx/scene/traversal/TraversalEngine.java 2013-06-07 09:30:29.000000000 -0700 +++ new/javafx-ui-common/src/com/sun/javafx/scene/traversal/TraversalEngine.java 2013-06-07 09:30:29.000000000 -0700 @@ -40,22 +40,22 @@ import com.sun.javafx.Logging; import com.sun.javafx.application.PlatformImpl; import sun.util.logging.PlatformLogger; -import com.sun.javafx.PlatformUtil; +import sun.util.logging.PlatformLogger.Level; public class TraversalEngine { - + private final Algorithm algorithm; - + private final Parent root; - + private final boolean isScene; - + private final Bounds initialBounds; - + public final List registeredNodes; - + private final List listeners; - + PlatformLogger focusLogger; protected boolean isScene() { @@ -64,7 +64,7 @@ protected Parent getRoot() { return root; } - + public TraversalEngine(Parent root, boolean isScene) { this.root = root; this.isScene = isScene; @@ -82,24 +82,24 @@ else { algorithm = new ContainerTabOrder(); } - + initialBounds = new BoundingBox(0, 0, 1, 1); registeredNodes = new ArrayList(); - listeners = new LinkedList(); + listeners = new LinkedList(); focusLogger = Logging.getFocusLogger(); - if (focusLogger.isLoggable(PlatformLogger.FINER)) { + if (focusLogger.isLoggable(Level.FINER)) { focusLogger.finer("TraversalEngine constructor"); } } - + public void addTraverseListener(TraverseListener listener) { listeners.add(listener); } - + public void removeTraverseListener(TraverseListener listener) { listeners.remove(listener); } - + public void reg(Node n) { registeredNodes.add(n); } @@ -112,11 +112,11 @@ Node newNode = algorithm.traverse(owner, dir, this); if (newNode == null) { - if (focusLogger.isLoggable(PlatformLogger.FINE)) { + if (focusLogger.isLoggable(Level.FINE)) { focusLogger.fine("new node is null, focus not moved"); } } else { - if (focusLogger.isLoggable(PlatformLogger.FINER)) { + if (focusLogger.isLoggable(Level.FINER)) { focusLogger.finer("new focus owner : "+newNode); } newNode.requestFocus(); @@ -124,7 +124,7 @@ listener.onTraverse(newNode, getBounds(newNode)); } } - } + } public int getTopLeftFocusableNode() { List nodes = getAllTargetNodes(); @@ -138,8 +138,8 @@ double distance; for (nodeIndex = 1; nodeIndex < nodes.size(); nodeIndex++) { - - if (focusLogger.isLoggable(PlatformLogger.FINEST)) { + + if (focusLogger.isLoggable(Level.FINEST)) { focusLogger.finest("getTopLeftFocusableNode(), distance : "+zeroZero.distance(getBounds(nodes.get(nodeIndex)).getMinX(), getBounds(nodes.get(nodeIndex)).getMinY())+" to : "+nodes.get(nodeIndex)+". @ : "+getBounds(nodes.get(nodeIndex)).getMinX()+":"+getBounds(nodes.get(nodeIndex)).getMinY()); } distance = zeroZero.distance(getBounds(nodes.get(nodeIndex)).getMinX(), getBounds(nodes.get(nodeIndex)).getMinY()); @@ -149,7 +149,7 @@ } } - if (focusLogger.isLoggable(PlatformLogger.FINER)) { + if (focusLogger.isLoggable(Level.FINER)) { focusLogger.finer("getTopLeftFocusableNode(), nearest : "+nearestNode+", at : "+nearestDistance); } @@ -173,7 +173,7 @@ ** get top level container */ Scene s = root.getScene(); - + addFocusableChildrenToList(targetNodes, s.getRoot()); return targetNodes; } @@ -181,7 +181,7 @@ List parentsNodes = parent.getChildrenUnmodifiable(); for (Node n : parentsNodes) { if (n.isFocusTraversable() && !n.isFocused() && n.impl_isTreeVisible() && !n.isDisabled()) { - + list.add(n); } if (n instanceof Parent) { @@ -213,7 +213,7 @@ } return targetBounds; } - + /** * Gets the appropriate bounds for the given node, transformed into * the scene's or the traversal root's coordinates. @@ -228,7 +228,7 @@ } } else { bounds = initialBounds; - } + } return bounds; } } --- old/javafx-ui-common/src/com/sun/javafx/scene/traversal/WeightedClosestCorner.java 2013-06-07 09:30:31.000000000 -0700 +++ new/javafx-ui-common/src/com/sun/javafx/scene/traversal/WeightedClosestCorner.java 2013-06-07 09:30:30.000000000 -0700 @@ -30,6 +30,7 @@ import javafx.scene.Node; import com.sun.javafx.Logging; import sun.util.logging.PlatformLogger; +import sun.util.logging.PlatformLogger.Level; import static com.sun.javafx.scene.traversal.Direction.*; @@ -168,19 +169,19 @@ List nodes = engine.getAllTargetNodes(); List bounds = engine.getTargetBounds(nodes); - if (focusLogger.isLoggable(PlatformLogger.FINER)) { + if (focusLogger.isLoggable(Level.FINER)) { focusLogger.finer("old focus owner : "+node+", bounds : "+engine.getBounds(node)); } - + int target = traverse(engine.getBounds(node), dir, bounds); if (target != -1) { newNode = nodes.get(target); - if (focusLogger.isLoggable(PlatformLogger.FINER)) { + if (focusLogger.isLoggable(Level.FINER)) { focusLogger.finer("new focus owner : "+newNode+", bounds : "+engine.getBounds(newNode)); } } else { - if (focusLogger.isLoggable(PlatformLogger.FINER)) { + if (focusLogger.isLoggable(Level.FINER)) { focusLogger.finer("no focus transfer"); } } --- old/javafx-ui-common/src/javafx/scene/CssStyleHelper.java 2013-06-07 09:30:32.000000000 -0700 +++ new/javafx-ui-common/src/javafx/scene/CssStyleHelper.java 2013-06-07 09:30:32.000000000 -0700 @@ -69,6 +69,7 @@ import javafx.scene.text.FontWeight; import javafx.stage.Window; import sun.util.logging.PlatformLogger; +import sun.util.logging.PlatformLogger.Level; /** * The StyleHelper is a helper class used for applying CSS information to Nodes. @@ -77,10 +78,10 @@ private static final PlatformLogger LOGGER = com.sun.javafx.Logging.getCSSLogger(); - private CssStyleHelper() { + private CssStyleHelper() { this.triggerStates = new PseudoClassState(); } - + /** * Creates a new StyleHelper. */ @@ -102,7 +103,7 @@ depth++; parent = parent.getStyleableParent(); } - + // The List should only contain entries for those // pseudo-class states that have styles. The StyleHelper's // pseudoclassStateMask is a bitmask of those pseudoclasses that @@ -113,44 +114,44 @@ // pseudo-class states that apply, a CacheEntry can be created or // fetched using only those pseudoclasses that matter. final PseudoClassState[] triggerStates = new PseudoClassState[depth]; - - final StyleMap styleMap = + + final StyleMap styleMap = StyleManager.getInstance().findMatchingStyles(node, triggerStates); - - final Map> smap + + final Map> smap = styleMap != null ? styleMap.getMap() : null; - + if (smap == null || smap.isEmpty()) { - + // If there are no styles at all, and no styles that inherit, then return final String inlineStyle = node.getStyle(); if (inlineStyle == null || inlineStyle.trim().isEmpty()) { - + boolean mightInherit = false; final List> props = node.getCssMetaData(); - + final int pMax = props != null ? props.size() : 0; for (int p=0; p prop = props.get(p); if (prop.isInherits()) { mightInherit = true; break; } } - + if (mightInherit == false) { return null; } } - } - + } + final CssStyleHelper helper = new CssStyleHelper(); - + helper.triggerStates.addAll(triggerStates[0]); - // make sure parent's transition states include the pseudo-classes + // make sure parent's transition states include the pseudo-classes // found when matching selectors parent = node.getStyleableParent(); for(int n=1; n 0) { - // Create a StyleHelper for the parent, if necessary. + // Create a StyleHelper for the parent, if necessary. if (parentNode.styleHelper == null) { parentNode.styleHelper = new CssStyleHelper(); } parentNode.styleHelper.triggerStates.addAll(triggerState); - - } - + + } + parent=parent.getStyleableParent(); - } - + } + helper.cacheContainer = new CacheContainer(node, styleMap, depth); return helper; } - + private CacheContainer cacheContainer; - + private final static class CacheContainer { // Set internal internalState structures @@ -196,7 +197,7 @@ int ctr = 0; int[] smapIds = new int[depth]; smapIds[ctr++] = this.smapId = styleMap.getId(); - + // // Create a set of StyleMap id's from the parent's smapIds. // The resulting smapIds array may have less than depth elements. @@ -218,31 +219,31 @@ } } parent = parent.getStyleableParent(); - + } this.localStyleCache = new StyleCache(); - - final Map styleCache = + + final Map styleCache = StyleManager.getInstance().getStyleCache(node.getScene()); - + final StyleCache.Key styleCacheKey = new StyleCache.Key(smapIds, ctr); StyleCache sharedCache = styleCache.get(styleCacheKey); - + if (sharedCache == null) { sharedCache = new StyleCache(); styleCache.put(styleCacheKey, sharedCache); } this.sharedCacheRef = new WeakReference(sharedCache); - + CssMetaData styleableFontProperty = null; - + final List> props = node.getCssMetaData(); final int pMax = props != null ? props.size() : 0; for (int p=0; p prop = props.get(p); - + if ("-fx-font".equals(prop.getProperty())) { // unchecked! styleableFontProperty = (CssMetaData) prop; @@ -253,7 +254,7 @@ this.fontProp = styleableFontProperty; this.cssSetProperties = new HashMap(); - + } private StyleMap getStyleMap(Styleable styleable) { @@ -273,14 +274,14 @@ } } - + private final CssMetaData fontProp; private final int smapId; private final StyleCache localStyleCache; private final Reference sharedCacheRef; private Map cssSetProperties; } - + // // Find the entry in local cache and in the shared cache that matches the // states. Whether or not this is a newly created StyleCacheEntry is returned @@ -288,7 +289,7 @@ private StyleCacheEntry.Key getStyleCacheEntryKey(Node node, Set[] transitionStates) { if (cacheContainer == null) return null; - + // // StyleHelper#triggerStates is the set of pseudo-classes that appear // in the style maps of this StyleHelper. Calculated values are @@ -301,7 +302,7 @@ // but the transtion state could be [hover, focused] // final Set[] pclassMask = new PseudoClassState[transitionStates.length]; - + int count = 0; int depth = 0; Node parent = node; @@ -325,35 +326,35 @@ void inlineStyleChanged(Node node) { - // Clear local cache so styles will be recalculated. - // Since we're clearing the cache and getting (potentially) + // Clear local cache so styles will be recalculated. + // Since we're clearing the cache and getting (potentially) // new styles, reset the properties to initial values. if (cacheContainer != null) { - + cacheContainer.localStyleCache.clear(); - + // do we have any styles at all now? final String inlineStyle = node.getStyle(); if(inlineStyle == null || inlineStyle.isEmpty()) { - final Map> smap = getStyleMap(node); + final Map> smap = getStyleMap(node); if (smap == null || smap.isEmpty()) { // We have no styles! Reset this StyleHelper to its - // initial state so that calls to transitionToState + // initial state so that calls to transitionToState // become a no-op. cacheContainer = null; resetToInitialValues(node); } - + // If smap isn't empty, then there are styles that // apply to the node. There isn't a need to remap the styles // since we've only removed an inline style and inline styles // aren't part of the style map. } - - - + + + } else { // if cacheContainer was null final String inlineStyle = node.getStyle(); @@ -366,7 +367,7 @@ // style before, then there would be cacheContainer. // But now the node does have an inline style and so it // needs to have an smap and localStyleCache for the logic - // in transitionToState to work. + // in transitionToState to work. Node parent = node; int depth = 0; while(parent != null) { @@ -376,11 +377,11 @@ cacheContainer = new CacheContainer(node, StyleMap.EMPTY_MAP, depth); } - + } - + private void resetToInitialValues(Styleable styleable) { - + final List> metaDataList = styleable.getCssMetaData(); final int nStyleables = metaDataList != null ? metaDataList.size() : 0; for (int n=0; n> getStyleMap(Styleable styleable) { if (cacheContainer == null || styleable == null) return null; StyleMap styleMap = cacheContainer.getStyleMap(styleable); return (styleMap != null) ? styleMap.getMap() : null; } - - /** - * Cache of parsed, inline styles. The key is Node.style. + + /** + * Cache of parsed, inline styles. The key is Node.style. * The value is the set of property styles from parsing Node.style. */ private static final Map> inlineStylesCache = @@ -455,14 +456,14 @@ * Get the mapping of property to style from Node.style for this node. */ private static Map getInlineStyleMap(Styleable styleable) { - + final String inlineStyles = styleable.getStyle(); // If there are no styles for this property then we can just bail if ((inlineStyles == null) || inlineStyles.isEmpty()) return null; Map styles = inlineStylesCache.get(inlineStyles); - + if (styles == null) { Stylesheet inlineStylesheet = @@ -471,13 +472,13 @@ inlineStylesheet.setOrigin(StyleOrigin.INLINE); } styles = getInlineStyleMap(inlineStylesheet); - + inlineStylesCache.put(inlineStyles, styles); } return styles; } - + /** * A Set of all the pseudo-class states which, if they change, need to * cause the Node to be set to UPDATE its CSS styles on the next pulse. @@ -501,57 +502,57 @@ * Called "triggerStates" since they would trigger a CSS update. */ private PseudoClassState triggerStates = new PseudoClassState(); - - boolean pseudoClassStateChanged(PseudoClass pseudoClass) { + + boolean pseudoClassStateChanged(PseudoClass pseudoClass) { return triggerStates.contains(pseudoClass); - } - + } + /** - * dynamic pseudo-class state of the node and its parents. - * Only valid during a pulse. + * dynamic pseudo-class state of the node and its parents. + * Only valid during a pulse. * * The StyleCacheEntry to choose depends on the Node's state and * the state of its parents. Without the parent state, the fact that * the the node in this state matched foo:blah bar { } is lost. * - */ + */ private Set[] getTransitionStates(Node node) { // - // Note Well: The array runs from leaf to root. That is, - // transitionStates[0] is the pseudo-class state for node and - // transitionStates[1..(states.length-1)] are the pseudoclassStates for the + // Note Well: The array runs from leaf to root. That is, + // transitionStates[0] is the pseudo-class state for node and + // transitionStates[1..(states.length-1)] are the pseudoclassStates for the // node's parents. // - + int count = 0; Node parent = node; while (parent != null) { count += 1; parent = parent.getParent(); } - + Set[] states = new PseudoClassState[count]; - + count = 0; parent = node; while (parent != null) { states[count] = parent.pseudoClassStates; count += 1; parent = parent.getParent(); - } - + } + return states; - + } - + ObservableMap, List