BaseTask.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. draw2d.BaseTask=function(_url){
  2. draw2d.ResizeImage.call(this,_url);
  3. this.outputPort = null;
  4. this.inputPort = null;
  5. this.setDimension(110,60);
  6. };
  7. draw2d.BaseTask.prototype=new draw2d.ResizeImage();
  8. draw2d.BaseTask.prototype.type="BaseTask";
  9. draw2d.BaseTask.prototype.createHTMLElement=function(){
  10. var item = draw2d.ResizeImage.prototype.createHTMLElement.call(this);
  11. this.textarea = document.createElement("div");
  12. this.textarea.className="task-textarea";
  13. this.textarea.style.position = "absolute";
  14. //this.textarea.style.zIndex = "" + draw2d.Figure.ZOrderBaseIndex;
  15. this.textarea.style.left = "0px";
  16. this.textarea.style.top = "0px";
  17. item.appendChild(this.textarea);
  18. return item;
  19. };
  20. draw2d.BaseTask.prototype.setDimension=function(w, h){
  21. try{
  22. draw2d.ResizeImage.prototype.setDimension.call(this, w, h);
  23. this.textarea.style.left = (this.width/10)+"px";
  24. this.textarea.style.top = (this.height/3)+"px";
  25. this.textarea.style.width = (this.width - 20) + "px";
  26. this.textarea.style.height = (this.height - 40)+ "px";
  27. if (this.outputPort !== null) {
  28. this.outputPort.setPosition(this.width + 5, this.height / 2);
  29. }
  30. if (this.inputPort !== null) {
  31. this.inputPort.setPosition(-5, this.height / 2);
  32. }
  33. }catch(e){
  34. }
  35. };
  36. draw2d.BaseTask.prototype.setWorkflow=function(_5019){
  37. draw2d.ResizeImage.prototype.setWorkflow.call(this,_5019);
  38. if (_5019 !== null && this.inputPort === null) {
  39. this.inputPort = new draw2d.MyInputPort();
  40. this.inputPort.setWorkflow(_5019);
  41. this.inputPort.setName("input");
  42. this.addPort(this.inputPort, -5, this.height / 2);
  43. this.outputPort = new draw2d.MyOutputPort();
  44. this.outputPort.setMaxFanOut(5);
  45. this.outputPort.setWorkflow(_5019);
  46. this.outputPort.setName("output");
  47. this.addPort(this.outputPort, this.width + 5, this.height / 2);
  48. }
  49. };
  50. draw2d.BaseTask.prototype.setContent = function(_5014) {
  51. this.textarea.innerHTML=_5014;
  52. };