Mercurial > hg > Members > nobuyasu > html > graphViewer
changeset 24:eb324ada669a draft
modified edgeInfoDisplay
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 22 Mar 2013 05:51:03 +0900 |
parents | c0066a07acd0 |
children | a51dd2e558ab |
files | show.html |
diffstat | 1 files changed, 14 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/show.html Fri Mar 22 04:37:57 2013 +0900 +++ b/show.html Fri Mar 22 05:51:03 2013 +0900 @@ -259,21 +259,26 @@ } function addEdgeInfoDiv(edgeInfoDiv) { - var body = $('#edgeInfoBody')[0]; - body.insertBefore(edgeInfoDiv); + var fc = $('#edgeInfoBody')[0].firstChild; + if (fc) { + $('#edgeInfoBody').append(edgeInfoDiv.view[0], fc) + } else { + $('#edgeInfobody').append(edgeInfoDiv.view); + } } -function createEdgeInfoDiv(edgeInfo) { +function createEdgeInfoDiv(node,edgeInfo) { function createEdgeInfoinnerHTML(edgeInfo) { return edgeInfo.kind + " : " + edgeInfo.num + ": " + edgeInfo.direction; } var edgeInfoDiv = $('<div class="edgeInfoDiv"/>') edgeInfoDiv[0].innerHTML = createEdgeInfoinnerHTML(edgeInfo); + edgeInfoDiv.click(function(){ getEvidence(node.property.id, edgeInfo.kind, edgeInfo.direction, edgeInfo.id); }); return edgeInfoDiv; } function updateEdgeInfoDisplay() { - var nodeId = this.id; + var nodeId = CURRENT_DATA.id; var node = GRAPH_DATA.nodes[nodeId]; showEdgeInfoDisplay(node); } @@ -283,8 +288,10 @@ var edgeInfoArray = node.property.edgeInfo; for (var i=0; i<edgeInfoArray.length; i++) { var edgeInfo = edgeInfoArray[i]; - if (!edgeInfo.view) edgeInfo.view = createEdgeInfoDiv(edgeInfo); - addEdgeInfoDiv(edgeInfo.view[0]); + if (!edgeInfo.view) { + edgeInfo.view = createEdgeInfoDiv(node,edgeInfo); + } + addEdgeInfoDiv(edgeInfo); } updateEdgeInfoBodyHeight(); } @@ -383,7 +390,7 @@ function getEvidence(id, kind, direction, edgeInfoId) { $.ajax({ url:"/aat/aaevidencesiftingmodel.userdesktops/get?desktopid="+desktopid() + "&id="+id+"&kind="+kind+"&direction="+direction+"&edgeinfoid="+edgeInfoId, - success:function(o) { parseJSONGraphData(GRAPH_DATA, o); recursiveCalcPosition(GRAPH_DATA, GRAPH_DATA.nodes[id]); showEdgesAndNodes(GRAPH_DATA, o, kind);}, + success:function(o) { 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); } });