📄 ig_webpanel.js
字号:
/*
Infragistics WebPanel Script
Version 5.1.20051.37
js-version 5.1.20051.18
Copyright (c) 2005 Infragistics, Inc. All Rights Reserved.
*/
function ig_CreateWebPanel(id,props){
if(!ig_WebControl.prototype.isPrototypeOf(ig_WebPanel.prototype))
{
ig_WebPanel.prototype = new ig_WebControl();
ig_WebPanel.prototype.constructor = ig_WebPanel;
ig_WebPanel.prototype.base=ig_WebControl.prototype;
ig_WebPanel.prototype.fireServerEvent =function(eventName,data){ __doPostBack(this._uniqueID,eventName+":"+data);}
ig_WebPanel.prototype.fireEvent =function(clientEvent,evt)
{
if(clientEvent==null||this._isInitializing)return false;
clientEvent._event.reset();
clientEvent._event.event=evt;
clientEvent._event.needPostBack=clientEvent._autoPostBack;
ig_fireEvent(this,clientEvent._handler,clientEvent._event);
if(!clientEvent._event.cancel&&clientEvent._event.needPostBack&&!clientEvent._event.cancelPostBack){this.fireServerEvent(clientEvent._eventName,clientEvent._getData())};
return clientEvent._event.cancel;
}
ig_WebPanel.prototype.notifyExpandComplete=function(evt){return this.onExpanded(evt);}
ig_WebPanel.prototype.getHeader =function(){return this._header;}
ig_WebPanel.prototype.onExpanding =function(e){return this.fireEvent(this._clientSideEvents._expandedStateChanging,e);}
ig_WebPanel.prototype.onExpanded =function(e){this._header._element.className=this.getExpanded()?this._header._expandedClass:this._header._collapsedClass; return this.fireEvent(this._clientSideEvents._expandedStateChanged,e);}
ig_WebPanel.prototype.updateState =function(propName,value){ig_ClientState.setPropertyValue(this.getViewState(),propName,value);this.updatePostField();}
ig_WebPanel.prototype.updatePostField =function(){this._hiddenField.value=ig_ClientState.getText(this.getStateBag());}
ig_WebPanel.prototype.getStateBag =function(){if(this._stateBag==null)this._stateBag=ig_ClientState.createRootNode();return this._stateBag;}
ig_WebPanel.prototype.getViewState =function(){if(this._viewState==null)this._viewState=ig_ClientState.addNode(this.getStateBag(),"WebPanel");return this._viewState;}
ig_WebPanel.prototype.getEnabled =function(){return !(this._element.disabled);}
ig_WebPanel.prototype.setEnabled =function(enable){this._element.disabled=!enable;this.updateState("Enabled",enable);}
ig_WebPanel.prototype.getExpandEffect =function(){return this._expandEffect}
ig_WebPanel.prototype.setExpandEffect =function(effect){this._expandEffect=effect;this.updateState("ExpandEffect",effect);}
ig_WebPanel.prototype.getExpanded =function(){return this._contentPanelElement.style.display!="none";}
ig_WebPanel.prototype.setExpanded =function(expand,evt)
{
var useEffect=this._expandEffect==1 && this._expandEffectSupported&&!this._isInitializing;
if(this.getExpanded()==expand)return;
this.updateState("Expanded",expand?"true":"false");
if(this.onExpanding(evt))return;
this.switchExpansionIndicator(expand);
if(expand && !useEffect){
if(this._preCollapseHeight!=null)this._element.style.height=this._preCollapseHeight;
}else{
this._preCollapseWidth=this._element.offsetWidth;
if(this._element.style.height!=null){
this._preCollapseHeight=parseInt(this._element.style.height?this._element.style.height:this._element.offsetHeight);
if(!useEffect)this._element.style.height=this._headerElement.offsetHeight;
}
}
var row=this._contentPanelElement.parentNode;
if(expand)this.adjustSizes(true);
if(useEffect ){
if(this._expandEffectGenerator==null)this._expandEffectGenerator=new igpnl_ExpandEffectGenerator(this);
this._expandEffectGenerator.expand(expand,evt);
}else{
if(!expand)this.adjustSizes(false);
this.onExpanded(evt);
}
}
ig_WebPanel.prototype.switchExpansionIndicator=function(expand)
{
var img=this._header._imageElement;
var imgSrc=(expand?img.getAttribute("expandedUrl"):(img.getAttribute("collapsedUrl")?img.getAttribute("collapsedUrl"):img.getAttribute("expandedUrl")));
if(imgSrc)img.src=imgSrc;
}
ig_WebPanel.prototype.adjustSizes =function(expand)
{
var row=this._contentPanelElement.parentNode;
if(!expand){
this._contentPanelElement.style.display=row.style.display="none";
if(this._element.offsetWidth<this._preCollapseWidth)this._element.style.width=this._preCollapseWidth;
this._element.style.height=this._headerElement.offsetHeight;
}else{
this._contentPanelElement.style.display=row.style.display="";
}
}
ig_WebPanel.prototype.getVisible =function(){return this._element.style.display!="none";}
ig_WebPanel.prototype.setVisible =function(show){ this._element.style.display=(show?"":"none");this.updateState("Visible",show);}
ig_WebPanel.prototype.init =function(id,props)
{
this.base.init.apply(this,[id]);
this._isInitializing=true;
this.Type="WebPanel";
if(props!=null&&props.length){
this._expandEffectSupported = !((navigator.userAgent.toLowerCase().indexOf("win98")!=-1) || (navigator.userAgent.toLowerCase().indexOf("windows 98")!=-1));
this._uniqueID =props[0];
this._clientID =props[1];
this._expanded =props[2];
this._enabled =props[3];
this._expandEffect =props[4];
this._element =ig.getElementById(this._clientID);
this._contentPanelElement =ig.getElementById(id+"_content");
this._headerElement =ig.getElementById(id+"_header");
this._clientSideEvents =new igpnl_ClientSideEvents(this,props[5]);
this._panelClass =props[6];
this._header =new ig_PanelHeader(this,this._headerElement,props[7]);
this._hiddenField =ig.getElementById(this._uniqueID+"_hidden");
if(this._hiddenField==null)
this._hiddenField=(typeof(document.getElementsByName)!="undefined"?(document.getElementsByName(this._uniqueID+"_hidden"))[0]:null);
if(!this._expanded)this.setExpanded(this._expanded);
if(!this._enabled)this.setEnabled(this._enabled);
}
this._isInitializing=false;
}//init()
}
return new ig_WebPanel(id, props);
}
function ig_WebPanel(id,props){
if(arguments.length>0)this.init(id,props);
}
function igpnl_getPanelById(id){
return ig_getWebControlById(id);
}
igpnl_ClientSideEvents.prototype.constructor=igpnl_ClientSideEvents;
igpnl_ClientSideEvents.prototype.init=function(panel,props){
this._panel=panel;
this._expandedStateChanging=new igpnl_ClientSideEvent(this._panel,props[0],"ExpandedStateChanging");
this._expandedStateChanging._getData=function(){return !this._panel.getExpanded();}
this._expandedStateChanged=new igpnl_ClientSideEvent(this._panel,props[1],"ExpandedStateChanged");
this._expandedStateChanged._getData=function(){return this._panel.getExpanded();}
}
function igpnl_ClientSideEvent(panel,props,name){
this._panel=panel;
this._handler=props[0];
this._autoPostBack=props[1];
this._eventName=name;
this._event=new ig_EventObject();
}
function igpnl_ClientSideEvents(panel,props){
if(arguments.length<2)return;
this.init(panel,props);
}
ig_PanelHeader.prototype.constructor=ig_PanelHeader;
ig_PanelHeader.prototype.onMouseOver =function(evt){if(!this.getEnabled())return; this._header._element.className+=" "+this._header._hoverClass;}
ig_PanelHeader.prototype.onMouseOut =function(evt){if(!this.getEnabled())return; this._header._element.className=this._header._panel.getExpanded()?this._header._expandedClass:this._header._collapsedClass;}
ig_PanelHeader.prototype.onButtonClick =function(evt){var panel=igpnl_getCallBackObject(evt);if(panel!=null&&panel.getEnabled()){panel.setExpanded(!panel.getExpanded(),evt);}}
ig_PanelHeader.prototype.onHeaderDoubleClick =function(evt){var panel=igpnl_getCallBackObject(evt);if(panel!=null&&panel.getEnabled()){panel.setExpanded(!panel.getExpanded(),evt);}}
ig_PanelHeader.prototype.setVisible =function(show){this._element.style.display=(show?"":"none");}
ig_PanelHeader.prototype.getVisible =function(){return this._element.style.display!="none";}
function igpnl_getCallBackObject(evt)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -