Mercurial > hg > Members > nobuyasu > html > graphViewer
changeset 27:992372c53479 draft
modified show.html
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 22 Mar 2013 23:51:15 +0900 |
parents | b6031eb79cc0 |
children | 4b6d41c8b0cd |
files | show.html |
diffstat | 1 files changed, 28 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/show.html Fri Mar 22 06:24:46 2013 +0900 +++ b/show.html Fri Mar 22 23:51:15 2013 +0900 @@ -126,6 +126,7 @@ var nextX = x + (e.clientX - oElem.mouseX); var nextY = y + (e.clientY - oElem.mouseY); if (nextX < 0) nextX = 0; + if (nextY < 0) nextY = 0; oElem.style.left = nextX + 'px'; oElem.style.top = nextY + 'px'; oElem.mouseX = e.clientX; @@ -148,6 +149,7 @@ var y = parseInt(oElem.style.top); var node = GRAPH_DATA.nodes[oElem.nodeId]; if (x < 0) x = 0; + if (y < 0) y = 0; node.position.x = x; node.position.y = y; nodePositionPost(node); @@ -208,13 +210,21 @@ } } -function createEdgeInfoDiv(node,edgeInfo) { +function setEdgeInfoClickFunction(nodeId, edgeInfo, edgeInfoDiv) { + edgeInfoDiv.click(function(){ getEvidence(nodeId, edgeInfo); }); + edgeInfoDiv.hover( + function(){edgeInfoDiv.css("box-shadow","black 0 0 50px"); }, + function(){edgeInfoDiv.css("box-shadow","");} + ); +} + +function createEdgeInfoDiv(nodeId, 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); }); + setEdgeInfoClickFunction(nodeId, edgeInfo, edgeInfoDiv); return edgeInfoDiv; } @@ -230,7 +240,9 @@ for (var i=0; i<edgeInfoArray.length; i++) { var edgeInfo = edgeInfoArray[i]; if (!edgeInfo.view) { - edgeInfo.view = createEdgeInfoDiv(node,edgeInfo); + edgeInfo.view = createEdgeInfoDiv(node.property.id, edgeInfo); + } else { + setEdgeInfoClickFunction(node.property.id, edgeInfo, edgeInfo.view); } addEdgeInfoDiv(edgeInfo); } @@ -315,10 +327,10 @@ showAllEdge(graphData); } -function getEvidence(id, kind, direction, edgeInfoId) { +function getEvidence(nodeId, edgeInfo) { $.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);}, + url:"/aat/aaevidencesiftingmodel.userdesktops/get?desktopid="+desktopid() +"&id="+nodeId+"&edgeinfoid="+edgeInfo.id, + success:function(o) { if(!o){return;} parseJSONGraphData(GRAPH_DATA, o); recursiveCalcPosition(GRAPH_DATA, GRAPH_DATA.nodes[nodeId]); showEdgesAndNodes(GRAPH_DATA, o, edgeInfo.kind);}, type:"GET", cache:true, error:function(o) { console.log("getEvidence error : ", o); } }); @@ -372,6 +384,12 @@ Retracted:"#fff" }; +var borderStyle = { +// kind : 'style', + Document:'solid', + Context:'dashed' +}; + function updateNodeElement(node) { var created = false; if(!node.view) { @@ -386,9 +404,11 @@ node.view[0].nodeId = node.property.id; div.click(function(){showMiniDisplay(node); showEdgeInfoDisplay(node);}); DragHandler.attach($(node.view)[0]); - var kindBorder = {agree:"#66a", rejected:"#a66"}; + div.css('border-style',borderStyle[node.property.kind]); div.css("background", StateColor[node.property.state]||"white"); - div.css("border-color", kindBorder[node.property.state] ||"#58f"); +// var kindBorder = {agree:"#66a", rejected:"#a66"}; +// div.css("border-color", kindBorder[node.property.state] ||"#58f"); + div.css("border-color","#444"); div.css({ left: node.position.x + 'px', top: node.position.y + 'px'