modify the count in plugin-new.js
This commit is contained in:
parent
fb91341d18
commit
d81a453296
|
@ -3,7 +3,7 @@ var PluginMethodListModel = function(pluginName, methodList) {
|
|||
this.methodList = methodList;
|
||||
};
|
||||
var pluginChoosedList = new Array();
|
||||
var pluignIndex=new Array();
|
||||
var pluginIndex=new HashMap();
|
||||
var pluginList = new Array();
|
||||
// var pluginMethodList = new Array();
|
||||
var index = 0;
|
||||
|
@ -22,6 +22,7 @@ function loadPluginList() {
|
|||
data = data.data;// List<String> pluginList
|
||||
for (var i = 0; i < data.length; i++) {
|
||||
pluginList.push(data[i]);
|
||||
pluginIndex.put(data[i], 0);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -45,6 +46,7 @@ function getMethod(pluglin) {
|
|||
}
|
||||
|
||||
function addPlugin() {
|
||||
alert("pluginIndex.length="+pluginIndex.length());
|
||||
var html = "";
|
||||
for (var j = 0; j < pluginList.length; j++) {
|
||||
|
||||
|
@ -81,12 +83,16 @@ function createLineWithRadio(lineText, nameAttr) {
|
|||
function pluginFinish() {
|
||||
$('#myModal_Plugin').modal('hide');
|
||||
var pluginName;
|
||||
// var pluginIndexNum=pluginIndex.get(item);
|
||||
// alert("pluginIndexNum="+pluginIndexNum);
|
||||
var item = $("input[type='radio']:checked").val();
|
||||
pluginName = item + "_" + num;
|
||||
|
||||
var aPluginIndex=pluginIndex.get(item);
|
||||
pluginIndex.put(item, aPluginIndex+1);
|
||||
pluginName=item+"_"+aPluginIndex;
|
||||
|
||||
//pluginName = item + "_" + num;
|
||||
pluginChoosedList.push(pluginName);
|
||||
num++;
|
||||
|
||||
//num++;
|
||||
document.getElementById("pluginArea").innerHTML += createLine(pluginName);
|
||||
|
||||
}
|
||||
|
|
|
@ -29,7 +29,72 @@ function ParameterModel(key,value){
|
|||
this.value=value;
|
||||
}
|
||||
|
||||
function pluignChoosedModel(plugin,index){
|
||||
this.plugin=plugin;
|
||||
function pluignChoosedModel(pluginName,index){
|
||||
this.pluginName=pluginName;
|
||||
this.index=index;
|
||||
}
|
||||
|
||||
function HashMap() {
|
||||
this.arrKey = new Array();
|
||||
this.arrValue = new Array();
|
||||
|
||||
// 检查Key是否存在
|
||||
this.exists = function(strKey) {
|
||||
strKey = strKey.toUpperCase();
|
||||
for (var i = 0; i < this.arrKey.length; i++) {
|
||||
if (this.arrKey[i] == strKey) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
this.length = function() {
|
||||
return this.arrKey.length;
|
||||
};
|
||||
|
||||
// 设置Key和Value
|
||||
this.put = function(strKey, objValue) {
|
||||
strKey = strKey.toUpperCase();
|
||||
for (var i = 0; i < this.arrKey.length; i++) {
|
||||
if (this.arrKey[i] == strKey) {
|
||||
this.arrValue[i] = objValue;
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.arrKey[this.arrKey.length] = strKey;
|
||||
this.arrValue[this.arrValue.length] = objValue;
|
||||
};
|
||||
|
||||
// 获取指定Key的Value,如果Key不存在,返回null
|
||||
this.get = function(strKey) {
|
||||
strKey = strKey.toUpperCase();
|
||||
for (var i = 0; i < this.arrKey.length; i++) {
|
||||
if (this.arrKey[i] == strKey) {
|
||||
return this.arrValue[i];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
// 删除一个Key
|
||||
this.remove = function(strKey) {
|
||||
strKey = strKey.toUpperCase();
|
||||
for (var i = 0; i < this.arrKey.length; i++) {
|
||||
if (this.arrKey[i] == strKey) {
|
||||
this.arrKey.splice(i, 1);
|
||||
this.arrValue.splice(i, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 获取所有的Key数组
|
||||
this.getKeys = function() {
|
||||
return this.arrKey;
|
||||
};
|
||||
|
||||
// 获取所有的Value数组
|
||||
this.getValues = function() {
|
||||
return this.arrValue;
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue