[fusion-commits] r2147 - sandbox/jxlib-3.0/widgets
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Fri Apr 16 14:54:02 EDT 2010
Author: madair
Date: 2010-04-16 14:54:01 -0400 (Fri, 16 Apr 2010)
New Revision: 2147
Modified:
sandbox/jxlib-3.0/widgets/Legend.js
sandbox/jxlib-3.0/widgets/SelectAttribute.js
Log:
add MAP_RELOADED event handler and fix recursion error in SelectAttribute.js; Legend.js fix IE problem with 'change' event not being handled until the element loses focus
Modified: sandbox/jxlib-3.0/widgets/Legend.js
===================================================================
--- sandbox/jxlib-3.0/widgets/Legend.js 2010-04-16 14:29:35 UTC (rev 2146)
+++ sandbox/jxlib-3.0/widgets/Legend.js 2010-04-16 18:54:01 UTC (rev 2147)
@@ -733,7 +733,7 @@
if ($defined(this.options.checked)) {
this.check(this.options.checked);
}
- this.checkbox.addEvent('change', function(e){
+ this.checkbox.addEvent('click', function(e){
if (this.options.data) {
if (e.target.checked && this.options.data.show) {
this.options.data.show();
Modified: sandbox/jxlib-3.0/widgets/SelectAttribute.js
===================================================================
--- sandbox/jxlib-3.0/widgets/SelectAttribute.js 2010-04-16 14:29:35 UTC (rev 2146)
+++ sandbox/jxlib-3.0/widgets/SelectAttribute.js 2010-04-16 18:54:01 UTC (rev 2147)
@@ -49,30 +49,33 @@
this.attrRow = document.createElement('div');
this.attrRow.className = 'selectAttrInputs';
this.workArea.appendChild(this.attrRow);
+
+ var d = document.createElement('div');
+ d.innerHTML = "layer to query:";
+ this.layerList = document.createElement('select');
+ this.layerList.className = 'layerSelector';
+ d.appendChild(this.layerList);
+ this.attrRow.appendChild(d);
this.getMap().registerForEvent(Fusion.Event.MAP_LOADED, OpenLayers.Function.bind(this.listLayers, this));
- this.getMap().registerForEvent(Fusion.Event.MAP_ACTIVE_LAYER_CHANGED, OpenLayers.Function.bind(this.setActiveLayer, this));
+ this.getMap().registerForEvent(Fusion.Event.MAP_RELOADED, OpenLayers.Function.bind(this.listLayers, this));
+ this.getMap().registerForEvent(Fusion.Event.MAP_ACTIVE_LAYER_CHANGED, OpenLayers.Function.bind(this.setAttributeOptions, this));
},
/**
* populate th list of seletable layers when the map loads
*/
listLayers: function() {
+ this.layerList.empty();
var map = this.getMap().aMaps[0];
- var d = document.createElement('div');
- d.innerHTML = "layer to query:";
- this.layerList = document.createElement('select');
- this.layerList.className = 'layerSelector';
- this.layerList.onchange = OpenLayers.Function.bind(this.setAttributeOptions, this);
this.layerList.add(new Option('--select--',''),null);
- d.appendChild(this.layerList);
- this.attrRow.appendChild(d);
for (var i=0; i<map.aLayers.length; ++i) {
var layer = map.aLayers[i];
if (layer.selectable) {
this.layerList.add(new Option(layer.legendLabel,layer.layerName),null);
}
}
+ this.layerList.onchange = OpenLayers.Function.bind(this.activateLayer, this);
var sl = Fusion.getScriptLanguage();
var queryScript = 'layers/' + map.arch + '/' + sl + '/GetAttributes.' + sl;
@@ -90,16 +93,6 @@
},
- setActiveLayer: function(event, layer) {
- for (var i=0; i<this.layerList.options.length; ++i) {
- if (this.layerList.options[i].value == layer.layerName) {
- this.layerList.selectedIndex = i;
- this.setAttributeOptions();
- break;
- }
- }
- },
-
setAttributes: function(xhr) {
if (xhr.status < 400) {
eval('this.attrs='+xhr.responseText);
@@ -115,6 +108,12 @@
for (var i=0; i<attrs.length; ++i) {
this.propsList.add(new Option(attrs[i],props[i]),null);
}
+ }
+ },
+
+ activateLayer: function(event) {
+ if (this.drawn) {
+ var layer = this.layerList[this.layerList.selectedIndex].value;
var map = this.getMap();
for (var i=0; i<map.aMaps[0].aLayers.length; ++i) {
if (map.aMaps[0].aLayers[i].layerName == layer) {
More information about the fusion-commits
mailing list