modify the function loadMethodParams in plugin-new.js and

MethodParamModel in pluginModel.js
This commit is contained in:
zhengyingying 2014-03-21 13:42:01 +08:00
parent 78647af647
commit 4406579532
3 changed files with 21 additions and 11 deletions

View File

@ -142,6 +142,12 @@ public class PluginActionController {
.getCommunicateWithMaster().getResponseModel(accessToken, url, .getCommunicateWithMaster().getResponseModel(accessToken, url,
PluginResponseModel.class, params, caller); PluginResponseModel.class, params, caller);
try {
Logger.getLogger(PluginActionController.class).info(MarshalHelper.marshal(PluginResponseModel.class, pluginResponseModel));
} catch (JAXBException e) {
e.printStackTrace();
}
if (pluginResponseModel.isSuccess()) { if (pluginResponseModel.isSuccess()) {
System.out.println("pluginResponseModel has been used"); System.out.println("pluginResponseModel has been used");
Set<MethodParamModel> methodParamSet = pluginResponseModel Set<MethodParamModel> methodParamSet = pluginResponseModel

View File

@ -212,7 +212,6 @@ function loadMethodParams(behaviorData, behaviorIndex) {
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
methodParams.push(data[i]); methodParams.push(data[i]);
} }
for (var j = 0; j < methodParams.length; j++) { for (var j = 0; j < methodParams.length; j++) {
var methodParamModel = new MethodParamModel( var methodParamModel = new MethodParamModel(
methodParams[j].name, methodParams[j].name,
@ -220,12 +219,16 @@ function loadMethodParams(behaviorData, behaviorIndex) {
methodParams[j].valueSeperator, methodParams[j].valueSeperator,
methodParams[j].fieldSeperator, methodParams[j].fieldSeperator,
methodParams[j].paramType, methodParams[j].paramType,
methodParams[j].methodParamPropertyModelSet); methodParams[j].methodParamProperties);
var methodParamPropertyModelSet = methodParamModel.methodParamPropertyModelSet; var methodParamProperties=new Array();
for(var q=0;q<methodParamModel.methodParamProperties.length;q++){
var methodParamPropertyModel=new MethodParamPropertyModel(methodParamModel.methodParamProperties[q].key,methodParamModel.methodParamProperties[q].value);
methodParamProperties.push(methodParamPropertyModel);
}
var type = methodParamModel.paramType; var type = methodParamModel.paramType;
var size = 0, cols = "", rows = ""; var size = 0, cols = "", rows = "";
for (var p = 0; p < methodParamPropertyModelSet.length; p++) { for (var p = 0; p < methodParamProperties.length; p++) {
var methodParamProertyModel = methodParamPropertyModelSet[p]; var methodParamProertyModel = methodParamProperties[p];
if (methodParamProertyModel.key == "size") { if (methodParamProertyModel.key == "size") {
size = methodParamProertyModel.value; size = methodParamProertyModel.value;
} else if (methodParamProertyModel.key == "cols") { } else if (methodParamProertyModel.key == "cols") {
@ -433,7 +436,7 @@ function createTable(methodParamModel, cols, behaviorIndex) {
td.appendChild(text); td.appendChild(text);
th.appendChild(td); th.appendChild(td);
td.appendChild(text_content); td_content.appendChild(text_content);
tr_content.appendChild(td_content); tr_content.appendChild(td_content);
} }
@ -447,7 +450,7 @@ function createTable(methodParamModel, cols, behaviorIndex) {
+ "</p><div class='sample_sub_frame'>" + "</p><div class='sample_sub_frame'>"
+ name + name
+ ":<br><button type='submit'onClick='addCol(this);'>addCol</button><button type='submit' " + ":<br><button type='submit'onClick='addCol(this);'>addCol</button><button type='submit' "
+ "onClick='removeCol(this);'>removeCol</button><br><table class='operateTableCols'>" + "onClick='removeCol(this);'>removeCol</button><br><table class='"+behaviorIndex+"_operateTableCols'>"
+ tableHead + "</table></div></div>"; + tableHead + "</table></div></div>";
/* /*
* // divNode.setAttribute("class","sample_frame"); * // divNode.setAttribute("class","sample_frame");
@ -465,7 +468,7 @@ function createTable(methodParamModel, cols, behaviorIndex) {
* div.appendChild(tableNode); divNode.appendChild(p); * div.appendChild(tableNode); divNode.appendChild(p);
* divNode.appendChild(div); * divNode.appendChild(div);
* *
* return divNode; * return $(divNode).html();
*/ */
return tableHtml; return tableHtml;

View File

@ -1,11 +1,12 @@
var ParamTypeEnum=['Field', 'MultiField', 'CheckBox', 'Table'];
// 创建一个MethodParamModel对象 // 创建一个MethodParamModel对象
function MethodParamModel(name, lable, valueSeperator,fieldSeperator,paramType, methodParamPropertyModelSet) { function MethodParamModel(name, lable, valueSeperator,fieldSeperator,paramType, methodParamProperties) {
this.name = name; this.name = name;
this.lable = lable; this.lable = lable;
this.valueSeperator=valueSeperator; this.valueSeperator=valueSeperator;
this.fieldSeperator=fieldSeperator; this.fieldSeperator=fieldSeperator;
this.paramType=paramType; this.paramType=paramType;
this.methodParamPropertyModelSet=methodParamPropertyModelSet; this.methodParamProperties=methodParamProperties;
} }
//创建一个MethodParamPropertyModel对象 //创建一个MethodParamPropertyModel对象
function MethodParamPropertyModel(key,value){ function MethodParamPropertyModel(key,value){