MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {}; MWF.xDesktop.requireApp("process.FormDesigner", "Module.$Container", null, false); MWF.xApplication.process.FormDesigner.Module.Datatable$Title = MWF.FCDatatable$Title = new Class({ Extends: MWF.FC$Element, Implements: [Options, Events], options: { "style": "default", "propertyPath": "../x_component_process_FormDesigner/Module/Datatable$Title/datatable$Title.html", "actions": [ { "name": "insertCol", "icon": "insertCol1.png", "event": "click", "action": "insertCol", "title": MWF.LP.process.formAction.insertCol }, { "name": "deleteCol", "icon": "deleteCol1.png", "event": "click", "action": "deleteCol", "title": MWF.LP.process.formAction.deleteCol }, { "name": "selectParent", "icon": "selectParent.png", "event": "click", "action": "selectParent", "title": MWF.APPFD.LP.formAction["selectParent"] } ] }, initialize: function(form, options){ this.setOptions(options); this.path = "../x_component_process_FormDesigner/Module/Datatable$Title/"; this.cssPath = "../x_component_process_FormDesigner/Module/Datatable$Title/"+this.options.style+"/css.wcss"; this._loadCss(); this.moduleType = "element"; this.moduleName = "datatable$Title"; this.Node = null; this.form = form; }, _setNodeProperty: function(){ if (this.form.moduleList.indexOf(this)==-1) this.form.moduleList.push(this); if (this.form.moduleNodeList.indexOf(this.node)==-1) this.form.moduleNodeList.push(this.node); if (this.form.moduleElementNodeList.indexOf(this.node)==-1) this.form.moduleElementNodeList.push(this.node); this.node.store("module", this); this.setPrefixOrSuffix(); }, setAllStyles: function(){ Object.each(this.json.styles, function(value, key){ var reg = /^border\w*/ig; if (!key.test(reg)){ if (key) this.node.setStyle(key, value); } }.bind(this)); this.setPropertiesOrStyles("properties"); this.reloadMaplist(); }, _dragIn: function(module){ this.parentContainer._dragIn(module); }, over: function(){ if (this.form.selectedModules.indexOf(this)==-1){ if (!this.form.moveModule) if (this.form.currentSelectedModule!=this) this.node.setStyles({ "border-width": "1px", "border-color": "#0072ff" }); } }, unOver: function(){ if (this.form.selectedModules.indexOf(this)==-1){ if (!this.form.moveModule) if (this.form.currentSelectedModule!=this) this.node.setStyles({ "border-width": "1px", "border-color": "#999" }); } }, unSelected: function(){ this.node.setStyles({ "border-width": "1px", "border-color": "#999" }); this._hideActions(); this.form.currentSelectedModule = null; this.hideProperty(); }, load : function(json, node, parent){ this.json = json; this.node= node; this.node.store("module", this); this.node.setStyles(this.css.moduleNode); this.node.set("text", this.json.name || "DataTitle"); if (!this.json.id){ var id = this._getNewId(parent.json.id); this.json.id = id; } node.set({ "MWFType": "datatable$Title", "id": this.json.id }); if (!this.form.json.moduleList[this.json.id]){ this.form.json.moduleList[this.json.id] = this.json; } this._initModule(); this._loadTreeNode(parent); this.parentContainer = this.treeNode.parentNode.module; this._setEditStyle_custom("id"); this.json.moduleName = this.moduleName; if( this.json.isShow === false ){ this._switchShow(); } }, _createMoveNode: function(){ return false; }, // _setEditStyle_custom: function(name){ // // }, _dragInLikeElement: function(module){ return false; }, setCustomStyles: function(){ this._recoveryModuleData(); var border = this.node.getStyle("border"); this.node.clearStyles(); this.node.setStyles(this.css.moduleNode); if (this.initialStyles) this.node.setStyles(this.initialStyles); this.node.setStyle("border", border); Object.each(this.json.styles, function(value, key){ var reg = /^border\w*/ig; if (!key.test(reg)){ this.node.setStyle(key, value); } }.bind(this)); this.setCustomNodeStyles(this.node, this.parentContainer.json.titleStyles); if( this.json.isShow === false ){ this._switchShow(); } }, insertCol: function(){ var module = this; var url = this.path+"insertCol.html"; MWF.require("MWF.widget.Dialog", function(){ var size = $(document.body).getSize(); var x = size.x/2-150; var y = size.y/2-90; var dlg = new MWF.DL({ "title": "Insert Col", "style": "property", "top": y, "left": x-40, "fromTop":size.y/2-45, "fromLeft": size.x/2, "width": 300, "height": 180, "url": url, "lp": MWF.xApplication.process.FormDesigner.LP.propertyTemplate, "buttonList": [ { "text": MWF.APPFD.LP.button.ok, "action": function(){ module._insertCol(); this.close(); } }, { "text": MWF.APPFD.LP.button.cancel, "action": function(){ this.close(); } } ] }); dlg.show(); }.bind(this)); }, _insertCol: function(){ var cols = $("MWFInsertColNumber").get("value"); var positionRadios = document.getElementsByName("MWFInsertColPosition"); var position = "before"; for (var i=0; i