diff --git a/Bench4Q-Web/src/main/webapp/plugin.jsp b/Bench4Q-Web/src/main/webapp/plugin.jsp index 88fc3a90..62abdb5c 100644 --- a/Bench4Q-Web/src/main/webapp/plugin.jsp +++ b/Bench4Q-Web/src/main/webapp/plugin.jsp @@ -110,14 +110,14 @@ body {
diff --git a/Bench4Q-Web/src/main/webapp/script/plugin-new.js b/Bench4Q-Web/src/main/webapp/script/plugin-new.js index 7f406f49..5ff5118d 100644 --- a/Bench4Q-Web/src/main/webapp/script/plugin-new.js +++ b/Bench4Q-Web/src/main/webapp/script/plugin-new.js @@ -4,7 +4,8 @@ var pluginList = new Array(); var pluginMethodList = new Array(); var usePluginList = new Array(); var behaviors = new Array(); -var clickNode = -1; +var clickPluginMethodNode = -1; +var clickPluginChoosedNode=0; var place = ""; $(document).ready(function() { loadPluginList(); @@ -72,6 +73,40 @@ function createLineWithRadio(lineText, nameAttr) { return $(divNode).html() + "
"; } +function createALine(pluginName,index,list){ + var div = document.createElement("div"); + var p = document.createElement("p"); + var i = document.createElement("i"); + var textNode = document.createTextNode(pluginName); + div.setAttribute("id", index); + i.setAttribute("class", "icon-hand-right"); + p.setAttribute("id", index); + p.setAttribute("class", ""); + if(list=="pluginMethodList"){ + p.setAttribute("onClick", "showMethodDocument(this)");// loadMethodParams + }else if(list=="pluginChoosedList"){ + p.setAttribute("onClick", "choosePlugin("+index+");"); + } + p.setAttribute("style", "cursor:pointer;width:85%"); + p.appendChild(i); + p.appendChild(textNode); + div.appendChild(p); + return div; +} + +function choosePlugin(index){ + clickPluginChoosedNode=index; + var pluginChoosedNode=$('#pluginArea').children(); + var length=pluginChoosedNode.length; + for(var i=0;i= clickNode; j--) { + for (var j = length - 1; j >= clickPluginMethodNode; j--) { pluginMethodList[j + 1] = pluginMethodList[j]; $(documentChild[j]).attr("id", parseInt(j + 1)); } - mark = clickNode; + mark = clickPluginMethodNode; pluginMethodList[mark] = behaviorData; } else if (place == "after") { - mark = parseInt(clickNode + 1); - if (clickNode == (length - 1) && clickNode != -1) { + mark = parseInt(clickPluginMethodNode + 1); + if (clickPluginMethodNode == (length - 1) && clickPluginMethodNode != -1) { pluginMethodList.push(behaviorData); } else { - for (var j = length - 1; j >= clickNode + 1; j--) { + for (var j = length - 1; j >= clickPluginMethodNode + 1; j--) { pluginMethodList[j + 1] = pluginMethodList[j]; $(documentChild[j]).attr("id", parseInt(j + 1)); } @@ -205,38 +246,26 @@ function createPluginMethodLines() { document.getElementById("showPluginMethod").innerHTML = ""; document.getElementById('behaviorArea').innerHTML = ""; for (var j = 0; j < pluginMethodList.length; j++) { - var div = document.createElement("div"); - var p = document.createElement("p"); - var i = document.createElement("i"); - var textNode = document.createTextNode(pluginMethodList[j]); - div.setAttribute("id", j); - i.setAttribute("class", "icon-hand-right"); - p.setAttribute("id", j); - p.setAttribute("class", ""); - p.setAttribute("onClick", "showMethodDocument(this)");// loadMethodParams - p.setAttribute("style", "cursor:pointer;width:85%"); - p.appendChild(i); - p.appendChild(textNode); - div.appendChild(p); + var div=createALine(pluginMethodList[j], j,"pluginMethodList"); document.getElementById('behaviorArea').appendChild(div); loadMethodParams(pluginMethodList[j], j); } } function showMethodDocument(selectedNode) { - clickNode = $(selectedNode).attr("id"); + clickPluginMethodNode = $(selectedNode).attr("id"); var length = $("#showPluginMethod").children().length; var behaviorAreaChild = $('#behaviorArea').children(); var div = $("#showPluginMethod").children(); for (var i = 0; i < length; i++) { - if (behaviorAreaChild[i].getAttribute("id") != clickNode) { + if (behaviorAreaChild[i].getAttribute("id") != clickPluginMethodNode) { $(behaviorAreaChild[i]).find("p").attr("class", ""); } else { $(behaviorAreaChild[i]).find("p").attr("class", "visited"); } } for (var j = 0; j < length; j++) { - if (div[j].getAttribute("id") == clickNode) { + if (div[j].getAttribute("id") == clickPluginMethodNode) { $(div[j]).show(); } else { $(div[j]).hide(); @@ -248,13 +277,13 @@ function showMethodDocument(selectedNode) { function removeInsertPluginByClicked() { var length=$('#behaviorArea').children().length; var removeDocumentNode = document.getElementById("showPluginMethod").childNodes; - for(var i=parseInt(clickNode+1);i