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

« back to all changes in this revision

Viewing changes to gis/dhis-gis-geostat/mfbase/mapfish/widgets/toolbar/MenuItem.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.toolbar');
 
21
 
 
22
/**
 
23
 * Class: mapfish.widgets.toolbar.MenuItem
 
24
 * A Menu item is associated with an OpenLayers Control of type BUTTON and will call trigger on it.
 
25
 * This class also add quicktips.
 
26
 *
 
27
 * Simple example usage:
 
28
 * (start code)
 
29
 * var menuItem = new mapfish.widgets.toolbar.MenuItem({
 
30
 *     text: 'My menu item',
 
31
 *     tooltip: 'My tooltip', 
 
32
 *     icon: 'lib/openlayers/theme/default/img/icon_roi_feature.png',
 
33
 *     control: new OpenLayers.Control.ROISelect({map: map})
 
34
 * });
 
35
 * (end)
 
36
 *
 
37
 * Inherits from:
 
38
 * - {Ext.menu.Item}
 
39
 */
 
40
 
 
41
/**
 
42
 * Constructor: mapfish.widgets.toolbar.MenuItem
 
43
 * Create a new MenuItem.
 
44
 *
 
45
 * Parameters:
 
46
 * config - {Object} Config object
 
47
 */
 
48
 
 
49
mapfish.widgets.toolbar.MenuItem = function(config) {
 
50
    Ext.apply(this, config);
 
51
    mapfish.widgets.toolbar.MenuItem.superclass.constructor.call(this);
 
52
};
 
53
 
 
54
Ext.extend(mapfish.widgets.toolbar.MenuItem, Ext.menu.Item, {
 
55
 
 
56
    // private
 
57
    initComponent: function() {
 
58
        mapfish.widgets.toolbar.MenuItem.superclass.initComponent.call(this);
 
59
        Ext.QuickTips.init();
 
60
        if (this.control) {
 
61
            this.scope = this;
 
62
            this.handler = function() { this.control.trigger(); };
 
63
        }
 
64
    },
 
65
 
 
66
    // private
 
67
    onRender : function(container, position) {
 
68
        mapfish.widgets.toolbar.MenuItem.superclass.onRender.apply(this, arguments);
 
69
        if (this.tooltip) {
 
70
            this.el.dom.qtip = this.tooltip;
 
71
        }
 
72
    }
 
73
});
 
74
Ext.reg('menuitem', mapfish.widgets.toolbar.MenuItem);