WidgetBase.js
Summary
No overview generated for 'WidgetBase.js'
function WidgetBase(widgetNode,model) {
this.model = model;
this.widgetNode = widgetNode;
var templatedWidget = false;
if(model.modelNode.attributes.getNamedItem("createByTemplate") && model.modelNode.attributes.getNamedItem("createByTemplate").nodeValue=='true'){
widgetNode.setAttribute("id","MbWidget_" + mbIds.getId());
templatedWidget = true;
}
if (widgetNode.attributes.getNamedItem("id")) {
this.id = widgetNode.attributes.getNamedItem("id").nodeValue;
} else {
alert(mbGetMessage("idRequired", widgetNode.nodeName));
}
this.getProperty = function(property, defaultValue) {
return Mapbuilder.getProperty(widgetNode, property, defaultValue);
}
if(templatedWidget){
this.outputNodeId = this.id;
}else {
this.outputNodeId = this.getProperty("mb:outputNodeId", "MbWidget_" + mbIds.getId());
}
if (!this.htmlTagId) {
this.htmlTagId = this.getProperty("mb:htmlTagId", this.id);
}
this.getNode = function() {
var node = document.getElementById(this.htmlTagId);
if(!node) {
}
return node;
}
this.autoRefresh = Mapbuilder.parseBoolean(this.getProperty("mb:autoRefresh", true));
this.debug = Mapbuilder.parseBoolean(this.getProperty("mb:debug", false));
this.initTargetModel = function(objRef) {
var targetModel = objRef.getProperty("mb:targetModel");
if (targetModel) {
objRef.targetModel = window.config.objects[targetModel];
if ( !objRef.targetModel ) {
alert(mbGetMessage("noTargetModelWidget", targetModel, objRef.id));
}
} else {
objRef.targetModel = objRef.model;
}
}
this.model.addListener("init", this.initTargetModel, this);
this.prePaint = function(objRef) {
}
this.postPaint = function(objRef) {
}
this.clearWidget = function(objRef) {
var outputNode = document.getElementById( objRef.outputNodeId );
var node = objRef.getNode();
if (node && outputNode) node.removeChild(outputNode);
}
this.model.addListener("newModel",this.clearWidget, this);
}
Documentation generated by
JSDoc on Sun Apr 27 20:30:54 2008