[Commits] r1672 - in sandbox/redlining/ux/RedLining/ux/widgets: . form

commits at geoext.org commits at geoext.org
Fri Jan 8 15:15:58 CET 2010


Author: adube
Date: 2010-01-08 15:15:58 +0100 (Fri, 08 Jan 2010)
New Revision: 1672

Modified:
   sandbox/redlining/ux/RedLining/ux/widgets/MainControler.js
   sandbox/redlining/ux/RedLining/ux/widgets/form/ComplexRedLiningForm.js
Log:
deleteAll and blank buttons

Modified: sandbox/redlining/ux/RedLining/ux/widgets/MainControler.js
===================================================================
--- sandbox/redlining/ux/RedLining/ux/widgets/MainControler.js	2010-01-08 13:49:00 UTC (rev 1671)
+++ sandbox/redlining/ux/RedLining/ux/widgets/MainControler.js	2010-01-08 14:15:58 UTC (rev 1672)
@@ -8,6 +8,8 @@
 
     drawControls: null,
 
+    deleteAllAction: null,
+
     actions: null,
 
     featureControl: null,
@@ -76,7 +78,7 @@
             geometryTypes.push("Point");
             geometryTypes.push("LineString");
             geometryTypes.push("Polygon");
-            //geometryTypes.push("Label");
+            geometryTypes.push("Label");
         }
 
         for(var i=0; i<geometryTypes.length; i++) {
@@ -95,6 +97,9 @@
               case "MultiPolygon":
                 handler = OpenLayers.Handler.Polygon;
                 break;
+              case "Label":
+                handler = OpenLayers.Handler.Point;
+                break;
             }
 
             control = new OpenLayers.Control.DrawFeature(
@@ -129,5 +134,22 @@
         this.drawControls = [];
     },
 
+    initDeleteAllAction: function() {
+        var action = new Ext.Action({
+            text:'DeleteAll',
+            handler: this.deleteAllFeatures,
+            scope: this
+        });
+
+        this.deleteAllAction = action;
+        this.actions.push(action);
+    },
+
+    deleteAllFeatures: function() {
+        for(var i=0; i<this.layers.length; i++) {
+            this.layers[i].destroyFeatures();
+        }
+    },
+
     CLASS_NAME: "GeoExt.ux.MainControler"
 });

Modified: sandbox/redlining/ux/RedLining/ux/widgets/form/ComplexRedLiningForm.js
===================================================================
--- sandbox/redlining/ux/RedLining/ux/widgets/form/ComplexRedLiningForm.js	2010-01-08 13:49:00 UTC (rev 1671)
+++ sandbox/redlining/ux/RedLining/ux/widgets/form/ComplexRedLiningForm.js	2010-01-08 14:15:58 UTC (rev 1672)
@@ -39,7 +39,8 @@
         this.initMap();
         this.initMain();
         this.initLayer();
-        this.initDrawControls();
+        this.initToolbar();
+        this.initForm();
 
         GeoExt.ux.form.ComplexRedLiningForm.superclass.initComponent.call(this);
     },
@@ -75,14 +76,29 @@
         this.layer = layer;
     },
 
-    /** private: method[initDrawControls]
+    /** private: method[initToolbar]
      */
-    initDrawControls: function() {
+    initToolbar: function() {
         this.main.initDrawControls();
+        this.main.initFeatureControl();
+        this.main.initDeleteAllAction();
 
+        var importAction = this.importAction || new Ext.Action({text:'Import'});
+        this.main.importAction = importAction;
+        this.main.actions.push(importAction);
+
+        var exportAction = this.exportAction || new Ext.Action({text:'ExportAll'});
+        this.main.exportAction = exportAction;
+        this.main.actions.push(exportAction);
+
+
         // Add buttons and toolbar
         Ext.apply(this, {tbar: new Ext.Toolbar(this.main.actions)});
+    },
 
+    /** private: method[initForm]
+     */
+    initForm: function() {
         oItems = [];
         oItems.push({
               id: "testid",
@@ -92,7 +108,6 @@
                 });
 
         Ext.apply(this, {items: oItems});
-
     },
     
     /** private: method[beforeDestroy]



More information about the Commits mailing list