Conflicts:
	Bench4Q-Web/src/main/webapp/script/editor/jstreeFactory.js
This commit is contained in:
hmm 2014-08-20 10:37:01 +08:00
commit 253245445c
6 changed files with 17 additions and 4154 deletions

View File

@ -18,7 +18,6 @@
<link href="lib/jquery/css/jquery-ui-1.10.4.css" rel="stylesheet">
<link href='css/scriptEditor.css' rel='stylesheet'>
<link rel="shortcut icon" href="images/bench4q.png">
<link rel="stylesheet" href="lib/bootstrap/bootstrap.css" />
<link rel="stylesheet" href="css/style.min.css" />
<style type="text/css">
body {
@ -228,7 +227,7 @@ body {
<script src="lib/chrisma/js/theme.js"></script>
<!-- <script src="script/base.js"></script> -->
<script src="lib/HashMap/HashMap.js"></script>
<!-- <script src="lib/other/jstree.js"></script> -->
<script src="lib/other/jstree.min.js"></script>
<script src="script/editor/pluginEditor/editorFactory.js"></script>
<script src="script/editor/pluginEditor/dataFormat.js"></script>
<script src="script/editor/pluginEditor/containerFactory.js"></script>
@ -239,11 +238,7 @@ body {
<script src="script/editor/usePlugin.js"></script>
<script src="script/editor/submitScript.js"></script>
<script src="script/editor/createScript.js"></script>
<script src="script/ScriptEditor/pluginModel.js"></script>
<!-- <script src="script/editor/jquery.js"></script>-->
<script src="lib/other/jstree.min.js"></script>
<script src="script/ScriptEditor/pluginModel.js"></script>
</fmt:bundle>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -34,7 +34,7 @@ function Behavior(usePlugin) {
this.index = 1;
var behavior = this;
// init tree node container
this.treeContainer = jstreeCreate(this.containerId);
jstreeCreate(this.containerId);
$("#addBehavior").click(function() {
// selected node's type
@ -258,18 +258,18 @@ function Behavior(usePlugin) {
$("#useBehaviorList").html("");
behavior.behaviorList = [];
})
$("#useBehaviorList").on(
"click",
"input[name='useBehavior']",
function() {
var behaviorName = $(
"#useBehaviorList input[name='useBehavior']:checked")
.val();
behavior.updateBehaviorEditors();
$("#behaviorEditor").append(
behavior.behaviorEditorMap.get(behaviorName));
$("#behaviorEditor").attr("behavior", behaviorName);
});
// $("#useBehaviorList").on(
// "click",
// "input[name='useBehavior']",
// function() {
// var behaviorName = $(
// "#useBehaviorList input[name='useBehavior']:checked")
// .val();
// behavior.updateBehaviorEditors();
// $("#behaviorEditor").append(
// behavior.behaviorEditorMap.get(behaviorName));
// $("#behaviorEditor").attr("behavior", behaviorName);
// });
this.updateBehaviorEditors = function() {
if ($("#behaviorEditor").attr("behavior") == undefined
|| $("#behaviorEditor").attr("behavior") == "") {
@ -357,8 +357,8 @@ function Behavior(usePlugin) {
}
//function about tree
this.getSelectedNodes = function() {
// var treeObj = $("#" + behavior.containerId).jstree(true);
return behavior.treeContainer.get_selected(true);
var treeObj = $("#" + behavior.containerId).jstree(true);
return treeObj.get_selected(true);
}
//end function about tree
this.showPluginList = function() {

File diff suppressed because it is too large Load Diff

View File

@ -1,76 +0,0 @@
/**
* @param containerId the id of jstree container
* @param data something
* @param name the name of new node
* @param id the id of new node
* @param pos the position of new node to the parent node,maybe "last" which means the childnode of the selected
* node,"after" or "before" means the sibling node of the selected node
*/
function jstreeCreateNode(containerId,data,name,id,pos){
var ref = $("#"+containerId).jstree(true);
var parentNode = ref.get_selected();
var childNode = null;
if(!parentNode.length){
parentNode=null;
}
else{
parentNode = parentNode[0];
}
childNode = ref.create_node(parentNode,{text:name,id:id,data:data,type:"default"},pos);
if(childNode) {
ref.open_node(parentNode);
}
}
/**
* @param containerId the id of jstree container
*/
function jstreeDeleteNode(containerId){
var ref = $("#"+containerId).jstree(true);
var parentNode = ref.get_selected();
if(!parentNode.length){return false;}
ref.delete_node(parentNode);
return ref.element.context.id;
}
/**
* @param containerId the id of jstree container
function jstreeRenameNode(containerId){
var ref = $("#"+containerId).jstree(true);
var sel = ref.get_selected();
if(!sel.length){return false;}
sel = sel[0];
ref.edit(sel);
} */
/**
* @param containerId the id of jstree container
*/
function jstreeCreate(containerId){
$("#"+containerId).jstree({
"core" : {
"animation" : 0,
"check_callback" : true,
"themes" : { "stripes" : true }
},
"types" : {
"default" : {"icon" : "/images/tree_icon.png"}
},
"contextmenu" : {
"items" : function(node) {
var tmp = $.jstree.defaults.contextmenu.items();
delete tmp.create;
delete tmp.ccp;
return tmp;
}
},
"plugins" : [ "contextmenu","dnd","types","wholerow" ]
}).on('select_node.jstree',function(e,data){
if(data.selected.length>1){
var ref = $("#"+containerId).jstree(true);
ref.deselect_all();
ref.select_node(data.node);
}
})
}