[Commits] r1726 - in sandbox/redlining/ux/FeatureEditing/ux/widgets: . form

commits at geoext.org commits at geoext.org
Tue Jan 12 20:12:42 CET 2010


Author: adube
Date: 2010-01-12 20:12:42 +0100 (Tue, 12 Jan 2010)
New Revision: 1726

Modified:
   sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js
   sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeaturePanel.js
Log:
blank attributes automatically added

Modified: sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js	2010-01-12 19:10:17 UTC (rev 1725)
+++ sandbox/redlining/ux/FeatureEditing/ux/widgets/FeatureEditingControler.js	2010-01-12 19:12:42 UTC (rev 1726)
@@ -379,9 +379,9 @@
         // display the popup
         var popup = new GeoExt.Popup({
             feature: feature,
-            width: 200,
             title: 'EditFeature',
             controler: this,
+                    layout: 'fit',
             items: [featurePanel]
         });
         feature.popup = popup;

Modified: sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeaturePanel.js
===================================================================
--- sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeaturePanel.js	2010-01-12 19:10:17 UTC (rev 1725)
+++ sandbox/redlining/ux/FeatureEditing/ux/widgets/form/FeaturePanel.js	2010-01-12 19:12:42 UTC (rev 1726)
@@ -20,11 +20,51 @@
  */
 GeoExt.ux.form.FeaturePanel = Ext.extend(Ext.form.FormPanel, {
 
+    /** api: config[labelWidth]
+     *  ``Number``  Default value.
+     */
+    labelWidth: 100,
+
     /** api: config[border]
      *  ``Boolean``  Default value.
      */
     border: false,
 
+    /** api: config[bodyStyle]
+     *  ``String``  Default value.
+     */
+    bodyStyle:'padding:5px 5px 5px 5px',
+
+    /** api: config[width]
+     *  ``String``  Default value.
+     */
+    width: 'auto',
+
+    /** api: config[autoWidth]
+     *  ``Boolean``  Default value.
+     */
+    autoWidth: true,
+
+    /** api: config[height]
+     *  ``String``  Default value.
+     */
+    height: 'auto',
+
+    /** api: config[autoHeight]
+     *  ``Boolean``  Default value.
+     */
+    autoHeight: true,
+
+    /** api: config[defaults]
+     *  ``Object``  Default value.
+     */
+    defaults: {width: 120},
+
+    /** api: config[defaultType]
+     *  ``String``  Default value.
+     */
+    defaultType: 'textfield',
+
     /** private: property[features]
      *  ``OpenLayers.Feature.Vector`` The feature currently being edited
      */
@@ -85,14 +125,36 @@
      *  Create field options and link them to the controler controls and actions
      */
     initForm: function() {
+        var oItems, oGroup, feature, field, oGroupItems;
+
+        // todo : for multiple features selection support, remove this...
+        if(this.features.length != 1) {
+            return;
+        } else {
+            feature = this.features[0];
+        }
         oItems = [];
-        oItems.push({
-              id: "featurepanel_id2",
-                    fieldLabel: "myOption",
-                    maxLength: 50,
-                    xtype: "checkbox"
-                });
+        oGroupItems = [];
+        oGroup = {
+            xtype: 'fieldset',
+            title: 'Attributes',
+            layout: 'form',
+            collapsible: true,
+            autoHeight: this.autoHeight,
+            autoWidth: this.autoWidth,
+            defaults: this.defaults,
+            defaultType: this.defaultType
+        };
 
+        for(var attribute in feature.attributes) {
+            field = {'name': attribute, 'fieldLabel': attribute};
+            oGroupItems.push(field);
+        }
+
+        oGroup.items = oGroupItems;
+
+        oItems.push(oGroup);
+
         Ext.apply(this, {items: oItems});
     },
 



More information about the Commits mailing list