All Downloads are FREE. Search and download functionalities are using the official Maven repository.

root.libs.composum.nodes.commons.components.js.tree.min.js Maven / Gradle / Ivy

There is a newer version: 4.3.4
Show newest version
(function(){CPM.namespace("core.components");(function(n,g){n.treeTypes={"default":{icon:"fa fa-cube text-muted"},summary:{icon:"fa fa-hand-o-right text-info"},root:{icon:"fa fa-sitemap text-muted"},system:{icon:"fa fa-cogs text-muted"},activities:{icon:"fa fa-signal text-muted"},nodetypes:{icon:"fa fa-tags text-muted"},nodetype:{icon:"fa fa-tag text-muted"},versionstorage:{icon:"fa fa-history text-muted"},folder:{icon:"fa fa-folder-o"},"resource-folder":{icon:"fa fa-folder-o"},orderedfolder:{icon:"fa fa-folder text-muted"},
registry:{icon:"fa fa-database text-muted"},"package":{icon:"fa fa-file-archive-o"},"resource-package":{icon:"fa fa-file-archive-o"},tenant:{icon:"fa fa-university text-info"},component:{icon:"fa fa-puzzle-piece text-info"},container:{icon:"fa fa-cubes text-info"},element:{icon:"fa fa-cube text-info"},site:{icon:"fa fa-sitemap text-info"},siteconfiguration:{icon:"fa fa-ellipsis-h text-muted"},page:{icon:"fa fa-globe text-info"},pagecontent:{icon:"fa fa-ellipsis-h text-muted"},"page-designer":{icon:"fa fa-cube text-info"},
"resource-designer":{icon:"fa fa-file-code-o text-muted"},"resource-redirect":{icon:"fa fa-share text-info"},"resource-parsys":{icon:"fa fa-ellipsis-v text-muted"},"resource-console":{icon:"fa fa-laptop text-muted"},"resource-pckgmgr":{icon:"fa fa-laptop text-muted"},"resource-path":{icon:"fa fa-bookmark-o text-muted"},"resource-resources":{icon:"fa fa-filter text-muted"},"resource-strings":{icon:"fa fa-filter text-muted"},"resource-felix":{icon:"fa fa-cog text-muted"},"resource-guide":{icon:"fa fa-book text-muted"},
"resource-servlet":{icon:"fa fa-cog text-muted"},acl:{icon:"fa fa-key text-muted"},authorizablefolder:{icon:"fa fa-diamond text-muted"},group:{icon:"fa fa-group text-muted"},service:{icon:"fa fa-cog text-info"},user:{icon:"fa fa-user"},linkedfile:{icon:"fa fa-link text-muted"},file:{icon:"fa fa-file-o"},resource:{icon:"fa fa-file-o"},"resource-file":{icon:"fa fa-file-o text-muted"},"file-image":{icon:"fa fa-file-image-o text-info"},"resource-image":{icon:"fa fa-file-image-o text-muted"},"file-video":{icon:"fa fa-file-video-o text-info"},
"resource-video":{icon:"fa fa-file-video-o text-muted"},"file-text":{icon:"fa fa-file-text-o text-info"},"resource-text":{icon:"fa fa-file-text-o text-muted"},"file-text-plain":{icon:"fa fa-file-text-o text-info"},"file-text-x-log":{icon:"fa fa-file-text-o text-info"},"resource-text-plain":{icon:"fa fa-file-code-o text-muted"},"file-text-html":{icon:"fa fa-globe text-info"},"resource-text-html":{icon:"fa fa-file-code-o text-muted"},"file-text-css":{icon:"fa fa-file-code-o text-info"},"resource-text-css":{icon:"fa fa-file-code-o text-muted"},
"file-javascript":{icon:"fa fa-file-code-o text-info"},"resource-javascript":{icon:"fa fa-file-code-o text-muted"},"file-text-javascript":{icon:"fa fa-file-code-o text-info"},"resource-text-javascript":{icon:"fa fa-file-code-o text-muted"},"file-text-x-java-properties":{icon:"fa fa-file-code-o text-info"},"file-text-x-java-source":{icon:"fa fa-file-code-o text-info"},"resource-text-x-java-source":{icon:"fa fa-file-code-o text-muted"},"file-octet-stream":{icon:"fa fa-file-code-o text-info"},"resource-octet-stream":{icon:"fa fa-file-code-o text-muted"},
"file-pdf":{icon:"fa fa-file-pdf-o text-info"},"resource-pdf":{icon:"fa fa-file-pdf-o text-muted"},"file-zip":{icon:"fa fa-file-archive-o text-info"},"resource-zip":{icon:"fa fa-file-archive-o text-muted"},"file-java-archive":{icon:"fa fa-file-archive-o text-info"},"resource-java-archive":{icon:"fa fa-file-archive-o text-muted"},asset:{icon:"fa fa-picture-o text-info"},assetcontent:{icon:"fa fa-picture-o text-muted"},"file-binary":{icon:"fa fa-file-o text-info"},"resource-binary":{icon:"fa fa-file-o text-muted"},
"resource-syntheticresourceproviderresource":{icon:"fa fa-code text-muted"},clientlibraryfolder:{icon:"fa fa-share-square-o"}};n.Tree=Backbone.View.extend({current:function(){var a=this.getSelectedTreeNode();return a?a.original:void 0},getSelectedPath:function(){var a=this.getSelectedTreeNode();return a?a.original.path:void 0},getSelectedTreeNode:function(){var a=this.jstree.get_selected(!0);return a&&0c+d-d/5&&b.scrollTop(a-d+d/4)}},setRootPath:function(a,b){this.preventFromSelectLock.isLocked()?window.setTimeout(_.bind(function(){this.setRootPath(a,b)},this),100):(this.rootPath!==a&&(this.rootPath=a,!1!==b&&(b=!0)),
b&&this.refresh())},getRootPath:function(){return this.rootPath?this.rootPath:"/"},setFilter:function(a,b){this.filter=a;(void 0===b||b)&&this.refresh()},initialize:function(a){var b={plugins:["types","unique","wholerow"],core:{animation:!1,check_callback:_.bind(this.checkCallback,this),data:_.bind(this.nodeData,this),cache:!1,load_open:!0,multiple:!1,themes:{name:"proton"},force_text:!0},types:n.treeTypes};this.log=a.log||log.getLogger("tree");this.log.setLevel(log.levels.DEBUG);this.preventFromSelectLock.log.setLevel(log.levels.DEBUG);
a.dragAndDrop&&(this.dragAndDrop=_.extend(this.dragAndDrop||{},a.dragAndDrop));this.dragAndDrop&&(b.plugins=_.union(b.plugins,["dnd"]),b.dnd=this.dragAndDrop);a.contextmenu&&(this.contextmenu=_.extend(this.contextmenu||{},a.contextmenu));this.contextmenu&&(b.plugins=_.union(b.plugins,["contextmenu"]),b.contextmenu=this.contextmenu);this.$jstree=this.$el.jstree(b);this.jstree=this.$el.jstree(!0);if(_.isFunction(this.renameNode))this.$jstree.off("dblclick").on("dblclick",".jstree-anchor",_.bind(this.editNodeName,
this));this.delegateEvents({"loaded.jstree":this.initSelectedData,"redraw.jstree":this.onRedrawNode,"open_node.jstree":this.onOpenNode,"select_node.jstree":this.nodeSelected});$(document).on("path:selected."+this.nodeIdPrefix+"tree",_.bind(this.onPathSelected,this)).on("path:inserted."+this.nodeIdPrefix+"tree",_.bind(this.onPathInserted,this)).on("path:changed."+this.nodeIdPrefix+"tree",_.bind(this.onPathChanged,this)).on("path:moved."+this.nodeIdPrefix+"tree",_.bind(this.onPathMoved,this)).on("path:deleted."+
this.nodeIdPrefix+"tree",_.bind(this.onPathDeleted,this))},initSelectedData:function(){this.initialSelect||(this.initialSelect=this.$el.attr("data-selected"));this.log.getLevel()<=log.levels.DEBUG&&this.log.debug(this.nodeIdPrefix+"tree.initSelectedData("+this.initialSelect+")");this.initialSelect&&(this.selectNode(this.initialSelect),this.initialSelect=void 0);this.undelegate("loaded.jstree")},onPathSelected:function(a,b){a=this.getSelectedTreeNode();return a&&a.original.path===b?!0:(this.log.getLevel()<=
log.levels.DEBUG&&this.log.debug(this.nodeIdPrefix+"tree.onPathSelected("+b+"): "+(a?JSON.stringify(a.original):"undefined")),this.selectNode(b,_.bind(this.checkSelectedPath,this)),!1)},checkSelectedPath:function(a){if(!this.getSelectedTreeNode()&&_.isFunction(this.onPathSelectedFailed))this.onPathSelectedFailed(a)},onPathInserted:function(a,b,c){var d=this.nodeId(b);this.log.getLevel()<=log.levels.DEBUG&&this.log.debug(this.nodeIdPrefix+"tree.onPathInserted("+b+","+c+")\x3e\x3e\x3e:"+d);this.preventFromSelectLock.lock("pathInserted "+
b,!0);this.ensureNodeExists(b,_.bind(function(){this.refreshNodeById(d,_.bind(function(){this.log.getLevel()<=this.log.levels.DEBUG&&this.log.debug(this.nodeIdPrefix+"tree.onPathInserted("+b+","+c+").exit.");this.preventFromSelectLock.unlock("pathInserted "+b)},this))},this))},ensureNodeExists:function(a,b){var c=!1;if(a&&!this.getTreeNode(a)){var d=g.getParentPath(a);d&&d!==a&&(this.ensureNodeExists(d,_.bind(function(){this.load_node_with_retry(this.nodeId(d),b)},this)),c=!0)}c||b()},load_node_with_retry:function(a,
b){try{this.jstree.load_node(a,b)}catch(c){this.log.info("First failure on loading "+a+" : "+c.message);try{this.jstree.load_node(a,b)}catch(d){this.log.warn("Second failure on loading "+a+" : "+d.message),_.isFunction(callbackWhenDone)&&callbackWhenDone()}}},onPathChanged:function(a,b){a=this.nodeId(b);this.log.getLevel()<=log.levels.DEBUG&&this.log.debug(this.nodeIdPrefix+"tree.onPathChanged("+b+"):"+a);this.refreshNodeById(a)},onPathMoved:function(a,b,c){a=this.getTreeNodeByPath(b);this.log.getLevel()<=
log.levels.DEBUG&&this.log.debug(this.nodeIdPrefix+"tree.onPathMoved("+b+","+c+"):"+a);if(a){var d=(a=this.getSelectedTreeNode())&&a.original.path===b;a=g.getParentPath(b);b=g.getParentPath(c);a!==b&&(a=this.nodeId(a),this.refreshNodeById(a));b=this.nodeId(b);this.jstree.get_node(b,!1).state.loaded=!1;this.refreshNodeById(b,_.bind(function(){d&&this.selectNode(c)},this))}},onPathDeleted:function(a,b,c){a=this.getTreeNodeByPath(b);this.log.getLevel()<=log.levels.DEBUG&&this.log.debug(this.nodeIdPrefix+
"tree.onPathDeleted("+b+"):"+a);if(a){var d=this.getSelectedTreeNode(),e=this.getTreeNode(c)||this.findNearestOfDeletion(b),h=void 0;d&&d.original.path===b&&(h=this.getTreeNode(c)||this.findNearestOfDeletion(b));this.refreshNodeById(this.getParentNodeId(a.id),_.bind(function(){var a;h&&(a=h.original.path,this.selectNode(a));e&&(a=e.original.path,this.get$TreeNodeAnchor(a).focus())},this))}},findNearestOfDeletion:function(a){if(a=this.getTreeNode(a)){var b=this.jstree.get_next_dom(a,!0);if(!b||1>b.length)b=
this.jstree.get_prev_dom(a,!0);if(!b||1>b.length)b=this.jstree.get_prev_dom(a);if(b&&0
Date.now();this.lockedAtTime&&!a&&(this.log.warn("tree.preventFromSelectLock timing out, breaking the log of ",this.lockmsg),this.lockedAtTime=0,this.lockmsg="");a&&this.lockmsg&&this.log.debug("tree.preventFromSelectLock is currently locked for ",this.lockmsg);return a},lock:function(a,b){if(!b&&this.isLocked())throw Error("tree.preventFromSelectLock already locked for "+this.lockmsg);b?this.log.info("tree.preventFromSelectLock is now locked with force unlock for ",a," (was locked for ",this.lockmsg,
")"):this.log.debug("tree.preventFromSelectLock is now locked for ",a);this.lockedAtTime=Date.now();this.lockmsg=a},unlock:function(a){a&&this.lockmsg!==a?this.log.info("tree.preventFromSelectLock unlocks now for ",this.lockmsg," (but was locked for ",a,")"):this.log.debug("tree.preventFromSelectLock unlocks now for ",this.lockmsg);this.lockedAtTime=0;this.lockmsg=""}}})})(CPM.core.components,CPM.core)})();




© 2015 - 2025 Weber Informatics LLC | Privacy Policy