changeset 6413:39856b5ce3f7

Automated merge with ssh://jfxsrc.us.oracle.com//javafx/8u/master/jfx/rt
author kcr
date Fri, 07 Mar 2014 13:16:52 -0800
parents 81208afdb29a ca9b98508292
children 9861cccfaecc 77d9f9491a0e
files
diffstat 5 files changed, 76 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/apps/experiments/3DViewer/src/main/java/com/javafx/experiments/importers/Importer3D.java	Wed Mar 05 08:00:36 2014 -0800
+++ b/apps/experiments/3DViewer/src/main/java/com/javafx/experiments/importers/Importer3D.java	Fri Mar 07 13:16:52 2014 -0800
@@ -34,12 +34,14 @@
 import java.io.IOException;
 import java.net.URL;
 import java.net.URLClassLoader;
+
 import javafx.animation.Timeline;
 import javafx.fxml.FXMLLoader;
 import javafx.scene.Node;
 import javafx.scene.shape.MeshView;
 import javafx.scene.shape.TriangleMesh;
 import javafx.util.Pair;
+
 import java.util.ServiceLoader;
 
 /**
@@ -107,9 +109,35 @@
                 break;
             }
         }
+
+        // Check well known loaders that might not be in a jar (ie. running from an IDE)
         if ((importer == null) && (!extension.equals("fxml"))){
-            throw new IOException("Unknown 3D file format [" + extension + "]");
+            String [] names = {
+                 "com.javafx.experiments.importers.dae.DaeImporter",
+                 "com.javafx.experiments.importers.max.MaxLoader",
+                 "com.javafx.experiments.importers.maya.MayaImporter",
+                 "com.javafx.experiments.importers.obj.ObjOrPolyObjImporter",
+            };
+            boolean fail = true;
+            for (String name : names) {
+                try {
+                    Class<?> clazz = Class.forName(name);
+                    Object obj = clazz.newInstance();
+                    if (obj instanceof Importer) {
+                        Importer plugin = (Importer) obj;
+                        if (plugin.isSupported(extension)) {
+                            importer = plugin;
+                            fail = false;
+                            break;
+                        }
+                    }
+                } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
+                    // FAIL SILENTLY
+                }
+            }
+            if (fail) throw new IOException("Unknown 3D file format [" + extension + "]");
         }
+        
         if (extension.equals("fxml")) {
             final Object fxmlRoot = FXMLLoader.load(new URL(fileUrl));
             if (fxmlRoot instanceof Node) {
--- a/modules/controls/src/main/java/com/sun/javafx/scene/control/SelectedCellsMap.java	Wed Mar 05 08:00:36 2014 -0800
+++ b/modules/controls/src/main/java/com/sun/javafx/scene/control/SelectedCellsMap.java	Fri Mar 07 13:16:52 2014 -0800
@@ -27,6 +27,7 @@
 import javafx.collections.FXCollections;
 import javafx.collections.ListChangeListener;
 import javafx.collections.ObservableList;
+import javafx.collections.transformation.SortedList;
 import javafx.scene.control.TablePositionBase;
 
 import java.util.*;
@@ -54,7 +55,7 @@
 
     public SelectedCellsMap(final ListChangeListener<T> listener) {
         selectedCells = FXCollections.<T>observableArrayList();
-        sortedSelectedCells = selectedCells.sorted(new Comparator<T>() {
+        sortedSelectedCells = new SortedList<>(selectedCells, new Comparator<T>() {
             @Override public int compare(T o1, T o2) {
                 return o1.getRow() - o2.getRow();
             }
--- a/modules/fxml/src/main/java/com/sun/javafx/fxml/annotation/FXMLAnnotationProcessor.java	Wed Mar 05 08:00:36 2014 -0800
+++ b/modules/fxml/src/main/java/com/sun/javafx/fxml/annotation/FXMLAnnotationProcessor.java	Fri Mar 07 13:16:52 2014 -0800
@@ -30,6 +30,8 @@
 import javax.annotation.processing.AbstractProcessor;
 import javax.annotation.processing.RoundEnvironment;
 import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.annotation.processing.SupportedSourceVersion;
+import javax.lang.model.SourceVersion;
 import javax.lang.model.element.Element;
 import javax.lang.model.element.ExecutableElement;
 import javax.lang.model.element.Modifier;
@@ -39,6 +41,7 @@
 import javax.tools.Diagnostic;
 
 @SupportedAnnotationTypes("javafx.fxml.FXML")
+@SupportedSourceVersion(SourceVersion.RELEASE_8)
 public class FXMLAnnotationProcessor extends AbstractProcessor{
 
     @Override
--- a/modules/graphics/src/main/java/javafx/scene/canvas/GraphicsContext.java	Wed Mar 05 08:00:36 2014 -0800
+++ b/modules/graphics/src/main/java/javafx/scene/canvas/GraphicsContext.java	Fri Mar 07 13:16:52 2014 -0800
@@ -1127,6 +1127,9 @@
         coords[0] = (float) x1;
         coords[1] = (float) y1;
         curState.transform.transform(coords, 0, coords, 0, 1);
+        if (path.getNumCommands() == 0) {
+            path.moveTo(coords[0], coords[1]);
+        }
         path.lineTo(coords[0], coords[1]);
         markPathDirty();
     }
@@ -1145,6 +1148,9 @@
         coords[2] = (float) x1;
         coords[3] = (float) y1;
         curState.transform.transform(coords, 0, coords, 0, 2);
+        if (path.getNumCommands() == 0) {
+            path.moveTo(coords[0], coords[1]);
+        }
         path.quadTo(coords[0], coords[1], coords[2], coords[3]);
         markPathDirty();
     }
@@ -1167,6 +1173,9 @@
         coords[4] = (float) x1;
         coords[5] = (float) y1;
         curState.transform.transform(coords, 0, coords, 0, 3);
+        if (path.getNumCommands() == 0) {
+            path.moveTo(coords[0], coords[1]);
+        }
         path.curveTo(coords[0], coords[1], coords[2], coords[3], coords[4], coords[5]);
         markPathDirty();
     }
@@ -1464,8 +1473,10 @@
      * Closes the path.
      */
     public void closePath() {
-        path.closePath();
-        markPathDirty();
+        if (path.getNumCommands() > 0) {
+            path.closePath();
+            markPathDirty();
+        }
     }
 
     /**
--- a/modules/graphics/src/test/java/javafx/scene/canvas/CanvasTest.java	Wed Mar 05 08:00:36 2014 -0800
+++ b/modules/graphics/src/test/java/javafx/scene/canvas/CanvasTest.java	Fri Mar 07 13:16:52 2014 -0800
@@ -174,9 +174,35 @@
         gc.stroke();
         gc.fill();
     }
-    
-    
-    
+
+    @Test public void testGCPath_LineTo_NoMoveto() throws Exception {
+        gc.lineTo(10, 10);
+    }
+
+    @Test public void testGCPath_QuadraticCurveTo_NoMoveto() throws Exception {
+        gc.quadraticCurveTo(10, 10, 20, 20);
+    }
+
+    @Test public void testGCPath_BezierCurveTo_NoMoveto() throws Exception {
+        gc.bezierCurveTo(10, 10, 20, 20, 30, 30);
+    }
+
+    @Test public void testGCPath_ArcTo_NoMoveto() throws Exception {
+        gc.arcTo(10, 10, 20, 20, 30);
+    }
+
+    @Test public void testGCPath_Arc_NoMoveto() throws Exception {
+        gc.arc(10, 10, 20, 20, 30, 30);
+    }
+
+    @Test public void testGCPath_ClosePath_NoMoveto() throws Exception {
+        gc.closePath();
+    }
+
+    @Test public void testGCPath_Rect_NoMoveto() throws Exception {
+        gc.rect(10, 10, 20, 20);
+    }
+
     @Test public void testGCState_Translate() throws Exception {
         gc.translate(50, 50);
         Affine result = gc.getTransform();