changeset 614:fbd9064f3f17 2.1-b17

Automated merge with ssh://jpgodine@jfxsrc.us.oracle.com//javafx/2.1/MASTER/jfx//rt
author jpgodine@JPGODINE-LAP.st-users.us.oracle.com
date Tue, 13 Mar 2012 11:07:39 -0700
parents 8cd620c27662 ccf9358f145b
children 9032a3e166ee 00ac6a9f61c2 b9616909af2e
files
diffstat 22 files changed, 226 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/javafx-ui-common/src/com/sun/javafx/css/Styleable.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/javafx-ui-common/src/com/sun/javafx/css/Styleable.java	Tue Mar 13 11:07:39 2012 -0700
@@ -90,14 +90,14 @@
     
      /**
       * RT-17293
-      * @treatasprivate implementation detail
+      * @treatAsPrivate implementation detail
       * @deprecated This is an experimental API that is not intended for use
       */
      private ObservableMap<WritableValue, List<Style>> styleMap;
      
      /**
       * RT-17293
-      * @treatasprivate implementation detail
+      * @treatAsPrivate implementation detail
       * @deprecated This is an experimental API that is not intended for general use and is subject to change in future versions
       */
      public ObservableMap<WritableValue, List<Style>> getStyleMap() {
@@ -106,7 +106,7 @@
 
      /**
       * RT-17293
-      * @treatasprivate implementation detail
+      * @treatAsPrivate implementation detail
       * @deprecated This is an experimental API that is not intended for general use and is subject to change in future versions
       */
      public void setStyleMap(ObservableMap<WritableValue, List<Style>> styleMap) {
--- a/javafx-ui-common/src/com/sun/javafx/scene/paint/GradientUtils.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/javafx-ui-common/src/com/sun/javafx/scene/paint/GradientUtils.java	Tue Mar 13 11:07:39 2012 -0700
@@ -29,6 +29,14 @@
 
 public class GradientUtils {
 
+    public static String lengthToString(double value, boolean proportional) {
+        if (proportional) {
+            return (value * 100) + "%";
+        } else {
+            return value + "px";
+        }
+    }
+
     public static class Point {
 
         public static Point MIN = new Point(0, true);
--- a/javafx-ui-common/src/com/sun/javafx/tk/DummyToolkit.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/javafx-ui-common/src/com/sun/javafx/tk/DummyToolkit.java	Tue Mar 13 11:07:39 2012 -0700
@@ -234,7 +234,7 @@
     }
 
     @Override
-    public Shape createStrokedShape(Shape shape, StrokeType pgtype, double strokewidth, StrokeLineCap pgcap, StrokeLineJoin pgjoin, float miterLimit) {
+    public Shape createStrokedShape(Shape shape, StrokeType pgtype, double strokewidth, StrokeLineCap pgcap, StrokeLineJoin pgjoin, float miterLimit, float[] dashArray, float dashOffset) {
         throw new UnsupportedOperationException("Not supported yet.");
     }
 
--- a/javafx-ui-common/src/com/sun/javafx/tk/Toolkit.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/javafx-ui-common/src/com/sun/javafx/tk/Toolkit.java	Tue Mar 13 11:07:39 2012 -0700
@@ -590,7 +590,9 @@
                            double strokewidth,
                            PGShape.StrokeLineCap cap,
                            PGShape.StrokeLineJoin join,
-                           float miterLimit);
+                           float miterLimit,
+                           float[] dashArray,
+                           float dashOffset);
 
     public abstract int getKeyCodeForChar(String character);
     public abstract MouseEvent convertMouseEventToFX(Object event);
--- a/javafx-ui-common/src/javafx/scene/Cursor.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/javafx-ui-common/src/javafx/scene/Cursor.java	Tue Mar 13 11:07:39 2012 -0700
@@ -287,6 +287,10 @@
             singleFrame = new StandardCursorFrame(type);
         }
 
+        /**
+         * @treatAsPrivate implementation detail
+         * @deprecated This is an internal API that is not intended for use and will be removed in the next version
+         */
         @Override
         public CursorFrame impl_getCurrentFrame() {
             return singleFrame;
--- a/javafx-ui-common/src/javafx/scene/Parent.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/javafx-ui-common/src/javafx/scene/Parent.java	Tue Mar 13 11:07:39 2012 -0700
@@ -1086,7 +1086,7 @@
      * It is possible to override this method to stop the recursion. This allows
      * a Parent to have a set of stylesheets distinct from its Parent. 
      * 
-     * @treatasprivate implementation detail
+     * @treatAsPrivate implementation detail
      * @deprecated This is an internal API that is not intended for use and will be removed in the next version
      */
     @Deprecated
--- a/javafx-ui-common/src/javafx/scene/effect/Effect.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/javafx-ui-common/src/javafx/scene/effect/Effect.java	Tue Mar 13 11:07:39 2012 -0700
@@ -41,8 +41,7 @@
  * An effect is a graphical algorithm that produces an image, typically
  * as a modification of a source image.
  * An effect can be associated with a scene graph {@code Node} by setting
- * the <a href="../javafx.scene/javafx.scene.Node.html#effect">Node.effect</a>
- * attribute.
+ * the {@link javafx.scene.Node#effectProperty Node.effect} attribute.
  * Some effects change the color properties of the source pixels
  * (such as {@link ColorAdjust}),
  * others combine multiple images together (such as {@link Blend}),
--- a/javafx-ui-common/src/javafx/scene/paint/Color.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/javafx-ui-common/src/javafx/scene/paint/Color.java	Tue Mar 13 11:07:39 2012 -0700
@@ -1562,6 +1562,7 @@
         int r = (int)Math.round(red * 255.0);
         int g = (int)Math.round(green * 255.0);
         int b = (int)Math.round(blue * 255.0);
-        return "Color[red=" + r + ",green=" + g + ",blue=" + b + ",opacity=" + opacity + "]";
+        int o = (int)Math.round(opacity * 255.0);
+        return String.format("0x%02x%02x%02x%02x" , r, g, b, o);
     }
 }
--- a/javafx-ui-common/src/javafx/scene/paint/LinearGradient.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/javafx-ui-common/src/javafx/scene/paint/LinearGradient.java	Tue Mar 13 11:07:39 2012 -0700
@@ -305,19 +305,29 @@
      * @return a string representation of this {@code LinearGradient} object.
      */
     @Override public String toString() {
-        final StringBuilder s = new StringBuilder("LinearGradient[startX=").append(startX)
-                .append(",startY=").append(startY).append(",endX=").append(endX)
-                .append(",endY=").append(endY).append(",proportional=").append(proportional)
-                .append(",cycleMethod=").append(cycleMethod).append(",stops=<");
-        if (stops.isEmpty()) {
-            s.append("empty");
-        } else {
-            for (Stop stop: stops) {
-                s.append(stop).append(",");
-            }
-            s.deleteCharAt(s.length() - 1);
+        final StringBuilder s = new StringBuilder("linear-gradient(from ")
+                .append(GradientUtils.lengthToString(startX, proportional))
+                .append(" ").append(GradientUtils.lengthToString(startY, proportional))
+                .append(" to ").append(GradientUtils.lengthToString(endX, proportional))
+                .append(" ").append(GradientUtils.lengthToString(endY, proportional))
+                .append(", ");
+
+        switch (cycleMethod) {
+            case REFLECT:
+                s.append("reflect").append(", ");
+                break;
+            case REPEAT:
+                s.append("repeat").append(", ");
+                break;
         }
-        s.append(">]");
+
+        for (Stop stop : stops) {
+            s.append(stop).append(", ");
+        }
+
+        s.delete(s.length() - 2, s.length());
+        s.append(")");
+
         return s.toString();
     }
 
--- a/javafx-ui-common/src/javafx/scene/paint/RadialGradient.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/javafx-ui-common/src/javafx/scene/paint/RadialGradient.java	Tue Mar 13 11:07:39 2012 -0700
@@ -322,20 +322,29 @@
      * @return a string representation of this {@code RadialGradient} object.
      */ 
     @Override public String toString() {
-        final StringBuilder s = new StringBuilder("RadialGradient[focusAngle=").append(focusAngle)
-                .append(",focusDistance=").append(focusDistance).append(",centerX=")
-                .append(centerX).append(",centerY=").append(centerY).append(",radius=")
-                .append(radius).append(",proportional=").append(proportional)
-                .append(",cycleMethod=").append(cycleMethod).append(",stops=<");
-        if (stops.isEmpty()) {
-            s.append("empty");
-        } else {
-            for (Stop stop: stops) {
-                s.append(stop).append(",");
-            }
-            s.deleteCharAt(s.length() - 1);
+        final StringBuilder s = new StringBuilder("radial-gradient(focus-angle ").append(focusAngle)
+                .append("deg, focus-distance ").append(focusDistance * 100)
+                .append("% , center ").append(GradientUtils.lengthToString(centerX, proportional))
+                .append(" ").append(GradientUtils.lengthToString(centerY, proportional))
+                .append(", radius ").append(GradientUtils.lengthToString(radius, proportional))
+                .append(", ");                
+
+        switch (cycleMethod) {
+            case REFLECT:
+                s.append("reflect").append(", ");
+                break;
+            case REPEAT:
+                s.append("repeat").append(", ");
+                break;
         }
-        s.append(">]");
+
+        for (Stop stop : stops) {
+            s.append(stop).append(", ");
+        }
+
+        s.delete(s.length() - 2, s.length());
+        s.append(")");
+
         return s.toString();
     }
 
--- a/javafx-ui-common/src/javafx/scene/paint/Stop.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/javafx-ui-common/src/javafx/scene/paint/Stop.java	Tue Mar 13 11:07:39 2012 -0700
@@ -225,6 +225,6 @@
      * @return a string representation of this {@code Stop} object.
      */ 
     @Override public String toString() {
-        return "Stop[offset=" + offset + ",color=" + color + "]";
+        return color + " " + offset*100 + "%";
     }
 }
--- a/javafx-ui-common/src/javafx/scene/shape/Shape.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/javafx-ui-common/src/javafx/scene/shape/Shape.java	Tue Mar 13 11:07:39 2012 -0700
@@ -1622,10 +1622,16 @@
         final float strokeMiterLimit =
                 (float) Utils.clampMin(getStrokeMiterLimit(),
                                        MIN_STROKE_MITER_LIMIT);
+        final float[] dashArray =
+                (hasStrokeDashArray())
+                        ? toPGDashArray(getStrokeDashArray())
+                        : DEFAULT_PG_STROKE_DASH_ARRAY;
+
         final com.sun.javafx.geom.Shape strokeShape =
                 Toolkit.getToolkit().createStrokedShape(
                         fillShape, strokeType, strokeWidth, strokeLineCap,
-                        strokeLineJoin, strokeMiterLimit);
+                        strokeLineJoin, strokeMiterLimit,
+                        dashArray, (float) getStrokeDashOffset());
 
         if (impl_mode == Mode.STROKE) {
             return createTransformedArea(strokeShape, transform);
--- a/javafx-ui-common/src/javafx/stage/Modality.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/javafx-ui-common/src/javafx/stage/Modality.java	Tue Mar 13 11:07:39 2012 -0700
@@ -31,7 +31,8 @@
 public enum Modality {
 
     /**
-     * Defines a top-level window that is not modal.
+     * Defines a top-level window that is not modal and does not block any other
+     * window.
      */
     NONE,
 
--- a/javafx-ui-common/src/javafx/stage/Stage.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/javafx-ui-common/src/javafx/stage/Stage.java	Tue Mar 13 11:07:39 2012 -0700
@@ -60,6 +60,55 @@
  * JavaFX Application Thread.
  * </p>
  *
+ * <p><b>Style</b></p>
+ * <p>
+ * A stage has one of the following styles:
+ * <ul>
+ * <li>{@link StageStyle#DECORATED} - a stage with a solid white background and
+ * platform decorations.</li>
+ * <li>{@link StageStyle#UNDECORATED} - a stage with a solid white background
+ * and no decorations.</li>
+ * <li>{@link StageStyle#TRANSPARENT} - a stage with a transparent background
+ * and no decorations.</li>
+ * <li>{@link StageStyle#UTILITY} - a stage with a solid white background and
+ * minimal platform decorations.</li>
+ * </ul>
+ * The style must be initialized before the stage is made visible.
+ * 
+ * <p><b>Owner</b></p>
+ * <p>
+ * A stage can optionally have an owner Window.
+ * When a window is a stage's owner, it is said to be the parent of that stage.
+ * When a parent window is closed, all its descendant windows are closed. 
+ * The same chained behavior applied for a parent window that is iconified. 
+ * A stage will always be on top of its parent window.
+ * The owner must be initialized before the stage is made visible.
+ *
+ * <p><b>Modality</b></p>
+ * <p>
+ * A stage has one of the following modalities:
+ * <ul>
+ * <li>{@link Modality#NONE} - a stage that does not block any other window.</li>
+ * <li>{@link Modality#WINDOW_MODAL} - a stage that blocks input events from 
+ * being delivered to all windows from its owner (parent) to its root.
+ * Its root is the closest ancestor window without an owner.</li>
+ * <li>{@link Modality#APPLICATION_MODAL} - a stage that blocks input events from 
+ * being delivered to all windows from the same application, except for those
+ * from its child hierarchy.</li>
+ * </ul> 
+ * 
+ * When a window is blocked by a modal stage, it receives no input events, but 
+ * continues to animate and render normally. Note that showing a modal stage does
+ * not block the calling thread. The {@link #show} method returns immediately 
+ * regardless of the modality.
+ * The modality must be initialized before the stage is made visible. 
+ * 
+ * <p>
+ * Many of the {@code Stage} properties are read only because they can
+ * be changed externally by the underlying platform and therefore must
+ * not be bindable.
+ * </p>
+ *
  * <p>Example:</p>
  *
  *
@@ -96,6 +145,7 @@
  * <p>produces the following on Windows Vista:</p>
  * <p><img src="doc-files/Stage0-vista.png"/></p>
  *
+ * 
  */
 public class Stage extends Window {
 
@@ -381,6 +431,10 @@
      * full-screen mode, upon exiting full-screen mode the {@code Stage} will
      * assume those attributes.
      * </p>
+     * <p>
+     * The property is read only because it can be changed externally
+     * by the underlying platform and therefore must not be bindable.
+     * </p>
      *
      * Notes regarding desktop profile implementation.
      * <p>
@@ -532,6 +586,10 @@
 
     /**
      * Defines whether the {@code Stage} is iconified or not.
+     * <p>
+     * The property is read only because it can be changed externally
+     * by the underlying platform and therefore must not be bindable.
+     * </p>
      *
      * @defaultValue false
      */
--- a/javafx-ui-common/src/javafx/stage/Window.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/javafx-ui-common/src/javafx/stage/Window.java	Tue Mar 13 11:07:39 2012 -0700
@@ -271,6 +271,10 @@
      * decorations which may be added by the Operating System such as resizable
      * frame handles. Typical applications will set the {@link javafx.scene.Scene} width
      * instead.
+     * <p>
+     * The property is read only because it can be changed externally
+     * by the underlying platform and therefore must not be bindable.
+     * </p>
      */
     private ReadOnlyDoubleWrapper width =
             new ReadOnlyDoubleWrapper(this, "width", Double.NaN);
@@ -292,6 +296,10 @@
      * {@code fullScreen} becomes false. This value includes any and all
      * decorations which may be added by the Operating System such as the title
      * bar. Typical applications will set the {@link javafx.scene.Scene} height instead.
+     * <p>
+     * The property is read only because it can be changed externally
+     * by the underlying platform and therefore must not be bindable.
+     * </p>
      */
     private ReadOnlyDoubleWrapper height =
             new ReadOnlyDoubleWrapper(this, "height", Double.NaN);
@@ -306,6 +314,10 @@
 
     /**
      * Whether or not this {@code Window} has the keyboard or input focus.
+     * <p>
+     * The property is read only because it can be changed externally
+     * by the underlying platform and therefore must not be bindable.
+     * </p>
      *
      * @profile common
      */
--- a/javafx-ui-common/test/unit/com/sun/javafx/pgstub/StubToolkit.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/javafx-ui-common/test/unit/com/sun/javafx/pgstub/StubToolkit.java	Tue Mar 13 11:07:39 2012 -0700
@@ -322,7 +322,9 @@
                                     double strokewidth,
                                     StrokeLineCap pgcap,
                                     StrokeLineJoin pgjoin,
-                                    float miterLimit) {
+                                    float miterLimit,
+                                    float[] dashArray,
+                                    float dashOffset) {
         initStroke(pgtype, strokewidth, pgcap, pgjoin, miterLimit);
         return tmpStroke.createStrokedShape(shape);
     }
--- a/javafx-ui-common/test/unit/javafx/scene/paint/ColorTest.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/javafx-ui-common/test/unit/javafx/scene/paint/ColorTest.java	Tue Mar 13 11:07:39 2012 -0700
@@ -630,6 +630,36 @@
         assertFalse(s.isEmpty());
     }
 
+    @Test
+    public void testToStringEquals() {
+        Color color = Color.web("#aabbcc");
+        assertEquals(color, Color.valueOf(color.toString()));
+        color = Color.web("#abc");
+        assertEquals(color, Color.valueOf(color.toString()));
+        color = Color.web("#aabbcc80", 0.5);
+        assertEquals(color, Color.valueOf(color.toString()));
+        color = Color.web("0xaabbcc");
+        assertEquals(color, Color.valueOf(color.toString()));
+        color = Color.web("0xaabbcc80");
+        assertEquals(color, Color.valueOf(color.toString()));
+        color = Color.web("orangered");
+        assertEquals(color, Color.valueOf(color.toString()));
+        color = Color.web("orangered", 0.4);
+        assertEquals(color, Color.valueOf(color.toString()));
+        color = Color.web("oRAngEReD");
+        assertEquals(color, Color.valueOf(color.toString()));
+        color = Color.web("0xaabbcc");
+        assertEquals(color, Color.valueOf(color.toString()));
+        color = Color.web("0xabc");
+        assertEquals(color, Color.valueOf(color.toString()));
+        color = Color.web("aAbBcC");
+        assertEquals(color, Color.valueOf(color.toString()));
+        color = Color.web("aBc");
+        assertEquals(color, Color.valueOf(color.toString()));
+        color = Color.web("aBc9");
+        assertEquals(color, Color.valueOf(color.toString()));
+    }
+
     //function testOfTheWayHandlesNegatives() {
         // TODO should this be tested? What does it mean?
     //}
--- a/javafx-ui-common/test/unit/javafx/scene/paint/LinearGradientTest.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/javafx-ui-common/test/unit/javafx/scene/paint/LinearGradientTest.java	Tue Mar 13 11:07:39 2012 -0700
@@ -156,6 +156,22 @@
         assertNotNull(s);
         assertFalse(s.isEmpty());
     }
+    
+    @Test
+    public void testToStringEquals() {
+        LinearGradient lg =
+                LinearGradient.valueOf("linear-gradient(from 0% 0% to 100% 100%, red  0% , blue 30%,  black 100%)");
+        assertEquals(lg, LinearGradient.valueOf(lg.toString()));
+        
+        lg = LinearGradient.valueOf("linear-gradient(from 100px 0 to 200px 0px, red 0px, blue 50px,  black 100px)");        
+        assertEquals(lg, LinearGradient.valueOf(lg.toString()));
+
+        lg = LinearGradient.valueOf("linear-gradient(to top, red  0%, blue  30%,black 100%)");
+        assertEquals(lg, LinearGradient.valueOf(lg.toString()));
+        
+        lg = LinearGradient.valueOf("linear-gradient(from 10% 20% to 30% 40%, ff00ff 0%, 0xffffff 30%,black 100%)");
+        assertEquals(lg, LinearGradient.valueOf(lg.toString()));
+    }
 
     @Test
     public void testImpl_getPlatformPaint() {
--- a/javafx-ui-common/test/unit/javafx/scene/paint/RadialGradientTest.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/javafx-ui-common/test/unit/javafx/scene/paint/RadialGradientTest.java	Tue Mar 13 11:07:39 2012 -0700
@@ -160,6 +160,22 @@
         assertNotNull(s);
         assertFalse(s.isEmpty());
     }
+    
+    @Test
+    public void testToStringEquals() {
+        RadialGradient rg =
+            RadialGradient.valueOf("radial-gradient(radius 100%, red  0% , blue 30%,  black 100%)");
+        assertEquals(rg, RadialGradient.valueOf(rg.toString()));
+
+        rg = RadialGradient.valueOf("radial-gradient(center 10px 10, radius 100, red 0px, blue 50px,  black 100px)");
+        assertEquals(rg, RadialGradient.valueOf(rg.toString()));
+        
+        rg = RadialGradient.valueOf("radial-gradient(radius 10%, red  0%, blue 30%, black 100%)");
+        assertEquals(rg, RadialGradient.valueOf(rg.toString()));
+        
+        rg = RadialGradient.valueOf("radial-gradient(focus-angle 3.1415926535rad, radius 10%, red  0%, blue 30%, black 100%)");
+        assertEquals(rg, RadialGradient.valueOf(rg.toString()));
+    }
 
     @Test
     public void testImpl_getPlatformPaint() {
--- a/javafx-ui-controls/src/javafx/scene/control/ContextMenu.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/javafx-ui-controls/src/javafx/scene/control/ContextMenu.java	Tue Mar 13 11:07:39 2012 -0700
@@ -195,8 +195,17 @@
      */
     @Deprecated
     private final BooleanProperty impl_showRelativeToWindow = new SimpleBooleanProperty(false);
+     /**
+      * @treatAsPrivate implementation detail
+      */
     public final boolean isImpl_showRelativeToWindow() { return impl_showRelativeToWindow.get(); }
+     /**
+      * @treatAsPrivate implementation detail
+      */
     public final void setImpl_showRelativeToWindow(boolean value) { impl_showRelativeToWindow.set(value); }
+     /**
+      * @treatAsPrivate implementation detail
+      */
     public final BooleanProperty impl_showRelativeToWindowProperty() { return impl_showRelativeToWindow; }
     
     /***************************************************************************
--- a/test-stub-toolkit/src/com/sun/javafx/pgstub/StubColor.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/test-stub-toolkit/src/com/sun/javafx/pgstub/StubColor.java	Tue Mar 13 11:07:39 2012 -0700
@@ -44,6 +44,7 @@
         int r = (int)Math.round(red * 255f);
         int g = (int)Math.round(green * 255f);
         int b = (int)Math.round(blue * 255f);
-        return "Color[red=" + r + ",green=" + g + ",blue=" + b + ",opacity=" + opacity + "]";
+        int o = (int)Math.round(opacity * 255f);
+        return String.format("0x%02x%02x%02x%02x" , r, g, b, o);
     }
 }
--- a/test-stub-toolkit/src/com/sun/javafx/pgstub/StubToolkit.java	Tue Mar 13 09:13:10 2012 -0400
+++ b/test-stub-toolkit/src/com/sun/javafx/pgstub/StubToolkit.java	Tue Mar 13 11:07:39 2012 -0700
@@ -324,7 +324,9 @@
                                     double strokewidth,
                                     StrokeLineCap pgcap,
                                     StrokeLineJoin pgjoin,
-                                    float miterLimit) {
+                                    float miterLimit,
+                                    float[] dashArray,
+                                    float dashOffset) {
         initStroke(pgtype, strokewidth, pgcap, pgjoin, miterLimit);
         return tmpStroke.createStrokedShape(shape);
     }