~mortenoh/+junk/dhis2-detailed-import-export

« back to all changes in this revision

Viewing changes to gis/dhis-gis-geostat/mfbase/mapfish/widgets/MapComponent.js

  • Committer: larshelge at gmail
  • Date: 2009-03-03 16:46:36 UTC
  • Revision ID: larshelge@gmail.com-20090303164636-2sjlrquo7ib1gf7r
Initial check-in

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2007-2008  Camptocamp
 
3
 *
 
4
 * This file is part of MapFish Client
 
5
 *
 
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.
 
10
 *
 
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.
 
15
 *
 
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/>.
 
18
 */
 
19
 
 
20
Ext.namespace('mapfish.widgets');
 
21
 
 
22
/**
 
23
 * Class: mapfish.widgets.MapComponent
 
24
 *
 
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
 
27
 *
 
28
 * Simple example usage:
 
29
 * > var mapcomponent = new mapfish.widgets.MapComponent({map: map});
 
30
 *
 
31
 * Inherits from:
 
32
 * - {Ext.Panel}
 
33
 */
 
34
 
 
35
/*
 
36
 * Constructor: mapfish.widgets.MapComponent
 
37
 * Create a new MapComponent.
 
38
 *
 
39
 * Parameters:
 
40
 * config - {Object} The config object
 
41
 */
 
42
mapfish.widgets.MapComponent = function(config) {
 
43
    Ext.apply(this, config);
 
44
    this.contentEl = this.map.div;
 
45
 
 
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%');
 
52
    
 
53
    mapfish.widgets.MapComponent.superclass.constructor.call(this);
 
54
};
 
55
 
 
56
Ext.extend(mapfish.widgets.MapComponent, Ext.Panel, {
 
57
    /**
 
58
     * Property: map
 
59
     * {OpenLayers.Map}  
 
60
     */
 
61
    map: null,
 
62
 
 
63
    initComponent: function() {
 
64
        mapfish.widgets.MapComponent.superclass.initComponent.apply(this, arguments);
 
65
        this.on("bodyresize", this.map.updateSize, this.map);
 
66
    }
 
67
});
 
68
Ext.reg('mapcomponent', mapfish.widgets.MapComponent);