[Commits] r543 - core/trunk/geoext/lib/GeoExt/data

commits at geoext.org commits at geoext.org
Thu Apr 30 07:05:48 CEST 2009


Author: tschaub
Date: 2009-04-30 07:05:48 +0200 (Thu, 30 Apr 2009)
New Revision: 543

Modified:
   core/trunk/geoext/lib/GeoExt/data/FeatureReader.js
   core/trunk/geoext/lib/GeoExt/data/FeatureRecord.js
   core/trunk/geoext/lib/GeoExt/data/FeatureStore.js
Log:
Docs for FeatureStore and tweaks for others (see #53).

Modified: core/trunk/geoext/lib/GeoExt/data/FeatureReader.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/data/FeatureReader.js	2009-04-30 03:58:20 UTC (rev 542)
+++ core/trunk/geoext/lib/GeoExt/data/FeatureReader.js	2009-04-30 05:05:48 UTC (rev 543)
@@ -24,7 +24,7 @@
 /** jst: (define)
  *  module = GeoExt.data
  *  class = FeatureReader
- *  base_link = `Ext.data.DataReader <http://localhost/projects/gx/trunk/ext/docs/?class=Ext.data.DataReader>`_
+ *  base_link = `Ext.data.DataReader <http://extjs.com/deploy/dev/docs/?class=Ext.data.DataReader>`_
  */
 Ext.namespace('GeoExt', 'GeoExt.data');
 
@@ -69,31 +69,26 @@
     totalRecords: null,
 
     /** private: method[read]
-     *  .. method:: FeatureReader.read(response)
-     *  
-     *      :param response: ``OpenLayers.Protocol.Response``
-     *      :return: ``Object`` An object with two properties. The value of the
-     *          ``records`` property is the array of records corresponding to
-     *          the features. The value of the ``totalRecords" property is the
-     *          number of records in the array.
+     *  :param response: ``OpenLayers.Protocol.Response``
+     *  :return: ``Object`` An object with two properties. The value of the
+     *      ``records`` property is the array of records corresponding to
+     *      the features. The value of the ``totalRecords" property is the
+     *      number of records in the array.
      *      
-     *      This method is only used by a DataProxy which has retrieved data.
-     *
+     *  This method is only used by a DataProxy which has retrieved data.
      */
     read: function(response) {
         return this.readRecords(response.features);
     },
 
     /** jst: method[readReacords]
-     *  .. method:: FeatureReader.readRecords(features)
+     *  :param features: ``Array(OpenLayers.Feature.Vector)`` List of
+     *      features for creating records
+     *  :return: ``Object``  An object with ``records`` and ``totalRecords``
+     *      properties.
      *  
-     *      :param features: ``Array(OpenLayers.Feature.Vector)`` List of
-     *          features for creating records
-     *      :return: ``Object``  An object with ``records`` and ``totalRecords``
-     *          properties.
-     *       
-     *      Create a data block containing :class:`GeoExt.data.FeatureRecord`
-     *      objects from an array of features.
+     *  Create a data block containing :class:`GeoExt.data.FeatureRecord`
+     *  objects from an array of features.
      */
     readRecords : function(features) {
         var records = [];

Modified: core/trunk/geoext/lib/GeoExt/data/FeatureRecord.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/data/FeatureRecord.js	2009-04-30 03:58:20 UTC (rev 542)
+++ core/trunk/geoext/lib/GeoExt/data/FeatureRecord.js	2009-04-30 05:05:48 UTC (rev 543)
@@ -8,7 +8,7 @@
 /** jst: (define)
  *  module = GeoExt.data
  *  class = FeatureRecord
- *  base_link = `Ext.data.Record <http://localhost/projects/gx/trunk/ext/docs/?class=Ext.data.Record>`_
+ *  base_link = `Ext.data.Record <http://extjs.com/deploy/dev/docs/?class=Ext.data.Record>`_
  */
 Ext.namespace("GeoExt.data");
 

Modified: core/trunk/geoext/lib/GeoExt/data/FeatureStore.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/data/FeatureStore.js	2009-04-30 03:58:20 UTC (rev 542)
+++ core/trunk/geoext/lib/GeoExt/data/FeatureStore.js	2009-04-30 05:05:48 UTC (rev 543)
@@ -9,8 +9,31 @@
  * @include GeoExt/data/FeatureReader.js
  */
 
+/** jst: (define)
+ *  module = GeoExt.data
+ *  class = FeatureStore
+ *  base_link = `Ext.data.DataStore <http://extjs.com/deploy/dev/docs/?class=Ext.data.DataStore>`_
+ */
 Ext.namespace("GeoExt.data");
 
+/** jst: constructor
+ *  .. class:: FeatureStore
+ *
+ *      A store containing :class:`GeoExt.data.FeatureRecord` entries that
+ *      optionally synchronizes with an ``OpenLayers.Layer.Vector``.
+ */
+
+/** jst: example
+ *  Sample code to create a store with features from a vector layer:
+ *  
+ *  .. code-block:: javascript
+ *
+ *      var store = new GeoExt.data.FeatureStore({
+ *          layer: myLayer,
+ *          features: myFeatures
+ *      });
+ */
+
 /**
  * Class: GeoExt.data.FeatureStoreMixin
  * A store that synchronizes a features array of an {OpenLayers.Layer.Vector} with a
@@ -36,59 +59,45 @@
  * (end)
  */
 GeoExt.data.FeatureStoreMixin = {
-    /**
-     * APIProperty: layer
-     * {OpenLayers.Layer.Vector} Layer that this store will be in sync with.
+    
+    /** jst: config[layer]
+     *  ``OpenLayers.Layer.Vector``  Layer to synchronize the store with.
      */
     layer: null,
+    
+    /** jst: config[features]
+     *  ``Array(OpenLayers.Feature.Vector)``  Features that will be added to the
+     *  store (and the layer if provided).
+     */
 
-    /**
-     * Property: reader
-     * {<GeoExt.data.FeatureReader>} The reader used to get
-     *     <GeoExt.data.FeatureRecord> objects from {OpenLayers.Feature.Vector}
-     *     objects.
+    /** jst: config[reader]
+     *  ``Ext.data.DataReader`` The reader used to produce records from objects
+     *  features.  Default is :class:`GeoExt.data.FeatureReader`.
      */
     reader: null,
 
-    /**
-     * APIProperty: addFeatureFilter
-     * {Function} This function is called before a feature record is added to
-     *     the store, it receives the feature from which a feature record is
-     *     to be created, if it returns false then no record is added.
+    /** jst: config[addFeatureFilter]
+     *  ``Function`` This function is called before a feature record is added to
+     *  the store, it receives the feature from which a feature record is to be
+     *  created, if it returns false then no record is added.
      */
     addFeatureFilter: null,
     
-    /**
-     * APIProperty: addRecordFilter
-     * {Function} This function is called before a feature is added to the
-     *     layer, it receives the feature record associated with the feature
-     *     to be added, if it returns false then no feature is added.
+    /** jst: config[addRecordFilter]
+     *  ``Function`` This function is called before a feature is added to the
+     *  layer, it receives the feature record associated with the feature to be
+     *  added, if it returns false then no feature is added.
      */
     addRecordFilter: null,
-
-    /**
-     * Constructor: GeoExt.data.FeatureStoreMixin
-     * 
-     * Parameters:
-     * config - {Object}
-     * 
-     * Valid config options:
-     * layer - {OpenLayers.Layer.Vector} layer to sync the feature store with.
-     * features - {Array(OpenLayers.Feature.Vector)} Features that will be added to the
-     *     feature store (and the layer, because we are already syncing).
-     * fields - {Array} If provided, a custom feature record type with additional fields
-     *     will be used. Default fields for every feature record are
-     *     {OpenLayers.Feature.Vector} feature, {String} state and
-     *     {Number|String} fid. The value of this option is either an array of
-     *     field definition objects as passed to the
-     *     GeoExt.data.FeatureRecord.create function or a
-     *     {<GeoExt.data.FeatureRecord>} constructor created using
-     *     GeoExt.data.FeatureRecord.create.
-     * initDir - {Number} Bitfields specifying the direction to use for the
-     *     initial sync between the layer and the store, if set to 0 then no
-     *     initial sync is done. Defaults to
-     *     <GeoExt.data.FeatureStore.LAYER_TO_STORE>|<GeoExt.data.FeatureStore.STORE_TO_LAYER>.
+    
+    /** jst: config[initDir]
+     *  ``Number``  Bitfields specifying the direction to use for the
+     *  initial sync between the layer and the store, if set to 0 then no
+     *  initial sync is done. Default is
+     *  ``GeoExt.data.FeatureStore.LAYER_TO_STORE|GeoExt.data.FeatureStore.STORE_TO_LAYER``.
      */
+
+    /** private */
     constructor: function(config) {
         config = config || {};
         config.reader = config.reader ||
@@ -109,21 +118,13 @@
         }
     },
 
-    /**
-     * APIMethod: bind
-     * Bind this store to a layer instance, once bound the store
-     * is synchronized with the layer and vice-versa.
-     * 
-     * Parameters:
-     * layer - {OpenLayers.Layer.Vector} The layer instance.
-     * options - {Object}
-     *
-     * Valid config options:
-     * initDir - {Number} Bitfields specifying the direction to use for the
-     *     initial sync between the layer and the store, if set to 0 then no
-     *     initial sync is done. Defaults to
-     *     <GeoExt.data.FeatureStore.LAYER_TO_STORE>|<GeoExt.data.FeatureStore.STORE_TO_LAYER>.
-     */
+    /** jst: method[bind]
+     *  :param layer: ``OpenLayers.Layer`` Layer that the store should be
+     *      synchronized with.
+     *  
+     *  Bind this store to a layer instance, once bound the store
+     *  is synchronized with the layer and vice-versa.
+     */ 
     bind: function(layer, options) {
         if(this.layer) {
             // already bound
@@ -168,9 +169,8 @@
         });
     },
 
-    /**
-     * APIMethod: unbind
-     * Unbind this store from the layer it is currently bound.
+    /** jst: method[unbind]
+     *  Unbind this store from the layer it is currently bound.
      */
     unbind: function() {
         if(this.layer) {
@@ -191,12 +191,8 @@
     },
    
    
-    /**
-     * Method: onFeaturesAdded
-     * Handler for layer featuresadded event
-     * 
-     * Parameters:
-     * evt - {Object}
+    /** private: method[onFeaturesAdded]
+     *  Handler for layer featuresadded event
      */
     onFeaturesAdded: function(evt) {
         if(!this._adding) {
@@ -220,12 +216,8 @@
         }
     },
     
-    /**
-     * Method: onFeaturesRemoved
-     * Handler for layer featuresremoved event
-     * 
-     * Parameters:
-     * evt - {Object}
+    /** private: method[onFeaturesRemoved]
+     *  Handler for layer featuresremoved event
      */
     onFeaturesRemoved: function(evt){
         if(!this._removing) {
@@ -242,12 +234,8 @@
         }
     },
 
-    /**
-     * Method: onFeatureModified
-     * Handler for layer featuremodified event
-     *
-     * Parameters:
-     * evt - {Object}
+    /** private: method[onFeatureModified]
+     *  Handler for layer featuremodified event
      */
     onFeatureModified: function(evt) {
         if(!this._updating) {
@@ -280,13 +268,9 @@
         }
     },
 
-    /**
-     * Method: addFeaturesToLayer
-     * Given an array of records add features to the layer. This
-     * function is used by the onLoad and onAdd handlers.
-     *
-     * Parameters:
-     * records - {Array(Ext.data.Record)}
+    /** private: method[addFeaturesToLayer]
+     *  Given an array of records add features to the layer. This
+     *  function is used by the onLoad and onAdd handlers.
      */
     addFeaturesToLayer: function(records) {
         var i, len, features, record;
@@ -311,14 +295,12 @@
         }
     },
    
-    /**
-     * Method: onLoad
-     * Handler for store load event
+    /** private: method[onLoad]
+     *  :param store: ``Ext.data.Store``
+     *  :param records: ``Array(Ext.data.Record)``
+     *  :param options: ``Object``
      * 
-     * Parameters:
-     * store - {Ext.data.Store}
-     * records - {Array(Ext.data.Record)}
-     * options - {Object}
+     *  Handler for store load event
      */
     onLoad: function(store, records, options) {
         // if options.add is true an "add" event was already
@@ -333,12 +315,10 @@
         }
     },
     
-    /**
-     * Method: onClear
-     * Handler for store clear event
-     * 
-     * Parameters:
-     * store - {Ext.data.Store}
+    /** private: method[onClear]
+     *  :param store: ``Ext.data.Store``
+     *      
+     *  Handler for store clear event
      */
     onClear: function(store) {
         this._removing = true;
@@ -346,14 +326,12 @@
         delete this._removing;
     },
     
-    /**
-     * Method: onAdd
-     * Handler for store add event
+    /** private: method[onAdd]
+     *  :param store: ``Ext.data.Store``
+     *  :param records: ``Array(Ext.data.Record)``
+     *  :param index: ``Number``
      * 
-     * Parameters:
-     * store - {Ext.data.Store}
-     * records - {Array(Ext.data.Record)}
-     * index - {Number}
+     *  Handler for store add event
      */
     onAdd: function(store, records, index) {
         if(!this._adding) {
@@ -363,14 +341,12 @@
         }
     },
     
-    /**
-     * Method: onRemove
-     * Handler for store remove event
-     * 
-     * Parameters:
-     * store - {Ext.data.Store}
-     * records - {Array(Ext.data.Record)}
-     * index - {Number}
+    /** private: method[onRemove]
+     *  :param store: ``Ext.data.Store``
+     *  :param records: ``Array(Ext.data.Record)``
+     *  :param index: ``Number``
+     *      
+     *  Handler for store remove event
      */
     onRemove: function(store, record, index){
         if(!this._removing) {
@@ -383,14 +359,12 @@
         }
     },
 
-    /**
-     * Method: onUpdate
-     * Handler for store update event
+    /** private: method[onUpdate]
+     *  :param store: ``Ext.data.Store``
+     *  :param record: ``Ext.data.Record``
+     *  :param operation: ``String``
      *
-     * Parameters:
-     * store - {Ext.data.Store}
-     * record - (Ext.data.Record)}
-     * operation - {String}
+     *  Handler for update.
      */
     onUpdate: function(store, record, operation) {
         if(!this._updating) {
@@ -420,23 +394,6 @@
     }
 };
 
-/**
- * Class: GeoExt.data.FeatureStore
- * Default implementation of an {Ext.data.Store} extended with
- * {<GeoExt.data.FeatureStoreMixin>}
- * 
- * Inherits from:
- * - {Ext.data.Store}
- * - {<GeoExt.data.FeatureStoreMixin>}
- */
-/**
- * Constructor: GeoExt.data.FeatureStore
- * 
- * Parameters:
- * config - {Object} See {<GeoExt.data.FeatureStoreMixin>} and 
- * http://extjs.com/deploy/dev/docs/?class=Ext.data.Store for valid config
- *     options. 
- */
 GeoExt.data.FeatureStore = Ext.extend(
     Ext.data.Store,
     GeoExt.data.FeatureStoreMixin



More information about the Commits mailing list