root/trunk/Vespucci/Controls/SelectionArgParser.js

Revision 663, 1.2 kB (checked in by sbenthall, 2 years ago)

Cleanup after Arnes foobup

Line 
1Vespucci.SelectionArgParser = 
2    OpenLayers.Class(OpenLayers.Control.ArgParser, {
3
4    SELECT_ARGUMENT_KEY: "select",
5   
6    application: null,
7   
8    centerSet: false,
9   
10    initialize: function(application, options) {
11        OpenLayers.Control.ArgParser.prototype.initialize.apply(this, [options]); 
12        this.application = application;
13    },
14   
15    setMap: function(map) {
16        OpenLayers.Control.ArgParser.prototype.setMap.apply(this, arguments);
17
18        this.application.wfsLayer.events.register("loadend", this, this.wfsLayerLoaded);
19    },
20   
21    setCenter: function() {
22        OpenLayers.Control.ArgParser.prototype.setCenter.apply(this, arguments);
23        this.centerSet = true; 
24    },
25   
26    wfsLayerLoaded: function() {
27        var args = OpenLayers.Util.getParameters();
28        var selectedFID = args[this.SELECT_ARGUMENT_KEY];
29       
30        if (selectedFID) {
31            var feature = this.application.getFeatureByFid(selectedFID);
32            feature.selected(this.application);
33        }
34       
35        // First load done. The map doesn't need us anymore.
36        this.application.wfsLayer.events.unregister("loadend", this, this.wfsLayerLoaded);
37    },
38   
39   
40   
41    CLASS_NAME: "Vespucci.SelectionArgParser"
42});
Note: See TracBrowser for help on using the browser.