FR.components.TreeNodeCustomUI = Ext.extend(Ext.tree.TreeNodeUI, {
getIcons: function() {
var a = this.node.attributes;
var icons = '';
if (a.custom) {
if (a.custom.share) {
icons += ' ';
}
if (a.custom.weblink) {
icons += ' ';
}
if (a.custom.notInfo) {
icons += ' ';
}
if (a.custom.star) {
icons += ' ';
}
if (a.custom.label) {
var s = a.custom.label.split('|');
icons += ' ';
}
}
if (a['new']) {
icons += ' ';
}
return icons;
},
updateIcons: function() {
this.frIconsNodeEl.update(this.getIcons());
},
getIconHTML: function() {
var a = this.node.attributes;
var icon = '';
return icon;
},
renderElements : function(n, a, targetNode, bulkRender){
this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';
var showMenuTrigger = (['myfiles', 'sharedFolder', 'trash'].indexOf(a.section) != -1);
var nel,
buf =
'
' +
''+
''+
'';
if (bulkRender !== true && n.nextSibling && (nel = n.nextSibling.ui.getEl())) {
this.wrap = Ext.DomHelper.insertHtml("beforeBegin", nel, buf);
} else {
this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf);
}
this.elNode = this.wrap.childNodes[0];
this.ctNode = this.wrap.childNodes[1];
var cs = this.elNode.childNodes;
this.indentNode = cs[0];
this.ecNode = cs[1];
this.iconNode = cs[2];
this.iconNodeEl = Ext.get(this.iconNode);
this.anchor = cs[3];
this.textNode = cs[3].firstChild;
this.frIconsNodeEl = Ext.get(cs[3].lastChild);
if (showMenuTrigger) {
this.menuTriggerNode = cs[4];
Ext.get(this.menuTriggerNode).on('click', function(e) {
FR.UI.tree.showContextMenu(n, e);
e.stopEvent();
});
}
},
updateExpandIcon : function(){
if(this.rendered){
var n = this.node, hasChild = n.hasChildNodes();
if(hasChild || n.attributes.expandable){
if (n.expanded){
Ext.fly(this.ecNode).replaceClass('fa-caret-right', 'fa-caret-down');
} else {
Ext.fly(this.ecNode).replaceClass('fa-caret-down', 'fa-caret-right');
}
} else {
Ext.fly(this.ecNode).removeClass('fa-caret-right');
}
}
},
beforeLoad : function() {
var i = this.iconNodeEl;
i.origCSSClass = i.getAttribute('class');
i.set({'class': 'x-tree-node-icon fa fa-lg fa-fw icon-silver fa-refresh fa-spin'});
},
afterLoad : function() {
this.iconNodeEl.set({'class': this.iconNodeEl.origCSSClass});
}
});