📄 core.js
字号:
else {var s;this._overflowX=sOverflowX;if(this._overflowX=="hidden"&&this._overflowY=="hidden")
s="-moz-scrollbars-none";else if(this._overflowX==this._overflowY)
s=sOverflowX;else if(this._overflowX=="hidden"&&this._overflowY=="scroll")
s="-moz-scrollbars-vertical";else if(this._overflowX=="scroll"||this._overflowY=="scroll")
s="scroll";else if(this._overflowX=="auto"||this._overflowY=="auto")
s="auto";else s="-moz-scrollbars-horizontal";this.setStyleProperty("overflow",s);}
if(!this.getHasFixedWidth()||!this.getHasFixedHeight())
this.invalidateParentLayout("size");this.invalidateLayout();}};_p.setOverflowY=function(sOverflowY)
{if(this._overflowY!=sOverflowY)
{if(BiBrowserCheck.ie)
{this.setStyleProperty("overflowY",sOverflowY);}
else {var s;this._overflowY=sOverflowY;if(this._overflowX=="hidden"&&this._overflowY=="hidden")
s="-moz-scrollbars-none";else if(this._overflowX==this._overflowY)
s=sOverflowY;else if(this._overflowX=="hidden"&&this._overflowY=="scroll")
s="-moz-scrollbars-vertical";else if(this._overflowX=="scroll"||this._overflowY=="scroll")
s="scroll";else if(this._overflowX=="auto"||this._overflowY=="auto")
s="auto";else s="-moz-scrollbars-horizontal";this.setStyleProperty("overflow",s);}
if(!this.getHasFixedWidth()||!this.getHasFixedHeight())
this.invalidateParentLayout("size");this.invalidateLayout();}};_p.getOverflowX=function()
{if(BiBrowserCheck.ie)
return this.getStyleProperty("overflowX");else {var s=this.getStyleProperty("overflow");if(s=="-moz-scrollbars-horizontal")
return"scroll";else if(s=="-moz-scrollbars-vertical"||s=="-moz-scrollbars-none")
return"hidden";else return s;}};_p.getOverflowY=function()
{if(BiBrowserCheck.ie)
return this.getStyleProperty("overflowY");else {var s=this.getStyleProperty("overflow");if(s=="-moz-scrollbars-vertical")
return"scroll";else if(s=="-moz-scrollbars-horizontal"||s=="-moz-scrollbars-none")
return"hidden";else return s;}};_p.setScrollLeft=function(nScrollLeft){if(!this._created)
throw new Error("Visual property on non created component");this._element.scrollLeft=nScrollLeft;};_p.setScrollTop=function(nScrollTop){if(!this._created)
throw new Error("Visual property on non created component");this._element.scrollTop=nScrollTop;};_p.getScrollLeft=function(){if(!this._created)
throw new Error("Visual property on non created component");BiComponent.flushLayoutComponent(this);this._element.offsetWidth;return this._element.scrollLeft;};_p.getScrollTop=function(){if(!this._created)
throw new Error("Visual property on non created component");BiComponent.flushLayoutComponent(this);this._element.offsetHeight;return this._element.scrollTop;};_p.getScrollWidth=function(){if(!this._created)
throw new Error("Visual property on non created component");BiComponent.flushLayoutComponent(this);this._element.offsetWidth;if((new BiBrowserCheck).getIe55()){var max=this._element.scrollWidth;var cs=this._children;var l=cs.length;for(var i=0;i<l;i++)
max=Math.max(max,cs[i].getLeft()+cs[i].getWidth());return max;}
else return this._element.scrollWidth;};_p.getScrollHeight=function(){if(!this._created)
throw new Error("Visual property on non created component");BiComponent.flushLayoutComponent(this);this._element.offsetHeight;if((new BiBrowserCheck).getIe55()){var max=this._element.scrollHeight;var cs=this._children;var l=cs.length;for(var i=0;i<l;i++)
max=Math.max(max,cs[i].getTop()+cs[i].getHeight());return max;}
else return this._element.scrollHeight;};_p.scrollIntoView=function(bTopLeft){this.scrollIntoViewX(bTopLeft);this.scrollIntoViewY(bTopLeft);};_p.scrollIntoViewX=function(bLeft){if(!this._created){return;}
var p=this._parent;if(!p)return;var l=this.getLeft();var w=this.getWidth();var sl=p.getScrollLeft();var cw=p.getClientWidth();if(bLeft)
p.setScrollLeft(l);else if(bLeft==false)
p.setScrollLeft(l+w-cw);else if(w>cw||l<sl)
p.setScrollLeft(l);else if(l+w>sl+cw)
p.setScrollLeft(l+w-cw);};_p.scrollIntoViewY=function(bTop){if(!this._created){return;}
var p=this._parent;if(!p)return;var t=this.getTop();var h=this.getHeight();var st=p.getScrollTop();var ch=p.getClientHeight();if(bTop)
p.setScrollTop(t);else if(bTop==false)
p.setScrollTop(t+h-ch);else if(h>ch||t<st)
p.setScrollTop(t);else if(t+h>st+ch)
p.setScrollTop(t+h-ch);};BiComponent.prototype.getTabIndex=function(){return this._tabIndex;};_p.setTabIndex=function(nTabIndex){this._tabIndex=nTabIndex;if(BiBrowserCheck.ie)
{this.setHtmlProperty("unselectable",nTabIndex<0||!this._enabled);this.setHtmlProperty("tabIndex",nTabIndex<0?-1:1);}
else {this.setStyleProperty("MozUserFocus",nTabIndex<0?"ignore":"normal");}};BiComponent.prototype.getHideFocus=function(){return this._hideFocus;};_p.setHideFocus=function(bHideFocus)
{this._hideFocus=bHideFocus;if(BiBrowserCheck.ie)
this.setHtmlProperty("hideFocus",bHideFocus);else {if(bHideFocus)
this.setStyleProperty("MozOutline","none");else this.removeStyleProperty("MozOutline");}};_p._focusComponent=function()
{if(BiBrowserCheck.ie)
{try
{this._element.focus();}
catch(ex){}}
else {if(this._element.focus)
{try
{this._element.focus();}
catch(ex){}}
else {var tlc=this.getTopLevelComponent();if(tlc)
{tlc._eventManager._mozOnFocus(null,this,this._element);}}}};_p._blurComponent=function()
{if(this.getDisposed())
return;if(BiBrowserCheck.ie)
{this._element.blur();}
else {if(this._element.blur)
{try{this._element.blur();}
catch(ex){}}
else {var tlc=this.getTopLevelComponent();if(tlc)
{tlc._eventManager._mozOnBlur(null,this,this._element);}}}};BiComponent.prototype.getFocused=function(){return this._focused;};_p.setFocused=function(bFocused)
{if(bFocused&&!this.getCanFocus())
throw new Error("Cannot set focus to component");if(this._focused!=bFocused){if(bFocused)
this._focusComponent();else{this.getTopLevelComponent()._eventManager._setFocusedComponent(null);this._blurComponent();}}};_p.getContainsFocus=function(){var fr=this.getFocusRoot();if(fr)
return this.contains(fr.getActiveComponent());return false;};_p.getCanFocus=function(){return this._created&&this.getTabIndex()>=0&&this.getIsEnabled()&&this.getIsVisible();};_p.getFocusRoot=function(){if(this._parent)
return this._parent.getFocusRoot();return null;};_p.getActiveComponent=function(){var fr=this.getFocusRoot();if(fr)
return fr.getActiveComponent();return null;};_p.isFocusRoot=function(){return false;};BiComponent.prototype.getFocusManager=function(){return this._focusManager;};BiComponent.prototype.setFocusManager=function(v){this._focusManager=v;};_p.getTabChildren=function()
{return this.getChildren();};BiComponent.prototype.getCanSelect=function(){return this._canSelect;};_p.setCanSelect=function(bCanSelect)
{this._canSelect=bCanSelect;if(BiBrowserCheck.ie)
{if(bCanSelect)
this.removeHtmlProperty("unselectable");else this.setHtmlProperty("unselectable","on");}
else {if(bCanSelect)
this.removeStyleProperty("MozUserSelect");else this.setStyleProperty("MozUserSelect","none");}};BiComponent.prototype.getEnabled=function(){return this._enabled;};_p.setEnabled=function(bEnabled)
{if(this._enabled!=bEnabled)
{if(this.getTabIndex()>=0)
{if(BiBrowserCheck.ie)
{if(!bEnabled||!this._canSelect)
this.setHtmlProperty("unselectable","on");else this.removeHtmlProperty("unselectable");}
if(!bEnabled&&this.getFocused()){this.setFocused(false);}}
this._enabled=bEnabled;this.setHtmlProperty("disabled",!bEnabled);if(BiBrowserCheck.moz)
{if(bEnabled)
this._removeHtmlAttribute("disabled");else this._setHtmlAttribute("disabled","true");}
this.dispatchEvent(new BiEvent("enabledchanged"));if(this._command)
this._command.setEnabled(bEnabled);var tlc;if(bEnabled&&this.getCanFocus()&&(tlc=this.getTopLevelComponent())&&tlc.getActiveComponent()==this)
{this.setFocused(true);}}};_p.getIsEnabled=function()
{if(!this.getEnabled())
return false;var p=this.getParent();if(p)
return p.getIsEnabled();return true;};BiComponent.prototype.getCapture=function(){return this._capture;};_p.setCapture=function(bCapture){if(this._created){this._element.onlosecapture=BiComponent.__oninlineevent;this._capture=bCapture;if(bCapture){if(BiBrowserCheck.ie)
this._element.setCapture();this.getTopLevelComponent()._eventManager.setCaptureComponent(this);}
else{if(BiBrowserCheck.ie)
this._element.releaseCapture();else this.getTopLevelComponent()._eventManager.setCaptureComponent(null);}}};_p.setAccessKey=function(sAccessKey){this.setHtmlProperty("accessKey",sAccessKey);};_p.getAccessKey=function(){return this.getHtmlProperty("accessKey");};BiComponent.prototype.getContextMenu=function(){return this._contextMenu;};BiComponent.prototype.setContextMenu=function(v){this._contextMenu=v;};BiComponent.prototype.getName=function(){return this._name;};BiComponent.prototype.setName=function(v){this._name=v;};BiComponent.prototype.setToolTip=function(v){this._toolTip=v;};BiComponent.prototype.getToolTipText=function(){return this._toolTipText;};BiComponent.prototype.setToolTipText=function(v){this._toolTipText=v;};_p.getToolTip=function(){if(this._toolTip!=null)
return this._toolTip;if(this._toolTipText!=null)
return BiToolTip.getTextToolTip(this._toolTipText);return null;};_p.setRightToLeft=function(b){if(b==true)
this.setStyleProperty("direction","rtl");else if(b==false)
this.setStyleProperty("direction","ltr");else this.removeStyleProperty("direction");};_p.getRightToLeft=function(){var v=this.getStyleProperty("direction");if(v==null&&this._parent)
return this._parent.getRightToLeft();return v=="rtl";};BiComponent.prototype.getCreated=function(){return this._created;};BiComponent._createEvent=new BiEvent("create");_p._create=function(oDocument){this._document=oDocument||document;var el=this._element=this._document.createElement(this._tagName);el._biComponent=this;this._setHtmlProperties();this._setCssProperties();if(BiBrowserCheck.ie)
{el.onscroll=BiComponent.__oninlineevent;}
else {this._setHtmlAttributes();el.onscroll=el.onfocus=BiComponent.__oninlineevent;}};_p._createChildren=function(oDocument){var cs=this._children;var l=cs.length;for(var i=0;i<l;i++){cs[i]._addHtmlElementToParent(this,null);}};_p._setCssProperties=function(){var es=this._element.style;var sp=this._style;for(var p in sp){es[p]=sp[p];}};_p._setHtmlProperties=function(){var el=this._element;var hp=this._htmlProperties;for(var p in hp){el[p]=hp[p];}};_p._setHtmlAttributes=function(){var el=this._element;var ha=this._htmlAttributes;for(var n in ha)
el.setAttribute(n,ha[n]);};_p._addHtmlElementToParent=function(oParent,oBefore)
{if(this._lazyCreate&&!this.getVisible())
return;if(!this._created)
this._create(oParent._document);if(oBefore&&oBefore._element)
oParent._element.insertBefore(this._element,oBefore._element);else oParent._element.appendChild(this._element);this._created=true;this._createChildren(oParent._document,false);this.invalidateParentLayout();this.dispatchEvent(BiComponent._createEvent);};_p._removeHtmlElement=function(oChild){oChild._removeHtmlElementFromParent(this);};_p._removeHtmlElementFromParent=function(oParent)
{if(this._created&&!(application&&application._disposed))
oParent._element.removeChild(this._element);};_p._oninlineevent=function(e)
{if(this._disposed)return;if(!e)
e=this._document.parentWindow.event;switch(e.type)
{case"losecapture":this._capture=false;this.getTopLevelComponent()._eventManager.setCaptureComponent(null);break;case"focus":if(this.getCanFocus())
this.getTopLevelComponent()._eventManager._mozOnFocus(e,this,this._element);return;case"propertychange":if(e.propertyName=="onpropertychange")
return;break;}
this.dispatchEvent(new BiEvent(e.type));application.flushLayoutQueue();};_p.dispose=function(){if(this._disposed)return;BiEventTarget.prototype.dispose.call(this);this.setCommand(null);var cs=this._children;for(var i=cs.length-1;i>=0;i--)
cs[i].dispose();if(this._border!=BiComponent.prototype._border)
this._border.dispose();this._border=null;var el=this._element;if(el){el._biComponent=null;el.onscroll=el.onfocus=el.onlosecapture=null;}
this.__oninlineevent=null;this._document=null;this._style=null;this._htmlProperties=null;this._children=null;this._parent=null;this._element=null;this._created=false;};_p.addXmlNode=function(oNode,oParser)
{if(oNode.nodeType==1)
{var c=oParser.fromNode(oNode);if(c instanceof BiComponent)
this.add(c);}};_p.setAttribute=function(sName,sValue,oParser)
{switch(sName)
{case"border":if(sValue.charAt(0)=="#")
{sValue=sValue.substr(1);var b=oParser.getComponentById(sValue);this.setBorder(b);}
else this.setBorder(BiBorder.fromString(sValue));break;case"contextMenu":case"toolTip":case"command":if(sValue.charAt(0)=="#")
sValue=sValue.substr(1);var ref=oParser.getComponentById(sValue);this.setProperty(sName,ref);break;case"margin":var parts=sValue.split(/\s+/).map(parseFloat);this.setMargin.apply(this,parts);break;default:BiEventTarget.prototype.setAttribute.apply(this,arguments);}};_p._command=null;BiComponent.prototype.getCommand=function(){return this._command;};_p.setCommand=function(oCommand)
{if(this._command!=oCommand)
{if(this._command)
{this._command.removeEventListener("enabledchanged",this._syncWithCommmand,this);this._command.removeEventListener("checkedchanged",this._syncWithCommmand,this);this._command.removeEventListener("uservaluechanged",this._syncWithCommmand,this);this._command.removeEventListener("shortcutchanged",this._syncWithCommmand,this);}
this._command=oCommand;if(this._command)
{this._syncWithCommmand();this._command.addEventListener("enabledchanged",this._syncWithCommmand,this);this._command.addEventListener("checkedchanged",this._syncWithCommmand,this);this._command.addEventListener("uservaluechanged",this._syncWithCommmand,this);this._command.addEventListener("shortcutchanged",this._syncWithCommmand,this);}}};_p._syncWithCommmand=function()
{if(this._command)
{this.setEnabled(this._command.getEnabled());}};_p.setDropDataTypes=function(aDataTypes)
{this._dropDataTypes=aDataTypes;};_p.getDropDataTypes=function()
{return this._dropDataTypes||[];};_p.setCssClassName=function(s)
{this._cssClassName=s;this.setHtmlProperty("className",s+application.getThemeManager().getAppearanceTag(this));};_p.getCssClassName=function(){return this._cssClassName;};_p.setAppearance=function(sName)
{this._appearance=sName;var tm=application.getThemeManager();tm.setAppearance(this,sName);tm.addAppearance(this);};_p.getAppearance=function()
{return this._appearance;};BiComponent.invalidateAll=function()
{var allElements;if
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -