From 3ceeb7055be93dcbd52ad2258c2a8a7b94eba62b Mon Sep 17 00:00:00 2001 From: zhengyingying Date: Wed, 19 Mar 2014 17:41:49 +0800 Subject: [PATCH] write the function loadMethodParam and modify paramTypeModels --- .../java/org/bench4q/web/model/CheckBox.java | 16 +- .../java/org/bench4q/web/model/Field.java | 17 +- .../org/bench4q/web/model/MultiField.java | 17 +- .../org/bench4q/web/model/ParamTypeModel.java | 33 +- .../java/org/bench4q/web/model/Table.java | 14 +- src/main/webapp/plugin.jsp | 11 +- src/main/webapp/script/plugin-new.js | 606 +++++++++--------- src/main/webapp/script/pluginModel.js | 9 +- 8 files changed, 349 insertions(+), 374 deletions(-) diff --git a/src/main/java/org/bench4q/web/model/CheckBox.java b/src/main/java/org/bench4q/web/model/CheckBox.java index 674a1e10..e360d87e 100644 --- a/src/main/java/org/bench4q/web/model/CheckBox.java +++ b/src/main/java/org/bench4q/web/model/CheckBox.java @@ -2,20 +2,10 @@ package org.bench4q.web.model; public class CheckBox extends ParamTypeModel { - private String rows; - - public String getRows() { - return rows; - } - - public void setRows(String rows) { - this.rows = rows; - } - - public CheckBox(String rows,String type, String valueSeperator, String fieldSeperator) { - super(type, valueSeperator, fieldSeperator); + public CheckBox(String type, String valueSeperator, String fieldSeperator, + int size, String cols, String rows) { + super(type, valueSeperator, fieldSeperator, size, cols, rows); // TODO Auto-generated constructor stub - this.rows=rows; } } diff --git a/src/main/java/org/bench4q/web/model/Field.java b/src/main/java/org/bench4q/web/model/Field.java index bc0adb4d..fa3c559e 100644 --- a/src/main/java/org/bench4q/web/model/Field.java +++ b/src/main/java/org/bench4q/web/model/Field.java @@ -2,21 +2,12 @@ package org.bench4q.web.model; public class Field extends ParamTypeModel{ - private int size; - - public int getSize() { - return size; - } - - public void setSize(int size) { - this.size = size; - } - - public Field(int size,String type, String valueSeperator, String fieldSeperator) { - super(type, valueSeperator, fieldSeperator); + public Field(String type, String valueSeperator, String fieldSeperator, + int size, String cols, String rows) { + super(type, valueSeperator, fieldSeperator, size, cols, rows); // TODO Auto-generated constructor stub - this.size=size; } + } diff --git a/src/main/java/org/bench4q/web/model/MultiField.java b/src/main/java/org/bench4q/web/model/MultiField.java index 6f4733d0..393a7ea1 100644 --- a/src/main/java/org/bench4q/web/model/MultiField.java +++ b/src/main/java/org/bench4q/web/model/MultiField.java @@ -2,20 +2,11 @@ package org.bench4q.web.model; public class MultiField extends ParamTypeModel { - private int size; - - public int getSize() { - return size; - } - - public void setSize(int size) { - this.size = size; - } - - public MultiField(int size,String type, String valueSeperator, String fieldSeperator) { - super(type, valueSeperator, fieldSeperator); + public MultiField(String type, String valueSeperator, + String fieldSeperator, int size, String cols, String rows) { + super(type, valueSeperator, fieldSeperator, size, cols, rows); // TODO Auto-generated constructor stub - this.size=size; } + } diff --git a/src/main/java/org/bench4q/web/model/ParamTypeModel.java b/src/main/java/org/bench4q/web/model/ParamTypeModel.java index 705f50a3..f3068909 100644 --- a/src/main/java/org/bench4q/web/model/ParamTypeModel.java +++ b/src/main/java/org/bench4q/web/model/ParamTypeModel.java @@ -5,12 +5,17 @@ public class ParamTypeModel { private String type; private String valueSeperator; private String fieldSeperator; + private int size; + private String cols; + private String rows; - public ParamTypeModel(String type,String valueSeperator,String fieldSeperator){ + public ParamTypeModel(String type,String valueSeperator,String fieldSeperator,int size,String cols,String rows){ this.type=type; this.valueSeperator=valueSeperator; this.fieldSeperator=fieldSeperator; - + this.size=size; + this.cols=cols; + this.rows=rows; } public String getType() { @@ -37,5 +42,29 @@ public class ParamTypeModel { this.fieldSeperator = fieldSeperator; } + public int getSize() { + return size; + } + + public void setSize(int size) { + this.size = size; + } + + public String getCols() { + return cols; + } + + public void setCols(String cols) { + this.cols = cols; + } + + public String getRows() { + return rows; + } + + public void setRows(String rows) { + this.rows = rows; + } + } diff --git a/src/main/java/org/bench4q/web/model/Table.java b/src/main/java/org/bench4q/web/model/Table.java index 6d339e37..9a317d25 100644 --- a/src/main/java/org/bench4q/web/model/Table.java +++ b/src/main/java/org/bench4q/web/model/Table.java @@ -2,18 +2,12 @@ package org.bench4q.web.model; public class Table extends ParamTypeModel { - private String cols; - public String getCols() { - return cols; - } - public void setCols(String cols) { - this.cols = cols; - } - public Table(String cols,String type, String valueSeperator, String fieldSeperator) { - super(type, valueSeperator, fieldSeperator); + public Table(String type, String valueSeperator, String fieldSeperator, + int size, String cols, String rows) { + super(type, valueSeperator, fieldSeperator, size, cols, rows); // TODO Auto-generated constructor stub - this.cols=cols; } + } diff --git a/src/main/webapp/plugin.jsp b/src/main/webapp/plugin.jsp index b614b75c..a4580a29 100644 --- a/src/main/webapp/plugin.jsp +++ b/src/main/webapp/plugin.jsp @@ -102,9 +102,7 @@ body {
-
- -
+

@@ -146,7 +144,7 @@ body {

- +
@@ -169,6 +167,7 @@ body {
+
@@ -215,9 +214,7 @@ body {
-
- -
+
diff --git a/src/main/webapp/script/plugin-new.js b/src/main/webapp/script/plugin-new.js index 28cd4366..db85c055 100644 --- a/src/main/webapp/script/plugin-new.js +++ b/src/main/webapp/script/plugin-new.js @@ -1,15 +1,14 @@ -//创建一个PluginMethodListModel -function PluginMethodListModel(pluginName,methodList){ - this.pluginName=pluginName; - this.methodList=methodList; -} +PluginMethodListModel = function(pluginName, methodList) { + this.pluginName = pluginName; + this.methodList = methodList; +}; +var pluginList = new Array(); +var pluginMethodList = new Array(); + $(document).ready(function() { loadPluginList(); }); -var pluginList = new Array(); -var pluginMethodList=new Array(); - function loadPluginList() { $.post("loadPlugin", {}, function(data) { if (!data.success) { @@ -23,8 +22,25 @@ function loadPluginList() { }); } +function getMethod(pluglin) { + var aMethodList = ""; + $.post("loadMethod", { + pluginName : plugin + }, function(data) { + if (!data.success) { + alert(data.failedMessage); + return; + } + data = data.data;// List methodList + for (var i = 0; i < data.length; i++) { + aMethodList.push(data[i]); + } + }); + return aMethodList; +} + function addPlugin() { - loadPluginList(); + var html = ""; for (var j = 0; j < pluginList.length; j++) { var textNode = document.createTextNode(pluginList[j]); @@ -59,11 +75,10 @@ function pluginFinish() { pluginChoosedList.push(data); num++; /* - //load选择的plugin的MethodList - var aMethodList=getMethod(item); - document.write(data); - pluginMethodList.push(new PluginMethodListModel(data,aMethodList)); -*/ + * //load选择的plugin的MethodList var aMethodList=getMethod(item); + * document.write(data); pluginMethodList.push(new + * PluginMethodListModel(data,aMethodList)); + */ var div = document.createElement("div"); var p = document.createElement("p"); var textNode = document.createTextNode(data); @@ -98,12 +113,14 @@ function showInsertPlugin(selectNode) { getMethodList(methodData); } -// plug-in.method列表 + function getMethodList(methodData) { var methodHtml = ""; var methodList = new Array(); + // plug-in.method列表 var plugin_method_List = new Array(); var plugin_method_List_count = 0; + // 得到_前的内容 var type = methodData.split("_"); var plugin = type[0]; @@ -152,54 +169,54 @@ function show(selectedNode) { a.appendChild(textNode); div.appendChild(a); - document.getElementById('behaviorArea').innerHTML += $(div).html(); + document.getElementById('behaviorArea').appendChild(div); + } function showMethodDocument(selectedNode) { + var behaviorData = selectedNode.firstChild.nodeValue; - + var temp; var flag = false; - var length = document.getElementById("showPluginMethod").childNodes.length; - - document.write(length); + var length = $("#showPluginMethod").children().length; if (length == 0) { flag = false; } else { for (var j = 0; j < length; j++) { - if ($($('#showPluginMethod').children()[j]).attr("id") == behaviorData) { + var data=document.getElementById("showPluginMethod").childNodes[length].firstChild.firstChild.nodeValue; + if (data==behaviorData) { // 该文档已经生成 - // document.getElementById("showPluginMethod").childNodes[j].getAttributeNode("id").nodeValue==behaviorData; + // document.getElementById("showPluginMethod").childNodes[j].firstChild.firstChild.nodeValue==behaviorData; flag = true; + temp = j; + for (var m = 0; m < length; m++) { + $('#showPluginMethod').children()[m].Attr("class", "hide"); + } + $('#showPluginMethod').children()[temp].Attr("class", ""); break; } } } - if (flag == false) { // 文档没有生成过,需要调用函数生成该文档 - loadMethodParams(behaviorData); - document.getElementById("showPluginMethod") - .appendChild($(behaviorData)); - } - for (var i = 0; i < length; i++) { - if ($('#showPluginMethod').children()[i].Attr("class", "")) { - $('#showPluginMethod').children()[i].Attr("class", "hide"); + for (var i = 0; i < length; i++) { + if ($('#showPluginMethod').children()[i].Attr("class", "")) { + $('#showPluginMethod').children()[i].Attr("class", "hide"); + } } - } - // 显示文档 - if ($(behaviorData).Attr("class") == "hide") { - $(behaviorData).attr("class", ""); + loadMethodParams(behaviorData); } } - var methodParams = new Array(); -var fieldHTML = ""; var temp; function loadMethodParams(behaviorData) { var temp = behaviorData.split('.'); var plugin = temp[0].split('_')[0]; var method = temp[1]; + var fieldHTML = ""; + var documentHtml = ""; + var boxHeader=""; $ .post( @@ -213,57 +230,265 @@ function loadMethodParams(behaviorData) { alert(data.failedMessage); return; } - data = data.data;// Set - // methodParamSet - - var boxHeader = "
" - + "" - + "

sample:" - + plugin - + "." - + method - + "

" - + "" - + "
"; - + data=data.data; for (var i = 0; i < data.length; i++) { methodParams.push(data[i]); } for (var j = 0; j < methodParams.length; j++) { var methodParamModel = new MethodParamModel( methodParams[j].name, - methodParams[j].label, + methodParams[j].lable, methodParams[j].paramTypeModel); var paramTypeModel = methodParamModel.paramTypeModel; if (paramTypeModel.type == "field") { - temp = createField(methodParamModel.label, + fieldHTML += createField( + methodParamModel.lable, methodParamModel.name, paramTypeModel.size); - } else if (paramTypeModel.type == "MultiField") { - temp = createMultiField(methodParamModel.label, + } else if (paramTypeModel.type == "multiField") { + fieldHTML += createMultiField( + methodParamModel.lable, methodParamModel.name, paramTypeModel.size); } else if (paramTypeModel.type == "Table") { - temp = createTable(methodParamModel); + fieldHTML += createTable(methodParamModel); } else if (paramTypeModel.type == "CheckBox") { - temp = createTable(methodParamModel); + fieldHTML += createTable(methodParamModel); } - fieldHTML += temp.innerHTML; } - - var html = "
" - + boxHeader - + "
" - + fieldHTML - + "
"; - - return html; - + + boxHeader = "
" + + "" + + "

sample:" + + behaviorData + + "

" + + "" + + "
"; + + documentHtml = "

" + + behaviorData + + "

" + + boxHeader + + "
" + + fieldHTML + + "
"; + + document.getElementById("showPluginMethod").innerHTML += documentHtml; }); } + +// 创建一个Table域 +function createTable(methodParamModel) { + + var name = methodParamModel.name; + var label = methodParamModel.label; + var table = methodParamModel.paramTypeModel; + var cols = table.cols; + var table_content = cols.split(table.valueSeperator); + /* + * var divNode = document.createElement("div"); var p = + * document.createElement("p"); var div = document.createElement("div"); var + * addCol = document.createElement("button"); var removeCol = + * document.createElement("button"); var tableNode = + * document.createElement("table"); var br1 = document.createElement("br"); + * var br2 = document.createElement("br"); var labelNode = + * document.createTextNode(label); var nameNode = + * document.createTextNode(name); + */ + + var th = document.createElement("th"); + var tr_content = document.createElement("tr"); + for (var i = 0; i < table_content.length; i++) { + var td = document.createElement("td"); + var text = document.createTextNode(table_content[i]); + var td_content = document.createElement("td"); + var text_content = document.createTextNode(""); + + td.appendChild(text); + th.appendChild(td); + td.appendChild(text_content); + tr_content.appendChild(td_content); + } + + var tableHead = th.innerHTML + tr_content.innerHTML; + var tableHtml = "

" + + label + + "

" + + name + + ":

" + + tableHead + "
"; + /* + * // divNode.setAttribute("class","sample_frame"); + * divNode.setAttribute("class", "Table"); divNode.setAttribute("id", name); + * div.setAttribute("class", "sample_sub_frame"); + * addCol.setAttribute("type", "submit"); addCol.setAttribute("onClick", + * "addCol(this);");// 添加一行 tableNode.setAttribute("class", + * "operateTableCols");// 便于为该Table添加删除行 removeCol.setAttribute("type", + * "submit"); removeCol.setAttribute("onClick", "removeCol();");// 删除一行 + * + * tableNode.appendChild(tr); tableNode.appendChild(tr_content); + * p.appendChild(labelNode); div.appendChild(nameNode + ":"); + * div.appendChild(br1); div.appendChild(addCol); + * div.appendChild(removeCol); div.appendChild(br2); + * div.appendChild(tableNode); divNode.appendChild(p); + * divNode.appendChild(div); + * + * return divNode; + */ + return tableHtml; + +} + +function addCol(selectedNode) { + var table = selectedNode.nextSibling.nextSibling.nextSibling; + var length = $(table).find("th").find("td").length; + var tr = document.createElement("tr"); + for (var i = 0; i < length; i++) { + var td = document.createElement("td"); + var text = document.createTextNode(""); + td.appendChild(text); + tr.appendChild(td); + } + table.appendChild(tr); +} + +function removeCol(selectedNode) { + var table = selectedNode.nextSibling.nextSibling; + var removeNode = table.lastChild; + table.removeChild(removeNode); +} + +// 创建一个CheckBox域 +function createCheckBox(methodParamModel) { + var name = methodParamModel.name; + var label = methodParamModel.label; + var checkBox = methodParamModel.paramTypeModel; + var rows = checkBox.rows; + var cb_content = rows.split(checkBox.valueSeperator); + + var divNode = document.createElement("div"); + var p = document.createElement("p"); + var div = document.createElement("div"); + var br = document.createElement("br"); + var labelNode = document.createTextNode(label); + var nameNode = document.createTextNode(name); + + // divNode.setAttribute("class","sample_frame"); + divNode.setAttribute("class", "CheckBox sample_frame"); + divNode.setAttribute("id", name); + div.setAttribute("class", "sample_sub_frame"); + p.appendChild(labelNode); + div.appendChild(nameNode + ":"); + div.appendChild(br); + for (var i = 0; i < cb_content.length; i++) { + var checkBoxNode = document.createElement("input"); + checkBoxNode.setAttribute("type", "checkbox"); + checkBoxNode.setAttribute("name", "checkbox_" + name); + checkBoxNode.setAttribute("value", cb_content[i]); + var checkBoxValue = document.createTextNode(cb_content[i]); + + checkBoxNode.appendChild(checkBoxValue); + div.appendChild(checkBoxNode); + + } + + divNode.appendChild(p); + divNode.appendChild(div); + + return divNode.innerHTML; + +} +// 创建一个label加一个input的域 +function createField(label, name, size) { + + // document.write(label+","+name+","+size); + if (size == 0) { + size = 20; + } + + var fieldHTML = "

" + label + + "

" + name + + ":
"; + return fieldHTML; + +} +// 创建一个可以增加field的域 +function createMultiField(label, name, size) { + if (size == 0) { + size = 20; + } + var multiFieldHTML = "

" + + name + + ":" + + label + + "


"; + + return multiFieldHTML; +} + +var field = 0; +function addField(size) { + var data = "field_" + field + ":"; + field = field + 1; + var newTrNode = document.createElement("tr"); + var newTdNode1 = document.createElement("td"); + var newTdNode2 = document.createElement("td"); + var newTdNode3 = document.createElement("td"); + var i = document.createElement("i"); + i.setAttribute("class", "icon-trash"); + i.setAttribute("style", "cursor:pointer"); + i.setAttribute("onClick", "deleteField(this)"); + newTdNode1.setAttribute("style", "width:40px;cursor:pointer;"); + newTdNode1.setAttribute("class", data); + newTdNode2.setAttribute("style", "width:40px;"); + var textNode = document.createTextNode(data); + var inputNode = document.createElement("input"); + inputNode.setAttribute("type", "text"); + inputNode.setAttribute("size", size); + + newTdNode1.appendChild(textNode); + newTdNode2.appendChild(inputNode); + newTdNode3.appendChild(i); + newTrNode.appendChild(newTdNode1); + newTrNode.appendChild(newTdNode2); + newTrNode.appendChild(newTdNode3); + document.getElementById("addFieldTable").appendChild(newTrNode); +} +function deleteField(selectedNode) { + var deletedNode = selectedNode.parentNode.parentNode; + var parentNode = deletedNode.parentNode; + parentNode.removeChild(deletedNode); +} +function removeField() { + $('#addFieldTable').empty(); +} + +$('#removeAllPlugin').click(function() { + document.getElementById('pluginArea').innerHTML = ""; +}); + +$('#pluginCancel').click(function() { + $('#myModal_Plugin').modal('hide'); +}); + +$('#behaviorFinish').click(function() { + $('#myModal_Behavior').modal('hide'); +}); + +$('#behaviorCancel').click(function() { + $('#myModal_Behavior').modal('hide'); +}); + function uploadBehavior(selectNode) { var uploadNode = selectNode.parentNode.parentNode; var tableNum = 0; @@ -346,249 +571,4 @@ function upload(uploadBehavior) { error : function(request, status, error) { } }); -} - -// 创建一个Table域 -function createTable(methodParamModel) { - - var name = methodParamModel.name; - var label = methodParamModel.label; - var table = methodParamModel.paramTypeModel; - var cols = table.cols; - var table_content = cols.split(table.valueSeperator); - /* - * var divNode = document.createElement("div"); var p = - * document.createElement("p"); var div = document.createElement("div"); var - * addCol = document.createElement("button"); var removeCol = - * document.createElement("button"); var tableNode = - * document.createElement("table"); var br1 = document.createElement("br"); - * var br2 = document.createElement("br"); var labelNode = - * document.createTextNode(label); var nameNode = - * document.createTextNode(name); - */ - - var th = document.createElement("th"); - var tr_content = document.createElement("tr"); - for (var i = 0; i < table_content.length; i++) { - var td = document.createElement("td"); - var text = document.createTextNode(table_content[i]); - var td_content = document.createElement("td"); - var text_content = document.createTextNode(""); - - td.appendChild(text); - th.appendChild(td); - td.appendChild(text_content); - tr_content.appendChild(td_content); - } - - var tableHead = th.innerHTML + tr_content.innerHTML; - var tableHtml = "

" - + label - + "

" - + name - + ":

" - + tableHead + "
"; - /* - * // divNode.setAttribute("class","sample_frame"); - * divNode.setAttribute("class", "Table"); divNode.setAttribute("id", name); - * div.setAttribute("class", "sample_sub_frame"); - * addCol.setAttribute("type", "submit"); addCol.setAttribute("onClick", - * "addCol(this);");// 添加一行 tableNode.setAttribute("class", - * "operateTableCols");// 便于为该Table添加删除行 removeCol.setAttribute("type", - * "submit"); removeCol.setAttribute("onClick", "removeCol();");// 删除一行 - * - * tableNode.appendChild(tr); tableNode.appendChild(tr_content); - * p.appendChild(labelNode); div.appendChild(nameNode + ":"); - * div.appendChild(br1); div.appendChild(addCol); - * div.appendChild(removeCol); div.appendChild(br2); - * div.appendChild(tableNode); divNode.appendChild(p); - * divNode.appendChild(div); - * - * return divNode; - */ - return tableHtml; - -} - -function addCol(selectedNode) { - var table = selectedNode.nextSibling.nextSibling.nextSibling; - var length = $(table).find("th").find("td").length; - var tr = document.createElement("tr"); - for (var i = 0; i < length; i++) { - var td = document.createElement("td"); - var text = document.createTextNode(""); - td.appendChild(text); - tr.appendChild(td); - } - table.appendChild(tr); -} - -function removeCol(selectedNode) { - var table = selectedNode.nextSibling.nextSibling; - var removeNode = table.lastChild; - table.removeChild(removeNode); -} - -// 创建一个CheckBox域 -function createCheckBox(methodParamModel) { - var name = methodParamModel.name; - var label = methodParamModel.label; - var checkBox = methodParamModel.paramTypeModel; - var rows = checkBox.rows; - var cb_content = rows.split(checkBox.valueSeperator); - - var divNode = document.createElement("div"); - var p = document.createElement("p"); - var div = document.createElement("div"); - var br = document.createElement("br"); - var labelNode = document.createTextNode(label); - var nameNode = document.createTextNode(name); - - // divNode.setAttribute("class","sample_frame"); - divNode.setAttribute("class", "CheckBox"); - divNode.setAttribute("id", name); - div.setAttribute("class", "sample_sub_frame"); - p.appendChild(labelNode); - div.appendChild(nameNode + ":"); - div.appendChild(br); - for (var i = 0; i < cb_content.length; i++) { - var checkBoxNode = document.createElement("input"); - checkBoxNode.setAttribute("type", "checkbox"); - checkBoxNode.setAttribute("name", "checkbox_" + name); - checkBoxNode.setAttribute("value", cb_content[i]); - var checkBoxValue = document.createTextNode(cb_content[i]); - - checkBoxNode.appendChild(checkBoxValue); - div.appendChild(checkBoxNode); - - } - - divNode.appendChild(p); - divNode.appendChild(div); - - return divNode; - -} -// 创建一个label加一个input的域 -function createField(label, name, size) { - if (size == null) { - size = 20; - } - var divNode = document.createElement("div"); - var p = document.createElement("p"); - var div = document.createElement("div"); - var input = document.createElement("input"); - var labelNode = document.createTextNode(label); - var nameNode = document.createTextNode(name); - - // divNode.setAttribute("class","sample_frame"); - divNode.setAttribute("class", "Field"); - divNode.setAttribute("id", name); - div.setAttribute("class", "sample_sub_frame"); - input.setAttribute("type", "text"); - input.setAttribute("size", size); - input.setAttribute("id", name + "_input"); - input.setAttribute("value", ""); - - p.appendChild(labelNode); - div.appendChild(nameNode + ":"); - div.appendChild(input); - divNode.appendChild(p); - divNode.appendChild(div); - - return divNode; - -} -// 创建一个可以增加field的域 -function createMultiField(label, name, size) { - if (size == null) { - size = 20; - } - var divNode = document.createElement("div"); - var p = document.createElement("p"); - var div = document.createElement("div"); - var addField = document.createElement("button"); - var removeField = document.createElement("button"); - var br = document.createElement("br"); - var table = document.createElement("table"); - var labelNode = document.createTextNode(name + ":" + label); - var addTextNode = document.createTextNode("Add Field"); - var removeTextNode = document.createTextNode("RemoveAll"); - - divNode.setAttribute("class", "MultiField"); - divNode.setAttribute("id", name); - div.setAttribute("class", "sample_sub_frame"); - addField.setAttribute("type", "submit"); - addField.setAttribute("onClick", "addField(" + size + ");"); - removeField.setAttribute("type", "submit"); - removeField.setAttribute("onClick", "removeField();"); - table.setAttribute("id", "addFieldTable"); - - p.appendChild(labelNode); - addField.appendChild(addTextNode); - removeField.appendChild(removeTextNode); - div.appendChild(addField); - div.appendChild(removeField); - div.appendChild(br); - div.appendChild(table); - divNode.appendChild(p); - divNode.appendChild(div); - - return divNode; -} - -function addField(size) { - - var field = 0; - var data = "field_" + field + ":"; - field = field + 1; - var newTrNode = document.createElement("tr"); - var newTdNode1 = document.createElement("td"); - var newTdNode2 = document.createElement("td"); - var newTdNode3 = document.createElement("td"); - var i = document.createElement("i"); - i.setAttribute("class", "icon-trash"); - i.setAttribute("style", "cursor:pointer"); - i.setAttribute("onClick", "deleteField(this)"); - newTdNode1.setAttribute("style", "width:40px;cursor:pointer;"); - newTdNode1.setAttribute("class", data); - newTdNode2.setAttribute("style", "width:40px;"); - var textNode = document.createTextNode(data); - var inputNode = document.createElement("input"); - inputNode.setAttribute("type", "text"); - inputNode.setAttribute("size", size); - - newTdNode1.appendChild(textNode); - newTdNode2.appendChild(inputNode); - newTdNode3.appendChild(i); - newTrNode.appendChild(newTdNode1); - newTrNode.appendChild(newTdNode2); - newTrNode.appendChild(newTdNode3); - document.getElementById("addFieldTable").appendChild(newTrNode); -} -function deleteField(selectedNode) { - var deletedNode = selectedNode.parentNode.parentNode; - var parentNode = deletedNode.parentNode; - parentNode.removeChild(deletedNode); -} -function removeField() { - $('#addFieldTable').empty(); -} - -$('#removeAllPlugin').click(function() { - document.getElementById('pluginArea').innerHTML = ""; -}); - -$('#pluginCancel').click(function() { - $('#myModal_Plugin').modal('hide'); -}); - -$('#behaviorFinish').click(function() { - $('#myModal_Behavior').modal('hide'); -}); - -$('#behaviorCancel').click(function() { - $('#myModal_Behavior').modal('hide'); -}); +} \ No newline at end of file diff --git a/src/main/webapp/script/pluginModel.js b/src/main/webapp/script/pluginModel.js index df0ef9d2..94df54b0 100644 --- a/src/main/webapp/script/pluginModel.js +++ b/src/main/webapp/script/pluginModel.js @@ -1,14 +1,17 @@ // 创建一个MethodParamModel对象 -function MethodParamModel(name, label, paramTypeModel) { +function MethodParamModel(name, lable, paramTypeModel) { this.name = name; - this.label = label; + this.lable = lable; this.paramTypeModel = paramTypeModel; } // 创建一个ParamTypeModel对象 -function ParamTypeModel(type, valueSeperator, fieldSeperator) { +function ParamTypeModel(type, valueSeperator, fieldSeperator, size, rows, cols) { this.type = type; this.valueSeperator = valueSeperator; this.fieldSeparator = fieldSeperator; + this.size = size; + this.rows = rows; + this.cols = cols; } // 创建一个Field对象 function Field(size, type, valueSeperator, fieldSeperator) {