Mercurial > hg > Members > nobuyasu > html > graphViewer
comparison show.html @ 35:26eaf273efbf draft
implemented StateSelect
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 23 Mar 2013 06:49:54 +0900 |
parents | fdad911675bc |
children | 9d31b5239170 |
comparison
equal
deleted
inserted
replaced
34:fdad911675bc | 35:26eaf273efbf |
---|---|
324 var DefaultSelectMenuInfo = { | 324 var DefaultSelectMenuInfo = { |
325 stateMenuHeight : $('#stateMenu')[0].offsetHeight - MENU_BORDER_MARGIN, | 325 stateMenuHeight : $('#stateMenu')[0].offsetHeight - MENU_BORDER_MARGIN, |
326 traverseMenuHeight : $('#traverseMenu')[0].offsetHeight - MENU_BORDER_MARGIN | 326 traverseMenuHeight : $('#traverseMenu')[0].offsetHeight - MENU_BORDER_MARGIN |
327 }; | 327 }; |
328 | 328 |
329 function appendStateSelectDiv(body, div, state) { | |
330 div.click(function(){ stateTraversePost(state) }); | |
331 appendMenuBody(body, div); | |
332 } | |
333 | |
329 function createStateSelectMenu() { | 334 function createStateSelectMenu() { |
330 removeStateMenuBody(); | 335 removeStateMenuBody(); |
331 var stateMenu = $('#stateMenu'); | 336 var stateMenu = $('#stateMenu'); |
332 var accepted = $('<div class="menuContent" >accept</div>'); | |
333 var rejected = $('<div class="menuContent" >reject</div>'); | |
334 var retract = $('<div class="menuContent" >retract</div>'); | |
335 var body = $('#stateMenuBody'); | 337 var body = $('#stateMenuBody'); |
336 body.viewFlag = true; | 338 body.viewFlag = true; |
337 body.append(accepted); | 339 for (var state in stateObj) { |
338 body.append(rejected); | 340 var div = $('<div class="menuContent" >'+state+'</div>'); |
339 body.append(retract); | 341 appendStateSelectDiv(body, div, stateObj[state]); |
342 } | |
340 } | 343 } |
341 | 344 |
342 var BASE_MARGIN = parseInt($('.menu').css('margin-top').split('px')[0])*2 + | 345 var BASE_MARGIN = parseInt($('.menu').css('margin-top').split('px')[0])*2 + |
343 parseInt($('.menuDisplayCss').css('border-top-width').split('px')[0])*2; | 346 parseInt($('.menuDisplayCss').css('border-top-width').split('px')[0])*2; |
344 function updateMenuDisplayHeight() { | 347 function updateMenuDisplayHeight() { |
384 var height = parseInt(heightStr); | 387 var height = parseInt(heightStr); |
385 $('#menuDisplay').css({ | 388 $('#menuDisplay').css({ |
386 left: rootLeft + 'px', | 389 left: rootLeft + 'px', |
387 top: rootTop + height + 50 +'px' | 390 top: rootTop + height + 50 +'px' |
388 }); | 391 }); |
392 createStateSelectMenu(); | |
393 // hiddenStateMenuBody(); | |
394 updateMenuDisplayHeight(); | |
389 } | 395 } |
390 | 396 |
391 function showMiniDisplay(node) { | 397 function showMiniDisplay(node) { |
392 CURRENT_DATA.nodeId = node.property.id; | 398 CURRENT_DATA.nodeId = node.property.id; |
393 $("#miniDisplay").css("visibility", "visible"); | 399 $("#miniDisplay").css("visibility", "visible"); |
453 } | 459 } |
454 | 460 |
455 function postToServer(parameter) { | 461 function postToServer(parameter) { |
456 $.ajax({ | 462 $.ajax({ |
457 url:"/aat/aaevidencesiftingmodel.userdesktops/update?desktopid="+desktopid()+"&"+parameter, | 463 url:"/aat/aaevidencesiftingmodel.userdesktops/update?desktopid="+desktopid()+"&"+parameter, |
458 success:function(o) { }, | 464 success:function(o) { console.log(this.url);}, |
459 type:"POST", cache:true, | 465 type:"POST", cache:true, |
460 error:function(o) { console.log("post error : ", o); } | 466 error:function(o) { console.log("post error : ", o); } |
461 }); | 467 }); |
462 } | 468 } |
463 | 469 |
465 accept:"Accepted", | 471 accept:"Accepted", |
466 reject:"Rejected", | 472 reject:"Rejected", |
467 retract:"Retract" | 473 retract:"Retract" |
468 }; | 474 }; |
469 | 475 |
470 function statePost(buttonEle) { | 476 function statePost(button) { |
471 var id = CURRENT_DATA.nodeId; | 477 var id = CURRENT_DATA.nodeId; |
472 var state = buttonEle.html(); | 478 var state = buttonEle.html(); |
473 var node = GRAPH_DATA.nodes[id]; | 479 var node = GRAPH_DATA.nodes[id]; |
474 node.property.state = stateObj[state]; | 480 node.property.state = stateObj[state]; |
475 postToServer("id="+id+"&state="+stateObj[state]); | 481 postToServer("id="+id+"&state="+stateObj[state]); |
482 showMiniDisplay(node); | |
483 updateNodeElement(node); | |
484 } | |
485 | |
486 function stateTraversePost(state) { | |
487 var id = CURRENT_DATA.nodeId; | |
488 var node = GRAPH_DATA.nodes[id]; | |
489 node.property.state = state; | |
490 postToServer("id="+id+"&state="+state); | |
476 showMiniDisplay(node); | 491 showMiniDisplay(node); |
477 updateNodeElement(node); | 492 updateNodeElement(node); |
478 } | 493 } |
479 | 494 |
480 function nodePositionPost(node) { | 495 function nodePositionPost(node) { |