actionsbuilder.actionNode.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. var ActionsBuilder;
  2. (function (ActionsBuilder) {
  3. var Node = (function () {
  4. function Node() {
  5. this.rect = null;
  6. this.text = null;
  7. this.line = null;
  8. this.detached = false;
  9. this.minimized = false;
  10. }
  11. /**
  12. * Returns if the point (x, y) is inside the text or rect
  13. * @param x: the x position of the point
  14. * @param y: the y position of the point
  15. */
  16. Node.prototype.isPointInside = function (x, y) {
  17. return this.rect.isPointInside(x, y) || this.text.isPointInside(x, y);
  18. };
  19. return Node;
  20. }());
  21. ActionsBuilder.Node = Node;
  22. var Action = (function () {
  23. /**
  24. * Constructor
  25. * @param node: The associated node to draw in the viewer
  26. */
  27. function Action(node) {
  28. this.parent = null;
  29. this.children = new Array();
  30. this.name = "";
  31. this.type = ActionsBuilder.Type.OBJECT;
  32. this.properties = new Array();
  33. this.propertiesResults = new Array();
  34. this.combineArray = null;
  35. this.hub = null;
  36. this.combineAction = null;
  37. this.node = node;
  38. }
  39. /*
  40. * Removes a combined action from the combine array
  41. * @param action: the action to remove
  42. */
  43. Action.prototype.removeCombinedAction = function (action) {
  44. if (action === null || this.combineArray === null) {
  45. return false;
  46. }
  47. var index = this.combineArray.indexOf(action);
  48. if (index !== -1) {
  49. this.combineArray.splice(index, 1);
  50. }
  51. return false;
  52. };
  53. /*
  54. * Adds a child
  55. * @param child: the action to add as child
  56. */
  57. Action.prototype.addChild = function (child) {
  58. if (child === null) {
  59. return false;
  60. }
  61. this.children.push(child);
  62. child.parent = this;
  63. return true;
  64. };
  65. /*
  66. * Removes the given action to children
  67. * @param child: the child to remove
  68. */
  69. Action.prototype.removeChild = function (child) {
  70. var indice = this.children.indexOf(child);
  71. if (indice !== -1) {
  72. this.children.splice(indice, 1);
  73. return true;
  74. }
  75. return false;
  76. };
  77. /*
  78. * Clears the children's array
  79. */
  80. Action.prototype.clearChildren = function () {
  81. this.children = new Array();
  82. };
  83. return Action;
  84. }());
  85. ActionsBuilder.Action = Action;
  86. })(ActionsBuilder || (ActionsBuilder = {}));
  87. //# sourceMappingURL=actionsbuilder.actionNode.js.map