$Element.js 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("process.FormDesigner", "Module.$Module", null, false);
  3. MWF.xApplication.process.FormDesigner.Module.$Element = MWF.FC$Element = new Class({
  4. Extends: MWF.FC$Module,
  5. Implements: [Options, Events],
  6. _setNodeProperty: function(){
  7. if (this.form.moduleList.indexOf(this)==-1) this.form.moduleList.push(this);
  8. if (this.form.moduleNodeList.indexOf(this.node)==-1) this.form.moduleNodeList.push(this.node);
  9. if (this.form.moduleElementNodeList.indexOf(this.node)==-1) this.form.moduleElementNodeList.push(this.node);
  10. this.node.store("module", this);
  11. },
  12. _dragIn: function(module){
  13. if (this.parentContainer.moduleName == "datagrid$Data"){
  14. this.parentContainer._dragIn(module);
  15. }else{
  16. module.inContainer = null;
  17. module.parentContainer = this.parentContainer;
  18. module.nextModule = this;
  19. this.parentContainer.node.setStyles({"border": "1px solid #ffa200"});
  20. var copyNode = module._getCopyNode(this);
  21. copyNode.inject(this.node, "before");
  22. }
  23. },
  24. _dragOut: function(module){
  25. module.inContainer = null;
  26. module.parentContainer = null;
  27. module.nextModule = null;
  28. this.parentContainer.node.setStyles(this.parentContainer.css.moduleNode);
  29. this.parentContainer.setCustomStyles();
  30. var copyNode = module._getCopyNode();
  31. copyNode.setStyle("display", "none");
  32. },
  33. _dragDrop: function(module){
  34. // this.node.setStyles(this.css.moduleNode);
  35. // this.node.setStyles(this.json.styles);
  36. this.parentContainer.node.setStyles(this.parentContainer.css.moduleNode);
  37. this.parentContainer.setCustomStyles();
  38. },
  39. destroy: function(){
  40. this.form.moduleList.erase(this);
  41. this.form.moduleNodeList.erase(this.node);
  42. this.form.moduleElementNodeList.erase(this.node);
  43. if (this.form.scriptDesigner){
  44. this.form.scriptDesigner.removeModule(this.json);
  45. }
  46. this.node.destroy();
  47. this.actionArea.destroy();
  48. delete this.form.json.moduleList[this.json.id];
  49. this.json = null;
  50. delete this.json;
  51. this.treeNode.destroy();
  52. },
  53. parseModules: function(){},
  54. _deleteModule: function(){
  55. this.destroy();
  56. },
  57. getJson: function(){
  58. var json = Object.clone(this.json);
  59. var o = {};
  60. o[json.id] = json;
  61. return o;
  62. }
  63. });