Details
-
Type:
Task
-
Status:
Closed
-
Priority:
Trivial
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.5rc2
-
Component/s: None
-
Labels:None
-
Number of attachments :
Description
Currently, every widget, tool and model script picks its config properties by using something like
var propertyNode = widgetNode.selectSingleNode("mb:myProperty");
this.property = propertyNode ? propertyNode.firstChild.nodeValue() : "default";
Not only that firstChild.nodeValue does not work in Opera (this is the reason why there is now the getNodeValue in Util.js, which is not being used very frequently), but it produces quite a huge amount of code duplication.
in r3866: introduced new functions Mapbuilder.getProperty() and Mapbuilder.parseBoolean(). MapPaneOL already makes use of those.
Instead of the above, we can now say
this.property = Mapbuilder.getProperty(widgetNode, "mb:property", "default");
If we expect "true" or "false" in a config node, we can parse it to a boolean value simply by saying:
this.property = Mapbuilder.parseBoolean(
Mapbuilder.getProperty(widgetNode, "mb:boolProp", "true"));
TODO: use it in all widgets, tools and models.