[Commits] r303 - apps/opengeo/geoexplorer/trunk/lib
commits at geoext.org
commits at geoext.org
Tue Mar 31 16:30:25 CEST 2009
Author: sbenthall
Date: 2009-03-31 16:30:25 +0200 (Tue, 31 Mar 2009)
New Revision: 303
Modified:
apps/opengeo/geoexplorer/trunk/lib/CapabilitiesGrid.js
apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js
Log:
CapabilitiesGrid now takes persisting GeoExplorer WMSStore. Also, some Natural
Docs.
Modified: apps/opengeo/geoexplorer/trunk/lib/CapabilitiesGrid.js
===================================================================
--- apps/opengeo/geoexplorer/trunk/lib/CapabilitiesGrid.js 2009-03-31 08:52:41 UTC (rev 302)
+++ apps/opengeo/geoexplorer/trunk/lib/CapabilitiesGrid.js 2009-03-31 14:30:25 UTC (rev 303)
@@ -1,14 +1,41 @@
+/**
+ * Class: CapabilitiesGrid
+ * Create a new grid displaying the WMS cabilities of a URL,
+ * or the contents of a <GeoExt.data.WMSCabilitiesStore>. The user can
+ * add layers to a passed in <GeoExt.MapPanel> from the grid.
+ *
+ * Extends:
+ * - <Ext.grid.GridPanel>
+ */
+/**
+ * Constructor: CapabilitiesGrid
+ * Creates a panel with a map inside it.
+ *
+ * Parameters:
+ * config - {Object} A config object. In addition to the config options
+ * of its parent class, this object can receive specific options,
+ * see the API properties to know about these specific options.
+ */
+
var CapabilitiesGrid = Ext.extend(Ext.grid.GridPanel, {
store: null,
cm: null,
+ /**
+ * APIProperty: mapPanel
+ * {<GeoExt.MapPanel>} A MapPanel to which layers can be added
+ * via this grid.
+ */
mapPanel : null,
- //this one is important; needs to be supplied
- //as configuration option
+ /**
+ * APIProperty: url
+ * {String} An OWS url to which the GetCapabilities request is sent.
+ * Necessary if a store is not passed in as a configuration option.
+ */
url: null,
height: 300,
@@ -16,13 +43,22 @@
autoExpandColumn: "description",
+ /**
+ * Method: initComponent
+ *
+ * Initializes the CapabilitiesGrid. Creates and loads a WMS
+ * Capabilities store from the url property if one is not passed as a
+ * configuration option.
+ */
initComponent: function(){
- this.store = new GeoExt.data.WMSCapabilitiesStore({
- url: this.url + "?service=wms&request=GetCapabilities"
- });
+ if(!this.store){
+ this.store = new GeoExt.data.WMSCapabilitiesStore({
+ url: this.url + "?service=wms&request=GetCapabilities"
+ });
- this.store.load();
+ this.store.load();
+ }
var expander = new Ext.grid.RowExpander({
tpl : new Ext.Template(
@@ -49,7 +85,11 @@
CapabilitiesGrid.superclass.initComponent.call(this);
},
-
+ /**
+ * Method: addLayer
+ *
+ * Adds a layer to the <GeoExt.MapPanel> of this instance.
+ */
addLayer : function(){
var sm = this.getSelectionModel();
Modified: apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js
===================================================================
--- apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js 2009-03-31 08:52:41 UTC (rev 302)
+++ apps/opengeo/geoexplorer/trunk/lib/GeoExplorer.js 2009-03-31 14:30:25 UTC (rev 303)
@@ -50,6 +50,10 @@
mapPanel: null,
/**
+ * Property: wmsStore
+ * {<GeoExt.data.WMSCapabilitiesStore>} A store of WMS Capabilities records from the url provided by configuration.
+
+ /**
* Property: toolbarItems
* {Array} An array containing toolbar items suitable for passing as a tbar: property
* on an Ext component
@@ -76,6 +80,7 @@
// create the layers store
this.initLayers();
+ this.initWMSStore();
this.initMapControls();
this.initToolbar();
@@ -210,6 +215,14 @@
this.layers.add(records);
},
+ initWMSStore: function(){
+ this.wmsStore = new GeoExt.data.WMSCapabilitiesStore({
+ url: this.ows + "?service=wms&request=GetCapabilities"
+ });
+
+ this.wmsStore.load();
+ },
+
showCapabilitiesGrid: function(){
var doneButton = new Ext.Button({
@@ -221,7 +234,7 @@
title: "Explore Data",
items: [
new CapabilitiesGrid({
- url : this.ows,
+ store : this.wmsStore,
mapPanel : this.mapPanel
})
],
More information about the Commits
mailing list