Package com.biglybt.ui.swt.speedtest
Class SpeedTestPanel
- java.lang.Object
-
- com.biglybt.ui.swt.wizard.AbstractWizardPanel
-
- com.biglybt.ui.swt.speedtest.SpeedTestPanel
-
- All Implemented Interfaces:
NetworkAdminSpeedTesterListener
,NetworkAdminSpeedTestScheduledTestListener
,IWizardPanel
public class SpeedTestPanel extends AbstractWizardPanel implements NetworkAdminSpeedTestScheduledTestListener, NetworkAdminSpeedTesterListener
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
SpeedTestPanel.AbortButtonListener
An abort button listener(package private) class
SpeedTestPanel.EncryptToggleButtonListener
Run test with encryption toggle button listener.(package private) class
SpeedTestPanel.RunButtonListener
A run button listener
-
Field Summary
Fields Modifier and Type Field Description private org.eclipse.swt.widgets.Button
abort
(package private) WizardListener
clListener
private org.eclipse.swt.widgets.Display
display
(package private) int
downloadTest
private org.eclipse.swt.widgets.Button
encryptToggle
(package private) long
maxDownloadTest
(package private) long
maxUploadTest
private NetworkAdminSpeedTestScheduler
nasts
private org.eclipse.swt.graphics.Color
originalColor
private org.eclipse.swt.widgets.ProgressBar
progress
private NetworkAdminSpeedTestScheduledTest
scheduled_test
private static java.lang.String
START_VALUES
private boolean
switched_to_close
private org.eclipse.swt.widgets.Button
test
private boolean
test_running
private org.eclipse.swt.widgets.Combo
testCombo
private org.eclipse.swt.widgets.Label
testCountDown1
private org.eclipse.swt.widgets.Label
testCountDown2
private org.eclipse.swt.widgets.Text
textMessages
(package private) int
uploadTest
-
Fields inherited from class com.biglybt.ui.swt.wizard.AbstractWizardPanel
previousPanel, wizard
-
-
Constructor Summary
Constructors Constructor Description SpeedTestPanel(SpeedTestWizard _wizard, IWizardPanel _previousPanel)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cancel()
void
complete(NetworkAdminSpeedTester tester, NetworkAdminSpeedTesterResult result)
When a test completes.void
complete(NetworkAdminSpeedTestScheduledTest test)
void
finish()
IWizardPanel
getFinishPanel()
IWizardPanel
getNextPanel()
private static int
getProgressBarValueFromString(java.lang.String step)
private static int[]
getTimeLeftFromString(java.lang.String step)
If you find the time left values then use them.private static int
getValueFromAveString(java.lang.String aveStr)
Get the number after the last " " space in the String.boolean
isFinishEnabled()
boolean
isFinishSelectionOK()
This method is called when the "finish" button is pressed.boolean
isNextEnabled()
private static java.lang.String
modifyProgressStatusString(java.lang.String step)
Change the "progress status" string into something that can be displayed.protected void
reportComplete(NetworkAdminSpeedTesterResult result)
protected void
reportStage(java.lang.String step)
protected void
runTest(int test_mode, boolean encrypt_mode)
void
show()
void
stage(NetworkAdminSpeedTester tester, java.lang.String step)
Informs listener when the test is at a new stage.void
stage(NetworkAdminSpeedTestScheduledTest test, java.lang.String step)
protected void
switchToClose()
-
Methods inherited from class com.biglybt.ui.swt.wizard.AbstractWizardPanel
cancelled, getPreviousPanel, isPreviousEnabled
-
-
-
-
Field Detail
-
nasts
private NetworkAdminSpeedTestScheduler nasts
-
scheduled_test
private NetworkAdminSpeedTestScheduledTest scheduled_test
-
testCombo
private org.eclipse.swt.widgets.Combo testCombo
-
encryptToggle
private org.eclipse.swt.widgets.Button encryptToggle
-
originalColor
private org.eclipse.swt.graphics.Color originalColor
-
test
private org.eclipse.swt.widgets.Button test
-
abort
private org.eclipse.swt.widgets.Button abort
-
testCountDown1
private org.eclipse.swt.widgets.Label testCountDown1
-
testCountDown2
private org.eclipse.swt.widgets.Label testCountDown2
-
textMessages
private org.eclipse.swt.widgets.Text textMessages
-
progress
private org.eclipse.swt.widgets.ProgressBar progress
-
display
private org.eclipse.swt.widgets.Display display
-
test_running
private boolean test_running
-
switched_to_close
private boolean switched_to_close
-
uploadTest
int uploadTest
-
downloadTest
int downloadTest
-
maxUploadTest
long maxUploadTest
-
maxDownloadTest
long maxDownloadTest
-
clListener
WizardListener clListener
-
START_VALUES
private static final java.lang.String START_VALUES
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SpeedTestPanel
public SpeedTestPanel(SpeedTestWizard _wizard, IWizardPanel _previousPanel)
-
-
Method Detail
-
show
public void show()
- Specified by:
show
in interfaceIWizardPanel
-
finish
public void finish()
- Specified by:
finish
in interfaceIWizardPanel
- Overrides:
finish
in classAbstractWizardPanel
-
cancel
public void cancel()
-
runTest
protected void runTest(int test_mode, boolean encrypt_mode)
-
stage
public void stage(NetworkAdminSpeedTestScheduledTest test, java.lang.String step)
- Specified by:
stage
in interfaceNetworkAdminSpeedTestScheduledTestListener
-
complete
public void complete(NetworkAdminSpeedTestScheduledTest test)
- Specified by:
complete
in interfaceNetworkAdminSpeedTestScheduledTestListener
-
stage
public void stage(NetworkAdminSpeedTester tester, java.lang.String step)
Description copied from interface:NetworkAdminSpeedTesterListener
Informs listener when the test is at a new stage.- Specified by:
stage
in interfaceNetworkAdminSpeedTesterListener
- Parameters:
tester
- - test running.step
- - String with stage.
-
complete
public void complete(NetworkAdminSpeedTester tester, NetworkAdminSpeedTesterResult result)
Description copied from interface:NetworkAdminSpeedTesterListener
When a test completes.- Specified by:
complete
in interfaceNetworkAdminSpeedTesterListener
- Parameters:
tester
- - test ranresult
- - String with the result
-
reportComplete
protected void reportComplete(NetworkAdminSpeedTesterResult result)
-
reportStage
protected void reportStage(java.lang.String step)
-
modifyProgressStatusString
private static java.lang.String modifyProgressStatusString(java.lang.String step)
Change the "progress status" string into something that can be displayed.- Parameters:
step
- - String must start with "progress:"- Returns:
- - a String that can be displayed in the Text Messages window.
-
getValueFromAveString
private static int getValueFromAveString(java.lang.String aveStr)
Get the number after the last " " space in the String.- Parameters:
aveStr
- - String in format "download ave 32000"- Returns:
- int 32000, or -1 if an error.
-
getTimeLeftFromString
private static int[] getTimeLeftFromString(java.lang.String step)
If you find the time left values then use them. On any error return null and the calling function should handle that condition.- Parameters:
step
- - String in format "progress: #: text: text: #: #" The last two items are the seconds till abort and seconds till complete respectively.- Returns:
- - int array of size 2 with time left in test, or null on any error.
-
getProgressBarValueFromString
private static int getProgressBarValueFromString(java.lang.String step)
- Parameters:
step
- - String with the expected format. "progress: #" where # is 0 - 100.- Returns:
- The number as an integer, if the result is not known return 0.
-
switchToClose
protected void switchToClose()
-
isFinishEnabled
public boolean isFinishEnabled()
- Specified by:
isFinishEnabled
in interfaceIWizardPanel
- Overrides:
isFinishEnabled
in classAbstractWizardPanel
-
isFinishSelectionOK
public boolean isFinishSelectionOK()
Description copied from interface:IWizardPanel
This method is called when the "finish" button is pressed. It allows operations to be carried out before the "finish" panel is shown.- Specified by:
isFinishSelectionOK
in interfaceIWizardPanel
- Overrides:
isFinishSelectionOK
in classAbstractWizardPanel
- Returns:
- true - carry on and show the finish panel; false - operation failed, leave on current panel
-
getFinishPanel
public IWizardPanel getFinishPanel()
- Specified by:
getFinishPanel
in interfaceIWizardPanel
- Overrides:
getFinishPanel
in classAbstractWizardPanel
-
isNextEnabled
public boolean isNextEnabled()
- Specified by:
isNextEnabled
in interfaceIWizardPanel
- Overrides:
isNextEnabled
in classAbstractWizardPanel
-
getNextPanel
public IWizardPanel getNextPanel()
- Specified by:
getNextPanel
in interfaceIWizardPanel
- Overrides:
getNextPanel
in classAbstractWizardPanel
-
-