Loading2.js
Summary
No overview generated for 'Loading2.js'
mapbuilder.loadScript(baseDir+"/widget/WidgetBase.js");
function Loading2(widgetNode, model) {
WidgetBase.apply(this,new Array(widgetNode, model));
this.imageSrc = config.skinDir + this.getProperty("mb:imageSrc", "/images/Loading.gif");
this.textMessage = this.getProperty("mb:textMessage", mbGetMessage("docLoading"));
this.updateMessage = this.textMessage;
this.mapContainerNode = widgetNode.selectSingleNode("mb:mapContainerId");
if (!this.mapContainerNode) {
this.mapContainerNode = widgetNode.selectSingleNode("mb:targetModel");
}
if (this.mapContainerNode) {
this.containerNodeId = getNodeValue(this.mapContainerNode);
this.htmlTagId = this.containerNodeId;
}
this.model.addListener("newModel",this.paint, this);
this.model.addListener("loadModel",this.clear, this);
this.model.addListener("refresh",this.paint, this);
this.model.addListener("modelStatus",this.update, this);
}
Loading2.prototype.paint = function(objRef) {
var node = objRef.getNode();
if (node) {
if (objRef.model.template) return;
if (!objRef.model.url && !objRef.mapContainerNode) return;
var outputNode = document.getElementById( objRef.outputNodeId+"_loading" );
if (!outputNode) {
outputNode = document.createElement("div");
outputNode.setAttribute("id",objRef.outputNodeId+"_loading");
node.appendChild(outputNode);
}
outputNode.className = "loadingIndicator";
outputNode.style.zIndex = 10001;
if (objRef.mapContainerNode){
outputNode.style.position="absolute";
outputNode.style.left='0px';
outputNode.style.top='0px';
}
if (objRef.imageSrc) {
var imageNode = document.getElementById( objRef.outputNodeId+"_imageNode" );
if (!imageNode) {
imageNode = document.createElement("img");
imageNode.setAttribute("id",objRef.outputNodeId+"_imageNode");
outputNode.appendChild(imageNode);
imageNode.style.zIndex = 10001;
}
imageNode.src = objRef.imageSrc;
}
if (objRef.updateMessage) {
var messageNode = document.getElementById( objRef.outputNodeId+"_messageNode" );
if (!messageNode) {
messageNode = document.createElement("p");
messageNode.setAttribute("id",objRef.outputNodeId+"_messageNode");
outputNode.appendChild(messageNode);
}
messageNode.innerHTML = objRef.updateMessage;
}
}
}
Loading2.prototype.clear= function(objRef, message) {
var outputNode = document.getElementById( objRef.outputNodeId+"_loading" );
var node = objRef.getNode();
if (node && outputNode) node.removeChild(outputNode);
}
Loading2.prototype.update= function(objRef, message) {
objRef.updateMessage = message || null;
if (message) {
objRef.paint(objRef);
} else {
objRef.clear(objRef);
}
}
Documentation generated by
JSDoc on Sun Apr 27 20:30:54 2008