2
* Copyright (C) 2007-2008 Camptocamp
4
* This file is part of MapFish Client
6
* MapFish Client is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
11
* MapFish Client is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with MapFish Client. If not, see <http://www.gnu.org/licenses/>.
20
Ext.namespace('mapfish.widgets');
23
* Class: mapfish.widgets.MapComponent
25
* A map container in order to be able to insert a map into a complex layout
26
* Its main interest is to update the map size when the container is resized
28
* Simple example usage:
29
* > var mapcomponent = new mapfish.widgets.MapComponent({map: map});
36
* Constructor: mapfish.widgets.MapComponent
37
* Create a new MapComponent.
40
* config - {Object} The config object
42
mapfish.widgets.MapComponent = function(config) {
43
Ext.apply(this, config);
44
this.contentEl = this.map.div;
46
// Set the map container height and width to avoid css
47
// bug in standard mode.
48
// See https://trac.mapfish.org/trac/mapfish/ticket/85
49
var content = Ext.get(this.contentEl);
50
content.setStyle('width', '100%');
51
content.setStyle('height', '100%');
53
mapfish.widgets.MapComponent.superclass.constructor.call(this);
56
Ext.extend(mapfish.widgets.MapComponent, Ext.Panel, {
63
initComponent: function() {
64
mapfish.widgets.MapComponent.superclass.initComponent.apply(this, arguments);
65
this.on("bodyresize", this.map.updateSize, this.map);
68
Ext.reg('mapcomponent', mapfish.widgets.MapComponent);