in optaplanner-docs/src/modules/ROOT/images/website/jstree/jstree.js [3115:3181]
activate_node : function (obj, e) {
if(this.is_disabled(obj)) {
return false;
}
if(!e || typeof e !== 'object') {
e = {};
}
// ensure last_clicked is still in the DOM, make it fresh (maybe it was moved?) and make sure it is still selected, if not - make last_clicked the last selected node
this._data.core.last_clicked = this._data.core.last_clicked && this._data.core.last_clicked.id !== undefined ? this.get_node(this._data.core.last_clicked.id) : null;
if(this._data.core.last_clicked && !this._data.core.last_clicked.state.selected) { this._data.core.last_clicked = null; }
if(!this._data.core.last_clicked && this._data.core.selected.length) { this._data.core.last_clicked = this.get_node(this._data.core.selected[this._data.core.selected.length - 1]); }
if(!this.settings.core.multiple || (!e.metaKey && !e.ctrlKey && !e.shiftKey) || (e.shiftKey && (!this._data.core.last_clicked || !this.get_parent(obj) || this.get_parent(obj) !== this._data.core.last_clicked.parent ) )) {
if(!this.settings.core.multiple && (e.metaKey || e.ctrlKey || e.shiftKey) && this.is_selected(obj)) {
this.deselect_node(obj, false, e);
}
else {
this.deselect_all(true);
this.select_node(obj, false, false, e);
this._data.core.last_clicked = this.get_node(obj);
}
}
else {
if(e.shiftKey) {
var o = this.get_node(obj).id,
l = this._data.core.last_clicked.id,
p = this.get_node(this._data.core.last_clicked.parent).children,
c = false,
i, j;
for(i = 0, j = p.length; i < j; i += 1) {
// separate IFs work whem o and l are the same
if(p[i] === o) {
c = !c;
}
if(p[i] === l) {
c = !c;
}
if(!this.is_disabled(p[i]) && (c || p[i] === o || p[i] === l)) {
if (!this.is_hidden(p[i])) {
this.select_node(p[i], true, false, e);
}
}
else {
this.deselect_node(p[i], true, e);
}
}
this.trigger('changed', { 'action' : 'select_node', 'node' : this.get_node(obj), 'selected' : this._data.core.selected, 'event' : e });
}
else {
if(!this.is_selected(obj)) {
this.select_node(obj, false, false, e);
}
else {
this.deselect_node(obj, false, e);
}
}
}
/**
* triggered when an node is clicked or intercated with by the user
* @event
* @name activate_node.jstree
* @param {Object} node
* @param {Object} event the ooriginal event (if any) which triggered the call (may be an empty object)
*/
this.trigger('activate_node', { 'node' : this.get_node(obj), 'event' : e });
},