source:
trunk/workshop-routing-foss4g/web/GeoExt/lib/GeoExt/widgets/UrlLegend.js
@
76
Revision 76, 1.5 KB checked in by djay, 12 years ago (diff) | |
---|---|
|
Rev | Line | |
---|---|---|
[76] | 1 | /** |
2 | * Copyright (c) 2008-2010 The Open Source Geospatial Foundation | |
3 | * | |
4 | * Published under the BSD license. | |
5 | * See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text | |
6 | * of the license. | |
7 | */ | |
8 | ||
9 | /** | |
10 | * @include GeoExt/widgets/LegendImage.js | |
11 | * @requires GeoExt/widgets/LayerLegend.js | |
12 | */ | |
13 | ||
14 | /** api: (define) | |
15 | * module = GeoExt | |
16 | * class = UrlLegend | |
17 | */ | |
18 | ||
19 | /** api: (extends) | |
20 | * GeoExt/widgets/LayerLegend.js | |
21 | */ | |
22 | ||
23 | Ext.namespace('GeoExt'); | |
24 | ||
25 | /** api: constructor | |
26 | * .. class:: UrlLegend(config) | |
27 | * | |
28 | * Show a legend image in a BoxComponent and make sure load errors are | |
29 | * dealt with. | |
30 | */ | |
31 | GeoExt.UrlLegend = Ext.extend(GeoExt.LayerLegend, { | |
32 | ||
33 | /** private: method[initComponent] | |
34 | * Initializes the legend image component. | |
35 | */ | |
36 | initComponent: function() { | |
37 | GeoExt.UrlLegend.superclass.initComponent.call(this); | |
38 | this.add(new GeoExt.LegendImage({ | |
39 | url: this.layerRecord.get("legendURL") | |
40 | })); | |
41 | }, | |
42 | ||
43 | /** private: method[update] | |
44 | * Private override | |
45 | */ | |
46 | update: function() { | |
47 | GeoExt.UrlLegend.superclass.update.apply(this, arguments); | |
48 | this.items.get(1).setUrl(this.layerRecord.get("legendURL")); | |
49 | } | |
50 | ||
51 | }); | |
52 | ||
53 | /** private: method[supports] | |
54 | * Private override | |
55 | */ | |
56 | GeoExt.UrlLegend.supports = function(layerRecord) { | |
57 | return layerRecord.get("legendURL") != null; | |
58 | }; | |
59 | ||
60 | /** api: legendtype = gx_urllegend */ | |
61 | GeoExt.LayerLegend.types["gx_urllegend"] = GeoExt.UrlLegend; | |
62 | ||
63 | /** api: xtype = gx_urllegend */ | |
64 | Ext.reg('gx_urllegend', GeoExt.UrlLegend); |
Note: See TracBrowser
for help on using the repository browser.