add a subclass of Ext.ProgressBar that allows for a percentage value to be used

This commit is contained in:
Damien Churchill 2009-02-20 22:19:59 +00:00
parent 13343a6b4b
commit 7279755f24
1 changed files with 22 additions and 4 deletions

View File

@ -1,16 +1,34 @@
Deluge.Details = {}
/*Deluge.ProgressBar = Ext.extend(Ext.ProgressBar, {
Deluge.ProgressBar = Ext.extend(Ext.ProgressBar, {
initComponent: function() {
Deluge.ProgressBar.superClass.initComponent.call(this);
Deluge.ProgressBar.superclass.initComponent.call(this);
},
updateProgress: function(value, text, animate) {
this.value = value || 0;
if (text) {
this.updateText(text);
}
if (this.rendered) {
var w = Math.floor(value*this.el.dom.firstChild.offsetWidth / 100.0);
this.progressBar.setWidth(w, animate === true || (animate !== false && this.animate));
if(this.textTopEl){
//textTopEl should be the same width as the bar so overflow will clip as the bar moves
this.textTopEl.removeClass('x-hidden').setWidth(w);
}
}
this.fireEvent('update', this, value, text);
return this;
}
});
Ext.reg('deluge-progress', Deluge.ProgressBar);*/
Ext.reg('deluge-progress', Deluge.ProgressBar);
Deluge.Details.Status = {
onRender: function(panel) {
this.panel = panel;
this.progressBar = new Ext.ProgressBar({
this.progressBar = new Deluge.ProgressBar({
id: 'pbar-status',
cls: 'deluge-status-progressbar'
});