/*
 * Copyright (c) 2001-2007, TIBCO Software Inc.
 * Use, modification, and distribution subject to terms of license.
 */
jsx3.require("jsx3.gui.Form","jsx3.gui.Block");jsx3.Class.defineClass("jsx3.gui.Button",jsx3.gui.Block,[jsx3.gui.Form],function(r,b){var zc=jsx3.gui.Event;var Gc=jsx3.gui.Form;r.DEFAULTBACKGROUNDCOLOR="#e8e8f5";r.DEFAULTHIGHLIGHT="#f6f6ff";r.DEFAULTSHADOW="#a6a6af";r.DEFAULTHEIGHT=17;b._jsxtf=null;r.DEFAULTCLASSNAME="jsx30button";b.init=function(k,h,d,f,c){this.jsxsuper(k,h,d,f);this.setText(c);};b.doValidate=function(){return this.setValidationState(jsx3.gui.Form.STATEVALID).getValidationState();};b.DY=function(i,d){if(i.spaceKey()||i.enterKey()){this.wd(i,d);i.cancelAll();}};b.doClick=function(){var dc=zc.getCurrent();this.wd(dc);};b.doExecute=function(o){this.wd(o);};b.wd=function(o,q){if(o==null||o.leftButton()||!o.isMouseEvent())this.doEvent(jsx3.gui.Interactive.EXECUTE,{objEVENT:o});};b.mL=function(h,e){if(!h.leftButton())return;if(!this.getBorder()){e.style.border="solid 1px "+r.DEFAULTSHADOW;e.style.borderRightColor=r.DEFAULTHIGHLIGHT;e.style.borderBottomColor=r.DEFAULTHIGHLIGHT;}e.childNodes[0].focus();};b._4=function(p,n){if(p.leftButton()){if(!this.getBorder()){n.style.border="solid 1px "+r.DEFAULTHIGHLIGHT;n.style.borderRightColor=r.DEFAULTSHADOW;n.style.borderBottomColor=r.DEFAULTSHADOW;}}this.jsxsupermix(p,n);};b.u2=function(p,i){if(!this.getBorder()){i.style.border="solid 1px "+r.DEFAULTHIGHLIGHT;i.style.borderRightColor=r.DEFAULTSHADOW;i.style.borderBottomColor=r.DEFAULTSHADOW;}};b.getValue=function(){return this.getText();};b.setEnabled=function(f,o){if(this._jsxtf!=null)this._jsxtf.setEnabled(f==Gc.STATEENABLED);return this.jsxsupermix(f,o);};r.s5={};r.s5[zc.CLICK]="wd";r.s5[zc.KEYDOWN]=true;r.s5[zc.MOUSEDOWN]=true;r.s5[zc.MOUSEUP]=true;r.s5[zc.MOUSEOUT]=true;b.k7=function(j,g,h){var Jc=this.RL(true,j);if(g){Jc.recalculate(j,g,h);var ob=Jc.pQ(0);ob.recalculate({parentwidth:Jc.XK(),parentheight:Jc.P5()},g.childNodes[0],h);}};b.T5=function(p){this.applyDynamicProperties();if(this.getParent()&&(p==null||isNaN(p.parentwidth)||isNaN(p.parentheight))){p=this.getParent().IO(this);}else{if(p==null){p={};}}var V,ic;p.tagname="span";if(p.width==null&&!jsx3.util.strEmpty(this.getWidth()))p.width=this.getWidth();p.height=this.getHeight()==null?r.DEFAULTHEIGHT:this.getHeight();if(this.getRelativePosition()!=0){p.boxtype="relativebox";if((ic=this.getMargin())!=null&&ic!="")p.margin=ic;}else{p.boxtype="box";p.left=!jsx3.util.strEmpty(this.getLeft())?this.getLeft():0;p.top=!jsx3.util.strEmpty(this.getTop())?this.getTop():0;}p.padding=(V=this.getPadding())!=null&&V!=""?V:"2";p.border=this.getBorder()||"solid 1px "+r.DEFAULTHIGHLIGHT+";solid 1px "+r.DEFAULTSHADOW+";solid 1px "+r.DEFAULTSHADOW+";solid 1px "+r.DEFAULTHIGHLIGHT;var xb=new jsx3.gui.Painted.Box(p);var Sb={};Sb.parentwidth=xb.XK();Sb.parentheight=xb.P5();Sb.height="100%";if(p.width){Sb.width="100%";Sb.tagname="div";Sb.boxtype="inline";}else{Sb.tagname="span";Sb.boxtype="relativebox";}var oc=new jsx3.gui.Painted.Box(Sb);xb.W8(oc);return xb;};b.paint=function(){this.applyDynamicProperties();var O;if((O=this.getKeyBinding())!=null){var cc=this;if(this._jsxtf!=null)this._jsxtf.destroy();this._jsxtf=this.doKeyBinding(function(c){cc.wd(c);},O);this._jsxtf.setEnabled(this.getEnabled()!=jsx3.gui.Form.STATEDISABLED);}var Hb=this.lM(this.getEnabled()==jsx3.gui.Form.STATEENABLED?r.s5:null,0);var Gb=this.renderAttributes(null,true);var wc=this.RL(true);wc.setAttributes("id=\""+this.getId()+"\" label=\""+this.getName()+"\" "+this.vH()+Hb+" class=\""+this.CH()+"\" unselectable=\"on\" "+Gb);wc.setStyles(this.T1()+this.MU()+this.I6()+this.g0()+this.oY()+this.D6()+this.QP()+this.UZ()+this.d9()+this.eQ()+this.iN());var hc=wc.pQ(0);hc.setAttributes(this.CI()+" class=\"jsx30button_text\" unselectable=\"on\" ");hc.setStyles(this.eQ());return wc.paint().join(hc.paint().join(this.AN())+this.paintChildren());};b.UZ=function(){var K=this.getEnabled()!=Gc.STATEDISABLED?this.getBackgroundColor()||r.DEFAULTBACKGROUNDCOLOR:this.getDisabledBackgroundColor()||Gc.DEFAULTDISABLEDBACKGROUNDCOLOR;return "background-color:"+K+";";};b.I6=function(){return this.getEnabled()==jsx3.gui.Form.STATEENABLED?"cursor:pointer;":"cursor:default;";};b.CH=function(){var rb=this.getClassName();return r.DEFAULTCLASSNAME+(rb?" "+rb:"");};r.getVersion=function(){return "3.0.00";};b.emGetType=function(){return jsx3.gui.Matrix.EditMask.FORMAT;};b.emInit=function(o){this.jsxsupermix(o);this.subscribe(jsx3.gui.Interactive.EXECUTE,this,"Mg");};b.emSetValue=function(e){};b.emGetValue=function(){return null;};b.emBeginEdit=function(n,m,g,s,d,j,k){var Tb=jsx3.html.selectSingleElm(k,0,0,0);if(Tb){this.jsxsupermix(n,m,g,s,d,j,k);Tb.focus();}else{return false;}};b.emPaintTemplate=function(){this.setEnabled(Gc.STATEDISABLED);var qc=this.paint();this.setEnabled(Gc.STATEENABLED);var Lc=this.paint();return this.PS(Lc,qc);};b.Mg=function(d){var uc=this.emGetSession();if(uc){}};});jsx3.Button=jsx3.gui.Button;
