Label.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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.Label = MWF.FCLabel = new Class({
  4. Extends: MWF.FC$Element,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "propertyPath": "/x_component_process_FormDesigner/Module/Label/label.html"
  9. },
  10. initialize: function(form, options){
  11. debugger;
  12. this.setOptions(options);
  13. this.path = "/x_component_process_FormDesigner/Module/Label/";
  14. this.cssPath = "/x_component_process_FormDesigner/Module/Label/"+this.options.style+"/css.wcss";
  15. this._loadCss();
  16. this.moduleType = "element";
  17. this.moduleName = "label";
  18. this.form = form;
  19. this.container = null;
  20. this.containerNode = null;
  21. },
  22. clearTemplateStyles: function(styles){
  23. if (this.json.templateType){
  24. if (styles){
  25. if (styles[this.json.templateType]){
  26. if (styles[this.json.templateType].styles) this.removeStyles(styles[this.json.templateType].styles, "styles");
  27. if (styles[this.json.templateType].inputStyles) this.removeStyles(styles[this.json.templateType].inputStyles, "inputStyles");
  28. if (styles[this.json.templateType].properties) this.removeStyles(styles[this.json.templateType].properties, "properties");
  29. }
  30. }
  31. }
  32. },
  33. setTemplateStyles: function(styles){
  34. if (this.json.templateType){
  35. if (styles[this.json.templateType].styles) this.copyStyles(styles[this.json.templateType].styles, "styles");
  36. if (styles[this.json.templateType].properties) this.copyStyles(styles[this.json.templateType].properties, "properties");
  37. }
  38. },
  39. _createMoveNode: function(){
  40. this.moveNode = new Element("div", {
  41. "MWFType": "label",
  42. "id": this.json.id,
  43. "styles": this.css.moduleNodeMove,
  44. "text": "(T)Text",
  45. "events": {
  46. "selectstart": function(){
  47. return false;
  48. }
  49. }
  50. }).inject(this.form.container);
  51. },
  52. _setEditStyle_custom: function(name, obj, oldValue){
  53. debugger;
  54. if (name=="valueType" || name=="text"){
  55. if (this.json.valueType=="text"){
  56. if (this.json.text){
  57. this.node.set("text", this.json.text);
  58. }else{
  59. this.node.set("text", "(T)Text");
  60. }
  61. }else{
  62. this.node.set("text", "(C)Text");
  63. }
  64. }
  65. if (name=="templateType"){
  66. if (this.form.templateStyles){
  67. var moduleStyles = this.form.templateStyles[this.moduleName];
  68. if (moduleStyles) {
  69. if (oldValue){
  70. if (moduleStyles[oldValue]){
  71. this.removeStyles(moduleStyles[oldValue].styles, "styles");
  72. this.removeStyles(moduleStyles[oldValue].styles, "properties");
  73. }
  74. }
  75. if (moduleStyles[this.json.templateType].styles) this.copyStyles(moduleStyles[this.json.templateType].styles, "styles");
  76. if (moduleStyles[this.json.templateType].styles) this.copyStyles(moduleStyles[this.json.templateType].properties, "properties");
  77. this.setPropertiesOrStyles("styles");
  78. this.setPropertiesOrStyles("properties");
  79. this.reloadMaplist();
  80. }
  81. }
  82. }
  83. }
  84. });