[Commits] r222 - sandbox/opengeo/alachua/lib/GeoExt/data
commits at geoext.org
commits at geoext.org
Fri Mar 13 19:58:51 CET 2009
Author: sbenthall
Date: 2009-03-13 19:58:51 +0100 (Fri, 13 Mar 2009)
New Revision: 222
Modified:
sandbox/opengeo/alachua/lib/GeoExt/data/FeatureStore.js
Log:
Updating FeatureStore with bind and unbind methods from
sandbox/elemoine/playground/lib/GeoExt/data/FeatureStore.js
Modified: sandbox/opengeo/alachua/lib/GeoExt/data/FeatureStore.js
===================================================================
--- sandbox/opengeo/alachua/lib/GeoExt/data/FeatureStore.js 2009-03-13 18:56:37 UTC (rev 221)
+++ sandbox/opengeo/alachua/lib/GeoExt/data/FeatureStore.js 2009-03-13 18:58:51 UTC (rev 222)
@@ -64,8 +64,10 @@
config, config.fields
)
})
- );
+ );
+ this.mediators = {};
};
+
Ext.extend(GeoExt.data.FeatureStore, Ext.data.Store, {
/**
* APIProperty: fields
@@ -73,5 +75,42 @@
* Ext.data.Record.create, or a Record constructor created using
* Ext.data.Record.create.
*/
- fields: null
+ fields: null,
+
+ /**
+ * Property: mediators
+ * {Object} An object mapping layer identifiers to
+ * {<GeoExt.data.LayerStoreMediator>} instances.
+ */
+ mediators: null,
+
+ /**
+ * Method: bind
+ * Bind a layer to this store.
+ *
+ * Parameters:
+ * layer - {OpenLayers.Layer.Vector} A vector layer instance.
+ */
+ bind: function(layer) {
+ if(!this.mediators[layer.id]) {
+ this.mediators[layer.id] = new GeoExt.data.LayerStoreMediator(
+ {layer: layer, store: this}
+ );
+ } else {
+ this.mediators[layer.id].activate();
+ }
+ },
+
+ /**
+ * Method: unbind
+ * Unbind a layer from this store.
+ *
+ * Parameters:
+ * layer - {OpenLayers.Layer.Vector} A vector layer instance.
+ */
+ unbind: function(layer) {
+ if(this.mediators[layer.id]) {
+ this.mediators[layer.id].deactivate();
+ }
+ }
});
More information about the Commits
mailing list