$Element.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. if (this.property) this.property.destroy();
  47. this.node.destroy();
  48. this.actionArea.destroy();
  49. delete this.form.json.moduleList[this.json.id];
  50. this.json = null;
  51. delete this.json;
  52. this.treeNode.destroy();
  53. o2.release(this);
  54. },
  55. parseModules: function(){},
  56. _deleteModule: function(){
  57. this.destroy();
  58. },
  59. getJson: function(){
  60. var json = Object.clone(this.json);
  61. var o = {};
  62. o[json.id] = json;
  63. return o;
  64. }
  65. });