comparison public/viewer/viewer_white.html @ 112:34aa9d3b81b6 draft

remove unnecessary code
author Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp>
date Mon, 18 Mar 2013 02:14:42 +0900
parents 5ad0ba30c785
children 790f37202698
comparison
equal deleted inserted replaced
111:5ad0ba30c785 112:34aa9d3b81b6
293 intervalX:140, 293 intervalX:140,
294 intervalY:120 294 intervalY:120
295 }; 295 };
296 296
297 297
298 var edgeArray = new Array();
299 function Edge(fromNode, toNode, relation) { 298 function Edge(fromNode, toNode, relation) {
300 var obj = {from:fromNode, to:toNode, rel:relation }; 299 var obj = {from:fromNode, to:toNode, rel:relation };
301 return obj; 300 return obj;
302 } 301 }
303 302
315 connector:"StateMachine", 314 connector:"StateMachine",
316 paintStyle:{lineWidth:2,strokeStyle:"#aaf"}, 315 paintStyle:{lineWidth:2,strokeStyle:"#aaf"},
317 hoverPaintStyle:{strokeStyle:"#dbe300"}, 316 hoverPaintStyle:{strokeStyle:"#dbe300"},
318 endpoint:"Blank", 317 endpoint:"Blank",
319 }; 318 };
320
321 function paintEdge() {
322 var array = edgeArray;
323 for (var i=0; i<array.length; i++) {
324 connectGraph(array[i]);
325 }
326 jsPlumb.removeAllEndpoints();
327 jsPlumb.draggable($('.graphNode'));
328 /*
329 jsPlumb.repaintEverything();
330 */
331 }
332
333 function connectGraph(graphObj) {
334 var fromNode = graphObj.from;
335 var toNode = graphObj.to;
336 var rel = graphObj.rel;
337 var c = jsPlumb.connect({source:fromNode.view[0], target:toNode.view[0]}, arrowConnector);
338 c.setLabel({label:"<span style='color:black;'>"+rel+"</span>",cssStyle:"color:black"});
339 return c;
340 }
341 319
342 function GraphData() { 320 function GraphData() {
343 var graphData = {}; 321 var graphData = {};
344 graphData.nodes = {}; 322 graphData.nodes = {};
345 graphData.edges = {}; 323 graphData.edges = {};
371 } 349 }
372 } 350 }
373 return memory; 351 return memory;
374 } 352 }
375 353
376 function start() {
377 init();
378 var rootNode = new Object();
379 rootNode.property = sampleJSON1;
380 showMiniDisplay(rootNode);
381 updateNode(rootNode);
382 /* test code */
383 var n1 = {property:{title:"task2"}};
384 var n2 = {property:{title:"task3"}};
385 updateNode(n1);
386 updateNode(n2);
387
388 var e1 = new Edge(rootNode, n1, "dependency");
389 var e2 = new Edge(n1, n2, "dependency");
390 edgeArray.push(e1);
391 edgeArray.push(e2);
392 paintEdge();
393 }
394
395
396 function showEdge(graphData, edge) { 354 function showEdge(graphData, edge) {
397 function connectEdge(fromNode, toNode, rel, type) { 355 function connectEdge(fromNode, toNode, rel, type) {
398 var c; 356 var c;
399 if (type == 'both') { 357 if (type == 'both') {
400 /* TODO */
401 c = jsPlumb.connect({source:fromNode.view[0], target:toNode.view[0]}, arrowBothConnector); 358 c = jsPlumb.connect({source:fromNode.view[0], target:toNode.view[0]}, arrowBothConnector);
402 } else { 359 } else {
403 c = jsPlumb.connect({source:fromNode.view[0], target:toNode.view[0]}, arrowConnector); 360 c = jsPlumb.connect({source:fromNode.view[0], target:toNode.view[0]}, arrowConnector);
404 } 361 }
405 c.setLabel({label:"<span style='color:black;'>"+rel+"</span>",cssStyle:"color:black"}); 362 c.setLabel({label:"<span style='color:black;'>"+rel+"</span>",cssStyle:"color:black"});
544 function logProperty(d) { 501 function logProperty(d) {
545 for(var key in d) { 502 for(var key in d) {
546 console.log("key: "+key+ "\nvalue: "+d[key]); 503 console.log("key: "+key+ "\nvalue: "+d[key]);
547 } 504 }
548 } 505 }
549
550 /* sample data */
551 sampleJSON1 = {
552 id:"5",
553 title:"task1",
554 kind:"agreed",
555 createdUser:"oshiro",
556 createdDate: new Date()
557 };
558 506
559 sampleJSONData = { 507 sampleJSONData = {
560 nodes: [ 508 nodes: [
561 { 509 {
562 id:"1", 510 id:"1",