MWF.xApplication = MWF.xApplication || {}; MWF.xApplication.query = MWF.xApplication.query || {}; MWF.xApplication.query.StatDesigner = MWF.xApplication.query.StatDesigner || {}; MWF.APPDSTD = MWF.xApplication.query.StatDesigner; MWF.require("MWF.widget.Common", null, false); MWF.require("MWF.xScript.Macro", null, false); MWF.xDesktop.requireApp("query.StatDesigner", "lp."+MWF.language, null, false); //MWF.xDesktop.requireApp("query.ViewDesigner", "View", null, false); MWF.xDesktop.requireApp("query.StatDesigner", "Property", null, false); MWF.xApplication.query.StatDesigner.Stat = new Class({ //Extends: MWF.xApplication.query.ViewDesigner.View, Extends: MWF.widget.Common, Implements: [Options, Events], options: { "style": "default", "isView": false, "showTab": true, "propertyPath": "/x_component_query_StatDesigner/$Stat/stat.html" }, initialize: function(designer, data, options){ this.setOptions(options); this.path = "/x_component_query_StatDesigner/$Stat/"; this.cssPath = "/x_component_query_StatDesigner/$Stat/"+this.options.style+"/css.wcss"; this._loadCss(); this.designer = designer; this.data = data; if (!this.data.data) this.data.data = {}; this.parseData(); this.node = this.designer.designNode; this.areaNode = new Element("div", {"styles": {"height": "100%", "overflow": "auto"}}); this.propertyListNode = this.designer.propertyDomArea; if(this.designer.application) this.data.applicationName = this.designer.application.name; if(this.designer.application) this.data.application = this.designer.application.id; this.isNewView = (this.data.id) ? false : true; this.items = []; this.view = this; this.queryView = null; this.autoSave(); this.designer.addEvent("queryClose", function(){ if (this.autoSaveTimerID) window.clearInterval(this.autoSaveTimerID); }.bind(this)); }, changeViewSelected: function(){ if (this.json.view){ if (!this.queryView){ this.designer.actions.getView(this.json.view, function(view){ this.queryView = JSON.decode(view.data.data); this.items.each(function(item){ item.changeViewSelected(this.queryView); }.bind(this)); this.checkIsGroupRadioDisplay(); }.bind(this)); }else{ this.items.each(function(item){ item.changeViewSelected(this.queryView); }.bind(this)); this.checkIsGroupRadioDisplay(); } }else{ //item.changeViewSelected(); } }, checkIsGroupRadioDisplay: function(){ if (this.property){ var groupNode = this.property.propertyContent.getElement(".MWFIsGroupArea"); if (groupNode){ if (this.queryView.group.column){ groupNode.setStyle("display", "block"); }else{ this.json.data.calculate.isGroup = false; var radios = groupNode.getElements("input"); for (var i=0; isize.x){ this.viewTitleNode.setStyle("width", ""+width+"px"); this.viewAreaNode.setStyle("width", ""+width+"px"); }else{ this.viewTitleNode.setStyle("width", ""+size.x+"px"); this.viewAreaNode.setStyle("width", ""+size.x+"px"); } this.setContentColumnWidth(); this.setContentHeight(); }, //setPropertyContent: function(){ // this.designer.propertyIdNode.set("text", this.data.id); // this.designer.propertyNameNode.set("value", this.data.name); // this.designer.propertyAliasNode.set("value", this.data.alias); // this.designer.propertyDescriptionNode.set("value", this.data.description); // // this.designer.jsonDomNode.empty(); // MWF.require("MWF.widget.JsonParse", function(){ // this.jsonParse = new MWF.widget.JsonParse(this.data.data, this.designer.jsonDomNode, this.designer.jsonTextAreaNode); // window.setTimeout(function(){ // this.jsonParse.load(); // }.bind(this), 1); // }.bind(this)); //}, setAreaNodeSize: function(){ //var size = this.node.getSize(); ////var tabSize = this.tab.tabNodeContainer.getSize(); //var tabSize = this.node.getSize(); //var y = size.y - tabSize.y; //this.areaNode.setStyle("height", ""+y+"px"); //if (this.editor) if (this.editor.editor) this.editor.editor.resize(); }, // createRootItem: function() { // this.items.push(new MWF.xApplication.process.DictionaryDesigner.Dictionary.item("ROOT", this.data.data, null, 0, this, true)); // }, saveSilence: function(callback){ if (!this.data.name){ this.designer.notice(this.designer.lp.notice.inputName, "error"); return false; } // if (!this.data.view){ // this.designer.notice(this.designer.lp.notice.inputView, "error"); // return false; // } if (!this.checkViewAndColumn()){ this.designer.notice(this.designer.lp.notice.errorViewColumn, "error"); return false; } this.designer.actions.saveStat(this.data, function(json){ this.data.id = json.data.id; if (this.lisNode) { this.lisNode.getLast().set("text", this.data.name+"("+this.data.alias+")"); } if (callback) callback(); }.bind(this)); }, save: function(callback){ //if (this.designer.tab.showPage==this.page){ if (!this.data.name){ this.designer.notice(this.designer.lp.notice.inputName, "error"); return false; } // if (!this.data.view){ // this.designer.notice(this.designer.lp.notice.inputView, "error"); // return false; // } if (!this.checkViewAndColumn()){ this.designer.notice(this.designer.lp.notice.errorViewColumn, "error"); return false; } //} this.designer.actions.saveStat(this.data, function(json){ this.designer.notice(this.designer.lp.notice.save_success, "success", this.node, {"x": "left", "y": "bottom"}); this.data.id = json.data.id; if (this.lisNode) { this.lisNode.getLast().set("text", this.data.name+"("+this.data.alias+")"); } if (callback) callback(); }.bind(this)); }, checkViewAndColumn: function(){ // if (this.json.view){ var flag = true; for (var i = 0; i