Mercurial > hg > Members > nobuyasu > html > graphViewer
annotate index.html @ 9:35ee0b1d8719 draft
modfied getEvidence function
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 20 Mar 2013 06:23:29 +0900 |
parents | 07191a24a9a4 |
children | 3fa1be92ab48 |
rev | line source |
---|---|
0 | 1 <meta http-equiv="content-type" content="text/html;charset=utf-8" /> |
2 <title>Graph Display</title> | |
3 <link rel='stylesheet' href="css/viewer_form.css"> | |
4 <script type="text/javascript" src="js/lib/jquery-1.8.1-min.js"></script> | |
5 <script type="text/javascript" src="js/lib/jquery-ui-1.8.23-min.js"></script> | |
6 <script type="text/javascript" src="js/lib/jquery.ui.touch-punch.min.js"></script> | |
7 <script type="text/javascript" src="js/lib/jsBezier-0.4-min.js"></script> | |
8 <script type="text/javascript" src="js/1.3.15/jsPlumb-util-1.3.15-RC1.js"></script> | |
9 <script type="text/javascript" src="js/1.3.15/jsPlumb-dom-adapter-1.3.15-RC1.js"></script> | |
10 <script type="text/javascript" src="js/1.3.15/jsPlumb-1.3.15-RC1.js"></script> | |
11 <script type="text/javascript" src="js/1.3.15/jsPlumb-defaults-1.3.15-RC1.js"></script> | |
12 <script type="text/javascript" src="js/1.3.15/jsPlumb-renderers-svg-1.3.15-RC1.js"></script> | |
13 <script type="text/javascript" src="js/1.3.15/jsPlumb-renderers-canvas-1.3.15-RC1.js"></script> | |
14 <script type="text/javascript" src="js/1.3.15/jsPlumb-renderers-vml-1.3.15-RC1.js"></script> | |
15 <script type="text/javascript" src="js/1.3.15/jquery.jsPlumb-1.3.15-RC1.js"></script> | |
16 <script type="text/javascript" src="js/1.3.15/jquery.jsPlumb-1.3.15-all-min.js"></script> | |
17 | |
2
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
18 <div id="traverseDisplay" style='position:fixed; width:250px; height:250px; border:solid 1px; border-radius:5px; opacity:1; z-index:10; visibility:visible;'> |
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
19 <div style='position:absolute; left:0; top:0; width:100%; height:100%; background:black; opacity:0.7;'></div> |
1
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
20 <div id="closeTraverseDisplay" style='position:absolute; right:5; top:-3; z-index:10; color:white;' onclick="$('#traverseDisplay').css('visibility','hidden');" onmouseover="$('#closeTraverseDisplay').css('color','yellow');" onmouseout="$('#closeTraverseDisplay').css('color','white')" >CLOSE</div> |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
21 <div style='position:absolute; width:90%; height:90%;'> |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
22 <div style='position:absolute; left:5%; top:5%; width:100%; height:100%; background:white;'> |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
23 <div id="traverseDisplayTitle" style='position:absolute; left:10px; top:5px; font-size:24px; width:100%; text-align:left;'> |
2
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
24 Traverse |
1
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
25 </div> |
3
d006eeb10183
modified traverse checkbox
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
26 <div style='position:absolute; top:30px; width:100%; margin-left:10px;'> Direction: |
4
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
27 <label style='position:relative;' ><input id="direction_in" type='checkbox' checked value='in'/>IN</label> |
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
28 <label style='position:relative;'><input id="direction_out" type='checkbox' checked value='out'/>OUT</label> |
3
d006eeb10183
modified traverse checkbox
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
2
diff
changeset
|
29 </div> |
4
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
30 <div id="traverseDisplayBody" style='position:absolute; left:20px; top:50px;'> |
8
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
31 Please click any node. |
1
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
32 </div> |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
33 </div> |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
34 </div> |
8
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
35 <span class='button display' style='position:absolute; width:100; left:75; bottom:5; opacity:1;' onclick='traverseAction();'>traverse</span> |
1
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
36 </div> |
0 | 37 |
2
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
38 <div id="miniDisplay" style='position:fixed; width:250px; height:250px; border:solid 1px; border-radius:5px; opacity:0.5; z-index:10; visibility:visible;'> |
1
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
39 <div style='position:absolute; left:0; top:0; width:100%; height:100%; background:black; opacity:0.5;'></div> |
0 | 40 <div id="closeMiniDisplay" style='position:absolute; right:5; top:-3; z-index:10; color:white;' onclick="$('#miniDisplay').css('visibility','hidden');" onmouseover="$('#closeMiniDisplay').css('color','yellow');" onmouseout="$('#closeMiniDisplay').css('color','white')" >CLOSE</div> |
41 <div style='position:absolute; width:90%; height:90%;'> | |
42 <div style='position:absolute; left:5%; top:5%; width:100%; height:100%; background:white;'> | |
43 <div id="miniDisplayTitle" style='position:absolute; left:10px; top:5px; font-size:24px; width:100%; text-align:left;'> | |
44 </div> | |
45 <div id="miniDisplayBody" style='position:absolute; left:20px; top:40px;'> | |
2
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
46 Please click any node. |
0 | 47 </div> |
48 </div> | |
49 </div> | |
50 </div> | |
51 | |
52 <div class="graphMainCss" style="position:absolute; left:0; bottom:0; width:100%; height:75%;" id='graphMain'> | |
53 <div style="position:absolute; width:0; height:0;left:0;" id='graphRoot'> | |
54 </div> | |
55 </div> | |
56 | |
1
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
57 |
0 | 58 <script type="text/javascript"> |
8
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
59 var BASE_URL = ""; |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
60 |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
61 |
0 | 62 if(!Array.prototype.filter){ |
63 Array.prototype.filter=function(func){ | |
64 var arr=[]; | |
65 for(var i=0;i<this.length;i++)if(func(this[i]))arr.push(this[i]); | |
66 return arr; | |
67 } | |
68 } | |
69 | |
70 function loadUserList() { | |
71 $.ajax({ | |
72 url:BASE_URL + "/users/all", | |
73 success:function(o) { userList = o.sort(); showUserList([]); }, | |
74 type:"GET", cache:false, | |
75 error:function(o) { console.log("loadUserList error : ",o); } | |
76 }); | |
77 } | |
78 | |
8
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
79 function GraphData() { |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
80 var graphData = {}; |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
81 graphData.nodes = {}; |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
82 graphData.edges = {}; |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
83 return graphData; |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
84 } |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
85 |
0 | 86 function beginScript() { |
87 DragHandler.attach($('#miniDisplay')[0]); | |
1
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
88 DragHandler.attach($('#traverseDisplay')[0]); |
0 | 89 } |
90 | |
91 var DragHandler = { | |
92 _oElem : null, | |
93 attach : function(oElem) { | |
94 oElem.onmousedown = DragHandler._dragBegin; | |
95 return oElem; | |
96 }, | |
97 _dragBegin : function(e) { | |
98 var oElem = DragHandler._oElem = this; | |
99 if (isNaN(parseInt(oElem.style.left))) { oElem.style.left = '0px'; } | |
100 if (isNaN(parseInt(oElem.style.top))) { oElem.style.top = '0px'; } | |
101 var x = parseInt(oElem.style.left); | |
102 var y = parseInt(oElem.style.top); | |
103 e = e ? e : window.event; | |
104 oElem.mouseX = e.clientX; | |
105 oElem.mouseY = e.clientY; | |
106 document.onmousemove = DragHandler._drag; | |
107 document.onmouseup = DragHandler._dragEnd; | |
108 return false; | |
109 }, | |
110 _drag : function(e) { | |
111 var oElem = DragHandler._oElem; | |
112 var x = parseInt(oElem.style.left); | |
113 var y = parseInt(oElem.style.top); | |
114 e = e ? e : window.event; | |
115 oElem.style.left = x + (e.clientX - oElem.mouseX) + 'px'; | |
116 oElem.style.top = y + (e.clientY - oElem.mouseY) + 'px'; | |
117 oElem.mouseX = e.clientX; | |
118 oElem.mouseY = e.clientY; | |
119 return false; | |
120 }, | |
121 _dragEnd : function() { | |
122 var oElem = DragHandler._oElem; | |
123 var x = parseInt(oElem.style.left); | |
124 var y = parseInt(oElem.style.top); | |
125 document.onmousemove = null; | |
126 document.onmouseup = null; | |
127 DragHandler._oElem = null; | |
128 } | |
129 | |
130 }; | |
131 | |
132 function addLoadEvent(func) { | |
133 var oldonload = window.onload; | |
134 if (typeof window.onload != 'function') { | |
135 window.onload = func; | |
136 } else { | |
137 window.onload = function() { | |
138 if (oldonload) { | |
139 oldonload(); | |
140 } | |
141 func(); | |
142 } | |
143 } | |
144 } | |
145 | |
146 addLoadEvent(function() { | |
147 beginScript(); | |
148 }); | |
149 | |
150 function writeMiniDisplay(title,str) { | |
151 $('#miniDisplayBody')[0].innerHTML = str; | |
152 if(title) { | |
153 $('#miniDisplayTitle')[0].innerHTML = title; | |
154 } | |
155 } | |
156 | |
157 function writeJSONDataToMiniDisplay(jsonObj) { | |
158 var str = ""; | |
159 for (var key in jsonObj.property) { | |
4
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
160 if (key != 'edgeInfo' ) { |
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
161 str = str + key + ": "+ jsonObj.property[key] + "<br>"; |
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
162 } |
0 | 163 } |
164 writeMiniDisplay(jsonObj.property.title, str); | |
165 } | |
2
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
166 |
4
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
167 function getTraverseDivTemplate(kind, inNum, outNum) { |
8
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
168 return "<div><label id='traverseLabel'><input type='checkbox' checked value='"+kind+"'/>"+kind+"</label><br>in:"+inNum+" out:"+outNum+"</div>"; |
2
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
169 } |
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
170 |
4
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
171 function createTraverseView(info) { |
5
db93a718f393
modified traverseTemplate
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
4
diff
changeset
|
172 var viewHtml = ""; |
4
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
173 for (var kind in info) { |
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
174 var data = info[kind]; |
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
175 var inNum = 0; |
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
176 var outNum = 0; |
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
177 if (data['in']) { |
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
178 inNum = data['in']; |
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
179 } |
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
180 if (data['out']) { |
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
181 outNum = data['out']; |
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
182 } |
5
db93a718f393
modified traverseTemplate
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
4
diff
changeset
|
183 viewHtml = viewHtml + getTraverseDivTemplate(kind, inNum, outNum); |
4
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
184 } |
5
db93a718f393
modified traverseTemplate
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
4
diff
changeset
|
185 return viewHtml; |
2
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
186 } |
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
187 |
8
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
188 function createEdgeInfoView(node) { |
2
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
189 var id = node.property.id; |
5
db93a718f393
modified traverseTemplate
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
4
diff
changeset
|
190 var edgeInfo = node.property.edgeInfo; |
1
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
191 var str = ""; |
2
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
192 var info = {}; |
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
193 for (var i=0; i<edgeInfo.length; i++) { |
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
194 var kind = edgeInfo[i].kind; |
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
195 var dir = edgeInfo[i].direction; |
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
196 var num = edgeInfo[i].num; |
6
a4323051f7af
output to traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
197 info[kind] = {}; |
2
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
198 info[kind][dir] = num; |
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
199 } |
5
db93a718f393
modified traverseTemplate
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
4
diff
changeset
|
200 var viewHTML = createTraverseView(info); |
db93a718f393
modified traverseTemplate
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
4
diff
changeset
|
201 edgeInfo.viewHtml = viewHTML; |
db93a718f393
modified traverseTemplate
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
4
diff
changeset
|
202 $('#traverseDisplayBody')[0].innerHTML = viewHTML; |
2
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
203 } |
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
204 |
0 | 205 function init() { |
206 jsPlumb.importDefaults({ | |
207 Connector : [ "Straight", { curviness:50 } ], | |
208 PaintStyle : { strokeStyle:"gray", lineWidth:2 }, | |
209 EndpointStyle : {}, | |
210 Anchors: ["BottomCenter","TopCenter"], | |
211 }); | |
212 var rootDiv = $('#graphMain'); | |
213 var rootLeft = rootDiv.offset().left; | |
214 var rootTop = rootDiv.offset().top; | |
1
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
215 $('#traverseDisplay').css( { |
0 | 216 left: rootLeft, |
217 top: rootTop | |
218 }); | |
2
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
219 var heightStr = $('#traverseDisplay').css('height').split('px')[0]; |
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
220 var height = parseInt(heightStr); |
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
221 $('#miniDisplay').css( { |
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
222 left: rootLeft, |
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
223 top: rootTop + height + 50 |
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
224 }); |
0 | 225 } |
226 | |
2
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
227 function showMiniDisplay(node) { |
0 | 228 $("#miniDisplay").css("visibility", "visible"); |
4
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
229 writeJSONDataToMiniDisplay(node); |
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
230 } |
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
231 |
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
232 function showTraverseDisplay(node) { |
8
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
233 this.id = node.property.id; |
5
db93a718f393
modified traverseTemplate
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
4
diff
changeset
|
234 if (!node.property.edgeInfo) { console.log("not found node.edgeInfo "); return; } |
db93a718f393
modified traverseTemplate
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
4
diff
changeset
|
235 if (!node.property.edgeInfo.viewHtml) { |
8
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
236 createEdgeInfoView(node); |
4
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
237 } |
8
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
238 $('#traverseDisplayBody')[0].innerHTML = node.property.edgeInfo.viewHtml; |
1
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
239 $("#traverseDisplay").css("visibility", "visible"); |
0 | 240 } |
241 | |
242 var nodeNum = 0; | |
7
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
243 var OFFSET = 200; |
0 | 244 var miniD = $('#miniDisplay')[0].style; |
245 var offsetLeft = parseInt(miniD.width.split('px')[0]); | |
246 var offsetTop = parseInt(miniD.height.split('px')[0]); | |
247 function calcNewNodePosition() { | |
248 var position = {}; | |
7
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
249 position = {x: offsetLeft, y: nodeNum*OFFSET + offsetTop / 3}; |
0 | 250 nodeNum++; |
251 return position; | |
252 } | |
253 | |
254 /* | |
255 * | |
256 */ | |
257 function clickNodeDiv(id) { | |
258 var graphData = GRAPH_DATA; | |
259 var node = graphData.nodes[id]; | |
260 var rels = {evidence:1, | |
261 dependency:1, | |
262 derived:1, | |
263 version:1, | |
264 agreement:1}; | |
265 showRelationNodes(graphData, node, rels); | |
266 } | |
267 | |
8
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
268 function addEdgeInfo(id, kind, direction) { |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
269 var nodes = GRAPH_DATA.nodes; |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
270 var edges = GRAPH_DATA.edges; |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
271 |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
272 } |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
273 |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
274 function getEvidence(id, kind, direction) { |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
275 $.ajax({ |
9
35ee0b1d8719
modfied getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
8
diff
changeset
|
276 url:"/aat/aaevidencesiftingmodel.userdesktops/get?id="+id+"?kind="+kind+"?direction="+direction, |
8
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
277 success:function(o) { parseJSONGraphData(GRAPH_DATA, o); }, |
9
35ee0b1d8719
modfied getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
8
diff
changeset
|
278 type:"GET", cache:false, |
8
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
279 error:function(o) { console.log("getEvidence error : ", o); } |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
280 }); |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
281 } |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
282 |
4
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
283 function traverseAction() { |
8
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
284 var inDirChecked = $('#direction_in')[0].checked; |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
285 var outDirChecked = $('#direction_out')[0].checked; |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
286 var labelTags = $('[id=traverseLabel]'); |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
287 var kinds = []; |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
288 for (var i=0;i<labelTags.length; i++ ) { |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
289 var inputTag = labelTags[i].children[0]; |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
290 if (inputTag.checked) { |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
291 kinds.push(inputTag.value); |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
292 } |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
293 } |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
294 var id = this.id; |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
295 for (var i=0; i<kinds.length; i++) { |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
296 var kind = kinds[i]; |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
297 if (inDirChecked) getEvidence(id, kind, "in"); |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
298 if (outDirChecked) getEvidence(id, kind, "out"); |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
299 } |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
300 |
4
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
301 } |
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
302 |
0 | 303 function returnCheckdRelation() { |
304 | |
305 } | |
306 | |
307 function createNodeDiv(node) { | |
308 node.view = $("<div class='graphNode'/>"); | |
309 node.view.click(function(){ clickNodeDiv(node.property.id) }); | |
310 if(!node.position) node.position = calcNewNodePosition(); | |
311 node.view.hover(); | |
312 var div = $("<div class='graphNodeContent' />")[0]; | |
313 div.innerHTML = node.property.title; | |
314 node.view[0].appendChild(div); | |
315 return node; | |
316 } | |
317 | |
318 function updateNodeElement(node) { | |
319 var created = false; | |
320 if(!node.view) { | |
321 created = true; | |
322 createNodeDiv(node); | |
323 } | |
324 var div = node.view; | |
325 // div.text(node.property.title); | |
4
810e406abb71
add traverseLabel
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
3
diff
changeset
|
326 div.click(function(){showMiniDisplay(node); showTraverseDisplay(node);}); |
0 | 327 DragHandler.attach($(node.view)[0]); |
328 var kindBackground = {agree:"#aaf", rejected:"#fff"}; | |
329 var kindBorder = {agree:"#66a", rejected:"#a66"}; | |
330 div.css("background", kindBackground[node.kind]||"white"); | |
331 div.css("border-color", kindBorder[node.kind] ||"#58f"); | |
332 div.css({ | |
333 left: node.position.x, | |
334 top: node.position.y | |
335 }); | |
336 return created; | |
337 } | |
338 | |
339 | |
340 function updateNode(node) { | |
341 if(updateNodeElement(node)) { | |
342 var fc = $('#graphRoot')[0].firstChild; | |
343 if(fc) { | |
344 $('#graphRoot')[0].insertBefore(node.view[0], fc); | |
345 } else { | |
346 $('#graphRoot').append(node.view); | |
347 } | |
348 } | |
349 } | |
350 | |
351 var ViewParam = { | |
352 offsetTop:100, | |
353 offsetBottom:100, | |
354 offsetLeft:100, | |
355 offsetRight:100, | |
356 nodeWidth:120, | |
357 nodeHeight:60, | |
358 intervalX:140, | |
359 intervalY:120 | |
360 }; | |
361 | |
362 | |
363 function Edge(fromNode, toNode, relation) { | |
364 var obj = {from:fromNode, to:toNode, rel:relation }; | |
365 return obj; | |
366 } | |
367 | |
368 var arrowConnector = { | |
369 connector:"StateMachine", | |
370 // paintStyle:{lineWidth:3,strokeStyle:"#056"}, | |
371 paintStyle:{lineWidth:2,strokeStyle:"#aaf"}, | |
372 hoverPaintStyle:{strokeStyle:"#dbe300"}, | |
373 endpoint:"Blank", | |
374 anchor:"Continuous", | |
375 overlays:[ ["PlainArrow", {location:1, width:20, length:12} ]] | |
376 }; | |
377 | |
378 var arrowBothConnector = { | |
379 connector:"StateMachine", | |
380 paintStyle:{lineWidth:2,strokeStyle:"#aaf"}, | |
381 hoverPaintStyle:{strokeStyle:"#dbe300"}, | |
382 endpoint:"Blank", | |
383 }; | |
384 | |
385 function parseJSONGraphData(memory ,jsonObj) { | |
386 var nodes = jsonObj.nodes; | |
387 for (var i=0; i<nodes.length; i++) { | |
388 var node = nodes[i]; | |
389 memory.nodes[node.id] = {}; | |
390 memory.nodes[node.id].in = []; | |
391 memory.nodes[node.id].out = []; | |
392 memory.nodes[node.id].both = []; | |
393 memory.nodes[node.id].property = node; | |
394 } | |
395 return memory; | |
396 } | |
397 | |
398 function showEdge(graphData, edge) { | |
399 function connectEdge(fromNode, toNode, rel, type) { | |
400 var c; | |
401 if (type == 'both') { | |
402 c = jsPlumb.connect({source:fromNode.view[0], target:toNode.view[0]}, arrowBothConnector); | |
403 } else { | |
404 c = jsPlumb.connect({source:fromNode.view[0], target:toNode.view[0]}, arrowConnector); | |
405 } | |
406 // jsPlumb.select({source:fromNode.view[0]}).removeAllOverlays(); | |
407 c.setLabel({label:"<span style='color:#129; font-size:1.5em;'>"+rel+"</span>",cssStyle:""}); | |
408 return c; | |
409 } | |
410 if (edge.visible) return; | |
411 var fromNode = graphData.nodes[edge.property.from]; | |
412 var toNode = graphData.nodes[edge.property.to]; | |
413 if (!fromNode.view && !toNode.view) return; | |
414 var rel = edge.property.rel; | |
415 var type = edge.property.type; | |
416 connectEdge(fromNode, toNode, rel, type); | |
417 edge.visible = true; | |
418 } | |
419 | |
420 function createNodeFromEdge(graphData, edge, baseNode) { | |
421 if(edge.visible) return; | |
422 var fromNode = graphData.nodes[edge.property.from]; | |
423 if (!fromNode.view) { | |
424 updateNode(fromNode); | |
425 } | |
426 var toNode = graphData.nodes[edge.property.to]; | |
427 if (!toNode.view) { | |
428 updateNode(toNode); | |
429 } | |
430 showEdge(graphData, edge); | |
431 } | |
432 | |
433 function getRelationEdgeIds(node) { | |
434 var edgeIds = []; | |
435 for (var i=0; i<node.in.length; i++) edgeIds.push(node.in[i]); | |
436 for (var i=0; i<node.out.length; i++) edgeIds.push(node.out[i]); | |
437 for (var i=0; i<node.both.length; i++) edgeIds.push(node.both[i]); | |
438 return edgeIds; | |
439 } | |
440 | |
441 function getRelationNodeIds(graphData, node) { | |
442 var nodes = graphData.nodes; | |
443 var edges = graphData.edges; | |
444 var nodeIds = []; | |
445 for (var i=0; i<node.in.length; i++) { | |
446 var edgeId = node.in[i]; | |
447 nodeIds.push(edges[edgeId].property.from); | |
448 } | |
449 for (var i=0; i<node.out.length; i++) { | |
450 var edgeId = node.out[i]; | |
451 nodeIds.push(edges[edgeId].property.to); | |
452 } | |
453 for (var i=0; i<node.both.length; i++) { | |
454 var edgeId = node.both[i]; | |
455 var fromId = edges[edgeId].property.from; | |
456 var toId = edges[edgeId].property.to; | |
457 if (fromId == node.property.id) { | |
458 nodeIds.push(toId); | |
459 } else { | |
460 nodeIds.push(fromId); | |
461 } | |
462 } | |
463 return nodeIds; | |
464 } | |
465 | |
466 /* | |
8
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
467 * This function output all NODE that are related [node] |
0 | 468 */ |
469 function updateRelationNodes(graphData, node) { | |
470 var id = node.property.id; | |
471 var edges = graphData.edges; | |
472 var edgeIds = getRelationEdgeIds(node); | |
473 for (var i=0; i<edgeIds.length; i++ ) { | |
474 createNodeFromEdge(graphData, edges[edgeIds[i]]); | |
475 } | |
476 jsPlumb.removeAllEndpoints(); | |
477 jsPlumb.draggable($('.graphNode')); | |
478 } | |
479 | |
480 /* | |
481 * rels = {dependency:1, evidence:1}; | |
482 * showRelationNodes(graphData, node, rels); | |
483 */ | |
484 function showRelationNodes(graphData, node, rels) { | |
485 var id = node.property.id; | |
486 var edges = graphData.edges; | |
487 var edgeIds = getRelationEdgeIds(node); | |
488 for (var i=0; i<edgeIds.length; i++) { | |
489 var edge = edges[edgeIds[i]]; | |
490 if (rels[edge.property.rel]) { | |
491 createNodeFromEdge(graphData, edges[edgeIds[i]]); | |
492 } | |
493 } | |
494 jsPlumb.removeAllEndpoints(); | |
495 jsPlumb.draggable($('.graphNode')); | |
496 } | |
497 | |
2
e90546bb87e4
mofidied traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
1
diff
changeset
|
498 var BASE_THETA = -30; |
0 | 499 var BASE_ANGLE = 180; |
500 var BASE_DISTANCE = 180; | |
501 function calcChildNodePosition(parent, num) { | |
502 var pX = parent.position.x; | |
503 var pY = parent.position.y; | |
504 var deg = BASE_ANGLE - num * BASE_THETA; | |
505 var theta = deg * (Math.PI / 180); | |
506 var cX = pX - (BASE_DISTANCE * Math.cos(theta)); | |
507 var cY = pY - (BASE_DISTANCE * Math.sin(theta)); | |
508 return {x:cX, y:cY}; | |
509 } | |
510 | |
511 function showAllEdge(graphData) { | |
512 var edges = graphData.edges; | |
513 for (var id in edges) { | |
514 showEdge(graphData, edges[id]); | |
515 } | |
516 jsPlumb.removeAllEndpoints(); | |
517 jsPlumb.draggable($('.graphNode')); | |
518 } | |
519 | |
520 var EDGE_LIST = { | |
521 evidence:'evidence', | |
522 dependency:'dependency', | |
523 version:'version', | |
524 derived:'derived', | |
525 agreement:'agreement' | |
526 }; | |
527 | |
528 function recursiveCalcPosition(graphData, parentNode) { | |
529 if (!parentNode.position) updateNode(parentNode); | |
530 childNodeIds = getRelationNodeIds(graphData, parentNode); | |
531 /* calcration of childNode position */ | |
532 var numCalcChild = 0; | |
533 var childArray = {}; | |
534 for (var i=0; i<childNodeIds.length; i++) { | |
535 var id = childNodeIds[i]; | |
536 var childNode = graphData.nodes[id]; | |
537 childArray[id] = childNode; | |
538 if (!childNode.position) { | |
539 childNode.position = calcChildNodePosition(parentNode, numCalcChild); | |
540 numCalcChild++; | |
541 } | |
542 } | |
543 /* calcration of grandchildNode position */ | |
544 for (var id in childArray) { | |
545 var childNode = childArray[id]; | |
546 var grandChildIds = getRelationNodeIds(graphData, childNode); | |
547 for (var i=0; i<grandChildIds.length; i++) { | |
548 var gId = grandChildIds[i]; | |
549 var grandChild = graphData.nodes[gId]; | |
550 if (!grandChild.position) { | |
551 recursiveCalcPosition(graphData, childNode); | |
552 } | |
553 } | |
554 } | |
555 } | |
556 | |
557 var GRAPH_DATA = new GraphData(); | |
558 var rootNode = {}; | |
7
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
559 function startUserDesktopUI() { |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
560 function showFirstEvidenceList(graphData) { |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
561 var nodes = graphData.nodes; |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
562 for (var id in nodes) { |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
563 updateNode(nodes[id]); |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
564 } |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
565 } |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
566 var graphData = GRAPH_DATA; |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
567 showFirstEvidenceList(graphData); |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
568 } |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
569 |
0 | 570 function testStart() { |
571 init(); | |
6
a4323051f7af
output to traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
5
diff
changeset
|
572 var graphData = parseJSONGraphData(GRAPH_DATA, sampleData); |
7
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
573 startUserDesktopUI(); |
0 | 574 } |
575 | |
8
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
576 $(function() { |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
577 userName = localStorage.userName; |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
578 testStart(); |
07191a24a9a4
modified getEvidence function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
7
diff
changeset
|
579 }) |
0 | 580 |
1
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
581 |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
582 edgeInfo1 = [ |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
583 { |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
584 kind:"collected", |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
585 direction:"in", |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
586 num:"2" |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
587 }, |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
588 { |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
589 kind:"reject", |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
590 direction:"out", |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
591 num:"1" |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
592 } |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
593 ]; |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
594 |
7
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
595 edgeInfo2 = [ |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
596 { |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
597 kind:"collected", |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
598 direction:"in", |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
599 num:"1" |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
600 } |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
601 ]; |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
602 |
1
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
603 sampleData = { |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
604 nodes: [ |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
605 { |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
606 id:"1", |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
607 title:"context1", |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
608 createdUser:"oshiro", |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
609 edgeInfo:edgeInfo1 |
7
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
610 }, |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
611 { |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
612 id:"2", |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
613 title:"context2", |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
614 content:"content", |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
615 createUser:"tamayose", |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
616 edgeInfo:edgeInfo2 |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
617 } |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
618 ] |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
619 }; |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
620 |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
621 /* id 1 select direction in and kind collected */ |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
622 sampleData2 = { |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
623 nodes: [ |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
624 { |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
625 id:"3", |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
626 title:"id 3", |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
627 createUser:"kinjo", |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
628 edgeInfo:edgeInfo1 |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
629 }, |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
630 { |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
631 id:"4", |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
632 title:"id 4", |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
633 createUser:"oshiro", |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
634 edgeInfo:edgeInfo2 |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
635 } |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
636 ] |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
637 }; |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
638 |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
639 /* id 1 select direction out and kind reject */ |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
640 sampleData3 = { |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
641 nodes: [ |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
642 { |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
643 id:"6", |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
644 title:"id 6", |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
645 createUser:"kinjo", |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
646 edgeInfo:edgeInfo1 |
1
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
647 } |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
648 ] |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
649 }; |
a3fdabc0613e
create traverseDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
0
diff
changeset
|
650 |
7
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
651 /* id 2 select direction in and kind collected */ |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
652 sampleData4 = { |
0 | 653 nodes: [ |
654 { | |
655 id:"5", | |
7
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
656 title:"id 5", |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
657 createUser:"user 5", |
29db6ff1d63e
create startUserDesktopUI function
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
6
diff
changeset
|
658 edgeInfo:edgeInfo2 |
0 | 659 } |
660 ] | |
661 }; | |
662 | |
663 </script> | |
664 |