diff --git a/Bench4Q-Web/src/main/webapp/css/script-editor.css b/Bench4Q-Web/src/main/webapp/css/script-editor.css index a19bb5aa..79c06549 100644 --- a/Bench4Q-Web/src/main/webapp/css/script-editor.css +++ b/Bench4Q-Web/src/main/webapp/css/script-editor.css @@ -10,9 +10,8 @@ button { .containerBox { width: 80%; - border: 1px solid #d5d5d5; + border: 1px solid #888888; color: #212121; - margin-top: 20px; margin-left: auto; margin-right: auto; margin-bottom: 20px; @@ -20,24 +19,85 @@ button { .containerBox .header { border-bottom: 1px solid #c5d5dd; + height: 25px; + line-height: 25px; padding-left: 10px; padding-top: 3px; font-weight: bold; text-shadow: 0 1px white; - background: #e5eecc; + /* background: #e5eecc; */ + background: #F6F6EA; + box-shadow: 3px 3px 3px #888888; border-top-right-radius: 4px; border-top-left-radius: 4px; color: #3a505b; + border-top-right-radius: 4px; +} + +.containerBox .header img { + src: images/device.png; + height: 36; +} + +.separator { + width: 80%; + border: 1px solid #d5d5d5; + border-top: 3px solid #212121; + color: #212121; + margin-top: 20px; + margin-left: auto; + margin-right: auto; + height: 50px; + line-height: 50px; + background: #f7f7f7; + text-align: center; +} + +.separator label { + margin-right: 10px; + font-weight: bold; + font-size: 25px; + font-weight: bold; +} + +.separator input { + width: 100px; + height: 25px; + font-weight: bold; + font-size: 25px; + font-weight: bold; } .editor { - background: #f7f7f7;; + background: #f7f7f7; padding-left: 10px; padding-right: 30px; padding-top: 10px; padding-bottom: 10px; } +.action { + background-color: #8AC007; + font-weight: bold; + font-size: 12px; + text-align: center; + padding-left: 10px; + padding-right: 10px; + padding-top: 3px; + padding-bottom: 4px; + text-decoration: none; + border-radius: 5px; + white-space: nowrap; + float:right; + color:#FFFFFF; +} +.booter{ + width: 80%; + margin-left: auto; + margin-right: auto; + margin-bottom: 20px; + +} tr,thead { width: 100%; } diff --git a/Bench4Q-Web/src/main/webapp/device.jsp b/Bench4Q-Web/src/main/webapp/device.jsp index fba360ed..a5f276f2 100644 --- a/Bench4Q-Web/src/main/webapp/device.jsp +++ b/Bench4Q-Web/src/main/webapp/device.jsp @@ -27,15 +27,18 @@ body {
-
- - +
+ + + To Configure Data Sender >>
+ + diff --git a/Bench4Q-Web/src/main/webapp/images/device.png b/Bench4Q-Web/src/main/webapp/images/device.png new file mode 100644 index 00000000..870b6304 Binary files /dev/null and b/Bench4Q-Web/src/main/webapp/images/device.png differ diff --git a/Bench4Q-Web/src/main/webapp/lib/HashMap/HashMap.js b/Bench4Q-Web/src/main/webapp/lib/HashMap/HashMap.js new file mode 100644 index 00000000..7c6ae755 --- /dev/null +++ b/Bench4Q-Web/src/main/webapp/lib/HashMap/HashMap.js @@ -0,0 +1,63 @@ +function HashMap() { + this.arrKey = new Array(); + this.arrValue = new Array(); + + this.exists = function(strKey) { + /*strKey = strKey.toUpperCase();*/ + for (var i = 0; i < this.arrKey.length; i++) { + if (this.arrKey[i] == strKey) { + return true; + } + } + return false; + }; + this.length = function() { + return this.arrKey.length; + }; + + this.put = function(strKey, objValue) { + /*strKey = strKey.toUpperCase();*/ + for (var i = 0; i < this.arrKey.length; i++) { + if (this.arrKey[i] == strKey) { + this.arrValue[i] = objValue; + return; + } + } + this.arrKey[this.arrKey.length] = strKey; + this.arrValue[this.arrValue.length] = objValue; + }; + + this.get = function(strKey) { + /*strKey = strKey.toUpperCase();*/ + for (var i = 0; i < this.arrKey.length; i++) { + if (this.arrKey[i] == strKey) { + return this.arrValue[i]; + } + } + return null; + }; + + this.remove = function(strKey) { + /*strKey = strKey.toUpperCase();*/ + for (var i = 0; i < this.arrKey.length; i++) { + if (this.arrKey[i] == strKey) { + this.arrKey.splice(i, 1); + this.arrValue.splice(i, 1); + return; + } + } + }; + + this.getKeys = function() { + return this.arrKey; + }; + + this.getValues = function() { + return this.arrValue; + }; + + this.clear = function(){ + this.arrKey.splice(0, this.arrKey.length); + this.arrValue.splice(0, this.arrValue.length); + }; +} \ No newline at end of file diff --git a/Bench4Q-Web/src/main/webapp/plugin-old.jsp b/Bench4Q-Web/src/main/webapp/plugin-old.jsp deleted file mode 100644 index 7dbd65ca..00000000 --- a/Bench4Q-Web/src/main/webapp/plugin-old.jsp +++ /dev/null @@ -1,278 +0,0 @@ - -<%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> - - -<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%> - -Bench4Q - - - - - - - - - - - - - - - - - - - - - - - -
-
- - - -
- - - -
-
-
-
-
- -

- (usePlugins) -

-
- -
-
-
- -
-
-
- -
-
- -
-
- -
-
-
-
-
-
- - -
-
-
- -
-
- - - - - - - -
- - - - - - - - - - - - - - - - - - - -
- - \ No newline at end of file diff --git a/Bench4Q-Web/src/main/webapp/plugin.jsp b/Bench4Q-Web/src/main/webapp/plugin.jsp index bd833fb3..e23c788b 100644 --- a/Bench4Q-Web/src/main/webapp/plugin.jsp +++ b/Bench4Q-Web/src/main/webapp/plugin.jsp @@ -268,6 +268,7 @@ body { + diff --git a/Bench4Q-Web/src/main/webapp/script/base.js b/Bench4Q-Web/src/main/webapp/script/base.js index 2e8e5cad..6f70e502 100644 --- a/Bench4Q-Web/src/main/webapp/script/base.js +++ b/Bench4Q-Web/src/main/webapp/script/base.js @@ -141,66 +141,3 @@ function loadProperties(){ mode:'map', // 用 Map 的方式使用资源文件中的值 } ); } -function HashMap() { - this.arrKey = new Array(); - this.arrValue = new Array(); - - this.exists = function(strKey) { - /*strKey = strKey.toUpperCase();*/ - for (var i = 0; i < this.arrKey.length; i++) { - if (this.arrKey[i] == strKey) { - return true; - } - } - return false; - }; - this.length = function() { - return this.arrKey.length; - }; - - this.put = function(strKey, objValue) { - /*strKey = strKey.toUpperCase();*/ - for (var i = 0; i < this.arrKey.length; i++) { - if (this.arrKey[i] == strKey) { - this.arrValue[i] = objValue; - return; - } - } - this.arrKey[this.arrKey.length] = strKey; - this.arrValue[this.arrValue.length] = objValue; - }; - - this.get = function(strKey) { - /*strKey = strKey.toUpperCase();*/ - for (var i = 0; i < this.arrKey.length; i++) { - if (this.arrKey[i] == strKey) { - return this.arrValue[i]; - } - } - return null; - }; - - this.remove = function(strKey) { - /*strKey = strKey.toUpperCase();*/ - for (var i = 0; i < this.arrKey.length; i++) { - if (this.arrKey[i] == strKey) { - this.arrKey.splice(i, 1); - this.arrValue.splice(i, 1); - return; - } - } - }; - - this.getKeys = function() { - return this.arrKey; - }; - - this.getValues = function() { - return this.arrValue; - }; - - this.clear = function(){ - this.arrKey.splice(0, this.arrKey.length); - this.arrValue.splice(0, this.arrValue.length); - }; -} \ No newline at end of file diff --git a/Bench4Q-Web/src/main/webapp/script/device/DeviceEditorAdapter.js b/Bench4Q-Web/src/main/webapp/script/device/DeviceEditorAdapter.js deleted file mode 100644 index f747d951..00000000 --- a/Bench4Q-Web/src/main/webapp/script/device/DeviceEditorAdapter.js +++ /dev/null @@ -1,14 +0,0 @@ -var EditorType = function(name, type, options) { - - this.name = name; - this.type = type; - this.options = options; -} -$(function() { - var editorTypeMap = new HashMap(); - var dataType=new EditorType("dataType","select","int;double"); - editorTypeMap.put("dataType",dataType); - var generator=new EditorType("generator","select","sin;cosin"); - edtiorTypeMap.put("generator",generator); - var min=new EditorType("min") -}); \ No newline at end of file diff --git a/Bench4Q-Web/src/main/webapp/script/device/DeviceFactory.js b/Bench4Q-Web/src/main/webapp/script/device/DeviceFactory.js new file mode 100644 index 00000000..dc31802e --- /dev/null +++ b/Bench4Q-Web/src/main/webapp/script/device/DeviceFactory.js @@ -0,0 +1,92 @@ +var DeviceFactory = function(deviceEditorInfo, container) { + this.deviceEditorInfo = deviceEditorInfo; + this.container = container; +}; +DeviceFactory.prototype.createDevice = function(header, id) { + var deviceSizeConfig = this.createDeviceSizeConfig(); + var deviceContainer = this.createEditorContainer(header, id, + this.deviceEditorInfo); + this.container.append(deviceSizeConfig); + + this.container.append(deviceContainer); + +}; +DeviceFactory.prototype.createDeviceSizeConfig = function() { + + var deviceSizeConfig = document.createElement("div"); + $(deviceSizeConfig).addClass("separator"); + var label = document.createElement("label"); + $(label).html("Device Size:"); + var input = document.createElement("input"); + $(input).attr("type", "text"); + $(deviceSizeConfig).append(label); + $(deviceSizeConfig).append(input); + return deviceSizeConfig; + +} + +DeviceFactory.prototype.createEditorContainer = function(header, id, + containerInfo) { + + var container = document.createElement("div"); + $(container).addClass("containerBox"); + if (id != null) { + $(container).attr("id", id); + } + var containerHeader = document.createElement("p"); + $(containerHeader).addClass("header"); + var img = document.createElement("img"); + $(containerHeader).append(img); + $(containerHeader).append(document.createTextNode(header)); + $(container).append(containerHeader); + + for ( var i = 0; i < containerInfo.length; i++) { + + if (containerInfo[i].children == null) { + this.appendEdtiors(container, containerInfo[i].label, + containerInfo[i].name, containerInfo[i].paramTypeModel); + } + + else { + $(container).append( + + this.createEditorContainer(containerInfo[i].name, null, + containerInfo[i].children)); + } + + } + + return container; + +}; + +DeviceFactory.prototype.appendEdtiors = function(container, label, name, + editorInfo) { + var editorFactory = new EditorFactory(); + + if (editorInfo.type.toLowerCase() == "field") { + $(container).append( + editorFactory.createField(label, name, editorInfo.size, name)); + + } else if (editorInfo.type.toLowerCase() == "nfield") { + $(container).append( + editorFactory.createMultiField(label, name, editorInfo.size, + name)); + } else if (editorInfo.type.toLowerCase() == "table") { + $(container).append( + editorFactory.createTable(label, name, editorInfo.cols, name)); + + } else if (editorInfo.type.toLowerCase() == "file") { + $(container).append( + editorFactory.createFile(lable, name, editorInfo.size, name)); + } else if (editorInfo.type.toLowerCase() == "date") { + $(container).append( + editorFactory.createDate(label, name, editorInfo.size, name)); + } else if (editorInfo.type.toLowerCase() == "select") { + $(container).append( + editorFactory.createSelect(label, name, editorInfo.size, + editorInfo.options, name)); + } else { + alert("no such editor type:" + editorInfo.type); + } +}; diff --git a/Bench4Q-Web/src/main/webapp/script/device/device.js b/Bench4Q-Web/src/main/webapp/script/device/device.js index b932315d..28dbdae6 100644 --- a/Bench4Q-Web/src/main/webapp/script/device/device.js +++ b/Bench4Q-Web/src/main/webapp/script/device/device.js @@ -1,78 +1,9 @@ -var Device = function(editorUnit) { - this.deviceTypes = [ "1", "2", "3" ]; - -}; -Device.prototype.createDeviceEditor = function(header, id, editorUnit) { - var deviceContainer = this.createEditorContainer(header, id, editorUnit); - - return deviceContainer; -}; -Device.prototype.createEditorContainer = function(header, id, containerInfo) { - - var container = document.createElement("div"); - $(container).addClass("containerBox"); - if (id != null) { - $(container).attr("id", id); - } - var containerHeader = document.createElement("p"); - $(containerHeader).addClass("header"); - $(containerHeader).html(header); - $(container).append(containerHeader); - - for ( var i = 0; i < containerInfo.length; i++) { - - if (containerInfo[i].children == null) { - this.appendEdtiors(container, containerInfo[i].label, - containerInfo[i].name, containerInfo[i].paramTypeModel); - } - - else { - $(container).append( - - this.createEditorContainer(containerInfo[i].name, null, - containerInfo[i].children)); - } - - } - - return container; - -}; - -Device.prototype.appendEdtiors = function(container, label, name, editorInfo) { - var editorFactory = new EditorFactory(); - - if (editorInfo.type.toLowerCase() == "field") { - $(container).append( - editorFactory.createField(label, name, editorInfo.size, name)); - - } else if (editorInfo.type.toLowerCase() == "nfield") { - $(container).append( - editorFactory.createMultiField(label, name, editorInfo.size, - name)); - } else if (editorInfo.type.toLowerCase() == "table") { - $(container).append( - editorFactory.createTable(label, name, editorInfo.cols, name)); - - } else if (editorInfo.type.toLowerCase() == "file") { - $(container).append( - editorFactory.createFile(lable, name, editorInfo.size, name)); - } else if (editorInfo.type.toLowerCase() == "date") { - $(container).append( - editorFactory.createDate(label, name, editorInfo.size, name)); - } else if (editorInfo.type.toLowerCase() == "select") { - $(container).append( - editorFactory.createSelect(label, name, editorInfo.size, - editorInfo.options, name)); - } else { - alert("no such editor type:" + editorInfo.type); - } -}; - -Device.prototype.addChildDevice = function() { -}; function dataTransfer(serverData) { + var Container = function(name, children) { + this.name = name; + this.children = children; + }; var editorInfos = new Array(); var paramInfos = serverData.paramInfoModels; var groupInfos = serverData.groupModels; @@ -92,24 +23,38 @@ function dataTransfer(serverData) { } return editorInfos; + } -var Container = function(name, children) { - this.name = name; - this.children = children; - -}; $(function() { - var pluginName = "hbase"; - var url = "/getPlugin/" + pluginName; - $.get(url, {}, function(data) { + var deviceFactory; + $.get("/getPlugin/" + "hbase", {}, function(data) { if (data.success) { - var device = new Device(); - $("#devices").append( - device.createDeviceEditor("device config", "device-0", - dataTransfer(data.pluginInfo))); + deviceFactory = new DeviceFactory(dataTransfer(data.pluginInfo), + $("#devices")); + deviceFactory.createDevice("device config", "device-0"); + $("#add-device").click( + { + deviceFactory : deviceFactory, + }, + function(event) { + event.preventDefault(); + event.data.deviceFactory.createDevice("device config", + "device-1"); + + }); + $("#remove-device").click(function(event) { + event.preventDefault(); + if ($("#devices").children(".containerBox").length <= 1) { + return; + } + + $("#devices").children(".containerBox").last().remove(); + $("#devices").children(".separator").last().remove(); + + }); } else { alert(data.failedMessage); diff --git a/Bench4Q-Web/src/main/webapp/script/plugin-new.js b/Bench4Q-Web/src/main/webapp/script/plugin-new.js deleted file mode 100644 index 966be1e9..00000000 --- a/Bench4Q-Web/src/main/webapp/script/plugin-new.js +++ /dev/null @@ -1,478 +0,0 @@ -var pluginChoosedList = new Array(); -var pluginIndex = new HashMap(); -var pluginList = new Array(); -var pluginMethodList = new Array(); -var pageList = new Array(); -var behaviorList = [];// 存放所有方法及其对应的parameter -var pluginParamList = [];// 一个plug-in名一个paramInfoModels list -var clickPluginMethodNode = -1; -var clickPluginChoosedNode = 0; -var place = ""; -var parameters = []; -var files = []; - -function setTab(name, m, n) { - for (var i = 1; i <= n; i++) { - var menu = document.getElementById(name + i); - var showDiv = document.getElementById("cont_" + name + "_" + i); - menu.className = i == m ? "on" : ""; - showDiv.style.display = i == m ? "block" : "none"; - } -} - -function fileChange(event){ - $.each(event.target.files, function(index, file) { - var reader = new FileReader(); - reader.onload = function(event) { - object = {}; - object.filename = file.name; - object.data = event.target.result; - files.push(object); - }; - reader.readAsDataURL(file); - }); -} - -$(document).ready(function() { - - loadPluginList(); - loadPluginParams(); -}); - -function loadPluginList (){ - $.post("loadPluginName", {}, function(response) { - if (!response.success) { - alert(response.failedMessage); - return; - } - pluginList=response.data; - for(var i=0;ipluginUIModels - for (var i = 0; i < data.length; i++) { - var pluginInfoModel = data[i].pluginInfoModel; - pluginParamList.push(pluginInfoModel.name); - pluginParamList[pluginInfoModel.name] = pluginInfoModel.paramInfoModels; - } - }); -} - -function addPlugin() { - var html = ""; - for (var j = 0; j < pluginList.length; j++) { - html += createLineWithRadio(pluginList[j], "plugin"); - } - $('#choosePlugin').html(html); - $('#myModal_Plugin').modal('show'); - - $("input:radio").click(function() { - $(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() + "
"; -} - -function createALine(name, index, list) { - var div = document.createElement("div"); - var p = document.createElement("p"); - var i = document.createElement("i"); - var textNode = document.createTextNode(name); - 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(this);");// 此处用于显示plugin文档 - } else if (list == "editPluginChoosedList") { - p.setAttribute("onClick", "chooseEditPlugin(this);"); - } - p.setAttribute("style", "cursor:pointer;width:85%"); - p.appendChild(i); - p.appendChild(textNode); - div.appendChild(p); - return div; -} - -function getParamInfoModelList(plugin) { - return pluginParamList[plugin]; -} - -function pluginFinish() { - $('#myModal_Plugin').modal('hide'); - var pluginName; - var item = $("input[type='radio']:checked").val(); - - var aPluginIndex = pluginIndex.get(item); - pluginIndex.put(item, aPluginIndex + 1); - pluginName = item + "_" + aPluginIndex; - pluginChoosedList.push(pluginName); - createPluginChoosedLines(); - var data = getParamInfoModelList(item);// paramInfoModels - document.getElementById("pluginParams").innerHTML += createAEditText(data, - pluginName, pluginChoosedList.length - 1); - alert($("input[type=file]").length); - $("input[type=file]").change(function(event){ - - fileChange(event); - }); - -} - -function choosePlugin(selectedNode) { - clickPluginChoosedNode = $(selectedNode).attr("id"); - var pluginChoosedNode = $('#pluginArea').children(); - var div = document.getElementById("pluginParams").childNodes; - showChoosedPluginInfo(pluginChoosedNode, div); -} - -function showChoosedPluginInfo(pluginChoosedNode, div) { - // 显示选中 - showChoosedPluginLine(pluginChoosedNode); - // 显示文档 - showChoosedPluginParamInfos(div); - -} - -function showChoosedPluginLine(pluginChoosedNode) { - for (var i = 0; i < pluginChoosedNode.length; i++) { - if (i == clickPluginChoosedNode) { - $(pluginChoosedNode[i]).find("p").attr("class", "visited"); - - } else { - $(pluginChoosedNode[i]).find("p").attr("class", ""); - } - } -} - -function showChoosedPluginParamInfos(div) { - for (var j = 0; j < div.length; j++) { - if (div[j].getAttribute("id") == clickPluginChoosedNode) { - $(div[j]).show(); - } else { - $(div[j]).hide(); - } - } -} - -function createPluginChoosedLines() { - document.getElementById('pluginArea').innerHTML = ""; - for (var j = 0; j < pluginChoosedList.length; j++) { - var pluginName = pluginChoosedList[j]; - var div = createALine(pluginName, j, "pluginChoosedList"); - document.getElementById('pluginArea').appendChild(div); - } -} - -function removePluginByClicked() { - var length = pluginChoosedList.length; - for (var i = parseInt(clickPluginChoosedNode + 1); i < length; i++) { - pluginChoosedList[i - 1] = pluginChoosedList[i]; - } - pluginChoosedList.splice(length - 1, 1); - createPluginChoosedLines(); -} - -function clearPluginChoosedList() { - pluginChoosedList.splice(0, pluginChoosedList.length); - for (var i = 0; i < pluginList.length; i++) { - pluginIndex.put(pluginList[i], 0); - } - document.getElementById('pluginArea').innerHTML = ""; -} - -function insert() { - place = "before"; - insertPlugin(); -} - -function insertAfter() { - place = "after"; - insertPlugin(); -} - -function insertPlugin() { - document.getElementById("pluginMethod").innerHTML = ""; - $('#myModal_Behavior').modal('show'); - var chooesedPluginHtml = ""; - for (var i = 0; i < pluginChoosedList.length; i++) { - chooesedPluginHtml += createLineWithRadio(pluginChoosedList[i], - "plugin"); - } - $("#insertPluginAreaPlugins").html(chooesedPluginHtml); -} - -$('#insertPluginAreaPlugins').click(function() { - var pluginName = $("input[type='radio']:checked").val(); - getBehaviorList(pluginName); -}); -function loadBehaviorList(plugin){ - var behaviors=null; - $.ajax({ - type : "POST", - url : "loadBehaviorList", - data:"pluginName="+plugin, - dataType : "json", - async : false, - success : function(response) { - if (!response.success) { - alert(response.failedMessage); - return; - } - behaviors=response.data; - } - }); - return behaviors; -} -function getBehaviorList(pluginName) { - var methodHtml = ""; - var type = pluginName.split("_"); - var plugin = type[0]; - behaviorList.splice(0, behaviorList.length); - var behaviors=loadBehaviorList(plugin); - for (var i = 0; i < behaviors.length; i++) { - behaviorList.push(behaviors[i].name); - behaviorList[behaviors[i].name] = behaviors[i].paramInfoModels; - methodHtml += createLineWithRadio(behaviors[i].name, "method"); - } - document.getElementById("pluginMethod").innerHTML = methodHtml; -} - -function behaviorFinish() { - var plugin = $("input[name='plugin']:checked").val(); - var method = $("input[name='method']:checked").val(); - if (plugin != null && plugin != "" && method != null && method != "") { - showPluginMethodLine(plugin, method); - } else { - alert("The plugin or the method shouldn't be null!"); - $('#myModal_Behavior').modal('hide'); - } -} - -var mark; -function showPluginMethodLine(plugin, method) { - var behaviorData = plugin + "." + method; - var length = pluginMethodList.length; - var documentChild = document.getElementById("showPluginMethod").childNodes; - if (place == "before") { - for (var j = length - 1; j >= clickPluginMethodNode; j--) { - pluginMethodList[j + 1] = pluginMethodList[j]; - $(documentChild[j]).attr("id", parseInt(j + 1)); - } - mark = clickPluginMethodNode; - clickPluginMethodNode = parseInt(clickPluginMethodNode + 1); - pluginMethodList[mark] = behaviorData; - } else if (place == "after") { - mark = parseInt(clickPluginMethodNode + 1); - if (clickPluginMethodNode == parseInt(length - 1) - && clickPluginMethodNode != -1) { - pluginMethodList.push(behaviorData); - } else { - for (var j = parseInt(length - 1); j >= mark; j--) { - pluginMethodList[j + 1] = pluginMethodList[j]; - $(documentChild[j]).attr("id", parseInt(j + 1)); - } - pluginMethodList[mark] = behaviorData; - } - } - $('#insertBefore').attr("class", "show"); - $('#myModal_Behavior').modal('hide'); - createPluginMethodLines(); -} - -function createPluginMethodLines() { - document.getElementById("showPluginMethod").innerHTML = ""; - document.getElementById('behaviorArea').innerHTML = ""; - for (var j = 0; j < pluginMethodList.length; j++) { - var div = createALine(pluginMethodList[j], j, "pluginMethodList"); - if (j == clickPluginMethodNode) { - $(div).find("p").attr("class", "visited"); - } - document.getElementById('behaviorArea').appendChild(div); - loadMethodParams(pluginMethodList[j], j); - } -} - -function showMethodDocument(selectedNode) { - clickPluginMethodNode = parseInt($(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") != 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") == clickPluginMethodNode) { - $(div[j]).show(); - } else { - $(div[j]).hide(); - } - } - $('#submitBehaviors').attr("class", "show"); -} - -function removeInsertPluginByClicked() { - var length = $('#behaviorArea').children().length; - var removeDocumentNode = document.getElementById("showPluginMethod").childNodes; - for (var i = parseInt(clickPluginMethodNode + 1); i < length; i++) { - pluginMethodList[i - 1] = pluginMethodList[i]; - } - pluginMethodList.splice(length - 1, 1);// js Array remove element - createPluginMethodLines(); - for (var j = 0; j < length; j++) { - if ($(removeDocumentNode[j]).attr("id") == clickPluginMethodNode) { - document.getElementById("showPluginMethod").removeChild( - removeDocumentNode[j]); - } - } -} - -function clearPluginMethodList() { - pluginMethodList.splice(0, pluginMethodList.length); - document.getElementById('behaviorArea').innerHTML = ""; - document.getElementById("showPluginMethod").innerHTML = ""; - $('#submitBehaviors').attr("class", "hide"); -} - -function loadMethodParams(behaviorData, behaviorIndex) { - var temp = behaviorData.split('.'); - var method = temp[1]; - var data = behaviorList[method];// data 为List - document.getElementById("showPluginMethod").innerHTML += createAEditText( - data, behaviorData, behaviorIndex); -} - -// 生成页面显示 -function createAEditText(data, name, index) { - var documentHtml = ""; - var boxHeader = ""; - var fieldHTML = ""; - boxHeader = "
" - + "" + "

sample:" + name - + "

"; - if (data != null) { - fieldHTML = createPluginsOrBehaviorsForm(data, index); - } - documentHtml = "

" - + name + "

" - + boxHeader + "
" + fieldHTML + "
" - + "
"; - console.log($("input[type=file]").lenth); - - return documentHtml; -} - -function cancelBehavior(selectedNode) { - var divNode = selectedNode.parentNode.parentNode.parentNode; - $(divNode).hide(); -} - -$('#pluginCancel').click(function() { - $('#myModal_Plugin').modal('hide'); -}); - -$('#behaviorCancel').click(function() { - $('#myModal_Behavior').modal('hide'); -}); - diff --git a/Bench4Q-Web/src/main/webapp/script/pluginCommon.js b/Bench4Q-Web/src/main/webapp/script/pluginCommon.js deleted file mode 100644 index ac9a6dee..00000000 --- a/Bench4Q-Web/src/main/webapp/script/pluginCommon.js +++ /dev/null @@ -1,30 +0,0 @@ -function getvars() { - - var vars = [], hash; - - var hashes = window.location.href.slice( - window.location.href.indexOf('?') + 1).split('&'); - - for (var i = 0; i < hashes.length; i++) - - { - - hash = hashes[i].split('='); - - vars.push(hash[0]); - - vars[hash[0]] = hash[1]; - - } - - return vars; -} -$(function() { - var jsonData = getvars()['jsonData']; - if(jsonData!=null){ - showScriptByJsonData(jsonData); - } -}); - - - diff --git a/Bench4Q-Web/src/test/java/org/bench4q/web/test/masterMessager/ScriptMessageTest.java b/Bench4Q-Web/src/test/java/org/bench4q/web/test/masterMessager/ScriptMessageTest.java index bd7906c7..534290f1 100644 --- a/Bench4Q-Web/src/test/java/org/bench4q/web/test/masterMessager/ScriptMessageTest.java +++ b/Bench4Q-Web/src/test/java/org/bench4q/web/test/masterMessager/ScriptMessageTest.java @@ -1,11 +1,7 @@ package org.bench4q.web.test.masterMessager; import static org.junit.Assert.*; - -import java.util.List; - import javax.xml.bind.JAXBException; - import org.bench4q.share.helper.MarshalHelper; import org.bench4q.share.models.master.OperateScriptServerResponseModel; import org.bench4q.share.models.master.ScriptModel;