SpeedTestFinishPanelpublic class SpeedTestFinishPanel extends org.gudy.azureus2.ui.swt.wizard.AbstractWizardPanel Created on May 3, 2007
Created by Alan Snyder
Copyright (C) 2007 Aelitis, All Rights Reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
AELITIS, SAS au capital de 63.529,40 euros
8 Allee Lenotre, La Grille Royale, 78600 Le Mesnil le Roi, France. |
Fields Summary |
---|
com.aelitis.azureus.core.speedmanager.SpeedManager | speedManager | TransferStatsView.limitToTextHelper | helper |
Methods Summary |
---|
private void | createDataLine(org.eclipse.swt.widgets.Composite panel, java.lang.String label, int maxKbps, com.aelitis.azureus.core.speedmanager.SpeedManagerLimitEstimate estimate)One line of data in the UI
GridData gridData;
Label c1 = new Label(panel, SWT.NULL);//max upload
gridData = new GridData();
gridData.horizontalSpan = 1;
gridData.horizontalAlignment = GridData.END;
c1.setLayoutData(gridData);
c1.setText(label+" ");
Label c2 = new Label(panel,SWT.NULL);//kbytes/sec
gridData = new GridData();
gridData.horizontalSpan = 1;
gridData.horizontalAlignment = GridData.CENTER;
c2.setLayoutData(gridData);
String estString = helper.getLimitText( estimate );
c2.setText(estString);
Label c3 = new Label(panel,SWT.NULL);//kbits/sec
gridData = new GridData();
gridData.horizontalSpan = 1;
gridData.horizontalAlignment = GridData.BEGINNING;
c3.setLayoutData(gridData);
String maxBitsPerSec;
if(maxKbps==0){
maxBitsPerSec = MessageText.getString("ConfigView.unlimited");
}else{
maxBitsPerSec = DisplayFormatters.formatByteCountToKiBEtcPerSec( maxKbps );
}
c3.setText(maxBitsPerSec);
| private void | createHeaderLine(org.eclipse.swt.widgets.Composite panel)
GridData gridData;
Label c1 = new Label(panel, SWT.NULL);//label
gridData = new GridData();
gridData.horizontalSpan = 1;
c1.setLayoutData(gridData);
c1.setText(" ");
Label c2 = new Label(panel,SWT.NULL);
gridData = new GridData();
gridData.horizontalSpan = 1;
gridData.horizontalAlignment = GridData.CENTER;
c2.setLayoutData(gridData);
c2.setText( MessageText.getString("SpeedTestWizard.set.upload.bytes.per.sec") );
Label c3 = new Label(panel,SWT.NULL);
gridData = new GridData();
gridData.horizontalSpan = 1;
gridData.horizontalAlignment = GridData.BEGINNING;
c3.setLayoutData(gridData);
c3.setText( MessageText.getString("SpeedTestWizard.set.upload.bits.per.sec") );
| private void | createStatusLine(org.eclipse.swt.widgets.Composite panel, java.lang.String label, boolean enabled)
GridData gridData;
Label r3c1 = new Label(panel, SWT.NULL);//label
gridData = new GridData();
gridData.horizontalSpan = 1;
gridData.horizontalAlignment = GridData.END;
r3c1.setLayoutData(gridData);
r3c1.setText(label);
Label c3 = new Label(panel,SWT.NULL);//enabled or disabled
gridData = new GridData();
gridData.horizontalSpan = 1;
gridData.horizontalAlignment = GridData.CENTER;
c3.setLayoutData(gridData);
if(enabled){
c3.setText( MessageText.getString("SpeedTestWizard.finish.panel.enabled","enabled") );
}else{
c3.setText( MessageText.getString("SpeedTestWizard.finish.panel.disabled","disabled") );
}
Label c2 = new Label(panel,SWT.NULL);//space.
gridData = new GridData();
gridData.horizontalSpan = 1;
gridData.horizontalAlignment = GridData.BEGINNING;
c2.setLayoutData(gridData);
String maxUploadBitsSec = " ";
c2.setText(maxUploadBitsSec);
| public boolean | isPreviousEnabled()
return false;
| public void | show()
String title = MessageText.getString("SpeedTestWizard.finish.panel.title");
wizard.setTitle(title);
Composite rootPanel = wizard.getPanel();
GridLayout layout = new GridLayout();
layout.numColumns = 1;
rootPanel.setLayout(layout);
Composite panel = new Composite(rootPanel, SWT.NULL);
GridData gridData = new GridData( GridData.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL );
panel.setLayoutData(gridData);
layout = new GridLayout();
layout.numColumns = 3;
layout.makeColumnsEqualWidth=true;
panel.setLayout(layout);
Label label = new Label(panel, SWT.WRAP);
gridData = new GridData();
gridData.horizontalSpan = 3;
gridData.widthHint = 380;
label.setLayoutData(gridData);
Messages.setLanguageText(label,"SpeedTestWizard.finish.panel.click.close");
//show the setting for upload speed
SpeedManagerLimitEstimate upEst = speedManager.getEstimatedUploadCapacityBytesPerSec();
int maxUploadKbs = upEst.getBytesPerSec()/1024;
SpeedManagerLimitEstimate downEst = speedManager.getEstimatedDownloadCapacityBytesPerSec();
int maxDownloadKbs = downEst.getBytesPerSec()/1024;
//boolean setting.
boolean autoSpeedEnabled = COConfigurationManager.getBooleanParameter( TransferSpeedValidator.AUTO_UPLOAD_ENABLED_CONFIGKEY );
boolean autoSpeedSeedingEnabled = COConfigurationManager.getBooleanParameter( TransferSpeedValidator.AUTO_UPLOAD_SEEDING_ENABLED_CONFIGKEY );
//spacer 2
Label s2 = new Label(panel, SWT.NULL);
gridData = new GridData();
gridData.horizontalSpan = 3;
s2.setLayoutData(gridData);
String autoSpeed = MessageText.getString("SpeedTestWizard.finish.panel.auto.speed");
createStatusLine(panel, autoSpeed, autoSpeedEnabled);
String autoSpeedWhileSeeding = MessageText.getString("SpeedTestWizard.finish.panel.auto.speed.seeding");
createStatusLine(panel, autoSpeedWhileSeeding, autoSpeedSeedingEnabled);
//spacer 1
Label s1 = new Label(panel, SWT.NULL);
gridData = new GridData();
gridData.horizontalSpan = 3;
s1.setLayoutData(gridData);
//displays a bytes/sec column and a bits/sec column
createHeaderLine(panel);
String maxUploadLbl = MessageText.getString("SpeedView.stats.estupcap");
createDataLine(panel, maxUploadLbl, maxUploadKbs, upEst);
String maxDownloadLbl = MessageText.getString("SpeedView.stats.estdowncap");
createDataLine(panel, maxDownloadLbl, maxDownloadKbs, downEst);
|
|