annotate public/viewer/viewer_white.html @ 103:1b44197d02ef draft

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