[Commits] r2287 - in sandbox/redlining: ux/FeatureEditing/examples ux/FeatureEditing/resources/lang ux/FeatureEditing/ux ux/FeatureEditing/ux/data ux/FeatureEditing/ux/util ux/FeatureEditing/ux/widgets ux/FeatureEditing/ux/widgets/form ux_externals

commits at geoext.org commits at geoext.org
Fri Aug 27 15:59:00 CEST 2010


Author: adube
Date: 2010-08-27 15:59:00 +0200 (Fri, 27 Aug 2010)
New Revision: 2287

Added:
   sandbox/redlining/ux/FeatureEditing/ux/data/
   sandbox/redlining/ux/FeatureEditing/ux/data/FeatureEditingDefaultStyleStore.js
   sandbox/redlining/ux/FeatureEditing/ux/util/
   sandbox/redlining/ux/FeatureEditing/ux/util/Clone.js
Modified:
   sandbox/redlining/ux/FeatureEditing/examples/ControlerOnlyExample.html
   sandbox/redlining/ux/FeatureEditing/examples/ControlerOnlyExample.js
   sandbox/redlining/ux/FeatureEditing/resources/lang/fr.js
   sandbox/redlining/ux/FeatureEditing/ux/FeatureEditing.js
   sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js
   sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeaturePanel.js
   sandbox/redlining/ux_externals/
Log:
RedLining - combobox styler support added

Modified: sandbox/redlining/ux/FeatureEditing/examples/ControlerOnlyExample.html
===================================================================
--- sandbox/redlining/ux/FeatureEditing/examples/ControlerOnlyExample.html	2010-08-27 13:39:20 UTC (rev 2286)
+++ sandbox/redlining/ux/FeatureEditing/examples/ControlerOnlyExample.html	2010-08-27 13:59:00 UTC (rev 2287)
@@ -2,6 +2,7 @@
     <head>
         <title>ControlerOnly Example</title>
         <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+
         <script type="text/javascript" src="http://extjs.cachefly.net/ext-3.0.0/adapter/ext/ext-base.js"></script>
         <script type="text/javascript" src="http://extjs.cachefly.net/ext-3.0.0/ext-all.js"></script>
         <link rel="stylesheet" type="text/css" href="http://extjs.cachefly.net/ext-3.0.0/resources/css/ext-all.css" />
@@ -11,16 +12,21 @@
         <script type="text/javascript" src="../resources/lang/fr.js"></script>
         <script type="text/javascript" src="../../../trunk/geoext/lib/GeoExt.js"></script>
 
-        <script type="text/javascript" src="http://dev.geoext.org/sandbox/cmoullet/ux/LayerManager/ux/downloadify/js/swfobject.js"></script>
-        <script type="text/javascript" src="http://dev.geoext.org/sandbox/cmoullet/ux/LayerManager/ux/downloadify/js/downloadify.min.js"></script>
-        <script type="text/javascript" src="http://dev.geoext.org/sandbox/cmoullet/ux/LayerManager/ux/utils/flash.js"></script>
-        <script type="text/javascript" src="http://dev.geoext.org/sandbox/cmoullet/ux/LayerManager/ux/data/FormatStore.js"></script>
-        <script type="text/javascript" src="http://dev.geoext.org/sandbox/cmoullet/ux/LayerManager/ux/data/Export.js"></script>
-        <script type="text/javascript" src="http://dev.geoext.org/sandbox/cmoullet/ux/LayerManager/ux/data/Import.js"></script>
-        <script type="text/javascript" src="http://dev.geoext.org/sandbox/cmoullet/ux/LayerManager/ux/widgets/LayerManagerExportPanel.js"></script>
-        <script type="text/javascript" src="http://dev.geoext.org/sandbox/cmoullet/ux/LayerManager/ux/widgets/LayerManagerImportPanel.js"></script>
-        <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>
+        <script type="text/javascript">OpenLayers.Lang.setCode('fr');</script>
+
+        <script type="text/javascript" src="../../../ux_externals/layermanager/ux/downloadify/js/swfobject.js"></script>
+        <script type="text/javascript" src="../../../ux_externals/layermanager/ux/downloadify/js/downloadify.min.js"></script>
+        <script type="text/javascript" src="../../../ux_externals/layermanager/ux/utils/flash.js"></script>
+        <script type="text/javascript" src="../../../ux_externals/layermanager/ux/data/FormatStore.js"></script>
+        <script type="text/javascript" src="../../../ux_externals/layermanager/ux/data/Export.js"></script>
+        <script type="text/javascript" src="../../../ux_externals/layermanager/ux/data/Import.js"></script>
+        <script type="text/javascript" src="../../../ux_externals/layermanager/ux/widgets/LayerManagerExportPanel.js"></script>
+        <script type="text/javascript" src="../../../ux_externals/layermanager/ux/widgets/LayerManagerImportPanel.js"></script>
+        <script type="text/javascript" src="../../../ux_externals/layermanager/ux/widgets/LayerManagerWindow.js"></script>
+        <script type="text/javascript" src="../../../ux_externals/layermanager/ux/widgets/LayerManagerExportWindow.js"></script>
+
+        <script type="text/javascript" src="../../../ux_externals/styler/ux/LayerStyleManager.js"></script>
+        <script type="text/javascript" src="../../../ux_externals/styler/ux/widgets/StyleSelectorComboBox.js"></script>
         
         <link rel="stylesheet" type="text/css" href="../resources/css/feature-editing.css" />
         <script type="text/javascript" src="../ux/FeatureEditing.js"></script>

Modified: sandbox/redlining/ux/FeatureEditing/examples/ControlerOnlyExample.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/examples/ControlerOnlyExample.js	2010-08-27 13:39:20 UTC (rev 2286)
+++ sandbox/redlining/ux/FeatureEditing/examples/ControlerOnlyExample.js	2010-08-27 13:59:00 UTC (rev 2287)
@@ -16,6 +16,7 @@
     controler = new GeoExt.ux.FeatureEditingControler({
         'cosmetic': true,
         map: mapPanel.map,
+        styler: 'combobox',
         popupOptions: {anchored: false, unpinnable: false, draggable: true}
     });
     

Modified: sandbox/redlining/ux/FeatureEditing/resources/lang/fr.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/resources/lang/fr.js	2010-08-27 13:39:20 UTC (rev 2286)
+++ sandbox/redlining/ux/FeatureEditing/resources/lang/fr.js	2010-08-27 13:59:00 UTC (rev 2287)
@@ -25,5 +25,31 @@
     'Delete All Features': 'Supprimer Tous Les Objets',
     'Do you really want to delete all features ?': 'Voulez-vous vraiment supprimer tous les objets ?',
     'RedLining Panel': 'Outil de dessin',
-    'Close': 'Fermer'
+    'Close': 'Fermer',
+    'Style': 'Style',
+    'color': 'couleur',
+    'select a color...': 'couleur...',
+
+     /* colors for styler */
+    'blue': 'bleu',
+    'red': 'rouge',
+    'green': 'vert',
+    'yellow': 'jaune',
+    'orange': 'orange',
+    'purple': 'violet',
+    'white': 'blanc',
+    'black': 'noir',
+    'gray': 'gris',
+    'pink': 'rose',
+    'brown': 'brun',
+    'cyan': 'cyan',
+    'lime': 'lime',
+    'indigo': 'indigo',
+    'magenta': 'magenta',
+    'maroon': 'maron',
+    'olive': 'olive',
+    'plum': 'prune',
+    'salmon': 'saumon',
+    'gold': 'or',
+    'silver': 'argent'
 });

Modified: sandbox/redlining/ux/FeatureEditing/ux/FeatureEditing.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/FeatureEditing.js	2010-08-27 13:39:20 UTC (rev 2286)
+++ sandbox/redlining/ux/FeatureEditing/ux/FeatureEditing.js	2010-08-27 13:59:00 UTC (rev 2287)
@@ -56,6 +56,8 @@
         "widgets/form/FeatureEditingPanel.js",
         "widgets/form/RedLiningPanel.js",
         "widgets/form/FeaturePanel.js",
+        "data/FeatureEditingDefaultStyleStore.js",
+        "util/Clone.js",
 
         "widgets/plugins/ImportFeatures.js",
         "widgets/plugins/ExportFeatures.js",

Added: sandbox/redlining/ux/FeatureEditing/ux/data/FeatureEditingDefaultStyleStore.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/data/FeatureEditingDefaultStyleStore.js	                        (rev 0)
+++ sandbox/redlining/ux/FeatureEditing/ux/data/FeatureEditingDefaultStyleStore.js	2010-08-27 13:59:00 UTC (rev 2287)
@@ -0,0 +1,28 @@
+Ext.namespace("GeoExt.ux.data");
+
+GeoExt.ux.data.FeatureEditingDefaultStyleStoreOptions = {
+    fields: ['name', 'style'],
+    data: [
+        [OpenLayers.i18n('blue'), {fillColor: 'blue', strokeColor: 'blue'}], 
+        [OpenLayers.i18n('red'), {fillColor: 'red', strokeColor: 'red'}], 
+        [OpenLayers.i18n('green'), {fillColor: 'green', strokeColor: 'green'}], 
+        [OpenLayers.i18n('yellow'), {fillColor: 'yellow', strokeColor: 'yellow'}],
+        [OpenLayers.i18n('orange'), {fillColor: 'orange', strokeColor: 'orange'}],
+        [OpenLayers.i18n('purple'), {fillColor: 'purple', strokeColor: 'purple'}],
+        [OpenLayers.i18n('white'), {fillColor: 'white', strokeColor: 'white'}],
+        [OpenLayers.i18n('black'), {fillColor: 'black', strokeColor: 'black'}],
+        [OpenLayers.i18n('gray'), {fillColor: 'gray', strokeColor: 'gray'}],
+        [OpenLayers.i18n('pink'), {fillColor: 'pink', strokeColor: 'pink'}],
+        [OpenLayers.i18n('brown'), {fillColor: 'brown', strokeColor: 'brown'}],
+        [OpenLayers.i18n('cyan'), {fillColor: 'cyan', strokeColor: 'cyan'}],
+        [OpenLayers.i18n('lime'), {fillColor: 'lime', strokeColor: 'lime'}],
+        [OpenLayers.i18n('indigo'), {fillColor: 'indigo', strokeColor: 'indigo'}],
+        [OpenLayers.i18n('magenta'), {fillColor: 'magenta', strokeColor: 'magenta'}],
+        [OpenLayers.i18n('maroon'), {fillColor: 'maroon', strokeColor: 'maroon'}],
+        [OpenLayers.i18n('olive'), {fillColor: 'olive', strokeColor: 'olive'}],
+        [OpenLayers.i18n('plum'), {fillColor: 'plum', strokeColor: 'plum'}],
+        [OpenLayers.i18n('salmon'), {fillColor: 'salmon', strokeColor: 'salmon'}],
+        [OpenLayers.i18n('gold'), {fillColor: 'gold', strokeColor: 'gold'}],
+        [OpenLayers.i18n('silver'), {fillColor: 'silver', strokeColor: 'silver'}]
+    ]
+};

Added: sandbox/redlining/ux/FeatureEditing/ux/util/Clone.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/util/Clone.js	                        (rev 0)
+++ sandbox/redlining/ux/FeatureEditing/ux/util/Clone.js	2010-08-27 13:59:00 UTC (rev 2287)
@@ -0,0 +1,30 @@
+Ext.namespace("Ext.ux.util");
+
+/**
+ * Clone Function
+ * @param {Object/Array} o Object or array to clone
+ * @return {Object/Array} Deep clone of an object or an array
+ * @author Ing. Jozef Sakáloš
+ */
+Ext.ux.util.clone = function(o) {
+    if(!o || 'object' !== typeof o) {
+        return o;
+    }
+    if('function' === typeof o.clone) {
+        return o.clone();
+    }
+    var c = '[object Array]' === Object.prototype.toString.call(o) ? [] : {};
+    var p, v;
+    for(p in o) {
+        if(o.hasOwnProperty(p)) {
+            v = o[p];
+            if(v && 'object' === typeof v) {
+                c[p] = Ext.ux.util.clone(v);
+            }
+            else {
+                c[p] = v;
+            }
+        }
+    }
+    return c;
+}; // eo function clone  

Modified: sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js	2010-08-27 13:39:20 UTC (rev 2286)
+++ sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js	2010-08-27 13:59:00 UTC (rev 2287)
@@ -225,6 +225,12 @@
      */
     selectControlOptions: {},
 
+    /** api: property[styler]
+     *  ``Styler``
+     *  The styler type to use in the FeaturePanel widget.
+     */
+    styler: null,
+
     /** private: method[constructor]
      *  Private constructor override.
      */
@@ -683,7 +689,8 @@
             autoSave: this.autoSave,
             features: [feature],
             controler: this,
-            useIcons: this.useIcons
+            useIcons: this.useIcons,
+            styler: this.styler
         };
 
         if(this['export'] === true) {

Modified: sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeaturePanel.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeaturePanel.js	2010-08-27 13:39:20 UTC (rev 2286)
+++ sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeaturePanel.js	2010-08-27 13:59:00 UTC (rev 2287)
@@ -115,12 +115,19 @@
      */
     useIcons: true,
 
+    /** api: property[styler]
+     *  ``Styler``
+     *  The styler type to use.  Possible values are :
+     *  - 'combobox', refering to the 'GeoExt.ux.StyleSelectorComboBox' type
+     */
+    styler: null,
+
     /** private: method[initComponent]
      */
     initComponent: function() {
         this.initFeatures(this.features);
         this.initToolbar();
-        this.initForm();
+        this.initMyItems();
 
         //this.on("afterrender", this.onAfterRender, this);
 
@@ -149,10 +156,11 @@
         Ext.apply(this, {bbar: new Ext.Toolbar(this.getActions())});
     },
 
-    /** private: method[initForm]
+    /** private: method[initMyItems]
      *  Create field options and link them to the controler controls and actions
+     *  and a styler (if one was defined in the 'styler' property)
      */
-    initForm: function() {
+    initMyItems: function() {
         var oItems, oGroup, feature, field, oGroupItems;
 
         // todo : for multiple features selection support, remove this...
@@ -189,6 +197,45 @@
 
         oItems.push(oGroup);
 
+        switch (this.styler)
+        {
+          case "combobox":
+
+            if (!GeoExt.ux.LayerStyleManager) {
+                break;
+            }
+
+            var styleStore = new Ext.data.SimpleStore(Ext.ux.util.clone(
+                GeoExt.ux.data.FeatureEditingDefaultStyleStoreOptions));
+            styleStore.sort('name');
+            var styler = new GeoExt.ux.LayerStyleManager(
+                new GeoExt.ux.StyleSelectorComboBox({
+                    store: styleStore,
+                    comboBoxOptions: {
+                        emptyText: OpenLayers.i18n("select a color..."),
+                        fieldLabel: OpenLayers.i18n('color')
+                    }
+            }), {});
+
+            oGroup = {
+                xtype: 'fieldset',
+                title: OpenLayers.i18n('Style'),
+                layout: 'form',
+                collapsible: true,
+                autoHeight: this.autoHeight,
+                autoWidth: this.autoWidth,
+                defaults: this.defaults,
+                defaultType: this.defaultType,
+                items: [styler.createLayout().comboBox]
+            };
+
+            oItems.push(oGroup);
+
+            styler.setCurrentFeature(this.features[0]);
+
+            break;
+        }
+
         Ext.apply(this, {items: oItems});
     },
 


Property changes on: sandbox/redlining/ux_externals
___________________________________________________________________
Name: svn:externals
   - styler http://svn.geoext.org/sandbox/styler/ux/Styler/

   + styler http://svn.geoext.org/sandbox/styler/ux/Styler/
layermanager http://svn.geoext.org/sandbox/cmoullet/ux/LayerManager/




More information about the Commits mailing list