refactor plugin

This commit is contained in:
fanfuxiaoran 2014-03-24 17:59:06 +08:00
parent 03601007eb
commit c4bae962ab
17 changed files with 238 additions and 256 deletions

View File

@ -5,11 +5,9 @@ import javax.xml.bind.JAXBException;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.bench4q.share.helper.ExceptionLog; import org.bench4q.share.helper.ExceptionLog;
import org.bench4q.web.model.BaseResponseModel; import org.bench4q.web.model.BaseResponseModel;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
@ControllerAdvice @ControllerAdvice
public class GlobalExceptionController { public class GlobalExceptionController {

View File

@ -37,12 +37,12 @@ display:none;
padding-right:5px; padding-right:5px;
} }
.div-left{ .left{
float:left; float:left;
} }
.div-right{ .right{
float:right; float:right;
} }

View File

@ -1,4 +1,3 @@
.inset { .inset {
width: 85%; width: 85%;
height: 80%; height: 80%;
@ -15,6 +14,14 @@ a:hover {
color: #ECE9D8; color: #ECE9D8;
} }
.button-div {
margin-top: 50px;
padding-left: 20px;
}
.button-div div {
margin-top: 10px;
}
.behavior_box { .behavior_box {
border: 1px inset; border: 1px inset;
@ -37,40 +44,30 @@ a:hover {
margin-right: 10px; margin-right: 10px;
} }
table, th, td,thead,tbody .listArea {
{
border: 1px solid #FFE37E;
width:40px;
height:18px;
}
#pluginArea{
width:280px;
height: 340px; height: 340px;
margin-bottom: 15px; margin-bottom: 15px;
outline-style: outset; outline-style: outset;
color: black;
}
#behaviorArea{
width:280px;
height:340px;
margin-bottom:15px;
outline-style: inset;
} }
.behavior-box { .behavior-box {
width:180px; height: 400px;
height:200px; border: solid 1px black;
border:solid thin #F0ECE0;
margin-left: 5px; margin-left: 5px;
outline-style:inset;
} }
.pluginChoosedList{
border-bottom:1px solid #F0ECE0 ; #myModal_Behavior {
color: #4E9BCB ; width: 800px;
width:220px; left:40%;
height:32px; }
.listArea,#insertPluginAreaPlugins,#pluginMethod p,a {
padding-top: 10px;
padding-left: 20px;
}
p,a{
color: #4E9BCB;
border-bottom: 1px solid #F0ECE0;
} }

View File

@ -1 +0,0 @@
/Thumbs.db

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

View File

@ -37,7 +37,7 @@ body {
<link href='css/uploadify.css' rel='stylesheet'> <link href='css/uploadify.css' rel='stylesheet'>
<link href='css/buttons.css' rel='stylesheet'> <link href='css/buttons.css' rel='stylesheet'>
<link href='bench4q-css/plugin.css' rel='stylesheet'> <link href='bench4q-css/plugin.css' rel='stylesheet'>
<link href='bench4q-css/bench4q.css' rel='stylesheet'>
<!-- The HTML5 shim, for IE6-8 support of HTML5 elements --> <!-- The HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]> <!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
@ -84,10 +84,9 @@ body {
</div> </div>
<div class="row-fluid sortable"> <div class="row-fluid sortable">
<div class="box span5"> <div class="box span6">
<div>
<div class="box-header well" data-original-title> <div class="box-header well" data-original-title>
<i class="icon-pencil" style="float: left;"></i> <i class="icon-pencil left"></i>
<h2> <h2>
<span>Plug-ins</span> <span>Plug-ins</span>
</h2> </h2>
@ -99,36 +98,30 @@ body {
class="icon-chevron-up"></i></a> class="icon-chevron-up"></i></a>
</div> </div>
</div> </div>
<div class="box-content"> <div class="box-content row-fluid">
<div class="operatePlugins center">
<div class="span8" style="float: left;"> <div id="pluginArea" class="listArea span9"></div>
<div id="pluginArea"></div> <div class=" span3 button-div">
</div> <div>
<div class="pluginButton">
<p>
<button type="submit" class="btn btn-inverse" id="addPlugin" <button type="submit" class="btn btn-inverse" id="addPlugin"
onClick="addPlugin();">Add</button> onClick="addPlugin();">Add</button>
</p> </div>
<div>
<p>
<button type="submit" class="btn btn-inverse" <button type="submit" class="btn btn-inverse"
id="removePlugin" onClick="removePlugin();">Remove</button> id="removePlugin" onClick="removePlugin();">Remove</button>
</p> </div>
<p> <div>
<button type="submit" class="btn btn-inverse" <button type="submit" class="btn btn-inverse"
id="removeAllPlugin" onClick="#">Remove all</button> id="removeAllPlugin" onClick="#">Remove all</button>
</p>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!--/span--> <!--/span-->
<!-- Behavior start --> <!-- Behavior start -->
<div class="box span5" style="float: left;"> <div class="box span6">
<div>
<div class="box-header well" data-original-title> <div class="box-header well" data-original-title>
<i class="icon-pencil" style="float: left;"></i> <i class="icon-pencil left"></i>
<h2> <h2>
<i></i> Behavior <i></i> Behavior
</h2> </h2>
@ -140,47 +133,39 @@ body {
class="icon-chevron-up"></i></a> class="icon-chevron-up"></i></a>
</div> </div>
</div> </div>
<div class="box-content"> <div class="box-content row-fluid">
<div class="operatePlugins center"> <div id="behaviorArea" class="listArea span9"></div>
<div class="span8 behavior" style="float: left;"> <div class="span3 button-div">
<div id="behaviorArea"> <div>
</div>
</div>
<div class="behaviorButton">
<p>
<button type="submit" class="btn btn-inverse" <button type="submit" class="btn btn-inverse"
id="insertBehavior_Plugin" onClick="insertPlugin();">Insert</button> id="insertBehavior_Plugin" onClick="insertPlugin();">Insert</button>
</p> </div>
<div>
<p>
<button type="submit" class="btn btn-inverse" <button type="submit" class="btn btn-inverse"
id="removeBehavior_Plugin" onClick="removeInsertPlugin();">Remove</button> id="removeBehavior_Plugin" onClick="removeInsertPlugin();">Remove</button>
</p>
</div> </div>
</div> </div>
</div> </div>
</div>
</div>
</div>
<div id="showPluginMethod" class="showPluginMethod"> <div id="showPluginMethod" class="showPluginMethod">
<!-- 显示方法文档,开始动态生成 ,只显示一个--> <!-- 显示方法文档,开始动态生成 ,只显示一个-->
</div> </div>
</div> </div>
</div>
<!--/row--> <!--/row-->
<!-- content ends --> <!-- content ends -->
</div> </div>
<!--/#content.span10--> <!--/#content.span10-->
</div> </div>
<hr> <hr>
<div class="modal hide fade span4" id="myModal_Plugin">
<div class="modal hide fade " id="myModal_Plugin">
<div class="modal-header"> <div class="modal-header">
<button type="button" id="myModal-close" class="close" <button type="button" id="myModal-close" class="close"
data-dismiss="modal">×</button> data-dismiss="modal">×</button>
@ -189,8 +174,6 @@ body {
<div class="modal-body" style="height: 260px;"> <div class="modal-body" style="height: 260px;">
<div class="inset scroll" id="choosePlugin"> <div class="inset scroll" id="choosePlugin">
<!-- 显示plugin列表 --> <!-- 显示plugin列表 -->
</div> </div>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
@ -204,27 +187,23 @@ body {
</div> </div>
<div class="modal hide fade span6" id="myModal_Behavior"> <div class="modal hide fade " id="myModal_Behavior">
<div class="modal-header"> <div class="modal-header">
<button type="button" id="myModal-close" class="close" <button type="button" id="myModal-close" class="close"
data-dismiss="modal">×</button> data-dismiss="modal">×</button>
<h3>Choose the behaviors of plug-in.</h3> <h3>Choose the behaviors of plug-in.</h3>
</div> </div>
<div class="modal-body" style="height: 320px;"> <div class="modal-body"">
<div class="inset span4 center"> <div class="row-fluid">
<div class="span2 behavior-box scroll" <div class="span6 behavior-box scroll" >
style="height: 200px; width: 220px;"> <div id="insertPluginAreaPlugins"></div>
</div>
<div class="span6 behavior-box scroll">
<div id="pluginMethod"></div> <div id="pluginMethod"></div>
</div> </div>
<div class="span2 behavior-box scroll"
style="height: 200px; width: 220px;">
<div id="insertPluginAreaPlugins">
<!-- 显示上个modal中的内容 -->
</div> </div>
</div> </div>
</div>
</div>
<div class="modal-footer"> <div class="modal-footer">
<button type="button" class="btn btn-inverse" <button type="button" class="btn btn-inverse"
@ -236,6 +215,7 @@ body {
</div> </div>
<jsp:include page="publiccontrol/footer.jsp"></jsp:include> <jsp:include page="publiccontrol/footer.jsp"></jsp:include>
</div>
<!--/.fluid-container--> <!--/.fluid-container-->

View File

@ -1,9 +1,11 @@
PluginMethodListModel = function(pluginName, methodList) { var PluginMethodListModel = function(pluginName, methodList) {
this.pluginName = pluginName; this.pluginName = pluginName;
this.methodList = methodList; this.methodList = methodList;
}; };
var pluginChoosedList = new Array();
var num = 0;
var pluginList = new Array(); var pluginList = new Array();
var pluginMethodList = new Array(); // var pluginMethodList = new Array();
var index = 0; var index = 0;
$(document).ready(function() { $(document).ready(function() {
loadPluginList(); loadPluginList();
@ -42,50 +44,52 @@ function getMethod(pluglin) {
function addPlugin() { function addPlugin() {
var html = ""; var html = "";
for ( var j = 0; j < pluginList.length; j++) { for ( var j = 0; j < pluginList.length; j++) {
var textNode = document.createTextNode(pluginList[j]);
var divNode = document.createElement("div"); html += createLineWithRadio(pluginList[j],"plugin");
var inputNode = document.createElement("input");
var brNode = document.createElement("br");
inputNode.setAttribute("type", "radio");
inputNode.setAttribute("name", "radio");
inputNode.setAttribute("class", "chooseOnePlugin");
inputNode.setAttribute("value", pluginList[j]);
divNode.appendChild(inputNode);
divNode.appendChild(textNode);
divNode.appendChild(brNode);
html += $(divNode).html() + "<br>";
} }
document.getElementById("choosePlugin").innerHTML = html; $('#choosePlugin').html(html);
$('#myModal_Plugin').modal('show'); $('#myModal_Plugin').modal('show');
$("input:radio").click(function() { $("input:radio").click(function() {
$(this).attr("checked", "checked"); $(this).attr("checked", "checked");
}); });
} }
function createLineWithRadio(lineText,nameAttr) {
var textNode = document.createTextNode(lineText);
var divNode = document.createElement("div");
var inputNode = document.createElement("input");
var brNode = document.createElement("br");
inputNode.setAttribute("type", "radio");
inputNode.setAttribute("name", nameAttr);
inputNode.setAttribute("class", "chooseOnePlugin");
inputNode.setAttribute("value", lineText);
divNode.appendChild(inputNode);
divNode.appendChild(textNode);
divNode.appendChild(brNode);
return $(divNode).html() + "<br>";
}
// 选中的plug-in list // 选中的plug-in list
var pluginChoosedList = new Array();
var num = 0;
function pluginFinish() { function pluginFinish() {
$('#myModal_Plugin').modal('hide'); $('#myModal_Plugin').modal('hide');
var data; var pluginName;
var item = $("input[name='radio']:checked").val(); var item = $("input[type='radio']:checked").val();
data = item + "_" + num; pluginName = item + "_" + num;
pluginChoosedList.push(data); pluginChoosedList.push(pluginName);
num++; num++;
document.getElementById("pluginArea").innerHTML += createLine(pluginName);
}
function createLine(pluginName) {
var div = document.createElement("div"); var div = document.createElement("div");
var p = document.createElement("p"); var p = document.createElement("p");
var textNode = document.createTextNode(data); var textNode = document.createTextNode(pluginName);
p.setAttribute("class", "pluginChoosedList");// 样式设计
p.setAttribute("onClick", "showInsertPlugin(this)");// 引入的plugin p.setAttribute("onClick", "showInsertPlugin(this)");// 引入的plugin
p.setAttribute("style", "cursor:pointer;float:left;"); p.setAttribute("style", "cursor:pointer;float:left;");
p.appendChild(textNode); p.appendChild(textNode);
div.appendChild(p); div.appendChild(p);
return $(div).html();
document.getElementById("pluginArea").innerHTML += $(div).html();
} }
function removePlugin() { function removePlugin() {
pluginChoosedList.pop(); pluginChoosedList.pop();
var last = document.getElementById("pluginArea").lastChild; var last = document.getElementById("pluginArea").lastChild;
@ -95,15 +99,15 @@ function removePlugin() {
function insertPlugin() { function insertPlugin() {
document.getElementById("pluginMethod").innerHTML = ""; document.getElementById("pluginMethod").innerHTML = "";
$('#myModal_Behavior').modal('show'); $('#myModal_Behavior').modal('show');
var table = $('#pluginArea').html(); var chooesedPluginHtml = "";
document.getElementById("insertPluginAreaPlugins").innerHTML = table; for ( var i = 0; i < pluginChoosedList.length; i++) {
chooesedPluginHtml += createLineWithRadio(pluginChoosedList[i],"plugin");
}
$("#insertPluginAreaPlugins").html(chooesedPluginHtml);
} }
function showInsertPlugin(selectNode) { function showInsertPlugin(pluginName) {
$('#behaviorFinish').attr('disabled', true); getMethodList(pluginName);
var textNode = selectNode.firstChild;
var methodData = textNode.nodeValue;
getMethodList(methodData);
} }
function removeInsertPlugin() { function removeInsertPlugin() {
@ -116,7 +120,6 @@ function getMethodList(methodData) {
var methodList = new Array(); var methodList = new Array();
// plug-in.method列表 // plug-in.method列表
var plugin_method_List = new Array(); var plugin_method_List = new Array();
var plugin_method_List_count = 0;
// 得到_前的内容 // 得到_前的内容
var type = methodData.split("_"); var type = methodData.split("_");
@ -132,24 +135,29 @@ function getMethodList(methodData) {
data = data.data;// List<String> methodList data = data.data;// List<String> methodList
for ( var i = 0; i < data.length; i++) { for ( var i = 0; i < data.length; i++) {
plugin_method_List.push(methodData + "." + data[i]);// httpPlugin_0.post plugin_method_List.push(methodData + "." + data[i]);// httpPlugin_0.post
plugin_method_List_count++;
methodList.push(data[i]); methodList.push(data[i]);
methodHtml += createLineWithRadio(methodList[i],"method");
} }
for (var j = 0; j < methodList.length; j++) { // for ( var j = 0; j < methodList.length; j++) {
var hideTextNode = document.createTextNode(plugin_method_List // var hideTextNode = document.createTextNode(plugin_method_List
.valueOf(j)); // .valueOf(j));
var hideNode = document.createElement("p"); // var hideNode = document.createElement("p");
hideNode.setAttribute("class", "hide"); // hideNode.setAttribute("class", "hide");
hideNode.appendChild(hideTextNode); // hideNode.appendChild(hideTextNode);
//
methodHtml += "<div id='" + plugin_method_List.valueOf(j) // methodHtml += "<div id='" + plugin_method_List.valueOf(j)
+ "'><a style='cursor: pointer;' onClick='show(this);'>" // + "'><a style='cursor: pointer;' onClick='show(this);'>"
+ methodList[j] + "</a><p class='hide'>" // + methodList[j] + "</a><p class='hide'>"
+ plugin_method_List.valueOf(j) + "</div>"; // + plugin_method_List.valueOf(j) + "</div>";
} // }
document.getElementById("pluginMethod").innerHTML = methodHtml; document.getElementById("pluginMethod").innerHTML = methodHtml;
}); });
} }
$('#insertPluginAreaPlugins').click(function() {
var item = $("input[type='radio']:checked").val();
showInsertPlugin(item);
});
function show(selectedNode) { function show(selectedNode) {
var node = selectedNode.nextSibling.firstChild; var node = selectedNode.nextSibling.firstChild;
var behaviorData = node.nodeValue; var behaviorData = node.nodeValue;