actionsbuilder.actionNode.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. Node.prototype.isPointInside = function (x, y) {
  12. return this.rect.isPointInside(x, y) || this.text.isPointInside(x, y);
  13. };
  14. return Node;
  15. })();
  16. ActionsBuilder.Node = Node;
  17. var Action = (function () {
  18. function Action(node) {
  19. this.parent = null;
  20. this.children = new Array();
  21. this.name = "";
  22. this.type = ActionsBuilder.Type.OBJECT;
  23. this.properties = new Array();
  24. this.propertiesResults = new Array();
  25. this.combineArray = null;
  26. this.hub = null;
  27. this.combineAction = null;
  28. this.node = node;
  29. }
  30. Action.prototype.removeCombinedAction = function (action) {
  31. if (action === null || this.combineArray === null) {
  32. return false;
  33. }
  34. var index = this.combineArray.indexOf(action);
  35. if (index !== -1) {
  36. this.combineArray.splice(index, 1);
  37. }
  38. return false;
  39. };
  40. Action.prototype.addChild = function (child) {
  41. if (child === null) {
  42. return false;
  43. }
  44. this.children.push(child);
  45. child.parent = this;
  46. return true;
  47. };
  48. Action.prototype.removeChild = function (child) {
  49. var indice = this.children.indexOf(child);
  50. if (indice !== -1) {
  51. this.children.splice(indice, 1);
  52. return true;
  53. }
  54. return false;
  55. };
  56. Action.prototype.clearChildren = function () {
  57. this.children = new Array();
  58. };
  59. return Action;
  60. })();
  61. ActionsBuilder.Action = Action;
  62. })(ActionsBuilder || (ActionsBuilder = {}));