add BehaviorViewModel in web

This commit is contained in:
hmm 2014-08-19 10:40:40 +08:00
parent 7eefaae62d
commit 8f583321c1
5 changed files with 15 additions and 10 deletions

View File

@ -132,6 +132,7 @@ plugin_jsp_scriptName=Script Name:
plugin_jsp_insertBefore=Insert Before plugin_jsp_insertBefore=Insert Before
plugin_jsp_insertAfter=Insert After plugin_jsp_insertAfter=Insert After
plugin_jsp_clear=Clear plugin_jsp_clear=Clear
plugin_jsp_insertChild=Insert Child
script_jsp_makeScript=ScriptEdit script_jsp_makeScript=ScriptEdit
script_jsp_recordScript=RecordScript script_jsp_recordScript=RecordScript
script_jsp_refresh=RefreshPage script_jsp_refresh=RefreshPage

View File

@ -132,6 +132,7 @@ plugin_jsp_addScriptName=\u8BF7\u8F93\u5165\u811A\u672C\u540D
plugin_jsp_scriptName=\u811A\u672C\u540D\uFF1A plugin_jsp_scriptName=\u811A\u672C\u540D\uFF1A
plugin_jsp_insertBefore=\u524D\u5BFC\u5165 plugin_jsp_insertBefore=\u524D\u5BFC\u5165
plugin_jsp_insertAfter=\u540E\u5BFC\u5165 plugin_jsp_insertAfter=\u540E\u5BFC\u5165
plugin_jsp_insertChild=\u5B50\u8282\u70B9
plugin_jsp_clear=\u6E05\u7A7A plugin_jsp_clear=\u6E05\u7A7A
script_jsp_makeScript=\u811A\u672C\u7F16\u8F91 script_jsp_makeScript=\u811A\u672C\u7F16\u8F91
script_jsp_recordScript=\u5F55\u5236\u811A\u672C script_jsp_recordScript=\u5F55\u5236\u811A\u672C

View File

@ -108,7 +108,7 @@ body {
</div> </div>
<div class="span3 buttonsControl"> <div class="span3 buttonsControl">
<div> <div id="insertChildDiv" class="hide">
<button type="submit" class="btn btn-primary btn-width" <button type="submit" class="btn btn-primary btn-width"
id="insertChildNode"> id="insertChildNode">
<fmt:message key="plugin_jsp_insertChild" /> <fmt:message key="plugin_jsp_insertChild" />

View File

@ -68,6 +68,9 @@ button {
view{ view{
margin-top:5px; margin-top:5px;
} }
.hide{
display:none;
}
#submitScript{ #submitScript{
margin-left: 0px; margin-left: 0px;

View File

@ -1,7 +1,7 @@
/** /**
* *
*/ */
function BehaviorModel(pluginModel, method, id){ function BehaviorViewModel(pluginModel, method, id){
this.pluginModel = pluginModel; this.pluginModel = pluginModel;
this.method = method; this.method = method;
this.id = id; this.id = id;
@ -68,7 +68,7 @@ function Behavior(usePlugin) {
if (pluginId == undefined || method == undefined) { if (pluginId == undefined || method == undefined) {
return; return;
} }
var behaviorModel = new BehaviorModel(behavior.usePlugin.map.get(pluginId),method,behavior.index); var behaviorModel = new BehaviorViewModel(behavior.usePlugin.map.get(pluginId),method,behavior.index);
if ($("#addBehavior").hasClass("clicked")) { if ($("#addBehavior").hasClass("clicked")) {
var pos = "last"; var pos = "last";
@ -77,18 +77,18 @@ function Behavior(usePlugin) {
$("#addBehavior").removeClass("clicked"); $("#addBehavior").removeClass("clicked");
} else if ($("#insertBehaviorBefore").hasClass("clicked")) { } else if ($("#insertBehaviorBefore").hasClass("clicked")) {
var pos = "before"; var pos = "before";
behavior.insertBehavior(behaviorName);//前插入和后插入一样?? behavior.insertBehavior(behaviorModel);//前插入和后插入一样??
jstreeCreateNode("useBehaviorList", behaviorModel.behaviorName,behaviorModel.id,pos); jstreeCreateNode("useBehaviorList", behaviorModel.behaviorName,behaviorModel.id,pos);
$("#insertBehaviorBefore").removeClass("clicked"); $("#insertBehaviorBefore").removeClass("clicked");
} else { } else {
var pos = "after"; var pos = "after";
behavior.insertBehavior(behaviorName);//前插入和后插入一样?? behavior.insertBehavior(behaviorModel);//前插入和后插入一样??
jstreeCreateNode("useBehaviorList", behaviorModel.behaviorName,behaviorModel.id,pos); jstreeCreateNode("useBehaviorList", behaviorModel.behaviorName,behaviorModel.id,pos);
$("#insertBehaviorAfter").removeClass("clicked"); $("#insertBehaviorAfter").removeClass("clicked");
} }
behavior.updateBehaviorEditors(); behavior.updateBehaviorEditors();
behavior.createBehaviorEditor(behaviorName); behavior.createBehaviorEditor(behaviorModel);
$("#selectBehavior").modal('hide'); $("#selectBehavior").modal('hide');
$("#usePlugins").html(""); $("#usePlugins").html("");
$("#pluginMethod").html(""); $("#pluginMethod").html("");
@ -150,10 +150,10 @@ function Behavior(usePlugin) {
$("#behaviorEditor").html(""); $("#behaviorEditor").html("");
} }
this.createBehaviorEditor = function(behaviorName) { this.createBehaviorEditor = function(behaviorModel) {
var pluginName = this.getPluginName(behaviorName); var pluginName = behaviorModel.pluginModel.name;//this.getPluginName(behaviorName);
var methodName = this.getBehaviorMethod(behaviorName); var methodName = behaviorModel.method;//this.getBehaviorMethod(behaviorName);
var containerFactory = new ContainerFactory(); var containerFactory = new ContainerFactory();
$ $
.post("getPluginMethod" + "/" + pluginName + "/" + methodName, .post("getPluginMethod" + "/" + pluginName + "/" + methodName,
@ -165,7 +165,7 @@ function Behavior(usePlugin) {
"generator", methodData); "generator", methodData);
$(generator).addClass("generator"); $(generator).addClass("generator");
behavior.behaviorEditorMap.put(behaviorName, behavior.behaviorEditorMap.put(behaviorModel.id,
generator); generator);
} else { } else {