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

commits at geoext.org commits at geoext.org
Fri May 29 00:58:56 CEST 2009


Author: tschaub
Date: 2009-05-29 00:58:56 +0200 (Fri, 29 May 2009)
New Revision: 897

Modified:
   core/trunk/geoext/lib/GeoExt/data/LayerStore.js
Log:
Docs for LayerStore.

Modified: core/trunk/geoext/lib/GeoExt/data/LayerStore.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/data/LayerStore.js	2009-05-28 22:35:29 UTC (rev 896)
+++ core/trunk/geoext/lib/GeoExt/data/LayerStore.js	2009-05-28 22:58:56 UTC (rev 897)
@@ -9,69 +9,82 @@
  * @include GeoExt/data/LayerReader.js
  */
 
+/** api: (define)
+ *  module = GeoExt.data
+ *  class = LayerStore
+ *  base_link = `Ext.data.DataStore <http://extjs.com/deploy/dev/docs/?class=Ext.data.DataStore>`_
+ */
 Ext.namespace("GeoExt.data");
 
-/**
- * Class: GeoExt.data.LayerStoreMixin
- * A store that synchronizes a layers array of an {OpenLayers.Map} with a
- * layer store holding {<GeoExt.data.LayerRecord>} entries.
+/** private: constructor
+ *  .. class:: LayerStoreMixin
+ *      A store that synchronizes a layers array of an {OpenLayers.Map} with a
+ *      layer store holding {<GeoExt.data.LayerRecord>} entries.
  * 
- * This class can not be instantiated directly. Instead, it is meant to extend
- * {Ext.data.Store} or a subclass of it:
- * (start code)
- * var store = new (Ext.extend(Ext.data.Store, GeoExt.data.LayerStoreMixin))({
- *     map: myMap,
- *     layers: myLayers
- * });
- * (end)
+ *      This class can not be instantiated directly. Instead, it is meant to
+ *      extend ``Ext.data.Store`` or a subclass of it.
+ */
+
+/** private: example
+ *  Sample code to extend a store with the LayerStoreMixin.
+ *
+ *  .. code-block:: javascript
+ *  
+ *      var store = new (Ext.extend(Ext.data.Store, GeoExt.data.LayerStoreMixin))({
+ *          map: myMap,
+ *          layers: myLayers
+ *      });
  * 
- * For convenience, a {<GeoExt.data.LayerStore>} class is available as a
- * shortcut to the Ext.extend sequence in the above code snippet. The above
- * is equivalent to:
- * (start code)
- * var store = new GeoExt.data.LayerStore({
- *     map: myMap,
- *     layers: myLayers
- * });
- * (end)
+ *  For convenience, a :class:`GeoExt.data.LayerStore` class is available as a
+ *  shortcut to the ``Ext.extend`` sequence in the above code snippet.
  */
+
 GeoExt.data.LayerStoreMixin = {
-    /**
-     * APIProperty: map
-     * {OpenLayers.Map} Map that this store will be in sync with.
+
+    /** api: config[map]
+     *  ``OpenLayers.Map``
+     *  Map that this store will be in sync with.
      */
+    
+    /** api: property[map]
+     *  ``OpenLayers.Map``
+     *  Map that the store is synchronized with.
+     */
     map: null,
+    
+    /** api: config[layers]
+     *  ``Array(OpenLayers.Layer)``
+     *  Layers that will be added to the store (and the map, depending on the
+     *  value of the ``initDir`` option.
+     */
+    
+    /** api: config[initDir]
+     *  ``Number``
+     *  Bitfields specifying the direction to use for the initial sync between
+     *  the map and the store, if set to 0 then no initial sync is done.
+     *  Defaults to ``GeoExt.data.LayerStore.MAP_TO_STORE|GeoExt.data.LayerStore.STORE_TO_MAP``
+     */
 
-    /**
-     * APIProperty: reader
-     * {<GeoExt.data.LayerReader>} The reader used to get
-     *     <GeoExt.data.LayerRecord> objects from {OpenLayers.Layer}
-     *     objects.
+    /** api: config[fields]
+     *  ``Array``
+     *  If provided a custom layer record type with additional fields will be
+     *  used. Default fields for every layer record are `layer`
+     *  (``OpenLayers.Layer``) `title` (``String``). The value of this option is
+     *  either a field definition objects as passed to the
+     *  :meth:`GeoExt.data.LayerRecord.create` function or a
+     *  :class:`GeoExt.data.LayerRecord` constructor created using
+     *  :meth:`GeoExt.data.LayerRecord.create`.
      */
+
+    /** api: config[reader]
+     *  ``Ext.data.DataReader`` The reader used to produce
+     *  :class:`GeoExt.data.LayerRecord` objects from ``OpenLayers.Layer``
+     *  objects.  If not provided, a :class:`GeoExt.data.LayerReader` will be
+     *  used.
+     */
     reader: null,
 
-    /**
-     * Constructor: GeoExt.data.LayerStoreMixin
-     * 
-     * Parameters:
-     * config - {Object}
-     * 
-     * Valid config options:
-     * map - {OpenLayers.Map|<GeoExt.MapPanel>} map to sync the layer store
-     *     with.
-     * layers - {Array(OpenLayers.Layer)} Layers that will be added to the
-     *     store (and the map, depending on the value of the initDir option).
-     * fields - {Array} If provided a custom layer record type with additional
-     *     fields will be used. Default fields for every layer record are
-     *     {OpenLayers.Layer} layer and {String} title. The value of this
-     *     option is either a field definition objects as passed to the
-     *     GeoExt.data.LayerRecord.create function or a
-     *     {<GeoExt.data.LayerRecord>} constructor created using
-     *     GeoExt.data.LayerRecord.create.
-     * initDir - {Number} Bitfields specifying the direction to use for the
-     *     initial sync between the map and the store, if set to 0 then no
-     *     initial sync is done. Defaults to
-     *     <GeoExt.data.LayerStore.MAP_TO_STORE>|<GeoExt.data.LayerStore.STORE_TO_MAP>.
+    /** private: method[constructor]
      */
     constructor: function(config) {
         config = config || {};
@@ -96,20 +109,12 @@
         }
     },
 
-    /**
-     * APIMethod: bind
-     * Bind this store to a map instance, once bound the store
-     * is synchronized with the map and vice-versa.
-     * 
-     * Parameters:
-     * map - {OpenLayers.Map} The map instance.
-     * options - {Object}
-     *
-     * Valid config options:
-     * initDir - {Number} Bitfields specifying the direction to use for the
-     *     initial sync between the map and the store, if set to 0 then no
-     *     initial sync is done. Defaults to
-     *     <GeoExt.data.LayerStore.MAP_TO_STORE>|<GeoExt.data.LayerStore.STORE_TO_MAP>.
+    /** private: method[bind]
+     *  :param map: ``OpenLayers.Map`` The map instance.
+     *  :param options: ``Object``
+     *  
+     *  Bind this store to a map instance, once bound the store
+     *  is synchronized with the map and vice-versa.
      */
     bind: function(map, options) {
         if(this.map) {
@@ -157,9 +162,8 @@
         });
     },
 
-    /**
-     * APIMethod: unbind
-     * Unbind this store from the map it is currently bound.
+    /** private: method[unbind]
+     *  Unbind this store from the map it is currently bound.
      */
     unbind: function() {
         if(this.map) {
@@ -180,13 +184,11 @@
         }
     },
     
-    /**
-     * Method: onChangeLayer
-     * Handler for layer changes.  When layer order changes, this moves the
-     *     appropriate record within the store.
-     *
-     * Parameters:
-     * evt - {Object}
+    /** private: method[onChangeLayer]
+     *  :param evt: ``Object``
+     * 
+     *  Handler for layer changes.  When layer order changes, this moves the
+     *  appropriate record within the store.
      */
     onChangeLayer: function(evt) {
         var layer = evt.layer;
@@ -213,12 +215,10 @@
         }
     },
    
-    /**
-     * Method: onAddLayer
-     * Handler for a map's addlayer event
-     * 
-     * Parameters:
-     * evt - {Object}
+    /** private: method[onAddLayer]
+     *  :param evt: ``Object``
+     *  
+     *  Handler for a map's addlayer event
      */
     onAddLayer: function(evt) {
         if(!this._adding) {
@@ -229,12 +229,10 @@
         }
     },
     
-    /**
-     * Method: onRemoveLayer
-     * Handler for a map's removelayer event
+    /** private: method[onRemoveLayer]
+     *  :param evt: ``Object``
      * 
-     * Parameters:
-     * evt - {Object}
+     *  Handler for a map's removelayer event
      */
     onRemoveLayer: function(evt){
         if(!this._removing) {
@@ -245,14 +243,12 @@
         }
     },
     
-    /**
-     * Method: onLoad
-     * Handler for a store's 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 a store's load event
      */
     onLoad: function(store, records, options) {
         if (!Ext.isArray(records)) {
@@ -279,12 +275,10 @@
         }
     },
     
-    /**
-     * Method: onClear
-     * Handler for a store's clear event
+    /** private: method[onClear]
+     *  :param store: ``Ext.data.Store``
      * 
-     * Parameters:
-     * store - {<Ext.data.Store>}
+     *  Handler for a store's clear event
      */
     onClear: function(store) {
         this._removing = true;
@@ -294,14 +288,12 @@
         delete this._removing;
     },
     
-    /**
-     * Method: onAdd
-     * Handler for a store's 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 a store's add event
      */
     onAdd: function(store, records, index) {
         if(!this._adding) {
@@ -318,14 +310,12 @@
         }
     },
     
-    /**
-     * Method: onRemove
-     * Handler for a store's remove event
+    /** private: method[onRemove]
+     *  :param store: ``Ext.data.Store``
+     *  :param record: ``Ext.data.Record``
+     *  :param index: ``Number``
      * 
-     * Parameters:
-     * store - {<Ext.data.Store>}
-     * records - {Array(Ext.data.Record)}
-     * index - {Number}
+     *  Handler for a store's remove event
      */
     onRemove: function(store, record, index){
         if(!this._removing) {
@@ -338,47 +328,46 @@
         }
     },
 
-    /**
-     * Method: removeMapLayers
-     * Removes a record's layer from the bound map.
-     * 
-     * Parameters:
-     * record - {<Ext.data.Record>}
+    /** private: method[removeMapLayer]
+     *  :param record: ``Ext.data.Record``
+     *  
+     *  Removes a record's layer from the bound map.
      */
     removeMapLayer: function(record){
         this.map.removeLayer(record.get("layer"));
     },
 
-    /**
-     * Method: onReplace
-     * Handler for a store's data collections' replace event
-     * 
-     * Parameters:
-     * key - {String}
-     * oldRecord - {Object} In this case, a record that has been replaced.
-     * newRecord - {Object} In this case, a record that is replacing oldRecord.
+    /** private: method[onReplace]
+     *  :param key: ``String``
+     *  :param oldRecord: ``Object`` In this case, a record that has been
+     *      replaced.
+     *  :param newRecord: ``Object`` In this case, a record that is replacing
+     *      oldRecord.
+
+     *  Handler for a store's data collections' replace event
      */
     onReplace: function(key, oldRecord, newRecord){
         this.removeMapLayer(oldRecord);
     }
 };
 
-/**
- * Class: GeoExt.data.LayerStore
- * Default implementation of an {Ext.data.Store} extended with
- * {<GeoExt.data.LayerStoreMixin>}
- * 
- * Inherits from:
- * - {Ext.data.Store}
- * - {<GeoExt.data.LayerStoreMixin>}
+/** api: example
+ *  Sample to create a new store containing a cache of
+ *  :class:`GeoExt.data.LayerRecord` instances derived from map layers.
+ *
+ *  .. code-block:: javascript
+ *  
+ *      var store = new GeoExt.data.LayerStore({
+ *          map: myMap,
+ *          layers: myLayers
+ *      });
  */
-/**
- * Constructor: GeoExt.data.LayerStore
- * 
- * Parameters:
- * config - {Object} See {<GeoExt.data.LayerStoreMixin>} and 
- * http://extjs.com/deploy/dev/docs/?class=Ext.data.Store for valid config
- *     options. 
+
+/** api: constructor
+ *  .. class:: LayerStore
+ *
+ *      A store that contains a cache of :class:`GeoExt.data.LayerRecord`
+ *      objects.
  */
 GeoExt.data.LayerStore = Ext.extend(
     Ext.data.Store,



More information about the Commits mailing list