changeset 9566:3c95d7eccde7 jdk-9+106

8145143: Promote Image.impl_getUrl() to public API as Image.getUrl() Reviewed-by: kcr
author jgiles
date Mon, 15 Feb 2016 11:53:47 +1300
parents f536655468a5
children e2ce93f1197e 151fdd3d048f
files apps/samples/3DViewer/src/main/java/com/javafx/experiments/exporters/javasource/JavaSourceExporter.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/css/CssValueConverter.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/metadata/util/DesignImage.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/util/Deprecation.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/util/control/effectpicker/editors/ImageControl.java modules/controls/src/main/java/javafx/scene/control/DialogPane.java modules/controls/src/main/java/javafx/scene/control/Labeled.java modules/controls/src/main/java/javafx/scene/control/Tooltip.java modules/graphics/src/main/java/com/sun/javafx/tk/quantum/GlassSystemMenu.java modules/graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumClipboard.java modules/graphics/src/main/java/javafx/scene/image/Image.java modules/graphics/src/test/java/test/com/sun/javafx/scene/layout/RegionTest.java modules/graphics/src/test/java/test/javafx/scene/CursorTest.java modules/graphics/src/test/java/test/javafx/scene/Node_cssMethods_Test.java modules/graphics/src/test/java/test/javafx/scene/image/ImageTest.java modules/graphics/src/test/java/test/javafx/scene/image/ImageViewTest.java modules/graphics/src/test/java/test/javafx/scene/image/ImageView_cssMethods_Test.java
diffstat 17 files changed, 35 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
--- a/apps/samples/3DViewer/src/main/java/com/javafx/experiments/exporters/javasource/JavaSourceExporter.java	Mon Feb 15 11:32:36 2016 +1300
+++ b/apps/samples/3DViewer/src/main/java/com/javafx/experiments/exporters/javasource/JavaSourceExporter.java	Mon Feb 15 11:53:47 2016 +1300
@@ -405,7 +405,7 @@
             nodeCode.append(indent + "try {\n");
             nodeCode.append(indent + "    " + materialName + ".setDiffuseMap("+toString(material.getDiffuseMap())+");\n");
             nodeCode.append(indent + "} catch (NullPointerException npe) {\n");
-            nodeCode.append(indent + "    System.err.println(\"Could not load texture resource ["+material.getDiffuseMap().impl_getUrl()+"]\");\n");
+            nodeCode.append(indent + "    System.err.println(\"Could not load texture resource ["+material.getDiffuseMap().getUrl()+"]\");\n");
             nodeCode.append(indent + "}\n");
         }
         if (material.getBumpMap() != null) {
@@ -421,7 +421,7 @@
     }
 
     private String toString(Image image) {
-        String url = image.impl_getUrl();
+        String url = image.getUrl();
         if (url.startsWith(baseUrl)) {
             return  "new Image("+className+".class.getResource(\""+url.substring(baseUrl.length())+"\").toExternalForm())";
         } else {
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/css/CssValueConverter.java	Mon Feb 15 11:32:36 2016 +1300
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/editor/panel/css/CssValueConverter.java	Mon Feb 15 11:53:47 2016 +1300
@@ -541,7 +541,7 @@
         StringBuilder builder = new StringBuilder();
         if (property.equals("-fx-background-image")) { //NOI18N
             Image p = bi.getImage();
-            builder.append(Deprecation.getUrl(p));
+            builder.append(p.getUrl());
         } else {
             if (property.equals("-fx-background-position")) {             //NOI18N
                 double left = 0, right = 0, top = 0, bottom = 0;
@@ -609,7 +609,7 @@
         StringBuilder builder = new StringBuilder();
         if (property.equals("-fx-border-image")) { //NOI18N
             Image p = bi.getImage();
-            builder.append(Deprecation.getUrl(p));
+            builder.append(p.getUrl());
         } else {
             if (property.equals("-fx-background-position")) {             //NOI18N
 
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/metadata/util/DesignImage.java	Mon Feb 15 11:32:36 2016 +1300
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/metadata/util/DesignImage.java	Mon Feb 15 11:53:47 2016 +1300
@@ -32,7 +32,6 @@
 
 package com.oracle.javafx.scenebuilder.kit.metadata.util;
 
-import com.oracle.javafx.scenebuilder.kit.util.Deprecation;
 import java.net.URL;
 import javafx.scene.image.Image;
 
@@ -53,10 +52,10 @@
 
     public DesignImage(Image image) {
         assert image != null;
-        assert Deprecation.getUrl(image) != null;
+        assert image.getUrl() != null;
 
         this.image = image;
-        this.location = Deprecation.getUrl(image);
+        this.location = image.getUrl();
     }
 
     public Image getImage() {
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/util/Deprecation.java	Mon Feb 15 11:32:36 2016 +1300
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/util/Deprecation.java	Mon Feb 15 11:53:47 2016 +1300
@@ -139,11 +139,6 @@
 //    public static void setTraversalEngine(Parent parent, TraversalEngine engine) {
 //        parent.setImpl_traversalEngine(engine);
 //    }
-    // Deprecated stuff in Image
-    // RT-21216 : Promote impl_getUrl to public API
-    public static String getUrl(Image image) {
-        return image.impl_getUrl();
-    }
 
 //    // RT-21217 : Promote impl_fromPlatformImage to public API
 //    public static Image fromPlatformImage(Object platformImage) {
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/util/control/effectpicker/editors/ImageControl.java	Mon Feb 15 11:32:36 2016 +1300
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/util/control/effectpicker/editors/ImageControl.java	Mon Feb 15 11:53:47 2016 +1300
@@ -168,7 +168,7 @@
         }
 
         editor_label.setText(labelString);
-        editor_textfield.setText(initVal == null ? "" : Deprecation.getUrl(initVal)); //NOI18N
+        editor_textfield.setText(initVal == null ? "" : initVal.getUrl()); //NOI18N
         setValue(initVal);
     }
 }
--- a/modules/controls/src/main/java/javafx/scene/control/DialogPane.java	Mon Feb 15 11:32:36 2016 +1300
+++ b/modules/controls/src/main/java/javafx/scene/control/DialogPane.java	Mon Feb 15 11:53:47 2016 +1300
@@ -356,7 +356,7 @@
                             final ImageView imageView = (ImageView)graphicNode;
                             final Image image = imageView.getImage();
                             if (image != null) {
-                                final String imageViewUrl = image.impl_getUrl();
+                                final String imageViewUrl = image.getUrl();
                                 if (url.equals(imageViewUrl)) return;
                             }
 
@@ -391,7 +391,7 @@
                     if (graphic instanceof ImageView) {
                         final Image image = ((ImageView)graphic).getImage();
                         if (image != null) {
-                            return image.impl_getUrl();
+                            return image.getUrl();
                         }
                     }
                     return null;
--- a/modules/controls/src/main/java/javafx/scene/control/Labeled.java	Mon Feb 15 11:32:36 2016 +1300
+++ b/modules/controls/src/main/java/javafx/scene/control/Labeled.java	Mon Feb 15 11:53:47 2016 +1300
@@ -476,7 +476,7 @@
                             final ImageView imageView = (ImageView)graphicNode;
                             final Image image = imageView.getImage();
                             if (image != null) {
-                                final String imageViewUrl = image.impl_getUrl();
+                                final String imageViewUrl = image.getUrl();
                                 if (url.equals(imageViewUrl)) return;
                             }
 
@@ -512,7 +512,7 @@
                     if (graphic instanceof ImageView) {
                         final Image image = ((ImageView)graphic).getImage();
                         if (image != null) {
-                            return image.impl_getUrl();
+                            return image.getUrl();
                         }
                     }
                     return null;
--- a/modules/controls/src/main/java/javafx/scene/control/Tooltip.java	Mon Feb 15 11:32:36 2016 +1300
+++ b/modules/controls/src/main/java/javafx/scene/control/Tooltip.java	Mon Feb 15 11:53:47 2016 +1300
@@ -385,7 +385,7 @@
                             final ImageView imageView = (ImageView)graphicNode;
                             final Image image = imageView.getImage();
                             if (image != null) {
-                                final String imageViewUrl = image.impl_getUrl();
+                                final String imageViewUrl = image.getUrl();
                                 if (url.equals(imageViewUrl)) return;
                             }
 
@@ -413,7 +413,7 @@
                     if (graphic instanceof ImageView) {
                         final Image image = ((ImageView)graphic).getImage();
                         if (image != null) {
-                            return image.impl_getUrl();
+                            return image.getUrl();
                         }
                     }
                     return null;
--- a/modules/graphics/src/main/java/com/sun/javafx/tk/quantum/GlassSystemMenu.java	Mon Feb 15 11:32:36 2016 +1300
+++ b/modules/graphics/src/main/java/com/sun/javafx/tk/quantum/GlassSystemMenu.java	Mon Feb 15 11:53:47 2016 +1300
@@ -294,7 +294,7 @@
             Image     im = iv.getImage();
             if (im == null) return null;
 
-            String    url          = im.impl_getUrl();
+            String    url          = im.getUrl();
 
             if (url == null || PixelUtils.supportedFormatType(url)) {
                 com.sun.prism.Image pi = (com.sun.prism.Image)im.impl_getPlatformImage();
--- a/modules/graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumClipboard.java	Mon Feb 15 11:32:36 2016 +1300
+++ b/modules/graphics/src/main/java/com/sun/javafx/tk/quantum/QuantumClipboard.java	Mon Feb 15 11:53:47 2016 +1300
@@ -435,7 +435,7 @@
             return false;
         }
 
-        String url = image.impl_getUrl();
+        String url = image.getUrl();
         if (url == null || PixelUtils.supportedFormatType(url)) {
             com.sun.prism.Image prismImage =
                         (com.sun.prism.Image)image.impl_getPlatformImage();
--- a/modules/graphics/src/main/java/javafx/scene/image/Image.java	Mon Feb 15 11:32:36 2016 +1300
+++ b/modules/graphics/src/main/java/javafx/scene/image/Image.java	Mon Feb 15 11:53:47 2016 +1300
@@ -47,8 +47,6 @@
 import javafx.beans.property.ReadOnlyObjectProperty;
 import javafx.beans.property.ReadOnlyObjectPropertyBase;
 import javafx.beans.property.ReadOnlyObjectWrapper;
-import javafx.event.ActionEvent;
-import javafx.event.EventHandler;
 import javafx.scene.paint.Color;
 import javafx.util.Duration;
 import com.sun.javafx.runtime.async.AsyncOperation;
@@ -158,12 +156,16 @@
     private final String url;
 
     /**
-     * @treatAsPrivate implementation detail
-     * @deprecated This is an internal API that is not intended for use and will be removed in the next version
+     * Returns the url used to fetch the pixel data contained in the Image instance,
+     * if specified in the constructor. If no url is provided in the constructor (for
+     * instance, if the Image is constructed from an
+     * {@link #Image(InputStream) InputStream}), this method will return null.
+     *
+     * @return a String containing the URL used to fetch the pixel data for this
+     *      Image instance.
+     * @since 9
      */
-    // SB-dependency: RT-21216 has been filed to track this
-    @Deprecated
-    public final String impl_getUrl() {
+    public final String getUrl() {
         return url;
     }
 
@@ -804,7 +806,7 @@
                 loader = loadImage(impl_source, getRequestedWidth(), getRequestedHeight(),
                                    isPreserveRatio(), isSmooth());
             } else {
-                loader = loadImage(impl_getUrl(), getRequestedWidth(), getRequestedHeight(),
+                loader = loadImage(getUrl(), getRequestedWidth(), getRequestedHeight(),
                                    isPreserveRatio(), isSmooth());
             }
             finishImage(loader);
--- a/modules/graphics/src/test/java/test/com/sun/javafx/scene/layout/RegionTest.java	Mon Feb 15 11:32:36 2016 +1300
+++ b/modules/graphics/src/test/java/test/com/sun/javafx/scene/layout/RegionTest.java	Mon Feb 15 11:53:47 2016 +1300
@@ -331,7 +331,7 @@
 //        for (int i=0; i<images.size(); i++) {
 //            BackgroundImage image = images.get(i);
 ////             TODO: fix this - expected is file:/... actual is jar:file:/...
-////            assertEquals(expectedUrls[i], image.getImage().impl_getUrl());
+////            assertEquals(expectedUrls[i], image.getImage().getUrl());
 //            assertEquals(expectedRepeats[i].getRepeatX(), image.getRepeatX());
 //            assertEquals(expectedRepeats[i].getRepeatY(), image.getRepeatY());
 //            assertEquals(expectedPositions[i].getTop(), image.getTop(), 0.01);
@@ -446,7 +446,7 @@
 //
 //        for (int i=0; i<images.size(); i++) {
 //            BorderImage image = images.get(i);
-//            assertEquals(expectedUrls[i], image.getImage().impl_getUrl());
+//            assertEquals(expectedUrls[i], image.getImage().getUrl());
 //            assertEquals(expectedRepeats[i].getRepeatX(), image.getRepeatX());
 //            assertEquals(expectedRepeats[i].getRepeatY(), image.getRepeatY());
 //            assertEquals(expectedSlices[i].getTop(), image.getTopSlice(),0.01);
--- a/modules/graphics/src/test/java/test/javafx/scene/CursorTest.java	Mon Feb 15 11:32:36 2016 +1300
+++ b/modules/graphics/src/test/java/test/javafx/scene/CursorTest.java	Mon Feb 15 11:53:47 2016 +1300
@@ -95,7 +95,7 @@
         assertTrue(cursor instanceof ImageCursor);
 
         final Image cursorImage = ((ImageCursor) cursor).getImage();
-        assertEquals(imageUrl, cursorImage.impl_getUrl());
+        assertEquals(imageUrl, cursorImage.getUrl());
     }
 
     @Test(expected=NullPointerException.class)
--- a/modules/graphics/src/test/java/test/javafx/scene/Node_cssMethods_Test.java	Mon Feb 15 11:32:36 2016 +1300
+++ b/modules/graphics/src/test/java/test/javafx/scene/Node_cssMethods_Test.java	Mon Feb 15 11:53:47 2016 +1300
@@ -78,7 +78,7 @@
                                        ((ImageCursor) actual).getImage();
 
                                if ((cursorImage != null)
-                                       && cursorImage.impl_getUrl().equals(
+                                       && cursorImage.getUrl().equals(
                                                   TEST_CURSOR_URL)) {
                                    return true;
                                }
--- a/modules/graphics/src/test/java/test/javafx/scene/image/ImageTest.java	Mon Feb 15 11:32:36 2016 +1300
+++ b/modules/graphics/src/test/java/test/javafx/scene/image/ImageTest.java	Mon Feb 15 11:53:47 2016 +1300
@@ -34,7 +34,6 @@
 import test.com.sun.javafx.test.PropertyInvalidationCounter;
 import com.sun.javafx.tk.Toolkit;
 import javafx.beans.InvalidationListener;
-import javafx.beans.Observable;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -68,7 +67,7 @@
 
         final Image image = new Image(url);
 
-        assertEquals(url, image.impl_getUrl());
+        assertEquals(url, image.getUrl());
         verifyLoadedImage(image, 0, 0, false, false, 100, 200);
     }
 
@@ -79,7 +78,7 @@
 
         final Image image = new Image(url, 200, 400, true, true);
 
-        assertEquals(url, image.impl_getUrl());
+        assertEquals(url, image.getUrl());
         verifyLoadedImage(image, 200, 400, true, true, 300, 100);
     }
 
@@ -494,7 +493,7 @@
 
         final Image image = new Image(url);
 
-        assertEquals(resolvedUrl, image.impl_getUrl());
+        assertEquals(resolvedUrl, image.getUrl());
         verifyLoadedImage(image, 0, 0, false, false, 100, 200);
     }
 
@@ -506,7 +505,7 @@
 
         final Image image = new Image(url);
 
-        assertEquals(resolvedUrl, image.impl_getUrl());
+        assertEquals(resolvedUrl, image.getUrl());
         verifyLoadedImage(image, 0, 0, false, false, 100, 200);
     }
 
--- a/modules/graphics/src/test/java/test/javafx/scene/image/ImageViewTest.java	Mon Feb 15 11:32:36 2016 +1300
+++ b/modules/graphics/src/test/java/test/javafx/scene/image/ImageViewTest.java	Mon Feb 15 11:53:47 2016 +1300
@@ -37,7 +37,6 @@
 import org.junit.Before;
 import org.junit.Test;
 
-import java.util.Comparator;
 import javafx.beans.value.ChangeListener;
 import javafx.beans.value.ObservableValue;
 import javafx.geometry.Bounds;
@@ -115,7 +114,7 @@
 
         final ImageView newImageView = new ImageView(url);
 
-        assertEquals(url, newImageView.getImage().impl_getUrl());
+        assertEquals(url, newImageView.getImage().getUrl());
     }
 
     @Test
--- a/modules/graphics/src/test/java/test/javafx/scene/image/ImageView_cssMethods_Test.java	Mon Feb 15 11:32:36 2016 +1300
+++ b/modules/graphics/src/test/java/test/javafx/scene/image/ImageView_cssMethods_Test.java	Mon Feb 15 11:53:47 2016 +1300
@@ -54,7 +54,7 @@
                 public boolean equals(final Object expected,
                                       final Object actual) {
                     return ((actual instanceof Image)
-                               && ((Image) actual).impl_getUrl().equals(expected));
+                               && ((Image) actual).getUrl().equals(expected));
                 }
             };