in optaplanner-docs/src/modules/ROOT/images/website/jstree/jstree.js [2637:2728]
open_node : function (obj, callback, animation) {
var t1, t2, d, t;
if($.isArray(obj)) {
obj = obj.slice();
for(t1 = 0, t2 = obj.length; t1 < t2; t1++) {
this.open_node(obj[t1], callback, animation);
}
return true;
}
obj = this.get_node(obj);
if(!obj || obj.id === $.jstree.root) {
return false;
}
animation = animation === undefined ? this.settings.core.animation : animation;
if(!this.is_closed(obj)) {
if(callback) {
callback.call(this, obj, false);
}
return false;
}
if(!this.is_loaded(obj)) {
if(this.is_loading(obj)) {
return setTimeout($.proxy(function () {
this.open_node(obj, callback, animation);
}, this), 500);
}
this.load_node(obj, function (o, ok) {
return ok ? this.open_node(o, callback, animation) : (callback ? callback.call(this, o, false) : false);
});
}
else {
d = this.get_node(obj, true);
t = this;
if(d.length) {
if(animation && d.children(".jstree-children").length) {
d.children(".jstree-children").stop(true, true);
}
if(obj.children.length && !this._firstChild(d.children('.jstree-children')[0])) {
this.draw_children(obj);
//d = this.get_node(obj, true);
}
if(!animation) {
this.trigger('before_open', { "node" : obj });
d[0].className = d[0].className.replace('jstree-closed', 'jstree-open');
d[0].setAttribute("aria-expanded", true);
}
else {
this.trigger('before_open', { "node" : obj });
d
.children(".jstree-children").css("display","none").end()
.removeClass("jstree-closed").addClass("jstree-open").attr("aria-expanded", true)
.children(".jstree-children").stop(true, true)
.slideDown(animation, function () {
this.style.display = "";
if (t.element) {
t.trigger("after_open", { "node" : obj });
}
});
}
}
obj.state.opened = true;
if(callback) {
callback.call(this, obj, true);
}
if(!d.length) {
/**
* triggered when a node is about to be opened (if the node is supposed to be in the DOM, it will be, but it won't be visible yet)
* @event
* @name before_open.jstree
* @param {Object} node the opened node
*/
this.trigger('before_open', { "node" : obj });
}
/**
* triggered when a node is opened (if there is an animation it will not be completed yet)
* @event
* @name open_node.jstree
* @param {Object} node the opened node
*/
this.trigger('open_node', { "node" : obj });
if(!animation || !d.length) {
/**
* triggered when a node is opened and the animation is complete
* @event
* @name after_open.jstree
* @param {Object} node the opened node
*/
this.trigger("after_open", { "node" : obj });
}
return true;
}
},