changeset 7849:caa2c16ce66b

[SCENEBUILDER] Some classes in FXOM now use LinkedHashMap (in place of HashMap) to preserve FXML declaration order. This will be useful for DTL-6774. This also avoids extra sorting in FXOMCloner (and FxIdCollector).
author eric.le.ponner <eric.le.ponner@oracle.com>
date Tue, 26 Aug 2014 10:25:17 +0200
parents eb3b7811bc31
children 41bbfc2cdc8d
files apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/fxom/FXOMCloner.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/fxom/FXOMInstance.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/fxom/FXOMIntrinsic.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/fxom/FXOMObject.java apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/fxom/FxIdCollector.java
diffstat 5 files changed, 8 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/fxom/FXOMCloner.java	Mon Aug 25 16:41:21 2014 -0700
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/fxom/FXOMCloner.java	Tue Aug 26 10:25:17 2014 +0200
@@ -36,7 +36,6 @@
 import com.oracle.javafx.scenebuilder.kit.metadata.util.PropertyName;
 import java.util.HashSet;
 import java.util.Map;
-import java.util.PriorityQueue;
 import java.util.Set;
 
 /**
@@ -308,7 +307,7 @@
             fxIds.remove(clonee.getFxId());
         }
         
-        for (String candidateFxId : new PriorityQueue<>(fxIds.keySet())) {
+        for (String candidateFxId : fxIds.keySet()) {
             
             final String renamedFxId = fxIdCollector.importFxId(candidateFxId);
             
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/fxom/FXOMInstance.java	Mon Aug 25 16:41:21 2014 -0700
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/fxom/FXOMInstance.java	Tue Aug 26 10:25:17 2014 +0200
@@ -38,10 +38,10 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.TreeMap;
 import javafx.fxml.FXMLLoader;
 
 /**
@@ -50,7 +50,7 @@
  */
 public class FXOMInstance extends FXOMObject {
     
-    private final Map<PropertyName, FXOMProperty> properties = new TreeMap<>();
+    private final Map<PropertyName, FXOMProperty> properties = new LinkedHashMap<>();
     private Class<?> declaredClass;
     
     
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/fxom/FXOMIntrinsic.java	Mon Aug 25 16:41:21 2014 -0700
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/fxom/FXOMIntrinsic.java	Tue Aug 26 10:25:17 2014 +0200
@@ -35,10 +35,10 @@
 import com.oracle.javafx.scenebuilder.kit.metadata.util.PropertyName;
 import java.net.URL;
 import java.util.Collections;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.TreeMap;
 
 /**
  *
@@ -53,7 +53,7 @@
         UNDEFINED
     }
     
-    private final Map<PropertyName, FXOMProperty> properties = new TreeMap<>();
+    private final Map<PropertyName, FXOMProperty> properties = new LinkedHashMap<>();
     private Object sourceSceneGraphObject;
 
     
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/fxom/FXOMObject.java	Mon Aug 25 16:41:21 2014 -0700
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/fxom/FXOMObject.java	Tue Aug 26 10:25:17 2014 +0200
@@ -37,8 +37,8 @@
 import com.oracle.javafx.scenebuilder.kit.util.JavaLanguage;
 import com.oracle.javafx.scenebuilder.kit.util.URLUtils;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.HashSet;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -405,7 +405,7 @@
     protected abstract void collectIncludes(String source, List<FXOMIntrinsic> result);
 
     public Map<String, FXOMObject> collectFxIds() {
-        final Map<String, FXOMObject> result = new HashMap<>();
+        final Map<String, FXOMObject> result = new LinkedHashMap<>();
         
         collectFxIds(result);
         
--- a/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/fxom/FxIdCollector.java	Mon Aug 25 16:41:21 2014 -0700
+++ b/apps/scenebuilder/SceneBuilderKit/src/com/oracle/javafx/scenebuilder/kit/fxom/FxIdCollector.java	Tue Aug 26 10:25:17 2014 +0200
@@ -35,7 +35,6 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
-import java.util.PriorityQueue;
 import java.util.Set;
 
 /**
@@ -88,7 +87,7 @@
     private void createNextIndexes() {
         nextIndexes = new HashMap<>();
         
-        for (String fxId : new PriorityQueue<>(fxIds)) {
+        for (String fxId : fxIds) {
             updateNextIndexes(fxId);
         }
     }