⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 grid.js

📁 DWR is the way for AJAX implementation
💻 JS
字号:
/* * Copyright (c) 2001-2007, TIBCO Software Inc. * Use, modification, and distribution subject to terms of license. */jsx3.require("jsx3.gui.List");jsx3.Class.defineClass("jsx3.gui.Grid",jsx3.gui.List,null,function(g,j){var Lc=jsx3.util.Logger.getLogger(g.jsxclass.getName());var pc=jsx3.gui.Event;g.DEFAULTXSLURL=jsx3.resolveURI(jsx3.CLASS_LOADER.resolvePath("jsx:///xsl/@path@/jsx30grid.xsl"));g.SELECTBGIMAGE="url("+jsx3.resolveURI("jsx:///images/grid/select.gif")+")";g.DEFAULTBACKGROUND="background-image:url("+jsx3.resolveURI("jsx:///images/list/grid.gif")+");";g.DEFAULTBACKGROUNDHEAD="background-image:url("+jsx3.resolveURI("jsx:///images/list/header.gif")+");";jsx3.html.loadImages("jsx:///images/grid/select.gif","jsx:///images/list/grid.gif","jsx:///images/list/header.gif");g.DEFAULTBACKGROUNDCOLOR="#c8cfd8";g.DEFAULTBACKGROUNDCOLORHEAD="#c8cfd8";g.DEFAULTROWCLASS="jsx30list_r2";j.init=function(k){this.jsxsuper(k);};j.Wt=function(){this._jsxij=null;this._jsxcellindex=null;this._jsxrowid=null;};j.getTabListener=function(){return this.jsxtablistener;};j.setTabListener=function(a){this.jsxtablistener=a;return this;};j.paint=function(){this.resetMask();this.Wt();return this.jsxsuper();};j.getClassName=function(){return this.jsxclassname==null?g.DEFAULTROWCLASS:this.jsxclassname;};j.getXSL=function(){var hb=this.jsxsuper(g.DEFAULTXSLURL);return hb;};j.doValidate=function(){return this.setValidationState(jsx3.gui.Form.STATEVALID).getValidationState();};j.UZ=function(){return "background-color:"+(this.getBackgroundColor()?this.getBackgroundColor():g.DEFAULTBACKGROUNDCOLOR)+";";};j.K2=function(){return this.getBackground()?this.getBackground()+";":g.DEFAULTBACKGROUND;};j.DA=function(b,k){this.resetMask();this.jsxsuper(b,k);};j.resetMask=function(m){if(m||(m=this.getActiveMask())!=null)m.setVisibility(jsx3.gui.Block.VISIBILITYHIDDEN,true).setLeft(0,true).setTop(0,true);};j.doSort=function(n){var qc;if(qc=this.getActiveMask())this.onAfterEdit(null,qc);this.resetMask();this.jsxsuper(n);};j.repaintBody=function(){this.resetMask();this.jsxsuper();};j.doBlurItem=function(l){};j.doFocusItem=function(f,s){var qb=pc.getCurrent();var oc=f.ownerDocument;var ic=f.parentNode.id.substring(this.getId().length+1);if(!this.g5(ic))return;var vc=f!=this._jsxij||s;if(vc&&this._jsxcurmask!=null&&(s==true||s!=true&&!(this._jsxcurmask instanceof jsx3.gui.TextBox))){this.onAfterEdit(this._jsxij,this._jsxcurmask);}else{if(vc&&this._jsxcurmask!=null){this.resetMask();}}try{f.focus();if(this._jsxij!=null)this._jsxij.style.backgroundImage=this._jsxij.prevBG!=null?this._jsxij.prevBG:"";if(this.getGrowBy()>0&&f.parentNode==f.parentNode.parentNode.lastChild)this.appendRow();}catch(Kc){var vb=oc.getElementById(this._jsxrowid);if(vb!=null)vb.childNodes[this._jsxcellindex].style.backgroundImage="";return false;}f.prevBG=f.style.backgroundImage;f.style.backgroundImage=g.SELECTBGIMAGE;this._jsxij=f;this._jsxcellindex=f.cellIndex;this._jsxrowid=f.parentNode.id;var Jb=this.LC()[this._jsxcellindex];if(s==null){var db=f.getAttribute("jsxmask");if(!jsx3.util.strEmpty(db)&&db!="jsxnull"){var fb=Jb.getDescendantOfName(db)||this.getDescendantOfName(db);this.fg(qb,f,fb);}else{this.doEvent(jsx3.gui.Interactive.SELECT,{objEVENT:qb,strRECORDID:ic,intCOLUMNINDEX:this._jsxcellindex});}}};j.fg=function(c,k,r){this.resetMask();this._jsxcurmask=r;var x=this.LC()[this._jsxcellindex].getPath().doReplace("@","");var rc=this.getSelectedId();r.setValue();var jc=this.doEvent(jsx3.gui.Interactive.BEFORE_EDIT,{objEVENT:c,strATTRIBUTENAME:x,strRECORDID:rc,objMASK:r,intCOLUMNINDEX:this._jsxcellindex});if(jc!==false&&k!=null&&r!=null){var kb=k.ownerDocument;var tc=this.getHeaderHeight()===0||this.getHeaderHeight()?this.getHeaderHeight():jsx3.gui.List.DEFAULTHEADERHEIGHT;r._jsxvalidrow=k.parentNode.id;var Cc=kb.getElementById(this.getId()+"_jsxbody");var v=this.getRecord(rc);var Gc=v[x];if(Gc==null)Gc="";var R=this.getAbsolutePosition(this.getRendered(),k);if(r instanceof jsx3.gui.TextBox){r.setLeft(R.L+Cc.scrollLeft,true);r.setTop(R.T-tc+Cc.scrollTop,true);r.setWidth(R.W-1,true);r.setHeight(R.H-1,true);r.setValue(Gc);r._jsxprevmaskvalue=Gc;r.setVisibility(jsx3.gui.Block.VISIBILITYVISIBLE,true);if((k=r.getRendered())&&k.scrollHeight>k.offsetHeight)r.setHeight(R.H-1+R.H,true);if(r.getType()==1){r.focus();r.getRendered().select();}else{r.focus();if(kb.selection){var Tb=kb.selection.createRange();Tb.move("sentence",-1);Tb.moveEnd("character",Gc.length);Tb.select();}}}else{if(r instanceof jsx3.gui.ToolbarButton||r instanceof jsx3.gui.Menu){r.setLeft(R.L+R.W-r.getAbsolutePosition().W+Cc.scrollLeft+(r instanceof jsx3.gui.Menu?2:0),true);r.setTop(R.T-tc+Cc.scrollTop-2,true);r.setVisibility(jsx3.gui.Block.VISIBILITYVISIBLE,true);r._jsxvalue=Gc==""?null:Gc;r._jsxprevmaskvalue=Gc;if(c.ctrlKey()){if(r instanceof jsx3.gui.Menu){r.showMenu(c,r.getRendered(),1);}else{r.focus();}}}else{if(r instanceof jsx3.gui.Select){if(r.getValue()==null){r.setValue(Gc==""?null:Gc);r.setText(Gc==null?"":Gc);}r.setLeft(R.L+Cc.scrollLeft,true);r.setTop(R.T-tc+Cc.scrollTop,true);r.setWidth(R.W-1,true);r.setHeight(R.H-1,true);r._jsxprevmaskvalue=r.getValue();r.setVisibility(jsx3.gui.Block.VISIBILITYVISIBLE,true);if(c.ctrlKey()){r.show();}else{r.focus();}}}}delete this._jsxisblur;}};j.doMaskKeyDown=function(q,o){if(o==null)o=pc.getCurrent();var dc=false;var Gc=o.keyCode();var Wb=Gc>36&&Gc<41;if((o.enterKey()||o.tabKey())&&!o.ctrlKey()||Wb&&(o.ctrlKey()||o.altKey())){if(o.enterKey()&&o.shiftKey()||Gc==pc.KEY_ARROW_UP){o.setKeyCode(pc.KEY_ARROW_UP);}else{if(o.enterKey()||Gc==pc.KEY_ARROW_DOWN){o.setKeyCode(pc.KEY_ARROW_DOWN);}else{if(o.tabKey()&&o.shiftKey()&&!(!this.getTabListener()||this.getTabListener()==jsx3.Boolean.TRUE)){try{this.focus();return;}catch(Kc){}}else{if(o.tabKey()&&!(!this.getTabListener()||this.getTabListener()==jsx3.Boolean.TRUE)){try{this.getRendered().lastChild.focus();return;}catch(Kc){}}}}}this._jsxisblur=this.getActiveMask()&&this.getActiveMask() instanceof jsx3.gui.TextBox;this.DY(o,q);dc=true;}else{if(o.ctrlKey()&&o.enterKey()){var nb=this.getDocument().selection.createRange();nb.text="\n";nb.select();dc=true;}else{if(Wb){dc=true;}}}if(dc)o.cancelBubble();};j.getSelectedId=function(){if(this._jsxrowid!=null){var mb=this.getRendered();if(mb){var rb=mb.ownerDocument.getElementById(this._jsxrowid);if(rb!=null)return this._jsxrowid.substring(this.getId().length+1);}this.Wt();}return null;};j.getActiveMask=function(){return this._jsxcurmask;};j.getActiveCell=function(){return this._jsxij;};j.getActiveRow=function(){var w;return (w=this.getActiveCell())?w.parentNode:null;};j.getActiveAttribute=function(){if(this._jsxcellindex){var R=this.LC()[this._jsxcellindex];if(R)return R.getPath().doReplace("@","");}return null;};j.onAfterEdit=function(k,q,c,m){var hb=pc.getCurrent();var Xb=this.LC()[this._jsxcellindex].getPath().doReplace("@","");var U=this.getSelectedId();if(k==null)k=this._jsxij;var dc=k&&k.parentNode?k.parentNode.id:null;if(q._jsxvalidrow==null||q._jsxvalidrow!=dc){Lc.warn("onAfterEdit called for invalid row "+dc);return;}if(!(jsx3.util.strEmpty(k.getAttribute("jsxmask"))||k.getAttribute("jsxmask")=="jsxnull")){if(q==null||typeof(q.getValue)=="function"&&q.getValue()!=q._jsxprevmaskvalue){var A=this.doEvent(jsx3.gui.Interactive.AFTER_EDIT,{objEVENT:hb,strATTRIBUTENAME:Xb,strRECORDID:U,objMASK:q,objGUI:k,intCOLUMNINDEX:this._jsxcellindex});if(A!==false&&q!=null){this.updateCell(Xb,U,k,q);if(c&&q instanceof jsx3.gui.Menu)this.getActiveCell().focus();}}}if(q!=null&&m!==true){this.resetMask(q);delete this._jsxcurmask;delete q._jsxvalidrow;}};j.updateCell=function(a,l,r,d){if(d==null)d=this.getActiveMask();if(r==null)r=this._jsxij;if(d&&r){if(a==null)a=this.LC()[this._jsxcellindex].getPath().doReplace("@","");if(l==null)l=this.getSelectedId();var Bc=typeof(d.getMaskValue)=="function"?d.getMaskValue():d.getValue();if(Bc==null)Bc="";this.insertRecordProperty(l,a,Bc,true);}};j.DY=function(p,i){if(this.jsxsupermix(p,i))return;if(this._jsxij==null||this._jsxij.parentNode==null)return;var Bb=this._jsxij;var eb=this.LC().length;var wc=p.keyCode();var mc=wc>=pc.KEY_ARROW_LEFT&&wc<=pc.KEY_ARROW_DOWN||wc==pc.KEY_TAB&&(!this.getTabListener()||this.getTabListener()==jsx3.Boolean.TRUE);var Kc=mc;if(mc){var mb=null;var R=Bb==Bb.parentNode.firstChild;var sc=Bb.cellIndex>=eb-1;var Ac=Bb.parentNode==Bb.parentNode.parentNode.firstChild;var P=Bb.parentNode==Bb.parentNode.parentNode.lastChild;if(wc==pc.KEY_ARROW_LEFT||p.shiftKey()&&wc==pc.KEY_TAB){if(wc==pc.KEY_TAB)wc=pc.KEY_ARROW_LEFT;if(R){if(Ac)mb=Bb;else mb=Bb.parentNode.previousSibling.childNodes[eb-1];}else{mb=Bb.previousSibling;}}else{if(wc==pc.KEY_ARROW_UP){if(Ac)mb=Bb;else mb=Bb.parentNode.previousSibling.childNodes[Bb.cellIndex];}else{if(wc==pc.KEY_ARROW_RIGHT||wc==pc.KEY_TAB){if(wc==pc.KEY_TAB)wc=pc.KEY_ARROW_RIGHT;if(sc){if(P)mb=Bb;else mb=Bb.parentNode.nextSibling.childNodes[0];}else{mb=Bb.nextSibling;}}else{if(wc==pc.KEY_ARROW_DOWN){if(P)mb=Bb;else mb=Bb.parentNode.nextSibling.childNodes[Bb.cellIndex];}}}}this.doFocusItem(mb,true);}else{if(wc==pc.KEY_ENTER){}else{if(wc==pc.KEY_TAB&&p.shiftKey()){this.focus();Kc=true;}else{if(wc==pc.KEY_TAB){this.getRendered().lastChild.focus();Kc=true;}}}}if(Kc){p.cancelBubble();p.cancelReturn();}};j.doExecute=function(e,s){this.Oy(this.isOldEventProtocol(),e,s);};j.Oy=function(h,r,f){if(r==null&&this._jsxrowid)r=this._jsxrowid.substring(this.getId().length+1);if(f==null)f=this._jsxcellindex;if(r==null)return;if(!this.g5(r))return;var gb=this.getRecordNode(r);if(gb!=null)this.eval(gb.getAttribute("jsxexecute"),{strRECORDID:r,intCOLUMNINDEX:f});if(h)this.doEvent(jsx3.gui.Interactive.EXECUTE,{objEVENT:h instanceof pc?h:null,strRECORDID:r,intCOLUMNINDEX:f});};j.IU=function(q,o){var eb=q.srcElement();if(eb.tagName=="TBODY"||eb.tagName=="TR")return;var Ob=this.getRendered();while(eb.tagName!="TD"&&eb!=Ob)eb=eb.parentNode;if(eb.tagName=="TD"){if(eb.parentNode.getAttribute("JSXDragId")==null)return;if(eb.cellIndex==this.LC().length)return;eb.focus();q.cancelBubble();q.cancelReturn();}};j.S3=function(){var E="";var Eb=this.LC();var ec=Eb.length;for(var G=0;G<ec;G++){var hb=Eb[G];var Cb=hb.getChildren();for(var bb=0;bb<Cb.length;bb++){E=E+Cb[bb].paint();}}return E;};j.redrawRecord=function(k,n){if(n==jsx3.xml.CDF.DELETE){this.resetMask();}this.jsxsuper(k,n);};g.getVersion=function(){return "3.0.00";};});jsx3.Grid=jsx3.gui.Grid;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -