Textarea.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. MWF.xApplication.process.FormDesigner.Module = MWF.xApplication.process.FormDesigner.Module || {};
  2. MWF.xDesktop.requireApp("process.FormDesigner", "Module.$Element", null, false);
  3. MWF.xApplication.process.FormDesigner.Module.Textarea = MWF.FCTextarea = new Class({
  4. Extends: MWF.FC$Element,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "/x_component_process_FormDesigner/Module/Textarea/textarea.html"
  9. },
  10. initialize: function(form, options){
  11. this.setOptions(options);
  12. this.path = "/x_component_process_FormDesigner/Module/Textarea/";
  13. this.cssPath = "/x_component_process_FormDesigner/Module/Textarea/"+this.options.style+"/css.wcss";
  14. this._loadCss();
  15. this.moduleType = "element";
  16. this.moduleName = "textarea";
  17. this.form = form;
  18. this.container = null;
  19. this.containerNode = null;
  20. },
  21. clearTemplateStyles: function(styles){
  22. if (styles){
  23. if (styles.styles) this.removeStyles(styles.styles, "styles");
  24. if (styles.inputStyles) this.removeStyles(styles.inputStyles, "inputStyles");
  25. if (styles.properties) this.removeStyles(styles.properties, "properties");
  26. }
  27. },
  28. setTemplateStyles: function(styles){
  29. if (styles.styles) this.copyStyles(styles.styles, "styles");
  30. if (styles.inputStyles) this.copyStyles(styles.inputStyles, "inputStyles");
  31. if (styles.properties) this.copyStyles(styles.properties, "properties");
  32. },
  33. _createMoveNode: function(){
  34. this.moveNode = new Element("div", {
  35. "MWFType": "textarea",
  36. "styles": this.css.moduleNodeMove,
  37. "id": this.json.id,
  38. "readonly": true,
  39. "events": {
  40. "selectstart": function(){
  41. return false;
  42. }
  43. }
  44. }).inject(this.form.container);
  45. var icon = new Element("div", {
  46. "styles": this.css.textareaIcon
  47. }).inject(this.moveNode);
  48. var text = new Element("div", {
  49. "styles": this.css.moduleText,
  50. "text": this.json.id
  51. }).inject(this.moveNode);
  52. },
  53. _loadNodeStyles: function(){
  54. var icon = this.node.getFirst("div");
  55. var text = this.node.getLast("div");
  56. icon.setStyles(this.css.textareaIcon);
  57. text.setStyles(this.css.moduleText);
  58. },
  59. _getCopyNode: function(){
  60. if (!this.copyNode) this._createCopyNode();
  61. this.copyNode.setStyle("display", "inline-block");
  62. return this.copyNode;
  63. },
  64. _setEditStyle_custom: function(name){
  65. if (name=="id"){
  66. this.node.getLast().set("text", this.json.id);
  67. }
  68. }
  69. });