Project

General

Profile

1 4307 leinfelder
/*
2
License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
3
$Id: FeatureList.js 3733 2007-12-12 23:13:47Z ahocevar $
4
*/
5
mapbuilder.loadScript(baseDir+"/widget/WidgetBaseXSL.js");
6
7
/**
8
 * Custom, read-only version of the FeatureList widget.
9
 * @author Andreas Hocevar andreas.hocevarATgmail.com
10
 * @base WidgetBaseXSL
11
 * @param widgetNode config node for this widget
12
 * @param model parent model for this widget
13
 */
14
function FeatureList(widgetNode, model) {
15
  WidgetBaseXSL.apply(this, arguments);
16
17
  /**
18
   * Listener function to highlight a list item when the mouse enters a
19
   * feature on the map.
20
   * @param objRef reference to this widget
21
   */
22
  this.highlightFeature = function(objRef) {
23
    var fid = objRef.model.getParam("mouseoverFeature");
24
    var highlightNode = document.getElementById(objRef.id+'_'+fid)
25
    if (fid && highlightNode) {
26
      highlightNode.className = 'listitem_active';
27
    }
28
  }
29
  model.addListener("mouseoverFeature", this.highlightFeature, this);
30
31
  /**
32
   * Listener function to dehighlight a list item when the mouse leaves a
33
   * feature on the map.
34
   * @param objRef reference to this widget
35
   */
36
  this.dehighlightFeature = function(objRef) {
37
    var fid = objRef.model.getParam("mouseoutFeature");
38
    var highlightNode = document.getElementById(objRef.id+'_'+fid)
39
    if (fid && highlightNode) {
40
      document.getElementById(objRef.id+'_'+fid).className = 'listitem';
41
    }
42
  }
43
  model.addListener("mouseoutFeature", this.dehighlightFeature, this);
44
45
  /**
46
   * Widget function to highlight the list item and call the listener that
47
   * will highlight the feature in the map.
48
   * @param div DOM node in the widget output that displays the feature
49
   * @param fid feature id of the feature
50
   */
51
  this.highlight = function(div, fid) {
52
    div.className="listitem_active";
53
    model.setParam("highlightFeature", fid);
54
  }
55
56
  /**
57
   * Widget function to dehighlight the list item and call the listener that
58
   * will hdeighlight the feature in the map.
59
   * @param div DOM node in the widget output that displays the feature
60
   * @param fid feature id of the feature
61
   */
62
  this.dehighlight = function(div, fid) {
63
    div.className="listitem";
64
    model.setParam("dehighlightFeature", fid);
65
  }
66
}