Mercurial > hg > Members > nobuyasu > html > graphViewer
changeset 19:3c02336869d4 draft
modified show.html
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Thu, 21 Mar 2013 20:57:33 +0900 |
parents | cfdce8445a14 |
children | 864c47b06e85 |
files | show.html |
diffstat | 1 files changed, 18 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/show.html Thu Mar 21 18:43:04 2013 +0900 +++ b/show.html Thu Mar 21 20:57:33 2013 +0900 @@ -38,8 +38,9 @@ Traverse </div> <div style='position:absolute; top:30px; width:100%; margin-left:10px;'> Direction: - <label style='position:relative;' ><input id="direction_in" type='checkbox' checked value='in'/>IN</label> - <label style='position:relative;'><input id="direction_out" type='checkbox' checked value='out'/>OUT</label> + <label style='position:relative;' ><input id="direction_in" type='radio' value='in' name='direction' checked value='in' checked />IN</label> + <label style='position:relative;'><input id="direction_out" type='radio' value='out' name='direction' value='out'/>OUT</label> + </form> </div> <div id="traverseDisplayBody" style='position:absolute; left:20px; top:50px;'> Please click any node. @@ -307,10 +308,9 @@ } function getEvidence(id, kind, direction, edgeInfoId) { - var u = "/aat/aaevidencesiftingmodel.userdesktops/get?desktopid="+desktopid() + "&id="+id+"&kind="+kind+"&direction="+direction+"&edgeinfoid="+edgeInfoId; $.ajax({ - url:u, - success:function(o) { parseJSONGraphData(GRAPH_DATA, o); recursiveCalcPosition(GRAPH_DATA, GRAPH_DATA.nodes[id]); showEdgesAndNodes(GRAPH_DATA, o, kind);}, + url:"/aat/aaevidencesiftingmodel.userdesktops/get?desktopid="+desktopid() + "&id="+id+"&kind="+kind+"&direction="+direction+"&edgeinfoid="+edgeInfoId, + success:function(o) { console.log(this.url); parseJSONGraphData(GRAPH_DATA, o); recursiveCalcPosition(GRAPH_DATA, GRAPH_DATA.nodes[id]); showEdgesAndNodes(GRAPH_DATA, o, kind);}, type:"GET", cache:true, error:function(o) { console.log("getEvidence error : ", o); } }); @@ -336,8 +336,8 @@ } function traverseAction() { - var inDirChecked = $('#direction_in')[0].checked; - var outDirChecked = $('#direction_out')[0].checked; + var inDirChecked = $('#direction_in').is(':checked'); + var outDirChecked = $('#direction_out').is(':checked'); var labelTags = $('[id=traverseLabel]'); var kinds = []; for (var i=0;i<labelTags.length; i++ ) { @@ -349,7 +349,7 @@ var id = this.id; var edgeInfoArray = GRAPH_DATA.nodes[id].property.edgeInfo; var edgeInfos = {}; - for (var i=0; i<edgeInfoArray.length; i++) { + for (var i=0; i<edgeInfoArray.length; i++) { var edgeInfo = edgeInfoArray[i]; var kind = edgeInfo.kind; edgeInfos[kind] = {}; @@ -366,7 +366,9 @@ function createNodeDiv(node) { node.view = $("<div class='graphNode'/>"); node.view.click(function(){ clickNodeDiv(node.property.id) }); - if(!node.position) node.position = calcNewNodePosition(); + if(!node.position) { + node.position = calcNewNodePosition(); + } node.view.hover(); var div = $("<div class='graphNodeContent' />")[0]; div.id = node.property.id; @@ -391,8 +393,8 @@ div.css("background", kindBackground[node.kind]||"white"); div.css("border-color", kindBorder[node.kind] ||"#58f"); div.css({ - left: node.position.x, - top: node.position.y + left: node.position.x + 'px', + top: node.position.y + 'px' }); return created; } @@ -430,6 +432,11 @@ memory.nodes[node.id].out = []; memory.nodes[node.id].both = []; memory.nodes[node.id].property = node; + if (node.coordX) { + memory.nodes[node.id].position = {}; + memory.nodes[node.id].position.x = node.coordX; + memory.nodes[node.id].position.y = node.coordY; + } } if (!jsonObj.edges) return memory; var edges = jsonObj.edges;