roojs-all.js
authorAlan Knowles <alan@akbkhome.com>
Mon, 26 Jul 2010 07:03:42 +0000 (15:03 +0800)
committerAlan Knowles <alan@akbkhome.com>
Mon, 26 Jul 2010 07:03:42 +0000 (15:03 +0800)
roojs-all.js

index 4148e4a..995a8f8 100644 (file)
@@ -389,7 +389,7 @@ this.dragSpecs.startSize=F;this.dragSpecs.startPoint=[x,y];Roo.dd.DDProxy.protot
 H=Math.min(Math.max(H,this.activeMinSize),this.activeMaxSize);if(H!=this.dragSpecs.startSize){if(this.fireEvent('beforeapply',this,H)!==false){this.adapter.setElementSize(this,H);this.fireEvent("moved",this,H);this.fireEvent("resize",this,H);}}},getAdapter:function(){return this.adapter;},setAdapter:function(I){this.adapter=I;this.adapter.init(this);},getMinimumSize:function(){return this.minSize;},setMinimumSize:function(J){this.minSize=J;},getMaximumSize:function(){return this.maxSize;},setMaximumSize:function(K){this.maxSize=K;},setCurrentSize:function(L){var M=this.animate;this.animate=false;this.adapter.setElementSize(this,L);this.animate=M;},destroy:function(N){if(this.shim){this.shim.remove();}
 this.dd.unreg();this.proxy.parentNode.removeChild(this.proxy);if(N){this.el.remove();}}});Roo.SplitBar.createProxy=function(O){var P=new Roo.Element(document.createElement("div"));P.unselectable();var Q='x-splitbar-proxy';P.addClass(Q+' '+(O==Roo.SplitBar.HORIZONTAL?Q+'-h':Q+'-v'));document.body.appendChild(P.dom);return P.dom;};Roo.SplitBar.BasicLayoutAdapter=function(){};Roo.SplitBar.BasicLayoutAdapter.prototype={init:function(s){},getElementSize:function(s){if(s.orientation==Roo.SplitBar.HORIZONTAL){return s.resizingEl.getWidth();}else {return s.resizingEl.getHeight();}},setElementSize:function(s,R,S){if(s.orientation==Roo.SplitBar.HORIZONTAL){if(!s.animate){s.resizingEl.setWidth(R);if(S){S(s,R);}}else {s.resizingEl.setWidth(R,true,.1,S,'easeOut');}}else {if(!s.animate){s.resizingEl.setHeight(R);if(S){S(s,R);}}else {s.resizingEl.setHeight(R,true,.1,S,'easeOut');}}}};Roo.SplitBar.AbsoluteLayoutAdapter=function(T){this.basic=new Roo.SplitBar.BasicLayoutAdapter();this.container=Roo.get(T);};Roo.SplitBar.AbsoluteLayoutAdapter.prototype={init:function(s){this.basic.init(s);},getElementSize:function(s){return this.basic.getElementSize(s);},setElementSize:function(s,U,V){this.basic.setElementSize(s,U,this.moveSplitter.createDelegate(this,[s]));},moveSplitter:function(s){var W=Roo.SplitBar;switch(s.placement){case W.LEFT:s.el.setX(s.resizingEl.getRight());break;case W.RIGHT:s.el.setStyle("right",(this.container.getWidth()-s.resizingEl.getLeft())+"px");break;case W.TOP:s.el.setY(s.resizingEl.getBottom());break;case W.BOTTOM:s.el.setY(s.resizingEl.getTop()-s.el.getHeight());break;}}};Roo.SplitBar.VERTICAL=1;Roo.SplitBar.HORIZONTAL=2;Roo.SplitBar.LEFT=1;Roo.SplitBar.RIGHT=2;Roo.SplitBar.TOP=3;Roo.SplitBar.BOTTOM=4;
 Roo.View=function(A,B,C){if(typeof(B)=='undefined'){Roo.apply(this,A);this.el=Roo.get(this.el);}else {this.el=Roo.get(A);this.tpl=B;Roo.apply(this,C);}if(typeof(this.tpl)=="string"){this.tpl=new Roo.Template(this.tpl);}this.tpl.compile();this.addEvents({"beforeclick":true,"click":true,"dblclick":true,"contextmenu":true,"selectionchange":true,"beforeselect":true});this.el.on({"click":this.onClick,"dblclick":this.onDblClick,"contextmenu":this.onContextMenu,scope:this});this.selections=[];this.nodes=[];this.cmp=new Roo.CompositeElementLite([]);if(this.store){this.store=Roo.factory(this.store,Roo.data);this.setStore(this.store,true);}
-Roo.View.superclass.constructor.call(this);};Roo.extend(Roo.View,Roo.util.Observable,{store:false,el:'',this.tpl:false,selectedClass:"x-view-selected",emptyText:"",getEl:function(){return this.el;},refresh:function(){var t=this.tpl;this.clearSelections();this.el.update("");var D=[];var E=this.store.getRange();if(E.length<1){this.el.update(this.emptyText);return;}for(var i=0,len=E.length;i<len;i++){var data=this.prepareData(E[i].data,i,E[i]);D[D.length]=t.apply(data);}
+Roo.View.superclass.constructor.call(this);};Roo.extend(Roo.View,Roo.util.Observable,{store:false,el:'',tpl:false,selectedClass:"x-view-selected",emptyText:"",getEl:function(){return this.el;},refresh:function(){var t=this.tpl;this.clearSelections();this.el.update("");var D=[];var E=this.store.getRange();if(E.length<1){this.el.update(this.emptyText);return;}for(var i=0,len=E.length;i<len;i++){var data=this.prepareData(E[i].data,i,E[i]);D[D.length]=t.apply(data);}
 this.el.update(D.join(""));this.nodes=this.el.dom.childNodes;this.updateIndexes(0);},prepareData:function(F){return F;},onUpdate:function(ds,G){this.clearSelections();var H=this.store.indexOf(G);var n=this.nodes[H];this.tpl.insertBefore(n,this.prepareData(G.data));n.parentNode.removeChild(n);this.updateIndexes(H,H);},onAdd:function(ds,I,J){this.clearSelections();if(this.nodes.length==0){this.refresh();return;}var n=this.nodes[J];for(var i=0,len=I.length;i<len;i++){var d=this.prepareData(I[i].data);if(n){this.tpl.insertBefore(n,d);}else {this.tpl.append(this.el,d);}}
 this.updateIndexes(J);},onRemove:function(ds,K,L){this.clearSelections();this.el.dom.removeChild(this.nodes[L]);this.updateIndexes(L);},refreshNode:function(M){this.onUpdate(this.store,this.store.getAt(M));},updateIndexes:function(N,O){var ns=this.nodes;N=N||0;O=O||ns.length-1;for(var i=N;i<=O;i++){ns[i].nodeIndex=i;}},setStore:function(P,Q){if(!Q&&this.store){this.store.un("datachanged",this.refresh);this.store.un("add",this.onAdd);this.store.un("remove",this.onRemove);this.store.un("update",this.onUpdate);this.store.un("clear",this.refresh);}if(P){P.on("datachanged",this.refresh,this);P.on("add",this.onAdd,this);P.on("remove",this.onRemove,this);P.on("update",this.onUpdate,this);P.on("clear",this.refresh,this);}if(P){this.refresh();}},findItemFromChild:function(R){var el=this.el.dom;if(!R||R.parentNode==el){return R;}var p=R.parentNode;while(p&&p!=el){if(p.parentNode==el){return p;}
 p=p.parentNode;}return null;},onClick:function(e){var S=this.findItemFromChild(e.getTarget());if(S){var M=this.indexOf(S);if(this.onItemClick(S,M,e)!==false){this.fireEvent("click",this,M,S,e);}}else {this.clearSelections();}},onContextMenu:function(e){var T=this.findItemFromChild(e.getTarget());if(T){this.fireEvent("contextmenu",this,this.indexOf(T),T,e);}},onDblClick:function(e){var U=this.findItemFromChild(e.getTarget());if(U){this.fireEvent("dblclick",this,this.indexOf(U),U,e);}},onItemClick:function(V,W,e){if(this.fireEvent("beforeclick",this,W,V,e)===false){return false;}if(this.multiSelect||this.singleSelect){if(this.multiSelect&&e.shiftKey&&this.lastSelection){this.select(this.getNodes(this.indexOf(this.lastSelection),W),false);}else {this.select(V,this.multiSelect&&e.ctrlKey);this.lastSelection=V;}