📄 igf_tree.js
字号:
// (c) 2007 Infragistics - Do NOT modify the content of this file
// Version 8.1.20081.1004
if(ig){if(!ig.tree){function IgWebTreePackage(){this.TYPE_TREE_VIEW="TreeView";this.TYPE_TREE_NODE="TreeNode";this.FLAG_PLUS_MINUS_ICON="pmi";this.PROP_COLLAPSED_ICON="oci";this.PROP_EXPANDED_ICON="oei";this.PROP_JUNCTION_EXPANDED_ICON="ojei";this.PROP_JUNCTION_COLLAPSED_ICON="ojci";this.init=function(){ig.factory.addClass(ig.tree.TYPE_TREE_VIEW,IgTreeView);ig.factory.addClass(ig.tree.TYPE_TREE_NODE,IgTreeNode);};this.getTree=function(domNode){return ig.getTargetUIElement(domNode,this.TYPE_TREE_VIEW);};this.onExpandedOnDemand=function(httpReq){ig.onPartialRefreshDefault(httpReq);var node=ig.getUIElementById(httpReq.getSourceOfRequest());if(!ig.isNull(node)){node.focus();}};this.onExpandNode=function(node){if(!ig.isNull(node)){var icon=(node.isExpanded())?node.getExpandedIcon():node.getCollapsedIcon();node.updateIcon(icon);if(node.hasChild()){icon=(node.isExpanded())?node.getAttribute(ig.tree.PROP_JUNCTION_EXPANDED_ICON,true):node.getAttribute(ig.tree.PROP_JUNCTION_COLLAPSED_ICON,true);node.updateJunctionIcon(icon);}
node.repaint();}};this.toggleNode=function(nodeId){var node=ig.getUIElementById(nodeId);if(!ig.isNull(node)){if(node.isEnabled()){node.toggle();}}
return false;};};ig.tree=new IgWebTreePackage();function IgTreeView(e){this.IgUIComponent(e);};ig.augment(IgTreeView,IgUIComponent);IgTreeView.prototype.isImmediateTreeNodeCollapseEvent=function(){return ig.NaES(this.getAttribute("igImmediateTreeNodeCollapseEvent"));};function IgTreeNode(e){this.IgUIElement(e);};IgTreeNode.prototype.collapse=function(){var cc=this.getChildContainer();if(!ig.isNull(cc)){cc.hide(true);var pc=this.getParentComponent();if(!ig.isNull(pc)){var sn=pc.getSelectedElement();if(this.isAncestor(sn)){this.select();}}
ig.tree.onExpandNode(this);this.queueEvent(this.getId(),"expand","false");var tree=ig.tree.getTree(this.elm);if(tree.isImmediateTreeNodeCollapseEvent()){ig.smartSubmit(this.getId(),null,null);tree.clearEventQueue();}}};IgTreeNode.prototype.expand=function(){if(this.hasChild()){this.callSuper("IgUIElement","expand");ig.tree.onExpandNode(this);this.queueEvent(this.getId(),"expand","true");}
else{this.fireEvent("expand",null,ig.tree.onExpandedOnDemand);}};IgTreeNode.prototype.focus=function(){ig.ui.setHoveredElement(this);if(this.elm.nodeName=='A'){this.elm.focus();}};IgTreeNode.prototype.getExpandedIcon=function(){var tmp=this.getAttribute(ig.tree.PROP_EXPANDED_ICON,false);if(ig.isNull(tmp)){tmp=this.getAttribute(ig.tree.PROP_COLLAPSED_ICON,false);if(!ig.isNull(tmp)){tmp=null;}
else{tmp=this.getAttribute(ig.tree.PROP_EXPANDED_ICON,true);}}
return tmp;};IgTreeNode.prototype.getCollapsedIcon=function(){return this.getAttribute(ig.tree.PROP_COLLAPSED_ICON,true);};IgTreeNode.prototype.getNextNode=function(){var nextNode=null;if(this.isExpanded()){nextNode=this.getFirstChild(true);}
if(ig.isNull(nextNode)){nextNode=this.getNextSibling(true);}
var pn=this.getParentSibling();while(ig.isNull(nextNode)&&!ig.isNull(pn)){nextNode=pn.getNextSibling(true);pn=pn.getParentSibling();}
return nextNode;};IgTreeNode.prototype.getPreviousNode=function(){var prevNode=this.getPreviousSibling(true);var lastChild=(!ig.isNull(prevNode))?prevNode.getLastChild(true):null;while(!ig.isNull(prevNode)&&prevNode.isExpanded()&&!ig.isNull(lastChild)){prevNode=lastChild;lastChild=prevNode.getLastChild(true);}
if(ig.isNull(prevNode)){prevNode=this.getParentSibling();}
return prevNode;};IgTreeNode.prototype.onClick=function(evt){};IgTreeNode.prototype.onKeyDown=function(evt){switch(evt.keyCode){case evt.KEY_UP:var sn=this.getPreviousNode();if(!ig.isNull(sn)){sn.focus();}
evt.preventDefault();break;case evt.KEY_DOWN:var nn=this.getNextNode();if(!ig.isNull(nn)){nn.focus();}
evt.preventDefault();break;case evt.KEY_LEFT:this.collapse();evt.preventDefault();break;case evt.KEY_RIGHT:this.expand();evt.preventDefault();break;case evt.KEY_TAB:if(evt.isShiftKeyPressed()){var pn=this.getPreviousNode();if(!ig.isNull(pn)){pn.focus();evt.preventDefault();}
break;}
else{var nn=this.getNextNode();if(!ig.isNull(nn)){nn.focus();evt.preventDefault();}
break;}}};IgTreeNode.prototype.updateIcon=function(anIcon){if(ig.NaES(anIcon)){var icon=this.elm.childNodes[1];if(!ig.isNull(icon)&&icon.src!=anIcon){icon.src=anIcon;}}};IgTreeNode.prototype.updateJunctionIcon=function(anIcon){if(ig.NaES(anIcon)){var icon=this.elm.childNodes[0];if(!ig.isNull(icon)&&icon.src!=anIcon){icon.src=anIcon;}}};ig.augment(IgTreeNode,IgUIElement);ig.tree.init();}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -