882b5fe9816bbd7e3af3601c19602300e8978d09a1141cd60ad74ddf72132636

Source Code:

// Gaia Ajax Copyright (C) 2008 - 2011 Gaiaware AS. details at http://gaiaware.net/
if(!Gaia.Extensions)
Gaia.Extensions=Class.create();Gaia.Extensions.TreeViewItem=Class.create(Gaia.Control,{initialize:function(element,options){this.initializeTreeViewItem(element,options);},initializeTreeViewItem:function(element,options){options.effects=Object.extend({gaiacollapsing:function(evt){Element.hide(this.getChildrenContainer());this.raiseAfterFinish(evt);},gaiaexpanding:function(evt){Element.show(this.getChildrenContainer());this.raiseAfterFinish(evt);}},options.effects);this.initializeControl(element,options);var p=options.p;this.options=Object.extend({isEnd:(p&1)===1,isLeaf:(p&2)===2,allowSelections:(p&4)===4,fetchedChildren:(p&8)===8,collapsed:(p&16)===16},this.options);this._addEventListeners();},raiseAfterFinish:function(evt){var memo=evt.memo;if(Object.isUndefined(memo))return;var afterFinish=evt.memo.afterFinish;if(!Object.isFunction(afterFinish))return;afterFinish.call(this);},setSel:function(value){this.options.allowSelections=value;this._removeEventListeners();this._addEventListeners();return this;},setLeaf:function(value){this.options.isLeaf=value;this._removeEventListeners();this._addEventListeners();return this;},setCol:function(value){if(!this.processing){this.processing=true;if(value&&!this.options.collapsed)
Element.fire(this.element,'gaia:collapsing',{afterFinish:this.dequeueAction.bind(this)});else if(!value&&this.options.collapsed)
Element.fire(this.element,'gaia:expanding',{afterFinish:this.dequeueAction.bind(this)});this.options.collapsed=value;}else
this.queueAction(value);return this;},queueAction:function(value){if(Object.isUndefined(this.collapseQueue))
this.collapseQueue=[value];else
this.collapseQueue.push(value);},dequeueAction:function(){this.processing=false;if(Object.isUndefined(this.collapseQueue)||this.collapseQueue.length===0)return;this.setCol(this.collapseQueue.shift());},setInd:function(value,index){var element=Element.down(this.element,'.span-for-indent');element.update(this.decodeArgument(element.innerHTML,value,index));return this;},setCCnt:function(value,index){var container=this.getContainer();container.className=this.decodeArgument(container.className,value,index);return this;},setCExp:function(value,index){var expander=this.getExpander();expander.className=this.decodeArgument(expander.className,value,index);return this;},reInit:function(){this._reInit();this._removeEventListeners();this._addEventListeners();},appendHtml:function(value){this._appendHtml(this.getChildrenContainer(),value);return this;},_onElementClicked:function(evt){if(!this.options.allowSelections||evt.nodeSelectEvent)return;var element=Event.element(evt);if(!this.options.isLeaf){var expander=this.getExpander();if(expander===element||Element.descendantOf(element,expander))
return;}
evt.nodeSelectEvent=true;this._onEvent(evt,'click',true);},_addEventListeners:function(){if(!this.options.isLeaf){this.onExpanderClicked=this._onEvent.bindAsEventListener(this,'click',true);Element.observe(this.getExpander(),'click',this.onExpanderClicked);}
if(this.options.allowSelections){this.onElementClicked=this._onElementClicked.bindAsEventListener(this);Element.observe(this.getContainer(),'click',this.onElementClicked);}},_removeEventListeners:function(){if(this.onExpanderClicked!==null)
Element.stopObserving(this.getExpander(),'click',this.onExpanderClicked);if(this.onElementClicked!==null)
Element.stopObserving(this.getContainer(),'click',this.onElementClicked);},getExpander:function(){return $(this.element.id+'_expander');},getContainer:function(){return $(this.element.id+'_container');},getChildrenContainer:function(){return $(this.element.id+'_children');},destroy:function(){this.destroyContainer();this._destroyImpl();},destroyContainer:function(){this._removeEventListeners();this.destroyChildControls();},_getElementPostValueEvent:function(evt){var argument='';var postValue='&__EVENTTARGET='+this.getCallbackName();if(evt!==null){if(!evt.nodeSelectEvent)
argument=this.options.collapsed?'E':'C';else
argument='S';}
return postValue+'&__EVENTARGUMENT='+argument;}});Object.extend(Gaia.Extensions.TreeViewItem.prototype,Gaia.Container.prototype);Gaia.TreeItem=Gaia.Extensions.TreeViewItem;Gaia.Extensions.TreeViewItem.browserFinishedLoading=true;