ActivityImpl.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /**
  2. *
  3. * @author Tom Baeyens
  4. * @author (Javascript) Dmitry Farafonov
  5. */
  6. var ActivityImpl = function(activityJson){
  7. this.outgoingTransitions = [];
  8. this.outgoingTransitions = [];
  9. this.incomingTransitions = [];
  10. this.activityBehavior = null;
  11. this.parent = null;
  12. this.isScope = false;
  13. this.isAsync = false;
  14. this.isExclusive = false;
  15. this.x = -1;
  16. this.y = -1;
  17. this.width = -1;
  18. this.height = -1;
  19. this.properties = {};
  20. //console.log("activityJson: ", activityJson);
  21. if (activityJson != undefined) {
  22. this.setId(activityJson.activityId);
  23. for (var propertyName in activityJson.properties) {
  24. this.setProperty(propertyName, activityJson.properties[propertyName]);
  25. }
  26. //this.setProperty("name", activityJson.activityName);
  27. //this.setProperty("type", activityJson.activityType);
  28. this.setX(activityJson.x);
  29. this.setY(activityJson.y);
  30. this.setWidth(activityJson.width);
  31. this.setHeight(activityJson.height);
  32. if (activityJson.multiInstance)
  33. this.setProperty("multiInstance", activityJson.multiInstance);
  34. if (activityJson.collapsed) {
  35. this.setProperty("collapsed", activityJson.collapsed);
  36. }
  37. if (activityJson.isInterrupting != undefined)
  38. this.setProperty("isInterrupting", activityJson.isInterrupting);
  39. }
  40. };
  41. ActivityImpl.prototype = {
  42. outgoingTransitions: [],
  43. outgoingTransitions: [],
  44. incomingTransitions: [],
  45. activityBehavior: null,
  46. parent: null,
  47. isScope: false,
  48. isAsync: false,
  49. isExclusive: false,
  50. id: null,
  51. properties: {},
  52. // Graphical information
  53. x: -1,
  54. y: -1,
  55. width: -1,
  56. height: -1,
  57. setId: function(id){
  58. this.id = id;
  59. },
  60. getId: function(){
  61. return this.id;
  62. },
  63. setProperty: function(name, value){
  64. this.properties[name] = value;
  65. },
  66. getProperty: function(name){
  67. return this.properties[name];
  68. },
  69. createOutgoingTransition: function(transitionId){
  70. },
  71. toString: function(id) {
  72. return "Activity("+id+")";
  73. },
  74. getParentActivity: function(){
  75. /*
  76. if (parent instanceof ActivityImpl) {
  77. 79 return (ActivityImpl) parent;
  78. 80 }
  79. 81 return null;
  80. */
  81. return this.parent;
  82. },
  83. // restricted setters ///////////////////////////////////////////////////////
  84. setOutgoingTransitions: function(outgoingTransitions){
  85. this.outgoingTransitions = outgoingTransitions;
  86. },
  87. setParent: function(parent){
  88. this.parent = parent;
  89. },
  90. setIncomingTransitions: function(incomingTransitions){
  91. this.incomingTransitions = incomingTransitions;
  92. },
  93. // getters and setters //////////////////////////////////////////////////////
  94. getOutgoingTransitions: function(){
  95. return this.outgoingTransitions;
  96. },
  97. getActivityBehavior: function(){
  98. return this.activityBehavior;
  99. },
  100. setActivityBehavior: function(activityBehavior){
  101. this.activityBehavior = activityBehavior;
  102. },
  103. getParent: function(){
  104. return this.parent;
  105. },
  106. getIncomingTransitions: function(){
  107. return this.incomingTransitions;
  108. },
  109. isScope: function(){
  110. return this.isScope;
  111. },
  112. setScope: function(isScope){
  113. this.isScope = isScope;
  114. },
  115. getX: function(){
  116. return this.x;
  117. },
  118. setX: function(x){
  119. this.x = x;
  120. },
  121. getY: function(){
  122. return this.y;
  123. },
  124. setY: function(y){
  125. this.y = y;
  126. },
  127. getWidth: function(){
  128. return this.width;
  129. },
  130. setWidth: function(width){
  131. this.width = width;
  132. },
  133. getHeight: function(){
  134. return this.height;
  135. },
  136. setHeight: function(height){
  137. this.height = height;
  138. },
  139. isAsync: function() {
  140. return this.isAsync;
  141. },
  142. setAsync: function(isAsync) {
  143. this.isAsync = isAsync;
  144. },
  145. isExclusive: function() {
  146. return this.isExclusive;
  147. },
  148. setExclusive: function(isExclusive) {
  149. this.isExclusive = isExclusive;
  150. },
  151. vvoid: function(){}
  152. };