[Commits] r993 - in apps/opengeo/geoexplorer/branches/0.1.x: . lib lib/Ext lib/Ext/grid lib/GeoExplorer theme

commits at geoext.org commits at geoext.org
Fri Jun 5 00:50:37 CEST 2009


Author: tschaub
Date: 2009-06-05 00:50:37 +0200 (Fri, 05 Jun 2009)
New Revision: 993

Added:
   apps/opengeo/geoexplorer/branches/0.1.x/lib/Ext/
   apps/opengeo/geoexplorer/branches/0.1.x/lib/Ext/grid/
   apps/opengeo/geoexplorer/branches/0.1.x/lib/Ext/grid/RowExpander.js
   apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer/CapabilitiesGrid.js
Removed:
   apps/opengeo/geoexplorer/branches/0.1.x/lib/CapabilitiesGrid.js
   apps/opengeo/geoexplorer/branches/0.1.x/lib/RowExpander.js
Modified:
   apps/opengeo/geoexplorer/branches/0.1.x/debug.html
   apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer.js
   apps/opengeo/geoexplorer/branches/0.1.x/theme/geoexplorer.css
Log:
Copy moves from trunk.

Modified: apps/opengeo/geoexplorer/branches/0.1.x/debug.html
===================================================================
--- apps/opengeo/geoexplorer/branches/0.1.x/debug.html	2009-06-04 22:10:46 UTC (rev 992)
+++ apps/opengeo/geoexplorer/branches/0.1.x/debug.html	2009-06-04 22:50:37 UTC (rev 993)
@@ -25,8 +25,8 @@
 
         <script type="text/javascript" src="lib/GeoExplorer.js"></script> 
         <script type="text/javascript" src="lib/GeoExplorer/util.js"></script> 
-        <script type="text/javascript" src="lib/RowExpander.js"></script> 
-        <script type="text/javascript" src="lib/CapabilitiesGrid.js"></script> 
+        <script type="text/javascript" src="lib/Ext/grid/RowExpander.js"></script> 
+        <script type="text/javascript" src="lib/GeoExplorer/CapabilitiesGrid.js"></script> 
 
         <script>
             Ext.BLANK_IMAGE_URL = "theme/img/blank.gif";

Deleted: apps/opengeo/geoexplorer/branches/0.1.x/lib/CapabilitiesGrid.js
===================================================================
--- apps/opengeo/geoexplorer/branches/0.1.x/lib/CapabilitiesGrid.js	2009-06-04 22:10:46 UTC (rev 992)
+++ apps/opengeo/geoexplorer/branches/0.1.x/lib/CapabilitiesGrid.js	2009-06-04 22:50:37 UTC (rev 993)
@@ -1,120 +0,0 @@
-/**
- * Copyright (c) 2008 The Open Planning Project
- *
- * Requires RowExpander.js from Ext examples
- */
-
-/**
- * Class: CapabilitiesGrid
- * Create a new grid displaying the WMS cabilities of a URL,
- *     or the contents of a <GeoExt.data.WMSCapabilitiesStore>.  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,
-
-    /**
-     * 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,
-
-    autoExpandColumn: "title",
-
-    /**
-     * 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(){
-
-        if(!this.store){
-            this.store = new GeoExt.data.WMSCapabilitiesStore({
-                url: this.url + "?service=wms&request=GetCapabilities"
-            });
-
-            this.store.load();
-        }
-
-        var expander = new Ext.grid.RowExpander({
-            tpl : new Ext.Template(
-                '<p><b>Abstract:</b> {abstract}</p>'
-            )
-        });
-
-        this.plugins = expander;
-
-        this.cm = new Ext.grid.ColumnModel([
-            expander,
-            {header: "Name", dataIndex: "name", width: 180, sortable: true},
-            {id: "title", header: "Title", dataIndex: "title", sortable: true},
-            {header: "Queryable", dataIndex: "queryable"}
-        ]);
-
-        CapabilitiesGrid.superclass.initComponent.call(this);       
-    },
-
-    /**
-     * Method: addLayers
-     * 
-     * Adds a layer to the <GeoExt.MapPanel> of this instance.
-     */    
-    addLayers : function(){
-
-        var sm = this.getSelectionModel();
-
-        //for now just use the first selected record
-        //TODO: force single selection (until we allow
-        //adding group layers)
-        var records = sm.getSelections();
-        
-        var record, layer;
-        for(var i = 0; i < records.length; i++){
-            record = records[i].copy(++Ext.data.Record.AUTO_ID);
-            /*
-             * TODO: deal with srs and maxExtent
-             * At this point, we need to think about SRS if we want the layer to
-             * have a maxExtent.  For our app, we are dealing with EPSG:4326
-             * only.  This will have to be made more generic for apps that use
-             * other srs.
-             */
-            layer = record.get("layer");
-            layer.restrictedExtent = OpenLayers.Bounds.fromArray(record.get("llbbox"));
-
-            if (this.alignToGrid) {
-                layer.maxExtent = new OpenLayers.Bounds(-180, -90, 180, 90);
-            } else {
-                layer.maxExtent = layer.restrictedExtent;
-            } 
-            this.mapPanel.layers.add(record);
-        }
-
-    }
-});

Copied: apps/opengeo/geoexplorer/branches/0.1.x/lib/Ext/grid/RowExpander.js (from rev 984, apps/opengeo/geoexplorer/branches/0.1.x/lib/RowExpander.js)
===================================================================
--- apps/opengeo/geoexplorer/branches/0.1.x/lib/Ext/grid/RowExpander.js	                        (rev 0)
+++ apps/opengeo/geoexplorer/branches/0.1.x/lib/Ext/grid/RowExpander.js	2009-06-04 22:50:37 UTC (rev 993)
@@ -0,0 +1,136 @@
+/*
+ * Ext JS Library 2.2.1
+ * Copyright(c) 2006-2009, Ext JS, LLC.
+ * licensing at extjs.com
+ * 
+ * http://extjs.com/license
+ */
+
+Ext.grid.RowExpander = function(config){
+    Ext.apply(this, config);
+
+    this.addEvents({
+        beforeexpand : true,
+        expand: true,
+        beforecollapse: true,
+        collapse: true
+    });
+
+    Ext.grid.RowExpander.superclass.constructor.call(this);
+
+    if(this.tpl){
+        if(typeof this.tpl == 'string'){
+            this.tpl = new Ext.Template(this.tpl);
+        }
+        this.tpl.compile();
+    }
+
+    this.state = {};
+    this.bodyContent = {};
+};
+
+Ext.extend(Ext.grid.RowExpander, Ext.util.Observable, {
+    header: "",
+    width: 20,
+    sortable: false,
+    fixed:true,
+    menuDisabled:true,
+    dataIndex: '',
+    id: 'expander',
+    lazyRender : true,
+    enableCaching: true,
+
+    getRowClass : function(record, rowIndex, p, ds){
+        p.cols = p.cols-1;
+        var content = this.bodyContent[record.id];
+        if(!content && !this.lazyRender){
+            content = this.getBodyContent(record, rowIndex);
+        }
+        if(content){
+            p.body = content;
+        }
+        return this.state[record.id] ? 'x-grid3-row-expanded' : 'x-grid3-row-collapsed';
+    },
+
+    init : function(grid){
+        this.grid = grid;
+
+        var view = grid.getView();
+        view.getRowClass = this.getRowClass.createDelegate(this);
+
+        view.enableRowBody = true;
+
+        grid.on('render', function(){
+            view.mainBody.on('mousedown', this.onMouseDown, this);
+        }, this);
+    },
+
+    getBodyContent : function(record, index){
+        if(!this.enableCaching){
+            return this.tpl.apply(record.data);
+        }
+        var content = this.bodyContent[record.id];
+        if(!content){
+            content = this.tpl.apply(record.data);
+            this.bodyContent[record.id] = content;
+        }
+        return content;
+    },
+
+    onMouseDown : function(e, t){
+        if(t.className == 'x-grid3-row-expander'){
+            e.stopEvent();
+            var row = e.getTarget('.x-grid3-row');
+            this.toggleRow(row);
+        }
+    },
+
+    renderer : function(v, p, record){
+        p.cellAttr = 'rowspan="2"';
+        return '<div class="x-grid3-row-expander">&#160;</div>';
+    },
+
+    beforeExpand : function(record, body, rowIndex){
+        if(this.fireEvent('beforeexpand', this, record, body, rowIndex) !== false){
+            if(this.tpl && this.lazyRender){
+                body.innerHTML = this.getBodyContent(record, rowIndex);
+            }
+            return true;
+        }else{
+            return false;
+        }
+    },
+
+    toggleRow : function(row){
+        if(typeof row == 'number'){
+            row = this.grid.view.getRow(row);
+        }
+        this[Ext.fly(row).hasClass('x-grid3-row-collapsed') ? 'expandRow' : 'collapseRow'](row);
+    },
+
+    expandRow : function(row){
+        if(typeof row == 'number'){
+            row = this.grid.view.getRow(row);
+        }
+        var record = this.grid.store.getAt(row.rowIndex);
+        var body = Ext.DomQuery.selectNode('tr:nth(2) div.x-grid3-row-body', row);
+        if(this.beforeExpand(record, body, row.rowIndex)){
+            this.state[record.id] = true;
+            Ext.fly(row).replaceClass('x-grid3-row-collapsed', 'x-grid3-row-expanded');
+            this.fireEvent('expand', this, record, body, row.rowIndex);
+        }
+    },
+
+    collapseRow : function(row){
+        if(typeof row == 'number'){
+            row = this.grid.view.getRow(row);
+        }
+        var record = this.grid.store.getAt(row.rowIndex);
+        var body = Ext.fly(row).child('tr:nth(1) div.x-grid3-row-body', true);
+        if(this.fireEvent('beforecollapse', this, record, body, row.rowIndex) !== false){
+            this.state[record.id] = false;
+            Ext.fly(row).replaceClass('x-grid3-row-expanded', 'x-grid3-row-collapsed');
+            this.fireEvent('collapse', this, record, body, row.rowIndex);
+        }
+    }
+});


Property changes on: apps/opengeo/geoexplorer/branches/0.1.x/lib/Ext/grid/RowExpander.js
___________________________________________________________________
Name: svn:mergeinfo
   + 

Copied: apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer/CapabilitiesGrid.js (from rev 984, apps/opengeo/geoexplorer/branches/0.1.x/lib/CapabilitiesGrid.js)
===================================================================
--- apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer/CapabilitiesGrid.js	                        (rev 0)
+++ apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer/CapabilitiesGrid.js	2009-06-04 22:50:37 UTC (rev 993)
@@ -0,0 +1,123 @@
+/**
+ * Copyright (c) 2008 The Open Planning Project
+ *
+ */
+
+/*
+ * @requires Ext/grid/RowExpander.js
+ */
+
+/**
+ * api: (define)
+ * module = GeoExplorer
+ * class = CapabilitiesGrid(config)
+ * extends = Ext.grid.GridPanel
+ */
+
+/** api: constructor
+ * ..class:: CapabilitiesGrid(config)
+ * :param: config: A configuration :class:`Object`
+ *
+ * Create a new grid displaying the WMS cabilities of a URL, or the contents of 
+ * a :class:`GeoExt.data.WMSCapabilitiesStore`\ .  The user can add layers to a
+ * passed-in :class:`GeoExt.MapPanel` from the grid.
+ */
+
+Ext.namespace("GeoExplorer");
+GeoExplorer.CapabilitiesGrid = Ext.extend(Ext.grid.GridPanel, {
+
+    store: null,
+
+    cm: null,
+
+    /**
+     * api: property[mapPanel]
+     * A :class:`GeoExt.MapPanel` to which layers can be added via this grid.
+     */
+    mapPanel : null,
+
+    /** api: property[url]
+     * A :class:`String` containing an OWS URL to which the GetCapabilities 
+     * request is sent.  Necessary if a store is not passed in as a 
+     * configuration option.
+     */
+    url: null,
+
+    autoExpandColumn: "title",
+
+    /** api: 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(){
+
+        if(!this.store){
+            this.store = new GeoExt.data.WMSCapabilitiesStore({
+                url: this.url + "?service=wms&request=GetCapabilities"
+            });
+
+            this.store.load();
+        }
+
+        var expander = new Ext.grid.RowExpander({
+            tpl : new Ext.Template(
+                '<p><b>Abstract:</b> {abstract}</p>')});
+
+        this.plugins = expander;
+
+        this.cm = new Ext.grid.ColumnModel([
+            expander,
+            {header: "Name", dataIndex: "name", width: 180, sortable: true},
+            {id: "title", header: "Title", dataIndex: "title", sortable: true},
+            {header: "Queryable", dataIndex: "queryable"}
+        ]);
+
+        GeoExplorer.CapabilitiesGrid.superclass.initComponent.call(this);       
+    },
+
+    /** api: method[addLayers]
+     * :param: base: a boolean indicating whether or not to make the new layer 
+     *     a base layer.
+     * 
+     * Adds a layer to the :class:`GeoExt.MapPanel` of this instance.
+     */    
+    addLayers : function(base){
+
+        var sm = this.getSelectionModel();
+
+        //for now just use the first selected record
+        //TODO: force single selection (until we allow
+        //adding group layers)
+        var records = sm.getSelections();
+        
+        var record, layer;
+        for(var i = 0; i < records.length; i++){
+            Ext.data.Record.AUTO_ID++;
+            record = records[i].copy(Ext.data.Record.AUTO_ID);
+
+            layer = record.get("layer").clone();
+            record.set("layer", null); //need to do this because record.set compares String(value) to determine equality (dumb)
+            record.set("layer", layer);
+
+            /*
+             * TODO: deal with srs and maxExtent
+             * At this point, we need to think about SRS if we want the layer to
+             * have a maxExtent.  For our app, we are dealing with EPSG:4326
+             * only.  This will have to be made more generic for apps that use
+             * other srs.
+             */
+            layer.restrictedExtent = OpenLayers.Bounds.fromArray(record.get("llbbox"));
+
+            if (this.alignToGrid) {
+                layer.maxExtent = new OpenLayers.Bounds(-180, -90, 180, 90);
+            } else {
+                layer.maxExtent = layer.restrictedExtent;
+            } 
+
+            this.mapPanel.layers.add(record);
+        }
+
+    }
+});


Property changes on: apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer/CapabilitiesGrid.js
___________________________________________________________________
Name: svn:mergeinfo
   + 

Modified: apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer.js
===================================================================
--- apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer.js	2009-06-04 22:10:46 UTC (rev 992)
+++ apps/opengeo/geoexplorer/branches/0.1.x/lib/GeoExplorer.js	2009-06-04 22:50:37 UTC (rev 993)
@@ -317,7 +317,7 @@
             autoScroll: true,
             ascending: false,
             map: this.map,
-            childDefaults: {border: false, cls: 'legend-title'}
+            defaults: {cls: 'legend-item'}
         });
 
         var westPanel = new Ext.Panel({
@@ -433,7 +433,7 @@
      */
     initCapGrid: function(){
 
-        var capGridPanel = new CapabilitiesGrid({
+        var capGridPanel = new GeoExplorer.CapabilitiesGrid({
             store: this.capabilities,
             mapPanel : this.mapPanel,
             layout: 'fit',

Deleted: apps/opengeo/geoexplorer/branches/0.1.x/lib/RowExpander.js
===================================================================
--- apps/opengeo/geoexplorer/branches/0.1.x/lib/RowExpander.js	2009-06-04 22:10:46 UTC (rev 992)
+++ apps/opengeo/geoexplorer/branches/0.1.x/lib/RowExpander.js	2009-06-04 22:50:37 UTC (rev 993)
@@ -1,136 +0,0 @@
-/*
- * Ext JS Library 2.2.1
- * Copyright(c) 2006-2009, Ext JS, LLC.
- * licensing at extjs.com
- * 
- * http://extjs.com/license
- */
-
-Ext.grid.RowExpander = function(config){
-    Ext.apply(this, config);
-
-    this.addEvents({
-        beforeexpand : true,
-        expand: true,
-        beforecollapse: true,
-        collapse: true
-    });
-
-    Ext.grid.RowExpander.superclass.constructor.call(this);
-
-    if(this.tpl){
-        if(typeof this.tpl == 'string'){
-            this.tpl = new Ext.Template(this.tpl);
-        }
-        this.tpl.compile();
-    }
-
-    this.state = {};
-    this.bodyContent = {};
-};
-
-Ext.extend(Ext.grid.RowExpander, Ext.util.Observable, {
-    header: "",
-    width: 20,
-    sortable: false,
-    fixed:true,
-    menuDisabled:true,
-    dataIndex: '',
-    id: 'expander',
-    lazyRender : true,
-    enableCaching: true,
-
-    getRowClass : function(record, rowIndex, p, ds){
-        p.cols = p.cols-1;
-        var content = this.bodyContent[record.id];
-        if(!content && !this.lazyRender){
-            content = this.getBodyContent(record, rowIndex);
-        }
-        if(content){
-            p.body = content;
-        }
-        return this.state[record.id] ? 'x-grid3-row-expanded' : 'x-grid3-row-collapsed';
-    },
-
-    init : function(grid){
-        this.grid = grid;
-
-        var view = grid.getView();
-        view.getRowClass = this.getRowClass.createDelegate(this);
-
-        view.enableRowBody = true;
-
-        grid.on('render', function(){
-            view.mainBody.on('mousedown', this.onMouseDown, this);
-        }, this);
-    },
-
-    getBodyContent : function(record, index){
-        if(!this.enableCaching){
-            return this.tpl.apply(record.data);
-        }
-        var content = this.bodyContent[record.id];
-        if(!content){
-            content = this.tpl.apply(record.data);
-            this.bodyContent[record.id] = content;
-        }
-        return content;
-    },
-
-    onMouseDown : function(e, t){
-        if(t.className == 'x-grid3-row-expander'){
-            e.stopEvent();
-            var row = e.getTarget('.x-grid3-row');
-            this.toggleRow(row);
-        }
-    },
-
-    renderer : function(v, p, record){
-        p.cellAttr = 'rowspan="2"';
-        return '<div class="x-grid3-row-expander">&#160;</div>';
-    },
-
-    beforeExpand : function(record, body, rowIndex){
-        if(this.fireEvent('beforeexpand', this, record, body, rowIndex) !== false){
-            if(this.tpl && this.lazyRender){
-                body.innerHTML = this.getBodyContent(record, rowIndex);
-            }
-            return true;
-        }else{
-            return false;
-        }
-    },
-
-    toggleRow : function(row){
-        if(typeof row == 'number'){
-            row = this.grid.view.getRow(row);
-        }
-        this[Ext.fly(row).hasClass('x-grid3-row-collapsed') ? 'expandRow' : 'collapseRow'](row);
-    },
-
-    expandRow : function(row){
-        if(typeof row == 'number'){
-            row = this.grid.view.getRow(row);
-        }
-        var record = this.grid.store.getAt(row.rowIndex);
-        var body = Ext.DomQuery.selectNode('tr:nth(2) div.x-grid3-row-body', row);
-        if(this.beforeExpand(record, body, row.rowIndex)){
-            this.state[record.id] = true;
-            Ext.fly(row).replaceClass('x-grid3-row-collapsed', 'x-grid3-row-expanded');
-            this.fireEvent('expand', this, record, body, row.rowIndex);
-        }
-    },
-
-    collapseRow : function(row){
-        if(typeof row == 'number'){
-            row = this.grid.view.getRow(row);
-        }
-        var record = this.grid.store.getAt(row.rowIndex);
-        var body = Ext.fly(row).child('tr:nth(1) div.x-grid3-row-body', true);
-        if(this.fireEvent('beforecollapse', this, record, body, row.rowIndex) !== false){
-            this.state[record.id] = false;
-            Ext.fly(row).replaceClass('x-grid3-row-expanded', 'x-grid3-row-collapsed');
-            this.fireEvent('collapse', this, record, body, row.rowIndex);
-        }
-    }
-});

Modified: apps/opengeo/geoexplorer/branches/0.1.x/theme/geoexplorer.css
===================================================================
--- apps/opengeo/geoexplorer/branches/0.1.x/theme/geoexplorer.css	2009-06-04 22:10:46 UTC (rev 992)
+++ apps/opengeo/geoexplorer/branches/0.1.x/theme/geoexplorer.css	2009-06-04 22:50:37 UTC (rev 993)
@@ -75,11 +75,11 @@
     background-image: url(img/geosilk/pan.png);
 }
 
-.legend-title label {
-    font-family: tahoma,arial,verdana,sans-serif;
+.legend-item {
+    margin: 0.5em 10px;
+}
+.legend-item label {
     font-size: 11px;
-    margin-top: 1em;
-    margin-left: 20px; /* Default GS legend swatch size */
     font-weight: bold;
 }
 



More information about the Commits mailing list