refactor plugin model

This commit is contained in:
fanfuxiaoran 2014-05-07 16:41:09 +08:00
parent 13665bfe89
commit cf93514f0d
9 changed files with 391 additions and 59 deletions

View File

@ -7,31 +7,10 @@ import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class BehaviorInfoModel {
private List<ParamInfoModel> paramInfoModels;
public class BehaviorInfoModel extends ParamsContainerModel {
private String behaviorType;
private String name;
@XmlElementWrapper
@XmlElement(name = "paramInfoModel", type = ParamInfoModel.class)
public List<ParamInfoModel> getParamInfoModels() {
return paramInfoModels;
}
public void setParamInfoModels(List<ParamInfoModel> paramInfoModels) {
this.paramInfoModels = paramInfoModels;
}
@XmlElement
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
private List<GroupModel> groupModels;
@XmlElement
public String getBehaviorType() {
@ -42,4 +21,14 @@ public class BehaviorInfoModel {
this.behaviorType = behaviorType;
}
@XmlElementWrapper(name = "groups")
@XmlElement(name = "group", type = GroupModel.class)
public List<GroupModel> getGroupModels() {
return groupModels;
}
public void setGroupModels(List<GroupModel> groupModels) {
this.groupModels = groupModels;
}
}

View File

@ -0,0 +1,22 @@
package org.bench4q.share.models.master.plugin;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class DateModel extends ParamTypeModel {
private int size;
@XmlElement
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
}

View File

@ -0,0 +1,8 @@
package org.bench4q.share.models.master.plugin;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class GroupModel extends ParamsContainerModel {
}

View File

@ -0,0 +1,36 @@
package org.bench4q.share.models.master.plugin;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class ParamsContainerModel {
private String name;
private List<ParamInfoModel> paramInfoModels;
@XmlElement
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@XmlElementWrapper
@XmlElement(name="paramInfoModel",type=ParamInfoModel.class)
public List<ParamInfoModel> getParamInfoModels() {
return paramInfoModels;
}
public void setParamInfoModels(
List<ParamInfoModel> paramInfoModels) {
this.paramInfoModels = paramInfoModels;
}
}

View File

@ -5,31 +5,18 @@ import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class PluginInfoModel {
public class PluginInfoModel extends ParamsContainerModel {
private List<GroupModel> groupModels;
private String name;
private List<ParamInfoModel> paramInfoModels;
@XmlElement
public String getName() {
return name;
@XmlElementWrapper(name = "groups")
@XmlElement(name = "group", type = GroupModel.class)
public List<GroupModel> getGroupModels() {
return groupModels;
}
public void setName(String name) {
this.name = name;
public void setGroupModels(List<GroupModel> groupModels) {
this.groupModels = groupModels;
}
@XmlElementWrapper
@XmlElement(name="paramInfoModel",type=ParamInfoModel.class)
public List<ParamInfoModel> getParamInfoModels() {
return paramInfoModels;
}
public void setParamInfoModels(
List<ParamInfoModel> paramInfoModels) {
this.paramInfoModels = paramInfoModels;
}
}

View File

@ -0,0 +1,32 @@
package org.bench4q.share.models.master.plugin;
import java.util.Set;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class SelectModel extends ParamTypeModel {
private Set<String> options;
private int size;
@XmlElementWrapper(name = "options")
@XmlElement(name = "option", type = String.class)
public Set<String> getOptions() {
return options;
}
public void setOptions(Set<String> options) {
this.options = options;
}
@XmlElement
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
}

View File

@ -0,0 +1,261 @@
label {
display: inline;
margin-right: 30px;
}
button {
margin-right: 5px;
width: 70px;
}
.editor {
background-color: #f5f5f5;
border-top-color: #dcdcdc;
width: 400px;
border: 1px solid #d5d5d5;
margin-left: 10px;
margin-top: 10px;
padding-left: 30px;
padding-right: 30px;
padding-top: 10px;
padding-bottom: 10px;
margin-bottom: 10px;
}
.editor div {
}
table tr td {
text-align: center;
width:10px;
}
.editor p {
font-weight: bold;
margin-bottom: 10px;
margin-top: 10px;
}
.editor button {
margin-top: 10px;
}
.inset {
width: 85%;
height: 80%;
align: center;
margin: 5px;
}
.scroll {
overflow-x: hidden;
overflow-y: auto;
}
.button-div {
margin-top: 50px;
padding-left: 20px;
}
.button-div div {
margin-top: 10px;
}
.behavior_box {
border: 1px inset;
width: 200px;
height: 300px;
margin-right: 0px;
margin-left: 0px;
}
.table-margin {
margin-top: 10px;
padding-top: 5px;
padding-left: 20px;
padding-bottom: 10px;
}
.sample_frame {
padding: 10px;
margin: 5px 5px 5px 5px;
border: #E8F2FE solid thin;
}
.sample_sub_frame {
border: #F0ECE0 solid thin;
margin-top: 5px;
margin-bottom: 5px;
margin-left: 10px;
margin-right: 10px;
}
.btn-width {
width: 85px;
}
.btn-large {
width: 25%;
}
.listArea {
height: 340px;
margin-bottom: 15px;
outline-style: outset;
outline-color: #A0D0EC;
/* color: black; */
}
.behavior-box {
height: 400px;
border: 1px solid #3689BB;
margin-left: 5px;
}
#myModal_Behavior {
width: 800px;
left: 40%;
}
.listArea,#insertPluginAreaPlugins,#pluginMethod p,a {
padding-top: 10px;
padding-left: 20px;
}
#pluginMethod {
padding-top: 10px;
padding-left: 20px;
}
a {
color: #4E9BCB;
/* border-bottom: 1px solid #F0ECE0; */
}
#submitBehaviors p {
margin-top: 10px;
margin-left: 10px;
}
.visited {
background-color: #E8F2FE;
}
.tab .nav li a:hover,.nav>li>a:focus {
text-decoration: none;
background-color: #E5E3E9;
}
.tab .nav-tabs {
border-bottom: 1px solid #F7F5FA;
margin-bottom: 15px;
}
.tab .nav {
list-style: none;
}
.tab {
background-color: #F7F5FA;
margin-bottom: 15px;
padding-bottom: 5px;
padding-top: -10px;
}
.tab ul {
/* zoom: 1; */
clear: both;
}
.tab ul:after {
display: block;
height: 0px;
visibility: hidden;
clear: both;
content: "";
}
.tab ul li {
margin-bottom: -10px;
text-align: center;
line-height: 100%;
width: 20%;
display: inline;
float: left;
height: 26px;
color: #fff;
text-align: center;
}
.tab ul li.on {
color: black;
}
.tabContent .span10 {
margin-left: -25px;
}
.help_step_box {
background: #f1f7e4;
height: 55px;
overflow: hidden;
border-top: 1px solid #FFF;
}
.help_step_item {
float: left;
height: 55px;
line-height: 55px;
padding: 0 25px 0 45px;
cursor: pointer;
position: relative;
font-size: 14px;
font-weight: bold;
}
.help_step_num {
width: 19px;
height: 19px;
line-height: 19px;
position: absolute;
text-align: center;
top: 18px;
left: 20px;
font-size: 16px;
font-weight: bold;
background: url(http://www.codefans.net/jscss/demoimg/201011/num.png);
color: #156600;
}
.help_step_set {
background: #27a806;
color: #FFF;
}
.help_step_set .help_step_left {
width: 8px;
height: 55px;
background: url(http://www.codefans.net/jscss/demoimg/201011/bak.jpg)
left top no-repeat;
position: absolute;
left: 0;
top: 0;
}
.help_step_set .help_step_right {
width: 8px;
height: 55px;
background: url(http://www.codefans.net/jscss/demoimg/201011/bak.jpg)
left bottom no-repeat;
position: absolute;
right: -8px;
top: 0;
}
.btn-page {
background-color: #50A8DC;
margin-top: 20px;
margin-bottom: 20px;
}

View File

@ -28,7 +28,7 @@ function createFieldLine(size, name) {
$(fieldName).html(name + ":");
var field = document.createElement("input");
$(field).attr("type", "text");
$(field).attr("size", size);
$(field).attr("width", size);
$(fieldDiv).append(fieldName.outerHTML + field.outerHTML);
return fieldDiv;
}
@ -66,7 +66,7 @@ function createFileEditor(label, name, size, id) {
$(fieldName).html(name + ":");
var file = document.createElement("input");
$(file).attr("type", "file");
$(file).attr("size", size);
$(file).attr("width", size);
$(fileEditor).append(fieldName.outerHTML + file.outerHTML);
$(div).append(fileEditor);
return div;
@ -103,7 +103,7 @@ function createTableEditor(label, name, cols, id) {
function getHeaders(col) {
var headers = new Array();
headers.push("name");
headers.push("name:");
var cols = col.split(";");
for ( var i = 0; i < cols.length; i++) {
headers.push(cols[i]);
@ -130,17 +130,17 @@ function createTableEditor(label, name, cols, id) {
var tr = document.createElement("tr");
for ( var i = 0; i < headers.length; i++) {
var th = document.createElement("th");
th.appendChild(document.createTextNode(headers[i]));
tr.appendChild(th);
$(th).append(document.createTextNode(headers[i]));
$(tr).append(th);
}
return tr;
}
function createTr(headers, name) {
var tr = document.createElement("tr");
var td = document.createElement("td");
$(td).html(name);
$(td).html(name+":");
$(tr).append(td);
for ( var i = 0; i < headers.length; i++) {
for ( var i = 1; i < headers.length; i++) {
var input = document.createElement("input");
$(input).attr("type", "text");
var td = document.createElement("td");
@ -153,15 +153,14 @@ function createTableEditor(label, name, cols, id) {
}
function createContainer(id, name) {
var div = document.createElement("div");
$(div).attr("id", id);
$(div).append(createMultiField("test", "name", 10, "test"));
$(div).append(createFileEditor("file", "file name", 10, "file"));
$(div).append(createField("field", "field name", 10, "field"));
$(div).append(createTableEditor("table","input","td1;td1;td3","id"));
$(div).append(createTableEditor("table", "input", "td1;td1;td3", "id"));
return div;
}

View File

@ -12,14 +12,12 @@
<link href="../../lib/chrisma/css/charisma-app.css" rel="stylesheet">
<link href="../../lib/chrisma/css/charisma-app.css" rel="stylesheet">
<link href="../../css/bench4q.css" rel="stylesheet">
<link href='../../css/plugin.css' rel='stylesheet'>
<link href='../../css/script-editor.css' rel='stylesheet'>
</head>
<body>
<div id="test"></div>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.0.min.js"></script>
<script src="js/createMultiField.js"></script>
<script src="js/createFile.js"></script>
<script src="../../script/device/EditorFactory.js"></script>
<script src="http://code.jquery.com/qunit/qunit-1.14.0.js"></script>
</body>
</html>