ErrorEnd.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. draw2d.ErrorEnd = function() {
  2. _url = "/js/designer/icons/enderror.png";
  3. draw2d.ResizeImage.call(this, _url);
  4. this.rightInputPort = null;
  5. this.leftInputPort = null;
  6. this.topInputPort = null;
  7. this.bottomInputPort = null;
  8. this.resizeable = false;// 不让改变大小
  9. this.eventId = 'ErrorEnd';
  10. this.eventName = "错误";
  11. this.setDimension(40, 40);
  12. };
  13. draw2d.ErrorEnd.prototype = new draw2d.Node();
  14. draw2d.ErrorEnd.prototype.type = "draw2d.ErrorEnd";
  15. draw2d.ErrorEnd.prototype.generateId = function() {
  16. this.id = "ErrorEnd";
  17. this.eventId = this.id;
  18. };
  19. draw2d.ErrorEnd.prototype.createHTMLElement = function() {
  20. var item = draw2d.ResizeImage.prototype.createHTMLElement.call(this);
  21. return item;
  22. };
  23. draw2d.ErrorEnd.prototype.setDimension = function(w, h) {
  24. draw2d.ResizeImage.prototype.setDimension.call(this, w, h);
  25. };
  26. draw2d.ErrorEnd.prototype.setWorkflow = function(_505d) {
  27. draw2d.ResizeImage.prototype.setWorkflow.call(this, _505d);
  28. if (_505d !== null && this.rightInputPort === null) {
  29. this.rightInputPort = new draw2d.MyInputPort();
  30. this.rightInputPort.setName("RightInputPort");
  31. this.rightInputPort.setWorkflow(_505d);
  32. this.rightInputPort.setBackgroundColor(new draw2d.Color(115, 115, 245));
  33. this.addPort(this.rightInputPort, this.width, this.height / 2);
  34. }
  35. if (_505d !== null && this.leftInputPort === null) {
  36. this.leftInputPort = new draw2d.MyInputPort();
  37. this.leftInputPort.setName("leftInputPort");
  38. this.leftInputPort.setWorkflow(_505d);
  39. this.leftInputPort.setBackgroundColor(new draw2d.Color(115, 115, 245));
  40. this.addPort(this.leftInputPort, 0, this.height / 2);
  41. }
  42. if (_505d !== null && this.topInputPort === null) {
  43. this.topInputPort = new draw2d.MyInputPort();
  44. this.topInputPort.setName("RightInputPort");
  45. this.topInputPort.setWorkflow(_505d);
  46. this.topInputPort.setBackgroundColor(new draw2d.Color(115, 115, 245));
  47. this.addPort(this.topInputPort, this.width / 2, 0);
  48. }
  49. if (_505d !== null && this.bottomInputPort === null) {
  50. this.bottomInputPort = new draw2d.MyInputPort();
  51. this.bottomInputPort.setName("RightInputPort");
  52. this.bottomInputPort.setWorkflow(_505d);
  53. this.bottomInputPort.setBackgroundColor(new draw2d.Color(115, 115, 245));
  54. this.addPort(this.bottomInputPort, this.width / 2, this.height);
  55. }
  56. };
  57. draw2d.ErrorEnd.prototype.figureDoubleClick = function() {
  58. if(!workflow.readOnly){
  59. processNode = this;
  60. Ext.getCmp('formSetting').hide();
  61. Ext.getCmp('actionSetting').hide();
  62. Ext.getCmp('listenerSetting').hide();
  63. Ext.getCmp('delegateSetting').hide();
  64. setPropertyNames();
  65. setSource();
  66. }
  67. };
  68. draw2d.ErrorEnd.prototype.getContextMenu = function() {
  69. if (this.workflow.disabled) return null;
  70. var menu = new draw2d.ContextMenu(100, 50);
  71. processNode = this;
  72. menu.appendMenuItem(new draw2d.ContextMenuItem("属性", "properties-icon", processNode, function(x, y) {
  73. setPropertyNames();
  74. setSource();
  75. }));
  76. return menu;
  77. };
  78. draw2d.ErrorEnd.prototype.toXML = function() {
  79. var xml = '<endEvent id="' + this.eventId + '" name="' + this.eventName + '"><errorEventDefinition errorRef="error123" /></endEvent>\n';
  80. return xml;
  81. };
  82. draw2d.ErrorEnd.prototype.toBpmnDI = function() {
  83. var w = this.getWidth();
  84. var h = this.getHeight();
  85. var x = this.getAbsoluteX();
  86. var y = this.getAbsoluteY();
  87. var xml = '<bpmndi:BPMNShape bpmnElement="' + this.eventId + '" id="BPMNShape_' + this.eventId + '">\n';
  88. xml = xml + '<omgdc:Bounds height="' + h + '" width="' + w + '" x="' + x + '" y="' + y + '"/>\n';
  89. xml = xml + '</bpmndi:BPMNShape>\n';
  90. return xml;
  91. };