$Element.js 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. MWF.xApplication.cms.FormDesigner.Module = MWF.xApplication.cms.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("cms.FormDesigner", "Module.$Module", null, false);
  3. MWF.xApplication.cms.FormDesigner.Module.$Element = MWF.CMSFC$Element = new Class({
  4. Extends: MWF.CMSFC$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. module.inContainer = null;
  14. module.parentContainer = this.parentContainer;
  15. module.nextModule = this;
  16. this.parentContainer.node.setStyles({"border": "1px solid #ffa200"});
  17. var copyNode = module._getCopyNode();
  18. copyNode.inject(this.node, "before");
  19. },
  20. _dragOut: function(module){
  21. module.inContainer = null;
  22. module.parentContainer = null;
  23. module.nextModule = null;
  24. this.parentContainer.node.setStyles(this.parentContainer.css.moduleNode);
  25. this.parentContainer.setCustomStyles();
  26. var copyNode = module._getCopyNode();
  27. copyNode.setStyle("display", "none");
  28. },
  29. _dragDrop: function(module){
  30. // this.node.setStyles(this.css.moduleNode);
  31. // this.node.setStyles(this.json.styles);
  32. this.parentContainer.node.setStyles(this.parentContainer.css.moduleNode);
  33. this.parentContainer.setCustomStyles();
  34. },
  35. destroy: function(){
  36. this.form.moduleList.erase(this);
  37. this.form.moduleNodeList.erase(this.node);
  38. this.form.moduleElementNodeList.erase(this.node);
  39. this.node.destroy();
  40. this.actionArea.destroy();
  41. delete this.form.json.moduleList[this.json.id];
  42. this.json = null;
  43. delete this.json;
  44. this.treeNode.destroy();
  45. },
  46. parseModules: function(){},
  47. _deleteModule: function(){
  48. this.destroy();
  49. },
  50. getJson: function(){
  51. var json = Object.clone(this.json);
  52. var o = {};
  53. o[json.id] = json;
  54. return o;
  55. }
  56. });