This commit is contained in:
hmm 2014-08-27 08:38:43 +08:00
commit 56a302cb4d
8 changed files with 62 additions and 30 deletions

View File

@ -7,7 +7,7 @@
</plugin>
<behavior name="Get">
<params>
<param name="url" label="The Url to request" required="true">
<param name="url" label="The Url to request!!!!!!" required="true">
<field size="7" />
</param>
<param name="queryParams" label="The query params of this request" required="false">
@ -31,11 +31,12 @@
<param name="queryParams" label="The query params of this request" required="false">
<nfield />
</param>
<param name="headers" label="The headers of this request">
<param name="headers" label="The headers of this request" required="false">
<table cols="header|value" />
</param>
<param name="respVarsToSaveInSession"
label="The regular expression of extracting variables from response">
label="The regular expression of extracting variables from response"
required="false">
<table cols="varName|varRegularExpression|leftBoundry|rightBoundry" />
</param>
</params>
@ -48,7 +49,7 @@
<param name="queryParams" label="The query params of this request" required="false">
<nfield />
</param>
<param name="headers" label="The headers of this request">
<param name="headers" label="The headers of this request" required="false">
<table cols="header|value" />
</param>
<param name="bodyContent" label="The body that will be post" required="false">
@ -58,7 +59,8 @@
<nfield />
</param>
<param name="respVarsToSaveInSession"
label="The regular expression of extracting variables from response">
label="The regular expression of extracting variables from response"
required="false">
<table cols="varName|varRegularExpression|leftBoundry|rightBoundry" />
</param>
</params>
@ -71,7 +73,7 @@
<param name="queryParams" label="The query params of this request" required="false">
<nfield />
</param>
<param name="headers" label="The headers of this request">
<param name="headers" label="The headers of this request" required="false">
<table cols="header|value" />
</param>
<param name="bodyContent" label="The body that will be put" required="false">
@ -81,7 +83,8 @@
<nfield />
</param>
<param name="respVarsToSaveInSession"
label="The regular expression of extracting variables from response">
label="The regular expression of extracting variables from response"
required="false">
<table cols="varName|varRegularExpression|leftBoundry|rightBoundry" />
</param>
</params>

View File

@ -19,6 +19,7 @@ public class ParamInfo {
private int id;
private String name;
private String lable;
private String required;
private ParamType paramType;
private ParamsContainer paramsContainer;
@ -51,6 +52,15 @@ public class ParamInfo {
this.lable = lable;
}
@Column(name = "required")
public String getRequired() {
return required;
}
public void setRequired(String required) {
this.required = required;
}
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
@JoinColumn(name = "typeId", nullable = false)
public ParamType getParamType() {

View File

@ -165,6 +165,8 @@ public class PluginEntityFactory {
ParamInfo paramInfo = new ParamInfo();
paramInfo.setLable(XmlParseHelper.getAttribute(paramElement, "label"));
paramInfo.setName(XmlParseHelper.getAttribute(paramElement, "name"));
paramInfo.setRequired(XmlParseHelper.getAttribute(paramElement,
"required"));
paramInfo.setParamType(ParamTypeFactory
.createParamTypeInfo(XmlParseHelper
.getSingleChild(paramElement)));

View File

@ -95,6 +95,11 @@
margin-bottom:5px
}
.testHeader .span-brief .value{
color:#317eac;
font-size:19px
}
.testHeader .span-brief h4{
font-size:23px
}

View File

@ -46,15 +46,15 @@ body {
<div class="row-fluid testHeader testHeader-top">
<div class="span4 span-brief">
<h6><fmt:message key="testPlanName" /></h6><br>
<div id="testplanName"></div>
<div class="value" id="testplanName"></div>
</div>
<div class="span4 span-brief">
<h6><fmt:message key="createdatetime" /></h6><br>
<div id="createTime"></div>
<div class="value" id="createTime"></div>
</div>
<div class="span4 span-brief">
<h6><fmt:message key="testExecuteTime" /></h6><br>
<div id="testTime"></div>
<div class="value" id="testTime"></div>
</div>
<%-- </div>
<div class="span4 span-brief">

View File

@ -22,9 +22,9 @@ ContainerFactory.prototype.createEditorContainer = function(header, id,
containerInfo[i].name == "";
}
if (containerInfo[i].children == null) {
console.log(containerInfo[i]);
this.appendEdtiors(container, containerInfo[i].label,
containerInfo[i].nameCN, containerInfo[i].name,
containerInfo[i].nameCN, containerInfo[i].required, containerInfo[i].name,
containerInfo[i].paramTypeModel,containerInfo[i].value == null ?"":containerInfo[i].value);
} else {
$(container).append(
@ -39,29 +39,30 @@ ContainerFactory.prototype.createEditorContainer = function(header, id,
};
ContainerFactory.prototype.appendEdtiors = function(container, label, name, id,
ContainerFactory.prototype.appendEdtiors = function(container, label, name, required, id,
editorInfo, value) {
var editorFactory = new EditorFactory();
if (editorInfo.type.toLowerCase() == "field") {
console.log("required:"+required);
$(container).append(
editorFactory.createField(label, name, editorInfo.size, id,value));
editorFactory.createField(label, name, required, editorInfo.size, id,value));
} else if (editorInfo.type.toLowerCase() == "nfield") {
$(container).append(
editorFactory
.createMultiField(label, name, editorInfo.size, id,value));
.createMultiField(label, name, required, editorInfo.size, id,value));
} else if (editorInfo.type.toLowerCase() == "table") {
$(container).append(
editorFactory.createTable(label, name, editorInfo.cols, id,value));
editorFactory.createTable(label, name, required, editorInfo.cols, id,value));
} else if (editorInfo.type.toLowerCase() == "file") {
$(container).append(
editorFactory.createFile(lable, name, editorInfo.size, id,value));
editorFactory.createFile(lable, name, required, editorInfo.size, id,value));
} else if (editorInfo.type.toLowerCase() == "date") {
$(container).append(
editorFactory.createDate(label, name, editorInfo.size, id,value));
editorFactory.createDate(label, name, required, editorInfo.size, id,value));
} else if (editorInfo.type.toLowerCase() == "select") {
$(container).append(
editorFactory.createSelect(label, name, editorInfo.size,

View File

@ -1,6 +1,5 @@
$(document).ready(function(){
$("#behaviorEditor").on("focusout",".editor input",function(){
console.log(this);
alert("This input field has lost its focus.");
})
});

View File

@ -50,14 +50,14 @@ EditorFactory.prototype.createChoice = function(value, defaultValue, name,
return div;
}
EditorFactory.prototype.createField = function(label, name, size, id, value) {
EditorFactory.prototype.createField = function(label, name, required, size, id, value) {
var div = this.createBaseEditor(label, id);
$(div).children(".editor").attr("editorType", "field");
$(div).children(".editor").append(this.createFieldLine(size, name, value));
$(div).children(".editor").append(this.createFieldLine(size, name, required, value));
return div;
}
EditorFactory.prototype.createMultiField = function(label, name, size, id,
EditorFactory.prototype.createMultiField = function(label, name, required, size, id,
value) {
var div = this.createBaseEditor(label, id);
$(div).children(".editor").attr("editorType", "multiField");
@ -65,7 +65,7 @@ EditorFactory.prototype.createMultiField = function(label, name, size, id,
var values = value.split(";");
for (var i = 0; i < values.length; i++) {
$(div).children(".editor").append(
this.createFieldLine(size, name, values[i]));
this.createFieldLine(size, name, required, values[i]));
}
}
@ -94,19 +94,22 @@ EditorFactory.prototype.createMultiField = function(label, name, size, id,
return div;
}
EditorFactory.prototype.createFieldLine = function(size, name, value) {
EditorFactory.prototype.createFieldLine = function(size, name, required, value) {
var fieldDiv = document.createElement("div");
$(fieldDiv).addClass("field");
var fieldName = document.createElement("label");
$(fieldName).html(name);
var field = document.createElement("input");
$(field).attr("type", "text");
if(required=="true"){
$(field).attr("required", "required");
}
// $(field).attr("maxlength", size);
$(field).attr("value", value);
$(fieldDiv).append(fieldName.outerHTML + field.outerHTML);
return fieldDiv;
}
EditorFactory.prototype.createFile = function(label, name, size, id, value) {
EditorFactory.prototype.createFile = function(label, name, required, size, id, value) {
if (size == null || size <= 0) {
size = 150;
}
@ -119,6 +122,9 @@ EditorFactory.prototype.createFile = function(label, name, size, id, value) {
$(fieldName).html(name);
var file = document.createElement("input");
$(file).attr("type", "file");
if(required == "true"){
$(field).attr("required", "required");
}
// $(field).attr("maxlength", size);
$(fileEditor).append(fieldName.outerHTML + file.outerHTML);
$(div).children(".editor").append(fileEditor);
@ -134,7 +140,7 @@ EditorFactory.prototype.createTable = /**
* @param value
* @returns
*/
function(label, name, cols, id, value) {
function(label, name, required, cols, id, value) {
var div = this.createBaseEditor(label, id);
$(div).children(".editor").attr("editorType", "table");
@ -152,7 +158,7 @@ function(label, name, cols, id, value) {
function(event) {
event.preventDefault();
$(this).parent().children("table").children("tbody").append(
createTr(event.data.headers, event.data.fieldName));
createTr(event.data.headers, event.data.fieldName, required));
});
var deleteButton = document.createElement("button");
$(deleteButton).html("remove");
@ -188,7 +194,7 @@ function(label, name, cols, id, value) {
var tbody = document.createElement("tbody");
$(thead).append(createHeader(headers));
for (var i = 0; i < values.length; i++) {//this minus one because there is a "|;" in the end of value string
$(tbody).append(createTr(headers, name, values[i]));
$(tbody).append(createTr(headers, name, required, values[i]));
}
$(table).append(thead);
@ -208,7 +214,7 @@ function(label, name, cols, id, value) {
}
return tr;
}
function createTr(headers, name, value) {
function createTr(headers, name, required, value) {
value == null? value="":value;
var values = value.split("|");
var tr = document.createElement("tr");
@ -220,6 +226,9 @@ function(label, name, cols, id, value) {
var input = document.createElement("input");
$(input).attr("type", "text");
$(input).attr("style","width:"+"90%");
if(required == "true"){
$(field).attr("required", "required");
}
if(values[i] != undefined){
$(input).val(values[i].split("=")[1]);
}
@ -259,7 +268,7 @@ EditorFactory.prototype.createSelect = function(label, name, size, options, id,
$(div).children(".editor").append(select);
return div;
}
EditorFactory.prototype.createDate = function(label, name, size, id, value) {
EditorFactory.prototype.createDate = function(label, name, required, size, id, value) {
if (size == null || size < 0) {
size = 150
@ -270,6 +279,9 @@ EditorFactory.prototype.createDate = function(label, name, size, id, value) {
$(dateLabel).html(name);
var date = document.createElement("input");
$(date).attr("type", "date");
if(required == "true"){
$(field).attr("required", "required");
}
$(div).children(".editor").append(dateLabel);
$(div).children(".editor").append(date);
return div;