[Commits] r805 - in core/trunk/geoext: lib/GeoExt/data tests/lib/GeoExt/data

commits at geoext.org commits at geoext.org
Mon May 18 19:04:47 CEST 2009


Author: tschaub
Date: 2009-05-18 19:04:47 +0200 (Mon, 18 May 2009)
New Revision: 805

Modified:
   core/trunk/geoext/lib/GeoExt/data/FeatureRecord.js
   core/trunk/geoext/lib/GeoExt/data/LayerRecord.js
   core/trunk/geoext/tests/lib/GeoExt/data/FeatureRecord.html
   core/trunk/geoext/tests/lib/GeoExt/data/LayerRecord.html
Log:
The copy method for layer and feature records does *not* clone the respective OL object. r=sbenthall (closes #58)

Modified: core/trunk/geoext/lib/GeoExt/data/FeatureRecord.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/data/FeatureRecord.js	2009-05-18 14:04:08 UTC (rev 804)
+++ core/trunk/geoext/lib/GeoExt/data/FeatureRecord.js	2009-05-18 17:04:47 UTC (rev 805)
@@ -28,24 +28,6 @@
 ]);
 
 /**
- * APIMethod: copy
- * Creates a copy of this Record.
- * 
- * Paremters:
- * id - {String} (optional) A new Record id.
- *
- * Returns:
- * {GeoExt.data.LayerRecord} A new layer record.
- */
-GeoExt.data.FeatureRecord.prototype.copy = function(id) {
-    var feature = this.get("feature") && this.get("feature").clone();
-    return new this.constructor(
-        Ext.applyIf({feature: feature}, this.data),
-        id || this.id
-    );
-};
-
-/**
  * APIFunction: GeoExt.data.FeatureRecord.create
  * Creates a constructor for a FeatureRecord, optionally with additional
  * fields.

Modified: core/trunk/geoext/lib/GeoExt/data/LayerRecord.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/data/LayerRecord.js	2009-05-18 14:04:08 UTC (rev 804)
+++ core/trunk/geoext/lib/GeoExt/data/LayerRecord.js	2009-05-18 17:04:47 UTC (rev 805)
@@ -30,24 +30,6 @@
 ]);
 
 /**
- * APIMethod: copy
- * Creates a copy of this Record.
- * 
- * Paremters:
- * id - {String} (optional) A new Record id.
- *
- * Returns:
- * {GeoExt.data.LayerRecord} A new layer record.
- */
-GeoExt.data.LayerRecord.prototype.copy = function(id) {
-    var layer = this.get("layer") && this.get("layer").clone();
-    return new this.constructor(
-        Ext.applyIf({layer: layer}, this.data),
-        id || this.id
-    );
-};
-
-/**
  * APIFunction: GeoExt.data.LayerRecord.create
  * Creates a constructor for a LayerRecord, optionally with additional
  * fields.

Modified: core/trunk/geoext/tests/lib/GeoExt/data/FeatureRecord.html
===================================================================
--- core/trunk/geoext/tests/lib/GeoExt/data/FeatureRecord.html	2009-05-18 14:04:08 UTC (rev 804)
+++ core/trunk/geoext/tests/lib/GeoExt/data/FeatureRecord.html	2009-05-18 17:04:47 UTC (rev 805)
@@ -50,24 +50,6 @@
             t.eq(record.get("foo"), "bar", "foo data row set correctly");
         }
 
-        function test_copy(t) {
-            
-            t.plan(2);
-            
-            var feature = new OpenLayers.Feature.Vector();
-            feature.fid = "foo";
-            var recordType = GeoExt.data.FeatureRecord.create();
-            
-            var record = new recordType({feature: feature, fid: feature.fid});
-            var copy = record.copy();
-            
-            record.set("fid", "bar");
-            t.ok(copy.get("fid") === "foo", "setting a property on original doesn't modify copy");
-            
-            t.ok(copy.get("feature") !== feature, "copy does not have original feature");
-            
-        }
-
     </script>
   <body>
     <div id="mappanel"></div>

Modified: core/trunk/geoext/tests/lib/GeoExt/data/LayerRecord.html
===================================================================
--- core/trunk/geoext/tests/lib/GeoExt/data/LayerRecord.html	2009-05-18 14:04:08 UTC (rev 804)
+++ core/trunk/geoext/tests/lib/GeoExt/data/LayerRecord.html	2009-05-18 17:04:47 UTC (rev 805)
@@ -44,23 +44,6 @@
             t.eq(record.get("foo"), "bar", "foo data row set correctly");
         }
         
-        function test_copy(t) {
-            
-            t.plan(2);
-            
-            var layer = new OpenLayers.Layer();
-            var recordType = GeoExt.data.LayerRecord.create();
-            
-            var record = new recordType({layer: layer, title: layer.name});
-            var copy = record.copy();
-            
-            record.set("title", "foo");
-            t.ok(copy.get("title") !== "foo", "setting a property on original doesn't modify copy");
-            
-            t.ok(copy.get("layer") !== layer, "copy does not have original layer");
-            
-        }
-        
     </script>
   <body>
     <div id="mappanel"></div>



More information about the Commits mailing list