Mercurial > hg > Members > nobuyasu > Consensus
annotate public/viewer/viewer_white.html @ 104:88c16240c78a draft
add jquery.jsPlumb-1.3.15-all-min.js
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 17 Mar 2013 03:55:08 +0900 |
parents | 1b44197d02ef |
children | 9bf5e984f288 |
rev | line source |
---|---|
94
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
1 <meta http-equiv="content-type" content="text/html;charset=utf-8" /> |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
2 <title>R-Consensus</title> |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
3 <link rel='stylesheet' href="form.css"> |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
4 <script src='form.js'></script> |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
5 <script type="text/javascript" src="js/lib/jquery-1.8.1-min.js"></script> |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
6 <script type="text/javascript" src="js/lib/jquery-ui-1.8.23-min.js"></script> |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
7 <script type="text/javascript" src="js/lib/jquery.ui.touch-punch.min.js"></script> |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
8 <script type="text/javascript" src="js/lib/jsBezier-0.4-min.js"></script> |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
9 <script type="text/javascript" src="js/1.3.15/jsPlumb-util-1.3.15-RC1.js"></script> |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
10 <script type="text/javascript" src="js/1.3.15/jsPlumb-dom-adapter-1.3.15-RC1.js"></script> |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
11 <script type="text/javascript" src="js/1.3.15/jsPlumb-1.3.15-RC1.js"></script> |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
12 <script type="text/javascript" src="js/1.3.15/jsPlumb-defaults-1.3.15-RC1.js"></script> |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
13 <script type="text/javascript" src="js/1.3.15/jsPlumb-renderers-svg-1.3.15-RC1.js"></script> |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
14 <script type="text/javascript" src="js/1.3.15/jsPlumb-renderers-canvas-1.3.15-RC1.js"></script> |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
15 <script type="text/javascript" src="js/1.3.15/jsPlumb-renderers-vml-1.3.15-RC1.js"></script> |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
16 <script type="text/javascript" src="js/1.3.15/jquery.jsPlumb-1.3.15-RC1.js"></script> |
104
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
17 <script type="text/javascript" src="js/1.3.15/jquery.jsPlumb-1.3.15-all-min.js"></script> |
94
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
18 <script type="text/javascript" src='treeArrangement.js'></script> |
95
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
19 |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
20 <style> |
103
1b44197d02ef
mofidied body css
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
102
diff
changeset
|
21 body { |
104
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
22 background-color:#ccf; |
103
1b44197d02ef
mofidied body css
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
102
diff
changeset
|
23 background:-moz-linear-gradient(top,#fff,#ccf); |
1b44197d02ef
mofidied body css
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
102
diff
changeset
|
24 background:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#ccf)); |
1b44197d02ef
mofidied body css
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
102
diff
changeset
|
25 } |
1b44197d02ef
mofidied body css
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
102
diff
changeset
|
26 div.header { |
1b44197d02ef
mofidied body css
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
102
diff
changeset
|
27 position:absolute; |
1b44197d02ef
mofidied body css
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
102
diff
changeset
|
28 left:0;top:0; |
1b44197d02ef
mofidied body css
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
102
diff
changeset
|
29 z-index:5; |
1b44197d02ef
mofidied body css
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
102
diff
changeset
|
30 height:50px; |
1b44197d02ef
mofidied body css
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
102
diff
changeset
|
31 width:100%; |
1b44197d02ef
mofidied body css
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
102
diff
changeset
|
32 background:#ddd; |
1b44197d02ef
mofidied body css
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
102
diff
changeset
|
33 background:-moz-linear-gradient(top,#fff,#ddd); |
1b44197d02ef
mofidied body css
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
102
diff
changeset
|
34 background:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#ddd)); |
1b44197d02ef
mofidied body css
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
102
diff
changeset
|
35 color:silver; |
1b44197d02ef
mofidied body css
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
102
diff
changeset
|
36 font-size:40px; |
95
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
37 } |
99 | 38 div.graphNode { |
101
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
39 position:absolute; |
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
40 font-size:12px; padding:4px; background:white; |
99 | 41 z-index:20; |
102
8d8e6c2bfec2
modified viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
101
diff
changeset
|
42 width: 45px; |
8d8e6c2bfec2
modified viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
101
diff
changeset
|
43 height: 40px; |
101
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
44 border-radius:50px; |
99 | 45 border:2px solid silver; |
46 overflow:hidden; | |
47 cursor:pointer; | |
100
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
48 border-color:"blue"; |
103
1b44197d02ef
mofidied body css
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
102
diff
changeset
|
49 } |
104
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
50 div.graphNodeContent { |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
51 position:absolute; |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
52 z-index:21; |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
53 font-size:12px; |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
54 background:white; |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
55 width: 50%; |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
56 height: 80%; |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
57 left: 10px; |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
58 top: 8px; |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
59 } |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
60 |
95
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
61 </style> |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
62 |
99 | 63 <div class='header'> |
64 <nobr id='header_title' style='margin-left:40px;'><a href='index.html'>Home</a></nobr> | |
65 </div> | |
66 | |
104
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
67 <div id="miniDisplay" style='position:fixed; right:20; top:70; width:300px; height:300px; border:solid 1px; border-radius:5px; opacity:0.5; z-index:10; visibility:hidden;'> |
99 | 68 <div style='position:absolute; left:0; top:0; width:100%; height:100%; background:black; opacity:0.5;'> </div> |
69 <div id="closeMiniDisplay" style='position:absolute; right:5; top:-3; z-index:10;' onclick="$('#miniDisplay').css('visibility','hidden');" onmouseover="$('#closeMiniDisplay').css('color','blue');" onmouseout="$('#closeMiniDisplay').css('color','black')" >CLOSE</div> | |
70 <div style='position:absolute; width:90%; height:90%;'> | |
71 <div style='position:absolute; left:5%; top:5%; width:100%; height:100%; background:white;'> | |
72 <div id="miniDisplayTitle" style='position:absolute; left:10px; top:5px; font-size:24px; width:100%; text-align:left;'> | |
73 </div> | |
74 <div id="miniDisplayBody" style='position:absolute; left:20px; top:40px;'> | |
75 body | |
76 </div> | |
77 </form> | |
78 </div> | |
79 </div> | |
80 </div> | |
81 | |
82 <div style="position:relative;left:0;top:0;" id='graphMain'> | |
100
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
83 <div style="position:absolute; width:0; height:0;left:0;" id='graphRoot'> |
99 | 84 </div> |
85 </div> | |
86 | |
87 | |
94
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
88 <script type="text/javascript"> |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
89 var LOAD_INTERVAL = 5; |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
90 var BASE_URL = ""; |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
91 if(!Array.prototype.filter){ |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
92 Array.prototype.filter=function(func){ |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
93 var arr=[]; |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
94 for(var i=0;i<this.length;i++)if(func(this[i]))arr.push(this[i]); |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
95 return arr; |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
96 } |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
97 } |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
98 |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
99 var treeInfo; |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
100 var userList = []; |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
101 var root_id; |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
102 function loadConsensus(id) { |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
103 function onload(json) { |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
104 var title = json.hogehoge ? json.hogehoge : "title"; |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
105 document.title = title; |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
106 $('#headertitle_main').text(title) |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
107 } |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
108 } |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
109 |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
110 function loadUserList() { |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
111 $.ajax({ |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
112 url:BASE_URL + "/users/all", |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
113 success:function(o) { userList = o.sort(); showUserList([]); }, |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
114 type:"GET", cache:false, |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
115 error:function(o) { console.log("loadUserList error : ",o); } |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
116 }); |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
117 } |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
118 |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
119 $(function() { |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
120 userName = localStorage.userName; |
100
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
121 if(userName) {start();} |
102
8d8e6c2bfec2
modified viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
101
diff
changeset
|
122 else { } |
94
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
123 }) |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
124 |
95
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
125 function beginScript() { |
97
5098c4967a3a
modified miniDisplay
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
96
diff
changeset
|
126 DragHandler.attach($('#miniDisplay')[0]); |
95
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
127 } |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
128 |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
129 var DragHandler = { |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
130 _oElem : null, |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
131 attach : function(oElem) { |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
132 oElem.onmousedown = DragHandler._dragBegin; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
133 return oElem; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
134 }, |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
135 _dragBegin : function(e) { |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
136 var oElem = DragHandler._oElem = this; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
137 if (isNaN(parseInt(oElem.style.left))) { oElem.style.left = '0px'; } |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
138 if (isNaN(parseInt(oElem.style.top))) { oElem.style.top = '0px'; } |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
139 var x = parseInt(oElem.style.left); |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
140 var y = parseInt(oElem.style.top); |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
141 e = e ? e : window.event; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
142 oElem.mouseX = e.clientX; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
143 oElem.mouseY = e.clientY; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
144 document.onmousemove = DragHandler._drag; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
145 document.onmouseup = DragHandler._dragEnd; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
146 return false; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
147 }, |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
148 _drag : function(e) { |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
149 var oElem = DragHandler._oElem; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
150 var x = parseInt(oElem.style.left); |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
151 var y = parseInt(oElem.style.top); |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
152 e = e ? e : window.event; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
153 oElem.style.left = x + (e.clientX - oElem.mouseX) + 'px'; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
154 oElem.style.top = y + (e.clientY - oElem.mouseY) + 'px'; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
155 oElem.mouseX = e.clientX; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
156 oElem.mouseY = e.clientY; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
157 return false; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
158 }, |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
159 _dragEnd : function() { |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
160 var oElem = DragHandler._oElem; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
161 var x = parseInt(oElem.style.left); |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
162 var y = parseInt(oElem.style.top); |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
163 document.onmousemove = null; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
164 document.onmouseup = null; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
165 DragHandler._oElem = null; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
166 } |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
167 |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
168 }; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
169 |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
170 function addLoadEvent(func) { |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
171 var oldonload = window.onload; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
172 if (typeof window.onload != 'function') { |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
173 window.onload = func; |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
174 } else { |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
175 window.onload = function() { |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
176 if (oldonload) { |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
177 oldonload(); |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
178 } |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
179 func(); |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
180 } |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
181 } |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
182 } |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
183 |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
184 addLoadEvent(function() { |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
185 beginScript(); |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
186 }); |
341766c5a6e9
modified viewer_whit.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
94
diff
changeset
|
187 |
100
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
188 function writeMiniDisplay(title,str) { |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
189 $('#miniDisplayBody')[0].innerHTML = str; |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
190 if(title) { |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
191 $('#miniDisplayTitle')[0].innerHTML = title; |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
192 } |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
193 } |
99 | 194 |
195 function writeJSONDataToMiniDisplay(jsonObj) { | |
196 var str = ""; | |
100
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
197 for (var key in jsonObj.property) { |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
198 str = str + key + ": "+ jsonObj.property[key] + "<br>"; |
99 | 199 } |
100
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
200 writeMiniDisplay(jsonObj.property.title, str); |
99 | 201 } |
202 | |
203 | |
204 function init() { | |
205 jsPlumb.importDefaults({ | |
100
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
206 Connector : [ "Straight", { curviness:50 } ], |
99 | 207 PaintStyle : { strokeStyle:"gray", lineWidth:2 }, |
208 EndpointStyle : {}, | |
104
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
209 Anchors: ["BottomCenter","TopCenter"], |
99 | 210 }); |
211 } | |
212 | |
213 function showMiniDisplay(jsonInfo) { | |
214 $("#miniDisplay").css("visibility", "visible"); | |
215 writeJSONDataToMiniDisplay(jsonInfo) | |
216 } | |
217 | |
100
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
218 var nodeNum = 0; |
104
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
219 |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
220 function createNodeDiv(node) { |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
221 node.view = $("<div class='graphNode'/>"); |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
222 node.position = {x:nodeNum*50, y: nodeNum*50}; |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
223 node.view.hover(); |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
224 var div = $("<div class='graphNodeContent'/>")[0]; |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
225 div.innerHTML = node.property.title; |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
226 node.view[0].appendChild(div); |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
227 nodeNum++; |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
228 } |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
229 |
100
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
230 function updateNodeElement(node) { |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
231 var created = false; |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
232 if(!node.view) { |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
233 created = true; |
104
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
234 createNodeDiv(node); |
100
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
235 } |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
236 var div = node.view; |
104
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
237 // div.text(node.property.title); |
100
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
238 div.click(function(){showMiniDisplay(node)}); |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
239 DragHandler.attach($(node.view)[0]); |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
240 var kindBackground = {agree:"#aaf", rejected:"#fff"}; |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
241 var kindBorder = {agree:"#66a", rejected:"#a66"}; |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
242 div.css("background", kindBackground[node.kind]||"white"); |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
243 div.css("border-color", kindBorder[node.kind] ||"blue"); |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
244 div.css({ |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
245 left: node.position.x, |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
246 top: node.position.y |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
247 }); |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
248 return created; |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
249 } |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
250 |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
251 |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
252 function updateNode(node) { |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
253 if(updateNodeElement(node)) { |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
254 var fc = $('#graphRoot')[0].firstChild; |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
255 if(fc) { |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
256 $('#graphRoot')[0].insertBefore(node.view[0], fc); |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
257 } else { |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
258 $('#graphRoot').append(node.view); |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
259 } |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
260 } |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
261 nodeNum++; |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
262 |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
263 /* |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
264 node.view.css({ |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
265 left: node.position.x * ViewParam.intervalX - ViewParam.nodeWidth/2, |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
266 top: node.position.y * ViewParam.intervalY - ViewParam.nodeHeight/2 |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
267 }); |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
268 */ |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
269 } |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
270 |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
271 var ViewParam = { |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
272 offsetTop:100, |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
273 offsetBottom:100, |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
274 offsetLeft:100, |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
275 offsetRight:100, |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
276 nodeWidth:120, |
101
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
277 nodeHeight:60, |
100
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
278 intervalX:140, |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
279 intervalY:120 |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
280 }; |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
281 |
99 | 282 function start() { |
283 init(); | |
100
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
284 var rootNode = new Object(); |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
285 rootNode.property = sampleJSON1; |
102
8d8e6c2bfec2
modified viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
101
diff
changeset
|
286 // showMiniDisplay(rootNode); |
100
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
287 updateNode(rootNode); |
99 | 288 $("#graphRoot").css({ |
100
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
289 left: ViewParam.offsetLeft + ViewParam.nodeWidth/2 - ViewParam.intervalX, |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
290 top: ViewParam.offsetTop + ViewParam.nodeHeight/2 |
99 | 291 }); |
292 $("#graphMain").css({ | |
100
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
293 width: ViewParam.intervalX * 1 + ViewParam.nodeWidth+ViewParam.offsetLeft + ViewParam.offsetRight, |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
294 height: ViewParam.intervalY * 1 + ViewParam.nodeHeight + ViewParam.offsetTop + ViewParam.offsetBottom, |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
295 top:50 |
99 | 296 }); |
297 | |
100
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
298 /* test code */ |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
299 var n1 = {property:{title:"tokage"}}; |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
300 var n2 = {property:{title:"ttt"}}; |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
301 updateNode(n1); |
06e419562734
add jsPlumb code
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
99
diff
changeset
|
302 updateNode(n2); |
101
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
303 |
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
304 var e1 = new Edge(rootNode, n1, "dependency"); |
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
305 var e2 = new Edge(n1, n2, "dependency"); |
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
306 edgeArray.push(e1); |
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
307 edgeArray.push(e2); |
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
308 paintEdge(); |
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
309 } |
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
310 |
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
311 var edgeArray = new Array(); |
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
312 function Edge(fromNode, toNode, relation) { |
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
313 var obj = {from:fromNode, to:toNode, rel:relation }; |
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
314 return obj; |
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
315 } |
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
316 |
104
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
317 var stateMachineConnector = { |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
318 connector:"StateMachine", |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
319 paintStyle:{lineWidth:3,strokeStyle:"#056"}, |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
320 hoverPaintStyle:{strokeStyle:"#dbe300"}, |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
321 endpoint:"Blank", |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
322 anchor:"Continuous", |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
323 overlays:[ ["PlainArrow", {location:1, width:20, length:12} ]] |
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
324 }; |
101
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
325 function paintEdge() { |
104
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
326 |
101
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
327 var array = edgeArray; |
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
328 for (var i=0; i<array.length; i++) { |
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
329 var fromNode = array[i].from; |
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
330 var toNode = array[i].to; |
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
331 var rel = array[i].rel; |
104
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
332 var c = jsPlumb.connect({source:fromNode.view[0], target:toNode.view[0]}, stateMachineConnector); |
101
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
333 c.setLabel({label:"<span style='color:white;'>"+"</span>",cssStyle:"color:white"}); |
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
334 } |
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
335 jsPlumb.removeAllEndpoints(); |
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
336 jsPlumb.draggable($('.graphNode')); |
104
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
337 /* |
101
098e87253903
modfied jsPlumb
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
100
diff
changeset
|
338 jsPlumb.repaintEverything(); |
104
88c16240c78a
add jquery.jsPlumb-1.3.15-all-min.js
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
103
diff
changeset
|
339 */ |
99 | 340 } |
341 | |
342 /* sample data */ | |
343 sampleJSON1 = { | |
344 id:"5", | |
345 title:"dimolto", | |
346 kind:"agreed", | |
347 createdUser:"oshiro", | |
348 createdDate: new Date() | |
349 }; | |
350 | |
94
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
351 </script> |
bf0cd5920429
modfied viewer_white.html
Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
parents:
diff
changeset
|
352 |