?? coreclasses.js
字號:
if(!cs[i].isFocusRoot())
this._getAllAfter(cs[i],oComp,oArray);}};_p._getAllBefore=function(oCont,oComp,oArray){var cs=oCont.getChildren();var l=cs.length;for(var i=0;i<l;i++){if(!(cs[i]instanceof BiComponent))
continue;if(cs[i].getCanFocus()&&cs[i].getTabIndex()>0&&this.compareTabOrder(oComp,cs[i])>0){oArray.push(cs[i]);}
if(!cs[i].isFocusRoot())
this._getAllBefore(cs[i],oComp,oArray);}};_p._getFirst=function(oCont,oFirst){var cs=oCont.getChildren();var l=cs.length;for(var i=0;i<l;i++){if(!(cs[i]instanceof BiComponent))
continue;if(cs[i].getCanFocus()&&cs[i].getTabIndex()>0){if(oFirst==null||this.compareTabOrder(cs[i],oFirst)<0)
oFirst=cs[i];}
if(!cs[i].isFocusRoot())
oFirst=this._getFirst(cs[i],oFirst);}
return oFirst;};_p._getLast=function(oCont,oLast){var cs=oCont.getChildren();var l=cs.length;for(var i=0;i<l;i++){if(!(cs[i]instanceof BiComponent))
continue;if(cs[i].getCanFocus()&&cs[i].getTabIndex()>0){if(oLast==null||this.compareTabOrder(cs[i],oLast)>0)
oLast=cs[i];}
if(!cs[i].isFocusRoot())
oLast=this._getLast(cs[i],oLast);}
return oLast;};function BiFont(nSize,sName){BiObject.call(this);if(nSize!=null)this._size=nSize;if(sName!=null)this._name=sName;}
var _p=BiFont.prototype=new BiObject;_p._className="BiFont";BiFont.prototype.getSize=function(){return this._size;};BiFont.prototype.setSize=function(v){this._size=v;};BiFont.prototype.getBold=function(){return this._bold;};BiFont.prototype.setBold=function(v){this._bold=v;};BiFont.prototype.getItalic=function(){return this._italic;};BiFont.prototype.setItalic=function(v){this._italic=v;};BiFont.prototype.getUnderline=function(){return this._underline;};BiFont.prototype.setUnderline=function(v){this._underline=v;};BiFont.prototype.getStrikeout=function(){return this._strikeout;};BiFont.prototype.setStrikeout=function(v){this._strikeout=v;};BiFont.prototype.getName=function(){return this._name;};BiFont.prototype.setName=function(v){this._name=v;};_p.paintFont=function(oComponent)
{if(this._name)
oComponent.setStyleProperty("fontFamily",this._name);if(this._size!=null)
oComponent.setStyleProperty("fontSize",this._size+"px");if(this._bold!=null)
oComponent.setStyleProperty("fontWeight",this._bold?"bold":"normal");if(this._italic!=null)
oComponent.setStyleProperty("fontStyle",this._italic?"italic":"normal");var td=null;if(this._underline==false&&this._strikeout==false)
td="none";else if(this._underline!=null||this._strikeout!=null)
{td=(this._underline?"underline":"")+(this._strikeout?" line-through":"");}
if(td!=null)
oComponent.setStyleProperty("textDecoration",td);};_p.removeFont=function(oComponent){oComponent.removeStyleProperty("fontFamily");oComponent.removeStyleProperty("fontSize");oComponent.removeStyleProperty("fontWeight");oComponent.removeStyleProperty("fontStyle");oComponent.removeStyleProperty("textDecoration");};BiFont.fromString=function(s)
{var f=new BiFont;var parts=s.split(/\s+/);var nameSb=[];var part;for(var i=0;i<parts.length;i++)
{part=parts[i];switch(part)
{case"bold":f.setBold(true);break;case"italic":f.setItalic(true);break;case"underline":f.setUnderline(true);break;case"strikeout":f.setStrikeout(true);break;default:var n=parseFloat(part);if(n==part||part.indexOf("px")!= -1)
f.setSize(n);else nameSb.push(part);break;}}
if(nameSb.length>0)
f.setName(nameSb.join(" "));return f;};function BiImagePreloaderManager(){if(BiImagePreloaderManager._singleton)
return BiImagePreloaderManager._singleton;BiObject.call(this);this._imagePreloaders={};BiImagePreloaderManager._singleton=this;application.addEventListener("dispose",this.dispose,this);}
_p=BiImagePreloaderManager.prototype=new BiObject;_p._className="BiImagePreloaderManager";_p.getPreloader=function(oUri){return this._imagePreloaders[String(oUri)];};_p.addPreloader=function(oImagePreloader){this._imagePreloaders[String(oImagePreloader._uri)]=oImagePreloader;};_p.hasPreloader=function(oUri){return this._imagePreloaders[String(oUri)]!=null;};_p.dispose=function(){if(this._disposed)return;application.removeEventListener("dispose",this.dispose,this);for(var uri in this._imagePreloaders)
{this._imagePreloaders[uri].dispose();delete this._imagePreloaders[uri];}
BiImagePreloaderManager._singleton=null;};function BiImagePreloader(oUri){var man=new BiImagePreloaderManager();var sUri=String(oUri);if(man.hasPreloader(sUri))
return man.getPreloader(sUri);BiEventTarget.call(this);this._uri=oUri;this._jsImage=new Image();this._jsImage._biImagePreloader=this;this._jsImage.onload=BiImagePreloader.__onload;this._jsImage.onerror=BiImagePreloader.__onerror;if(this._uri)
this._jsImage.src=sUri;man.addPreloader(this);}
_p=BiImagePreloader.prototype=new BiEventTarget;_p._className="BiImagePreloader";_p._loaded=false;BiImagePreloader.__onload=function(){this._biImagePreloader._onload();};BiImagePreloader.__onerror=function(){this._biImagePreloader._onerror();};_p.getWidth=function(){if(BiBrowserCheck.moz)
return this._jsImage.naturalWidth;else return this._jsImage.width;};_p.getHeight=function(){if(BiBrowserCheck.moz)
return this._jsImage.naturalHeight;else return this._jsImage.height;};_p.getLoaded=function(){if(BiBrowserCheck.ie)
return this._jsImage.readyState=="complete";else return this._loaded;}
_p._isPng=function(){return/\.png$/i.test(this._jsImage.nameProp);};_p.dispose=function(){if(this._disposed)return;BiEventTarget.prototype.dispose.call(this);this._jsImage.onload=this._jsImage.onerror=null;this._jsImage._biImagePreloader=null;this._jsImage=null;this._uri=null;this._loaded=false;};_p._onload=function(){this._loaded=true;this.dispatchEvent(new BiEvent("load"));};_p._onerror=function(){this._loaded=false;this.dispatchEvent(new BiEvent("error"));};function BiImage(oUri,nWidth,nHeight)
{BiComponent.call(this);this.setHtmlProperty("src",BiImage.BLANK_IMAGE_URI);this.setCanSelect(false);if(nWidth!=null)
this.setWidth(nWidth);if(nHeight!=null)
this.setHeight(nHeight);if(oUri)
this.setUri(oUri);}
_p=BiImage.prototype=new BiComponent;_p._className="BiImage";BiImage.BLANK_IMAGE_URI=application.getPath()+"images/blank.gif";BiImage.fromUri=function(oUri)
{return new BiImage(oUri);};_p._uri=null;_p._tagName="IMG";_p._width=null;_p._height=null;_p.setUri=function(oUri)
{if(this._uri!=oUri)
{if(this._imagePreloader)
{this._imagePreloader.removeEventListener("load",this._onload,this);this._imagePreloader.removeEventListener("error",this._onerror,this);}
if(oUri!=null)
{if(oUri instanceof BiUri)
this._uri=oUri;else this._uri=new BiUri(application.getAdfPath(),oUri);}
else this._uri=null;if(this._uri)
{this._imagePreloader=new BiImagePreloader(this._uri);if(this._imagePreloader.getLoaded())
this._onload();else {this._imagePreloader.addEventListener("load",this._onload,this);this._imagePreloader.addEventListener("error",this._onerror,this);}}}};BiImage.prototype.getUri=function(){return this._uri;};_p.getPreferredWidth=function()
{if(this._preferredWidth!=null)
return this._preferredWidth;if(this._imagePreloader)
return this._imagePreloader.getWidth();throw new Error("No image file");};_p.getPreferredHeight=function()
{if(this._preferredHeight!=null)
return this._preferredHeight;if(this._imagePreloader)
return this._imagePreloader.getHeight();throw new Error("No image file");};_p.getWidth=function()
{if(this._width!=null&&(this._left==null||this._right==null))
return this._width;else return BiComponent.prototype.getWidth.call(this);};_p.getHeight=function()
{if(this._height!=null&&(this._top==null||this._bottom==null))
return this._height;else return BiComponent.prototype.getHeight.call(this);};_p.getLoaded=function()
{if(this._imagePreloader)
return this._imagePreloader.getLoaded();throw new Error("No image file");};_p.dispose=function()
{if(this._disposed)return;if(this._imagePreloader)
{this._imagePreloader.removeEventListener("load",this._onload,this);this._imagePreloader.removeEventListener("error",this._onerror,this);}
this._imagePreloader=null;if(this._element)
this._element.style.filter="none";BiComponent.prototype.dispose.call(this);};_p._create=function(oDocument)
{BiComponent.prototype._create.call(this,oDocument);this._element.removeAttribute("width");this._element.removeAttribute("height");};_p._recreate=function()
{if(!this._created||this._disposed)return;var el=this._element;if(!el||!el.parentNode)return;if(el)
{el._biComponent=null;el.onscroll=el.onresize=el.onlosecapture=null;el.style.filter="";}
this._create(this._document);if(el.parentNode)
el.parentNode.replaceChild(this._element,el);};_p._onload=function()
{if(BiBrowserCheck.ie)
{if(this._isPng())
{var w=this._width;var h=this._height
this.setHtmlProperty("src",BiImage.BLANK_IMAGE_URI);if(w==null)
this.setStyleProperty("width",this.getPreferredWidth()+"px");if(h==null)
this.setStyleProperty("height",this.getPreferredHeight()+"px");this._recreate();this.setStyleProperty("filter","progid:DXImageTransform.Microsoft."+"AlphaImageLoader(src='"+this._uri+"',sizingMethod='scale')");}
else {this.removeStyleProperty("filter");this.setHtmlProperty("src",String(this._uri));if(this._width==""||this._width==null)
this.removeStyleProperty("width");if(this._height==""||this._height==null)
this.removeStyleProperty("height");}}
else {this.setHtmlProperty("src",String(this._uri));}
this.dispatchEvent(new BiEvent("load"));};_p._onerror=function()
{this.dispatchEvent(new BiEvent("error"));};_p._isPng=function()
{if(this._imagePreloader)
return this._imagePreloader._isPng();return false;};if(BiBrowserCheck.ie)
{_p.setOpacity=function(n)
{if(this._opacity!=n)
{this._opacity=n;var x=Math.max(0,Math.min(100,Math.round(n*100)));var base=this._isPng()?"progid:DXImageTransform.Microsoft."+"AlphaImageLoader(src='"+this._uri+"',sizingMethod='scale')":"";if(x==100)
this.setStyleProperty("filter",base);else this.setStyleProperty("filter","Alpha(Opacity="+x+") "+base);}};}
_p.getIconHtml=function(bHasText,bEnabled,sIconPosition,nIconTextGap,sClassName)
{if(typeof bHasText!="boolean")
{throw new Exception("BiImage getIconHtml has changed");var c=bHasText;bHasText=!(c._html==""||c._text=="");bEnabled=c.getEnabled();sIconPosition=c.getIconPosition();nIconTextGap=c.getIconTextGap();}
var w=this._width;var h=this._height;if(this.getLoaded())
{if(w==null)
w=this.getPreferredWidth();if(h==null)
h=this.getPreferredHeight();}
var marginSide,blockStyle="";switch(sIconPosition)
{case"right":marginSide="left";break;case"top":marginSide="bottom";blockStyle="display:block;"
break;case"bottom":marginSide="top";blockStyle="display:block;"
break;default:marginSide="right";break;}
var iconTextGap=bHasText?nIconTextGap:0;if(BiBrowserCheck.ie)
{var isPng=this._isPng();var uri=!isPng?this.getUri():BiImage.BLANK_IMAGE_URI;var imgFilter;if(isPng){imgFilter="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+this.getUri()+"',sizingMethod='scale');";spanFilter="filter:gray() alpha(opacity=50);";}
else{imgFilter=bEnabled?"":"filter:gray() alpha(opacity=50);";spanFilter="";}
return(!bEnabled&&isPng?"<span style=\""+spanFilter+"width:1px;"+blockStyle+"\">":"")+"<img src=\""+uri+"\" style=\"vertical-align:middle;"+(w?"width:"+w+"px;":"")+(h?"height:"+h+"px;":"")+blockStyle+imgFilter+"margin-"+marginSide+":"+iconTextGap+"px;\""+(sClassName?" class=\""+sClassName+"\"":"")+(!bEnabled&&isPng?"></span>":">");}
else {var brBefore=sIconPosition=="bottom"&&bHasText?"<br>":"";var brAfter=sIconPosition=="top"&&bHasText?"<br>":"";return brBefore+"<img src=\""+this.getUri()+"\" style=\"vertical-align:middle;"+"width:"+w+"px;"+"height:"+h+"px;"+(!bEnabled?"-moz-opacity:0.5
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -