Alien-Web-ExtJS-V3
view release on metacpan or search on metacpan
share/ext-all-debug-w-comments.js view on Meta::CPAN
// private
var sortWindows = function(d1, d2){
return (!d1._lastAccess || d1._lastAccess < d2._lastAccess) ? -1 : 1;
};
// private
var orderWindows = function(){
var a = accessList, len = a.length;
if(len > 0){
a.sort(sortWindows);
var seed = a[0].manager.zseed;
for(var i = 0; i < len; i++){
var win = a[i];
if(win && !win.hidden){
win.setZIndex(seed + (i*10));
}
}
}
activateLast();
};
// private
var setActiveWin = function(win){
if(win != front){
if(front){
front.setActive(false);
}
front = win;
if(win){
win.setActive(true);
}
}
};
// private
var activateLast = function(){
for(var i = accessList.length-1; i >=0; --i) {
if(!accessList[i].hidden){
setActiveWin(accessList[i]);
return;
}
}
// none to activate
setActiveWin(null);
};
return {
/**
* The starting z-index for windows in this WindowGroup (defaults to 9000)
* @type Number The z-index value
*/
zseed : 9000,
/**
* <p>Registers a {@link Ext.Window Window} with this WindowManager. This should not
* need to be called under normal circumstances. Windows are automatically registered
* with a {@link Ext.Window#manager manager} at construction time.</p>
* <p>Where this may be useful is moving Windows between two WindowManagers. For example,
* to bring the Ext.MessageBox dialog under the same manager as the Desktop's
* WindowManager in the desktop sample app:</p><code><pre>
var msgWin = Ext.MessageBox.getDialog();
MyDesktop.getDesktop().getManager().register(msgWin);
</pre></code>
* @param {Window} win The Window to register.
*/
register : function(win){
if(win.manager){
win.manager.unregister(win);
}
win.manager = this;
list[win.id] = win;
accessList.push(win);
win.on('hide', activateLast);
},
/**
* <p>Unregisters a {@link Ext.Window Window} from this WindowManager. This should not
* need to be called. Windows are automatically unregistered upon destruction.
* See {@link #register}.</p>
* @param {Window} win The Window to unregister.
*/
unregister : function(win){
delete win.manager;
delete list[win.id];
win.un('hide', activateLast);
accessList.remove(win);
},
/**
* Gets a registered window by id.
* @param {String/Object} id The id of the window or a {@link Ext.Window} instance
* @return {Ext.Window}
*/
get : function(id){
return typeof id == "object" ? id : list[id];
},
/**
* Brings the specified window to the front of any other active windows in this WindowGroup.
* @param {String/Object} win The id of the window or a {@link Ext.Window} instance
* @return {Boolean} True if the dialog was brought to the front, else false
* if it was already in front
*/
bringToFront : function(win){
win = this.get(win);
if(win != front){
win._lastAccess = new Date().getTime();
orderWindows();
return true;
}
return false;
},
/**
* Sends the specified window to the back of other active windows in this WindowGroup.
* @param {String/Object} win The id of the window or a {@link Ext.Window} instance
* @return {Ext.Window} The window
*/
sendToBack : function(win){
( run in 0.972 second using v1.01-cache-2.11-cpan-119454b85a5 )