[Commits] r1769 - in sandbox/redlining/ux/FeatureEditing: . examples resources resources/css resources/images ux/widgets ux/widgets/form ux/widgets/plugins

commits at geoext.org commits at geoext.org
Mon Jan 18 17:35:55 CET 2010


Author: adube
Date: 2010-01-18 17:35:55 +0100 (Mon, 18 Jan 2010)
New Revision: 1769

Added:
   sandbox/redlining/ux/FeatureEditing/resources/
   sandbox/redlining/ux/FeatureEditing/resources/css/
   sandbox/redlining/ux/FeatureEditing/resources/css/feature-editing.css
   sandbox/redlining/ux/FeatureEditing/resources/images/
   sandbox/redlining/ux/FeatureEditing/resources/images/delete_off.png
   sandbox/redlining/ux/FeatureEditing/resources/images/draw_line_off.png
   sandbox/redlining/ux/FeatureEditing/resources/images/draw_point_off.png
   sandbox/redlining/ux/FeatureEditing/resources/images/draw_polygon_off.png
   sandbox/redlining/ux/FeatureEditing/resources/images/edit_off.png
   sandbox/redlining/ux/FeatureEditing/resources/images/icon_query.png
   sandbox/redlining/ux/FeatureEditing/resources/images/printer.png
Modified:
   sandbox/redlining/ux/FeatureEditing/examples/RedLiningPanelExample.html
   sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js
   sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeatureEditingPanel.js
   sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeaturePanel.js
   sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ExportFeature.js
   sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ExportFeatures.js
   sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ImportFeatures.js
Log:
useIcons new flag, delete bug fixed

Modified: sandbox/redlining/ux/FeatureEditing/examples/RedLiningPanelExample.html
===================================================================
--- sandbox/redlining/ux/FeatureEditing/examples/RedLiningPanelExample.html	2010-01-18 16:07:37 UTC (rev 1768)
+++ sandbox/redlining/ux/FeatureEditing/examples/RedLiningPanelExample.html	2010-01-18 16:35:55 UTC (rev 1769)
@@ -20,6 +20,7 @@
         <script type="text/javascript" src="http://dev.geoext.org/sandbox/cmoullet/ux/LayerManager/ux/widgets/LayerManagerWindow.js"></script>
         <script type="text/javascript" src="http://dev.geoext.org/sandbox/cmoullet/ux/LayerManager/ux/widgets/LayerManagerExportWindow.js"></script>
         
+        <link rel="stylesheet" type="text/css" href="../resources/css/feature-editing.css" />
         <script type="text/javascript" src="../ux/FeatureEditing.js"></script>
         
         <script type="text/javascript" src="RedLiningPanelExample.js"></script>

Added: sandbox/redlining/ux/FeatureEditing/resources/css/feature-editing.css
===================================================================
--- sandbox/redlining/ux/FeatureEditing/resources/css/feature-editing.css	                        (rev 0)
+++ sandbox/redlining/ux/FeatureEditing/resources/css/feature-editing.css	2010-01-18 16:35:55 UTC (rev 1769)
@@ -0,0 +1,47 @@
+.gx-featureediting-draw-point {
+  background-image:url("../images/draw_point_off.png") !important;
+  height:20px !important;
+  width:20px !important;
+}
+
+.gx-featureediting-draw-line {
+  background-image:url("../images/draw_line_off.png") !important;
+  height:20px !important;
+  width:20px !important;
+}
+
+.gx-featureediting-draw-polygon {
+  background-image:url("../images/draw_polygon_off.png") !important;
+  height:20px !important;
+  width:20px !important;
+}
+
+.gx-featureediting-draw-label {
+  background-image:url("../images/draw_point_off.png") !important;
+  height:20px !important;
+  width:20px !important;
+}
+
+.gx-featureediting-editfeature {
+  background-image:url("../images/edit_off.png") !important;
+  height:20px !important;
+  width:20px !important;
+}
+
+.gx-featureediting-delete {
+  background-image:url("../images/delete_off.png") !important;
+  height:20px !important;
+  width:20px !important;
+}
+
+.gx-featureediting-import {
+  background-image:url("../images/icon_query.png") !important;
+  height:20px !important;
+  width:20px !important;
+}
+
+.gx-featureediting-export {
+  background-image:url("../images/printer.png") !important;
+  height:20px !important;
+  width:20px !important;
+}
\ No newline at end of file


Property changes on: sandbox/redlining/ux/FeatureEditing/resources/css/feature-editing.css
___________________________________________________________________
Name: svn:mime-type
   + text/css
Name: svn:eol-style
   + native

Added: sandbox/redlining/ux/FeatureEditing/resources/images/delete_off.png
===================================================================
(Binary files differ)


Property changes on: sandbox/redlining/ux/FeatureEditing/resources/images/delete_off.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: sandbox/redlining/ux/FeatureEditing/resources/images/draw_line_off.png
===================================================================
(Binary files differ)


Property changes on: sandbox/redlining/ux/FeatureEditing/resources/images/draw_line_off.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: sandbox/redlining/ux/FeatureEditing/resources/images/draw_point_off.png
===================================================================
(Binary files differ)


Property changes on: sandbox/redlining/ux/FeatureEditing/resources/images/draw_point_off.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: sandbox/redlining/ux/FeatureEditing/resources/images/draw_polygon_off.png
===================================================================
(Binary files differ)


Property changes on: sandbox/redlining/ux/FeatureEditing/resources/images/draw_polygon_off.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: sandbox/redlining/ux/FeatureEditing/resources/images/edit_off.png
===================================================================
(Binary files differ)


Property changes on: sandbox/redlining/ux/FeatureEditing/resources/images/edit_off.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: sandbox/redlining/ux/FeatureEditing/resources/images/icon_query.png
===================================================================
(Binary files differ)


Property changes on: sandbox/redlining/ux/FeatureEditing/resources/images/icon_query.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: sandbox/redlining/ux/FeatureEditing/resources/images/printer.png
===================================================================
(Binary files differ)


Property changes on: sandbox/redlining/ux/FeatureEditing/resources/images/printer.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js	2010-01-18 16:07:37 UTC (rev 1768)
+++ sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js	2010-01-18 16:35:55 UTC (rev 1769)
@@ -67,6 +67,19 @@
      */    
     featurePanel: null,
 
+    /** api: config[popup]
+     *  ``GeoExt.Popup``
+     *  A reference to the Popup object created
+     */    
+    popup: null,
+
+    /** private: property[useIcons]
+     *  ``Boolean``
+     *  If set to true, enables the use of image icons.  Must be combined with
+     *  a .css (see in resources/css).
+     */
+    useIcons: true,
+
     /** private: method[constructor]
      *  Private constructor override.
      */    
@@ -143,7 +156,7 @@
      *  actions array.
      */
     initFeatureControl: function() {
-        var layer, control, options;
+        var layer, control, options, actionOptions;
 
         layer = this.activeLayer;
         options = {};
@@ -154,9 +167,7 @@
         this.featureControl = control;
         this.map.addControl(control);
 
-        var action = new GeoExt.Action({
-            //iconCls: "todo",
-            text: OpenLayers.i18n("EditFeature"),
+        actionOptions = {
             control: control,
             map: this.map,
             // button options
@@ -167,8 +178,16 @@
             // check item options
             group: this.map.id,
             checked: false
-        });
+        }
 
+        if(this.useIcons === true) {
+            actionOptions['iconCls'] = "gx-featureediting-editfeature";
+        } else {
+            actionOptions['text'] = OpenLayers.i18n("EditFeature");
+        }
+
+        var action = new GeoExt.Action(actionOptions);
+
         this.actions.push(action);
     },
 
@@ -185,7 +204,7 @@
      */
     initDrawControls: function() {
         var layer, control, handler, geometryTypes, geometryType,
-            options, action, iconCls;
+            options, action, iconCls, actionOptions;
 
         geometryTypes = [];
         options = {};
@@ -207,17 +226,21 @@
               case "LineString":
               case "MultiLineString":
                 handler = OpenLayers.Handler.Path;
+                iconCls = "gx-featureediting-draw-line";
                 break;
               case "Point":
               case "MultiPoint":
                 handler = OpenLayers.Handler.Point;
+                iconCls = "gx-featureediting-draw-point";
                 break;
               case "Polygon":
               case "MultiPolygon":
                 handler = OpenLayers.Handler.Polygon;
+                iconCls = "gx-featureediting-draw-polygon";
                 break;
               case "Label":
                 handler = OpenLayers.Handler.Point;
+                iconCls = "gx-featureediting-draw-label";
                 break;
             }
 
@@ -239,9 +262,7 @@
                 scope: this
             });
 
-            action = new GeoExt.Action({
-                //iconCls: "todo",
-                text: geometryType,
+            actionOptions = {
                 control: control,
                 map: this.map,
                 // button options
@@ -252,8 +273,17 @@
                 // check item options
                 group: this.map.id,
                 checked: false
-            });
+            };
 
+            // use icons or text for the display
+            if(this.useIcons === true) {
+                actionOptions['iconCls'] = iconCls;
+            } else {
+                actionOptions['text'] = geometryType;
+            }
+
+            action = new GeoExt.Action(actionOptions);
+
             this.actions.push(action);
         }
     },
@@ -273,12 +303,19 @@
      *  and pushed to te actions array.
      */
     initDeleteAllAction: function() {
-        var action = new Ext.Action({
-            text: OpenLayers.i18n('DeleteAll'),
+        var actionOptions = {
             handler: this.deleteAllFeatures,
             scope: this
-        });
+        }
 
+        if(this.useIcons === true) {
+            actionOptions['iconCls'] = "gx-featureediting-delete";
+        } else {
+            actionOptions['text'] = OpenLayers.i18n('DeleteAll');
+        }
+
+        var action = new Ext.Action(actionOptions);
+
         this.deleteAllAction = action;
         this.actions.push(action);
     },
@@ -288,6 +325,11 @@
      *  Destroy all features from all layers.
      */
     deleteAllFeatures: function() {
+        if(this.popup) {
+            this.popup.close();
+            this.popup = null;
+        }
+
         for(var i=0; i<this.layers.length; i++) {
             this.layers[i].destroyFeatures();
         }
@@ -393,6 +435,7 @@
           autoSave: this.autoSave,
           features: [feature],
           controler: this,
+          useIcons: this.useIcons,
           plugins: [new GeoExt.ux.ExportFeature()]
 
         };
@@ -408,6 +451,7 @@
             items: [this.featurePanel]
         });
         feature.popup = popup;
+        this.popup = popup;
         popup.on({
             close: function() {
                 if(OpenLayers.Util.indexOf(this.controler.activeLayer.selectedFeatures, this.feature) > -1) {
@@ -445,6 +489,12 @@
             feature.popup = null;
         }
 
+        this.reactivateDrawControl();
+    },
+
+    /** private: methodreactivateDrawControl[]
+     */
+    reactivateDrawControl: function() {
         if(this.lastDrawControl && this.activeLayer.selectedFeatures.length == 0) {
             this.featureControl.deactivate();
             this.lastDrawControl.activate();
@@ -452,21 +502,6 @@
         }
     },
 
-    /** private: method[onFeatureUnselect]
-     *  :param event: ``event``
-     *  Close the popup linked to a feature if any.
-     */
-    onFeatureUnselect: function(event) {
-        var feature = (event.geometry) ? event : event.feature;
-
-        this.triggerAutoSave();
-
-        if(feature.popup){
-            feature.popup.close();
-            feature.popup = null;
-        }
-    },
-
     /** private: method[triggerAutoSave]
      */
     triggerAutoSave: function() {

Modified: sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeatureEditingPanel.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeatureEditingPanel.js	2010-01-18 16:07:37 UTC (rev 1768)
+++ sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeatureEditingPanel.js	2010-01-18 16:35:55 UTC (rev 1769)
@@ -90,6 +90,13 @@
      *  creating new OpenLayers.Layer.Vector objects.
      */
     styleMap: null,
+
+    /** private: property[useIcons]
+     *  ``Boolean``
+     *  If set to true, enables the use of image icons.  Must be combined with
+     *  a .css (see in resources/css).
+     */
+    useIcons: true,
     
     /** private: method[initComponent]
      */
@@ -125,7 +132,8 @@
         if(!this.controler){
             this.controler = new GeoExt.ux.FeatureEditingControler({
                 map: this.map,
-                autoSave: this.autoSave
+                autoSave: this.autoSave,
+                useIcons: this.useIcons
             });
         }
     },

Modified: sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeaturePanel.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeaturePanel.js	2010-01-18 16:07:37 UTC (rev 1768)
+++ sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeaturePanel.js	2010-01-18 16:35:55 UTC (rev 1769)
@@ -104,6 +104,13 @@
      */
     labelAttribute: "name",
 
+    /** private: property[useIcons]
+     *  ``Boolean``
+     *  If set to true, enables the use of image icons.  Must be combined with
+     *  a .css (see in resources/css).
+     */
+    useIcons: true,
+
     /** private: method[initComponent]
      */
     initComponent: function() {
@@ -186,12 +193,19 @@
      *  and pushed to te actions array.
      */
     initDeleteAction: function() {
-        var action = new Ext.Action({
-            text: OpenLayers.i18n('Delete'),
+        var actionOptions = {
             handler: this.deleteFeatures,
             scope: this
-        });
+        }
 
+        if(this.useIcons === true) {
+            actionOptions['iconCls'] = "gx-featureediting-delete";
+        } else {
+            actionOptions['text'] = OpenLayers.i18n('Delete');
+        }
+
+        var action = new Ext.Action(actionOptions);
+
         this.deleteAction = action;
     },
 
@@ -199,14 +213,18 @@
      *  Called when the deleteAction is triggered (button pressed).  
      *  Destroy all features from all layers.
      */
-    deleteFeatures: function(features) {
-        features = features || this.features;
+    deleteFeatures: function() {
+        for(var i=0; i<this.features.length; i++) {
+            var feature = this.features[i];
+            if(feature.popup){
+                feature.popup.close();
+                feature.popup = null;
+            }
 
-        for(var i=0; i<features.length; i++) {
-            features[i].layer.destroyFeatures([features[i]]);
+            feature.layer.destroyFeatures([feature]);
         }
 
-        this.features = [];
+        this.controler.reactivateDrawControl();
     },
 
     /** private: method[getActions]
@@ -247,7 +265,7 @@
             if(feature.attributes[this.labelAttribute] != "") {
                 feature.layer.drawFeature(feature); 
             } else {
-                this.deleteFeatures([feature]);
+                feature.layer.destroyFeatures([feature]);
             }
         }
     },

Modified: sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ExportFeature.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ExportFeature.js	2010-01-18 16:07:37 UTC (rev 1768)
+++ sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ExportFeature.js	2010-01-18 16:35:55 UTC (rev 1769)
@@ -7,11 +7,19 @@
     init: function(form) {
         this.controler = form.controler;
 
-        var action = new Ext.Action({
-            text: OpenLayers.i18n("Export"),
+        var actionOptions = {
             handler: this.exportFeatures,
             scope: this
-        });
+        }
+
+        if(this.controler.useIcons === true) {
+            actionOptions['iconCls'] = "gx-featureediting-export";
+        } else {
+            actionOptions['text'] = OpenLayers.i18n("Export");
+        }
+
+        var action = new Ext.Action(actionOptions);
+
         form.getBottomToolbar().add(action);
 
         this.editFeatureForm = form;

Modified: sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ExportFeatures.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ExportFeatures.js	2010-01-18 16:07:37 UTC (rev 1768)
+++ sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ExportFeatures.js	2010-01-18 16:35:55 UTC (rev 1769)
@@ -5,11 +5,18 @@
     init: function(form) {
         this.controler = form.controler;
 
-        var action = new Ext.Action({
-            text: OpenLayers.i18n("Export"),
+        var actionOptions = {
             handler: this.exportFeatures,
             scope: this
-        });
+        }
+
+        if(this.controler.useIcons === true) {
+            actionOptions['iconCls'] = "gx-featureediting-export";
+        } else {
+            actionOptions['text'] = OpenLayers.i18n("Export");
+        }
+
+        var action = new Ext.Action(actionOptions);
         form.getTopToolbar().add(action);
     },
 

Modified: sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ImportFeatures.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ImportFeatures.js	2010-01-18 16:07:37 UTC (rev 1768)
+++ sandbox/redlining/ux/FeatureEditing/ux/widgets/plugins/ImportFeatures.js	2010-01-18 16:35:55 UTC (rev 1769)
@@ -2,13 +2,24 @@
 
     layer: null,
 
+    controler: null,
+
     init: function(form) {
         this.layer = form.layer;
-        var action = new Ext.Action({
-            text: OpenLayers.i18n("Import"),
+        this.controler = form.controler;
+
+        var actionOptions = {
             handler: this.importFeatures,
             scope: this
-        });
+        };
+
+        if(this.controler.useIcons === true) {
+            actionOptions['iconCls'] = "gx-featureediting-import";
+        } else {
+            actionOptions['text'] = OpenLayers.i18n("Import");
+        }
+
+        var action = new Ext.Action(actionOptions);
         form.getTopToolbar().add(action);
     },
 



More information about the Commits mailing list