write the function loadMethodParam and modify paramTypeModels

This commit is contained in:
zhengyingying 2014-03-19 17:41:49 +08:00
parent d94ef8fe48
commit 3ceeb7055b
8 changed files with 349 additions and 374 deletions

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -102,9 +102,7 @@ body {
<div class="box-content">
<div class="operatePlugins center">
<div class="span8" style="float: left;">
<div id="pluginArea">
</div>
<div id="pluginArea"></div>
</div>
<div class="pluginButton">
<p>
@ -146,7 +144,7 @@ body {
<div class="operatePlugins center">
<div class="span8 behavior" style="float: left;">
<div id="behaviorArea">
</div>
</div>
<div class="behaviorButton">
@ -169,6 +167,7 @@ body {
<div id="showPluginMethod">
<!-- 显示方法文档,开始动态生成 ,只显示一个-->
</div>
</div>
@ -215,9 +214,7 @@ body {
<div class="inset span4 center">
<div class="span2 behavior-box scroll"
style="height: 200px; width: 220px;">
<div id="pluginMethod">
</div>
<div id="pluginMethod"></div>
</div>
<div class="span2 behavior-box scroll"
style="height: 200px; width: 220px;">

View File

@ -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<String> 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<MethodParamModel>
// methodParamSet
var boxHeader = "<div class='box-header well ' data-original-title>"
+ "<i class='icon-pencil' style='float:left'></i>"
+ "<h2>sample:<i>"
+ plugin
+ "."
+ method
+ "</i></h2><div class='box-icon'><a class='btn btn-setting btn-round'>"
+ "<i class='icon-plus'></i></a><a class='btn btn-round'><i class='icon-list'></i></a>"
+ "<a class='btn btn-minimize btn-round'><i class='icon-chevron-up'></i></a></div></div>";
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 = "<div id='"
+ behaviorData
+ "' class='hide'><div class='span10 showPluginDetails box'>"
+ boxHeader
+ "<div class='box-content'>"
+ fieldHTML
+ "</div><button id='' type='submit' onClick='uploadBehavior(this);'></button></div></div>";
return html;
boxHeader = "<div class='box-header well ' data-original-title> "
+ "<i class='icon-pencil' style='float:left'></i>"
+ "<h2>sample:<i>"
+ behaviorData
+ "</i></h2><div class='box-icon'><a class='btn btn-setting btn-round'>"
+ "<i class='icon-plus'></i></a><a class='btn btn-round'><i class='icon-list'></i></a>"
+ "<a class='btn btn-minimize btn-round'><i class='icon-chevron-up'></i></a></div></div>";
documentHtml = "<div id='"
+ behaviorData
+ "' class=''><p class='hide'>"
+ behaviorData
+ "</p><div class='span10 showPluginDetails box'>"
+ boxHeader
+ "<div class='box-content'>"
+ fieldHTML
+ "</div><div><button id='' type='submit' onClick='uploadBehavior(this);'>submit</button></div></div></div>";
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 = "<div class='Table sample_frame'id="
+ name
+ "><p>"
+ label
+ "</p><div class='sample_sub_frame'>"
+ name
+ ":<br><button type='submit'onClick='addCol(this);'>addCol</button><button type='submit' onClick='removeCol(this);'>removeCol</button><br><table class='operateTableCols'>"
+ tableHead + "</table></div></div>";
/*
* // 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 = "<div class='Field sample_frame' id='" + name + "'><p>" + label
+ "</p><div class='sample_sub_frame'>" + name
+ ":<input type='text' size=" + size + " id='" + name
+ "_input' value=''></input></div></div>";
return fieldHTML;
}
// 创建一个可以增加field的域
function createMultiField(label, name, size) {
if (size == 0) {
size = 20;
}
var multiFieldHTML = "<div class='MultiField sample_frame' id='"
+ name
+ "'><p>"
+ name
+ ":"
+ label
+ "</p><div class='sample_sub_frame'><button type='submit' onClick='addField("
+ size
+ ");'>Add Field</button><button type='submit' onClick='removeField();'>RemoveAll</button><br><table id='addFieldTable'></table></div></div>";
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 = "<div class='Table'id="
+ name
+ "><p>"
+ label
+ "</p><div class='sample_sub_frame'>"
+ name
+ ":<br><button type='submit'onClick='addCol(this);'>addCol</button><button type='submit' onClick='removeCol(this);'>removeCol</button><br><table class='operateTableCols'>"
+ tableHead + "</table></div></div>";
/*
* // 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');
});
}

View File

@ -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) {