1 function tasks_link(anc, a, b, type) {
4 this.o = document.createElement("div");
5 this.o.style.top = "0px";
6 this.o.style.left = "0px";
7 this.o.style.position = "absolute";
8 this.o.style.visibility = "hidden";
9 this.beg = document.createElement("div");
10 this.end = document.createElement("div");
11 this.arr = document.createElement("img");
12 this.arr.style.position = "absolute";
13 this.o.appendChild(this.arr);
14 this.anc.appendChild(this.o);
15 for (var i = 0 ; i < 2 ; i++) {
16 cur = i == 0 ? this.beg : this.end;
17 cur.style.width = '5px';
18 cur.style.height = '5px';
19 cur.style.backgroundColor = 'gray';
20 cur.style.visibility = 'inherit';
21 cur.style.zIndex = 20;
22 cur.style.position = 'absolute';
23 this.o.appendChild(cur);
31 if (typeof(a.connected) != 'object')
34 if (typeof(b.connected) != 'object')
37 for (var i = 0 ; i < 2 ; i++) {
38 cur = (i == 0 ? a : b);
39 cur.connected[cur.connected.length++] = this;
40 for( ; cur.parentNode != null && cur.parentNode != anc ; cur = cur.parentNode) {
47 tasks_link.prototype = {
52 update: function(method, obj)
55 if (method == 'end') {
56 if (this.o.style.visibility == 'visible')
57 this.o.style.visibility = 'hidden';
59 this.o.style.visibility = 'visible';
63 // FIXME you need to user the width of the border instead of +2
64 this.beg.style.left = (parseInt(this.a.style.left) + parseInt(this.a.style.width) + 2 + parseInt(this.a.parentNode.style.left))+"px";
65 this.beg.style.top = (parseInt(this.a.style.top) + parseInt(((parseInt(this.a.style.height) + 2) / 2)) + parseInt(this.a.parentNode.style.top))+"px";
66 this.beg.style.width = (parseInt(this.b.style.left) - (parseInt(this.a.style.left) + 2 + parseInt(this.b.style.width) + 2)+ parseInt(this.b.parentNode.style.left) + 5)+"px";
67 this.beg.style.height = "1px";
69 this.end.style.left = (parseInt(this.beg.style.left) + parseInt(this.beg.style.width))+"px";
70 this.arr.style.left = (parseInt(this.end.style.left) - 3)+"px";
71 /* this.end.style.left = (parseInt(this.b.style.left) + parseInt(this.b.parentNode.style.left))+"px";
72 this.end.style.top = (parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top))+"px"; */
73 endpty = parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top)+10;
74 this.end.style.width = "1px";
76 if (parseInt(this.beg.style.top) < endpty) {
77 this.end.style.top = this.beg.style.top;
78 this.end.style.height = (parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top) - ((parseInt(this.a.style.top) + parseInt(this.a.parentNode.style.top))) ) - 11 +"px";
79 this.arr.style.top = (parseInt(this.end.style.top) + parseInt(this.end.style.height) - 5)+"px";
80 this.arr.src = "img/arrow_do.png";
83 this.end.style.top = (parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top) + 23)+"px";
84 this.end.style.height = (parseInt(this.a.style.top) + parseInt(this.a.parentNode.style.top) - ((parseInt(this.b.style.top) + parseInt(this.b.parentNode.style.top))) ) - 11 +"px";
86 this.arr.style.top = this.end.style.top;
87 this.arr.src = "img/arrow_up.png";
91 this.o.style.visibility = "visible";
93 console.log("met: " + method + " obj: " + (obj == this.a ? "Obj A" : (obj == this.b ? "Obj B" : "Other")) );