Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] [ndt] r488 committed - Made osfwWorker an outer public class, reorganized methods in Tcpbw100...

Subject: NDT-DEV email list created

List archive

[ndt-dev] [ndt] r488 committed - Made osfwWorker an outer public class, reorganized methods in Tcpbw100...


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt-dev] [ndt] r488 committed - Made osfwWorker an outer public class, reorganized methods in Tcpbw100...
  • Date: Fri, 12 Aug 2011 16:48:09 +0000

Revision: 488
Author:

Date: Fri Aug 12 09:47:53 2011
Log: Made osfwWorker an outer public class, reorganized methods in Tcpbw100.java, renamed class variables and some local variables
http://code.google.com/p/ndt/source/detail?r=488

Added:
/branches/kkumar_code_organize/Applet/OsfwWorker.java
Modified:
/branches/kkumar_code_organize/Applet/Message.java
/branches/kkumar_code_organize/Applet/NDTConstants.java
/branches/kkumar_code_organize/Applet/Protocol.java
/branches/kkumar_code_organize/Applet/StatusPanel.java
/branches/kkumar_code_organize/Applet/Tcpbw100.java

=======================================
--- /dev/null
+++ /branches/kkumar_code_organize/Applet/OsfwWorker.java Fri Aug 12 09:47:53 2011
@@ -0,0 +1,102 @@
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+
+public class OsfwWorker implements Runnable {
+
+ private ServerSocket _srvSocket;
+ private int _iTestTime;
+ private boolean _iFinalized = false;
+ //local TApplet reference
+ Tcpbw100 _localTcpAppObj;
+
+ OsfwWorker(ServerSocket srvSocketParam, int iParamTestTime)
+ {
+ this._srvSocket = srvSocketParam;
+ this._iTestTime = iParamTestTime;
+ }
+
+ OsfwWorker(ServerSocket srvSocketParam, int iParamTestTime, Tcpbw100 _localParam)
+ {
+ this._srvSocket = srvSocketParam;
+ this._iTestTime = iParamTestTime;
+ this._localTcpAppObj = _localParam;
+ }
+
+ public void finalize()
+ {
+ while (!_iFinalized) {
+ try {
+ Thread.currentThread().sleep(1000);
+ }
+ catch (InterruptedException e) {
+ // do nothing.
+ }
+ }
+ }
+
+ public void run()
+ {
+ Message msg = new Message();
+ Socket sock = null;
+
+ try {
+ _srvSocket.setSoTimeout(_iTestTime * 1000);
+ try {
+ sock = _srvSocket.accept();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ //s2cResult = NDTConstants.SFW_POSSIBLE;
+
this._localTcpAppObj.setS2CTestResults(NDTConstants.SFW_POSSIBLE);
+ _srvSocket.close();
+ _iFinalized = true;
+ return;
+ }
+ Protocol sfwCtl = new Protocol(sock);
+
+ //commented out sections indicate move to outer class
+ if (sfwCtl.recv_msg(msg) != 0) {
+ System.out.println("Simple firewall test:
unrecognized message");
+ //s2cResult = NDTConstants.SFW_UNKNOWN;
+
this._localTcpAppObj.setS2CTestResults(NDTConstants.SFW_UNKNOWN);
+ sock.close();
+ _srvSocket.close();
+ _iFinalized = true;
+ return;
+ }
+ if (msg.getType() != MessageType.TEST_MSG) {
+ //s2cResult = NDTConstants.SFW_UNKNOWN;
+
this._localTcpAppObj.setS2CTestResults(NDTConstants.SFW_UNKNOWN);
+ sock.close();
+ _srvSocket.close();
+ _iFinalized = true;
+ return;
+ }
+ if (! new String(msg.getBody()).equals("Simple firewall
test")) {
+ System.out.println("Simple firewall test: Improper
message");
+ //s2cResult = NDTConstants.SFW_UNKNOWN;
+
this._localTcpAppObj.setS2CTestResults(NDTConstants.SFW_UNKNOWN);
+ sock.close();
+ _srvSocket.close();
+ _iFinalized = true;
+ return;
+ }
+ //s2cResult = NDTConstants.SFW_NOFIREWALL;
+
this._localTcpAppObj.setS2CTestResults(NDTConstants.SFW_NOFIREWALL);
+ }
+ catch (IOException ex) {
+ //s2cResult = NDTConstants.SFW_UNKNOWN;
+
this._localTcpAppObj.setS2CTestResults(NDTConstants.SFW_UNKNOWN);
+ }
+ try {
+ sock.close();
+ _srvSocket.close();
+ }
+ catch (IOException e) {
+ // do nothing
+ }
+ _iFinalized = true;
+ }
+}
=======================================
--- /branches/kkumar_code_organize/Applet/Message.java Wed Aug 10 13:58:17 2011
+++ /branches/kkumar_code_organize/Applet/Message.java Fri Aug 12 09:47:53 2011
@@ -10,6 +10,31 @@
*/
public class Message {

- byte type;
- byte[] body;
-}
+ //TODO: Make this private and test changes in Protocol class
+ byte _yType;
+ byte[] _yaBody;
+
+ public byte getType() {
+ return _yType;
+ }
+
+ public void setType(byte bParamType) {
+ this._yType = bParamType;
+ }
+
+ public byte[] getBody() {
+ return _yaBody;
+ }
+
+ public void setBody(byte[] baParamBody, int iParamSize) {
+ _yaBody = new byte[iParamSize];
+ System.arraycopy(baParamBody, 0, _yaBody, 0, iParamSize);
+ }
+
+ public void initBodySize(int iParamSize) {
+ this._yaBody = new byte[iParamSize];
+
+ }
+
+
+}
=======================================
--- /branches/kkumar_code_organize/Applet/NDTConstants.java Wed Aug 10 13:58:17 2011
+++ /branches/kkumar_code_organize/Applet/NDTConstants.java Fri Aug 12 09:47:53 2011
@@ -48,14 +48,21 @@

public static final double VIEW_DIFF = 0.1;

+ //
+ public static String TARGET1 = "U";
+ public static String TARGET2 = "H";

/*Method to initialise a few constants */
- private static ResourceBundle messages;
+ private static ResourceBundle _rscBundleMessages;
public static String TCPBW100_MSGS = "Tcpbw100_msgs";

+
+ //system variables could be declared as strings too
+ //half_duplex:, country , etc
+
public static void initConstants(Locale paramLocale) {
try {
- messages = ResourceBundle.getBundle( TCPBW100_MSGS, paramLocale);
+ _rscBundleMessages = ResourceBundle.getBundle( TCPBW100_MSGS, paramLocale);
System.out.println("Obtained messages ");
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Error while loading language files:\n" + e.getMessage());
@@ -67,7 +74,7 @@
public static void initConstants(String lang, String country) {
try {
Locale locale = new Locale(lang, country);
- messages =
ResourceBundle.getBundle("Tcpbw100_msgs", locale);
+ _rscBundleMessages = ResourceBundle.getBundle("Tcpbw100_msgs", locale);
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Error while loading language files:\n" + e.getMessage());
e.printStackTrace();
@@ -76,7 +83,7 @@


public static String getMessageString(String paramStrName) {
- return messages.getString(paramStrName);
+ return _rscBundleMessages.getString(paramStrName);
}

}
=======================================
--- /branches/kkumar_code_organize/Applet/Protocol.java Wed Aug 10 13:58:17 2011
+++ /branches/kkumar_code_organize/Applet/Protocol.java Fri Aug 12 09:47:53 2011
@@ -5,6 +5,7 @@

/* Class to define Protocol
* TODO :summarize methods below to give a brief explanation of the Protocol class
+ * TODO :use setter/getter methods for
* */


@@ -12,36 +13,38 @@
private InputStream _ctlin;
private OutputStream _ctlout;

- public Protocol(Socket ctlSocket) throws IOException
- {
- _ctlin = ctlSocket.getInputStream();
- _ctlout = ctlSocket.getOutputStream();
+ public Protocol(Socket ctlSocketParam) throws IOException
+ {
+ _ctlin = ctlSocketParam.getInputStream();
+ _ctlout = ctlSocketParam.getOutputStream();
}

- public void send_msg(byte type, byte toSend) throws IOException
- {
- byte[] tab = new byte[] { toSend };
- send_msg(type, tab);
+ public void send_msg(byte bParamType, byte bParamToSend) throws IOException
+ {
+ byte[] tab = new byte[] { bParamToSend };
+ send_msg(bParamType, tab);
}

- public void send_msg(byte type, byte[] tab) throws IOException
+ public void send_msg(byte bParamType, byte[] baParamTab) throws IOException
{
byte[] header = new byte[3];
- header[0] = type;
- header[1] = (byte) (tab.length >> 8);
- header[2] = (byte) tab.length;
+ header[0] = bParamType;
+ header[1] = (byte) (baParamTab.length >> 8);
+ header[2] = (byte) baParamTab.length;

_ctlout.write(header);
- _ctlout.write(tab);
+ _ctlout.write(baParamTab);
}

- public int readn(Message msg, int amount) throws IOException
+ public int readn(Message msgParam, int iParamAmount) throws
IOException
{
int read = 0;
int tmp;
- msg.body = new byte[amount];
- while (read != amount) {
- tmp = _ctlin.read(msg.body, read, amount - read);
+ //msg.body = new byte[amount];
+ msgParam.initBodySize(iParamAmount);
+ while (read != iParamAmount) {
+ //tmp = _ctlin.read(msg.body, read, amount - read);
+ tmp = _ctlin.read(msgParam._yaBody, read,
iParamAmount - read);
if (tmp <= 0) {
return read;
}
@@ -50,16 +53,22 @@
return read;
}

- public int recv_msg(Message msg) throws IOException
+ public int recv_msg(Message msgParam) throws IOException
{
int length;
- if (readn(msg, 3) != 3) {
+ if (readn(msgParam, 3) != 3) {
return 1;
}
- msg.type = msg.body[0];
+ /*
+ * msg.type = msg.body[0];
length = ((int) msg.body[1] & 0xFF) << 8;
- length += (int) msg.body[2] & 0xFF;
- if (readn(msg, length) != length) {
+ length += (int) msg.body[2] & 0xFF;
+ */
+ byte [] yaMsgBody = msgParam.getBody();
+ msgParam.setType(yaMsgBody[0]);
+ length = ((int) yaMsgBody[1] & 0xFF) << 8;
+ length += (int) yaMsgBody[2] & 0xFF;
+ if (readn(msgParam, length) != length) {
return 3;
}
return 0;
=======================================
--- /branches/kkumar_code_organize/Applet/StatusPanel.java Wed Aug 10 13:58:17 2011
+++ /branches/kkumar_code_organize/Applet/StatusPanel.java Fri Aug 12 09:47:53 2011
@@ -11,50 +11,50 @@

public class StatusPanel extends JPanel
{
- private int _testNo;
- private int _testsNum;
- private boolean _stop = false;
-
- private JLabel testNoLabel = new JLabel();
- private JButton stopButton;
- private JProgressBar progressBar = new JProgressBar();
+ private int _iTestsCompleted; //variable used to record the count of "finished" tests
+ private int _iTestsNum;
+ private boolean _bStop = false;
+
+ private JLabel _labelTestNum = new JLabel();
+ private JButton _buttonStop;
+ private JProgressBar _progressBarObj = new JProgressBar();

/* Constructor
* @param testsNum Total number of tests scheduled to be run
* @param sParamaEnableMultiple Are multiple tests scheduled?*/
- StatusPanel(int testsNum, String sParamEnableMultiple) {
- this._testNo = 1;
- this._testsNum = testsNum;
+ StatusPanel(int iParamTestsNum, String sParamEnableMultiple) {
+ this._iTestsCompleted = 1;
+ this._iTestsNum = iParamTestsNum;

setTestNoLabelText();
//re-arch
//If multiple tests are enabled to be run, then add
information about the
//test number being run
if ( sParamEnableMultiple != null) {
- add(testNoLabel);
+ add(_labelTestNum);
}
/*
if ( getParameter("enableMultipleTests") != null ) {
add(testNoLabel);
}*/
- progressBar.setMinimum(0);
- progressBar.setMaximum(_testsNum);
- progressBar.setValue(0);
- progressBar.setStringPainted(true);
- if (_testsNum == 0) {
- progressBar.setString("");
- progressBar.setIndeterminate(true);
+ _progressBarObj.setMinimum(0);
+ _progressBarObj.setMaximum(_iTestsNum);
+ _progressBarObj.setValue(0);
+ _progressBarObj.setStringPainted(true);
+ if (_iTestsNum == 0) {
+ _progressBarObj.setString("");
+ _progressBarObj.setIndeterminate(true);
}
else {
-
progressBar.setString(NDTConstants.getMessageString("initialization"));
- }
- add(progressBar);
- stopButton= new
JButton(NDTConstants.getMessageString("stop"));
- stopButton.addActionListener(new ActionListener() {
+ _progressBarObj.setString(NDTConstants.getMessageString("initialization"));
+ }
+ add(_progressBarObj);
+ _buttonStop= new
JButton(NDTConstants.getMessageString("stop"));
+ _buttonStop.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {
- _stop = true;
- stopButton.setEnabled(false);
+ _bStop = true;
+ _buttonStop.setEnabled(false);

StatusPanel.this.setText(NDTConstants.getMessageString("stopping"));
}

@@ -66,31 +66,31 @@
//If multiple tests are enabled to be run, provide user
option to
// stop the one currently running
if (sParamEnableMultiple != null) {
- add(stopButton);
+ add(_buttonStop);
}
}

/*Set Test number being run*/
private void setTestNoLabelText() {
- testNoLabel.setText(NDTConstants.getMessageString("test") + " " + _testNo + " " + NDTConstants.getMessageString("of") + " " +_testsNum);
+ _labelTestNum.setText(NDTConstants.getMessageString("test") + " " + _iTestsCompleted + " " + NDTConstants.getMessageString("of") + " " +_iTestsNum);
}

/*record intention to stop tests */
public boolean wantToStop() {
- return _stop;
+ return _bStop;
}

/*end the currently runnig test */
public void endTest() {
- progressBar.setValue(_testNo);
- _testNo++;
+ _progressBarObj.setValue(_iTestsCompleted);
+ _iTestsCompleted++;
setTestNoLabelText();
}

/* Set progress text */
- public void setText(String text) {
- if (!progressBar.isIndeterminate()) {
- progressBar.setString(text);
+ public void setText(String sParamText) {
+ if (!_progressBarObj.isIndeterminate()) {
+ _progressBarObj.setString(sParamText);
}
}
} //end class StatusPanel
=======================================
--- /branches/kkumar_code_organize/Applet/Tcpbw100.java Wed Aug 10 13:58:17 2011
+++ /branches/kkumar_code_organize/Applet/Tcpbw100.java Fri Aug 12 09:47:53 2011
@@ -59,36 +59,71 @@
The Software was developed at least in part by the University of Chicago,
as Operator of Argonne National Laboratory (http://miranda.ctd.anl.gov:7123/).
*/
-import java.io.*;
-import java.net.*;
-import java.net.Socket;
-import java.awt.*;
-import java.awt.event.*;
-import java.awt.event.ActionListener;
+/***
+ *
+ * Naming convention used: Hungarian, with the following details
+ * _VarName: Class variable (instead of c_VarName for class variables to reduce length)
+ * iVarName: Integer variable
+ * sVarName: String variable
+ * bVarName: boolean variable
+ * dVarName: double varibale
+ * _iaVarName: Integer "Array" variable
+ * ...and some other self descriptive examples are..
+ * _rscBundleMessages : class scoped ResourceBundle Variable called "Messages"
+ * _cmboboxIpV6 : Class scoped combo-box variable to indicate IpV6 choice..
+ *
+ * Some variables which were called "pub_xxx" are declared to have "accessor" methods for use by
+ * other clients. I have left this untouched. These are class scope variables. Though the type is
+ * not evident from the declaration immediately, the "getter/setter" methods for them will immediately
+ * indicate their types
+ *
+ */
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Dimension;
+import java.awt.Panel;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionEvent;
-import java.awt.datatransfer.*;
-import java.util.*;
-import javax.swing.JLabel;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.Inet6Address;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.MalformedURLException;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.SocketException;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Date;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.StringTokenizer;
+
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
import javax.swing.JApplet;
-import javax.swing.JFrame;
-import javax.swing.JTextArea;
import javax.swing.JButton;
import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
-import javax.swing.BorderFactory;
-import javax.swing.JTextPane;
-import javax.swing.text.BadLocationException;
-import javax.swing.JOptionPane;
-import javax.swing.BoxLayout;
import javax.swing.JSpinner;
+import javax.swing.JTextArea;
import javax.swing.SpinnerNumberModel;
-import javax.swing.JComboBox;
-import javax.swing.JProgressBar;
-
-// Workaround for remote JavaScript start method
-import java.security.AccessController;
-import java.security.PrivilegedAction;


public class Tcpbw100 extends JApplet implements ActionListener
@@ -102,44 +137,46 @@
*/

JTextArea _txtDiagnosis, _txtStatistics;
- ResultsTextPane results;
- String inresult, outresult, errmsg;
- JButton startTest;
- JButton disMiss, disMiss2;
- JButton copy, copy2;
- JButton deTails;
- JButton sTatistics;
- JButton mailTo;
- JButton options;
- JCheckBox defaultTest, preferIPv6;
- JSpinner numOfTests = new JSpinner();
- String[] delays = { "immediate", "1min","5mins","10mins","30mins","2hours","12hours","1day" };
- JComboBox delay;
-
- boolean Randomize, failed, cancopy;
- URL location;
- NewFrame frameWeb100Vars, frameDetailedStats, frameOptions;
- String s;
- double t;
- int ECNEnabled, NagleEnabled, MSSSent, MSSRcvd;
- int SACKEnabled, TimestampsEnabled, WinScaleRcvd, WinScaleSent;
- int FastRetran, AckPktsOut, SmoothedRTT, CurrentCwnd, MaxCwnd;
- int SndLimTimeRwin, SndLimTimeCwnd, SndLimTimeSender;
- int SndLimTransRwin, SndLimTransCwnd, SndLimTransSender, MaxSsthresh;
- int SumRTT, CountRTT, CurrentMSS, Timeouts, PktsRetrans;
- int SACKsRcvd, DupAcksIn, MaxRwinRcvd, MaxRwinSent;
- int DataPktsOut, Rcvbuf, Sndbuf, AckPktsIn, DataBytesOut;
- int PktsOut, CongestionSignals, RcvWinScale;
- int pkts, lth=8192, CurrentRTO;
- int c2sData, c2sAck, s2cData, s2cAck;
+ ResultsTextPane _resultsTxtPane;
+ //String inresult, outresult;
+ String _sErrMsg;
+ JButton _buttonStartTest;
+ //TODO: Use just one button for dismiss and copy
+ JButton _buttonDismiss, _buttonStatsDismiss;
+ JButton _buttonCopy, _buttonStatsCopy;
+ JButton _buttonDetails;
+ JButton _buttonStatistics;
+ JButton _buttonMailTo;
+ JButton _buttonOptions;
+ JCheckBox _chkboxDefaultTest, _chkboxPreferIPv6;
+ JSpinner _spinnerTestCount = new JSpinner();
+ String[] _saDelays = { "immediate", "1min","5mins","10mins","30mins","2hours","12hours","1day" };
+ JComboBox _cmboboxDelay;
+
+ boolean _bRandomize, _bFailed, _bCanCopy;
+ //URL location; //unused, hence commenting out
+ NewFrame _frameWeb100Vars, _frameDetailedStats, _frameOptions;
+ //String s; Unused, commenting out
+ double _dTime;
+ int _iECNEnabled, _iNagleEnabled, MSSSent, MSSRcvd;
+ int _iSACKEnabled, _iTimestampsEnabled, _iWinScaleRcvd,
_iWinScaleSent;
+ int _iFastRetran, _iAckPktsOut, _iSmoothedRTT, _iCurrentCwnd,
_iMaxCwnd;
+ int _iSndLimTimeRwin, _iSndLimTimeCwnd, _iSndLimTimeSender;
+ int _iSndLimTransRwin, _iSndLimTransCwnd, _iSndLimTransSender, _iMaxSsthresh;
+ int _iSumRTT, _iCountRTT, _iCurrentMSS, _iTimeouts, _iPktsRetrans;
+ int _iSACKsRcvd, _iDupAcksIn, _iMaxRwinRcvd, _iMaxRwinSent;
+ int _iDataPktsOut, _iRcvbuf, _iSndbuf, _iAckPktsIn, _iDataBytesOut;
+ int _iPktsOut, _iCongestionSignals, _iRcvWinScale;
+ //what length is 8192? TODO
+ int _iPkts, _iLength=8192, _iCurrentRTO;
+ int _iC2sData, _iC2sAck, _iS2cData, _iS2cAck;
// added for mailto url
- protected URL targetURL;
- private String TARGET1 = "U";
- private String TARGET2 = "H";
- String emailText;
- double s2cspd, c2sspd, sc2sspd, ss2cspd;
- int ssndqueue;
- double sbytes;
+ protected URL _targetURL;
+
+ String _sEmailText;
+ double _dS2cspd, _dC2sspd, _dSc2sspd, _dSs2cspd;
+ int _iSsndqueue;
+ double _dSbytes;


/*************************************************************************
* JavaScript access API extension
@@ -150,7 +187,9 @@
* from web applications using NDT as a back-end.
*/

-
+ //These variables are accessed by the setter/getter methods. While they do not follow naming convention,
+ // are left this way
+ // TODO :What is the difference between pub_c2sspd and _dC2sspd above?
private double pub_c2sspd = 0.0;
private double pub_s2cspd = 0.0;
private int pub_CurRwinRcvd = 0; // source variable does not exist
@@ -189,8 +228,8 @@
private String pub_status = "notStarted";
private double pub_time = 0.0;
private int pub_bytes = 0;
- private String isAutoRun;
- private String userAgent = null;
+ private String _sIsAutoRun;
+ private String _sUserAgent = null;

/**
* Accessor methods for public variables
@@ -437,11 +476,11 @@
}

public String getUserAgent() {
- return userAgent;
+ return _sUserAgent;
}

public void setUserAgent(String userAgent) {
- this.userAgent = userAgent;
+ this._sUserAgent = userAgent;
}

/**
@@ -453,8 +492,8 @@
* Added by Martin Sandsmark, UNINETT AS
* Internationalization
*/
- private Locale locale;
- private ResourceBundle messages;
+ private Locale _localeObj;
+ private ResourceBundle _resBundleMessages;
private String lang="en";
private String country="US";
//private static String lang="nb";
@@ -483,10 +522,10 @@
if (getParameter("language") != null) lang =
getParameter("language");

try {
- locale = new Locale(lang, country);
- messages = ResourceBundle.getBundle("Tcpbw100_msgs",
locale);
-
- //Replaced method call to initialize messages for
access by class
+ _localeObj = new Locale(lang, country);
+ _resBundleMessages = ResourceBundle.getBundle("Tcpbw100_msgs", _localeObj);
+
+ //Replaced method call to initialize _resBundleMessages for access by class
//NDTConstants.initConstants(locale);
NDTConstants.initConstants(lang, country);

@@ -495,39 +534,46 @@
e.printStackTrace();
}

+ //call method to create a window
+ createMainWindow();
+
+ //TODO :Can we move this to SwiigUtilies? Plan for after documentation - it does'nt help
+ //with understanding the functionality itself
+
+ /*
getContentPane().setLayout(new BorderLayout());
- showStatus(messages.getString("ready"));
- failed = false ;
- Randomize = false;
- cancopy = false;
- results = new ResultsTextPane();
- results.append("TCP/Web100 Network Diagnostic Tool v" + NDTConstants.VERSION + "\n");
- results.setEditable(false);
- getContentPane().add(new JScrollPane(results));
- results.append(messages.getString("clickStart") + "\n");
+ showStatus(_resBundleMessages.getString("ready"));
+ _bFailed = false ;
+ _bRandomize = false;
+ _bCanCopy = false;
+ _resultsTxtPane = new ResultsTextPane();
+ _resultsTxtPane.append("TCP/Web100 Network Diagnostic Tool v" + NDTConstants.VERSION + "\n");
+ _resultsTxtPane.setEditable(false);
+ getContentPane().add(new JScrollPane(_resultsTxtPane));
+ _resultsTxtPane.append(_resBundleMessages.getString("clickStart") + "\n");
Panel mPanel = new Panel();
- startTest = new JButton(messages.getString("start"));
- startTest.addActionListener(this);
- mPanel.add(startTest);
- sTatistics = new JButton(messages.getString("statistics"));
- sTatistics.addActionListener(this);
+ _buttonStartTest = new
JButton(_resBundleMessages.getString("start"));
+ _buttonStartTest.addActionListener(this);
+ mPanel.add(_buttonStartTest);
+ _buttonStatistics = new JButton(_resBundleMessages.getString("statistics"));
+ _buttonStatistics.addActionListener(this);
if (getParameter("disableStatistics") == null) {
- mPanel.add(sTatistics);
- }
- sTatistics.setEnabled(false);
- deTails = new JButton(messages.getString("moreDetails"));
- deTails.addActionListener(this);
+ mPanel.add(_buttonStatistics);
+ }
+ _buttonStatistics.setEnabled(false);
+ _buttonDetails = new JButton(_resBundleMessages.getString("moreDetails"));
+ _buttonDetails.addActionListener(this);
if (getParameter("disableDetails") == null) {
- mPanel.add(deTails);
- }
- deTails.setEnabled(false);
- mailTo = new JButton(messages.getString("reportProblem"));
- mailTo.addActionListener(this);
+ mPanel.add(_buttonDetails);
+ }
+ _buttonDetails.setEnabled(false);
+ _buttonMailTo = new JButton(_resBundleMessages.getString("reportProblem"));
+ _buttonMailTo.addActionListener(this);
if (getParameter("disableMailto") == null) {
- mPanel.add(mailTo);
- }
- mailTo.setEnabled(false);
- options = new JButton(messages.getString("options") + "...");
+ mPanel.add(_buttonMailTo);
+ }
+ _buttonMailTo.setEnabled(false);
+ options = new JButton(_resBundleMessages.getString("options") +
"...");
options.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent e) {
@@ -541,169 +587,250 @@
mPanel.add(options);
}
getContentPane().add(BorderLayout.SOUTH, mPanel);
- preferIPv6 = new JCheckBox(messages.getString("preferIPv6"));
- preferIPv6.setSelected(true);
- defaultTest = new
JCheckBox(messages.getString("defaultTests"));
- defaultTest.setSelected(true);
- defaultTest.setEnabled(false);
+ _chkboxPreferIPv6 = new JCheckBox(_resBundleMessages.getString("_chkboxPreferIPv6"));
+ _chkboxPreferIPv6.setSelected(true);
+ _chkboxDefaultTest = new JCheckBox(_resBundleMessages.getString("_chkboxDefaultTests"));
+ _chkboxDefaultTest.setSelected(true);
+ _chkboxDefaultTest.setEnabled(false);
SpinnerNumberModel model = new SpinnerNumberModel();
model.setMinimum(new Integer(0));
model.setValue(new Integer(1));
- numOfTests.setModel(model);
- numOfTests.setPreferredSize(new Dimension(60, 20));
+ _spinnerTestCount.setModel(model);
+ _spinnerTestCount.setPreferredSize(new Dimension(60, 20));
delay = new JComboBox();
- for (int i = 0; i < delays.length; i++) {
- delay.addItem(messages.getString(delays[i]));
+ for (int i = 0; i < _saDelays.length; i++) {
+
delay.addItem(_resBundleMessages.getString(_saDelays[i]));
}
delay.setSelectedIndex(0);
-
+ */
+
+
//Autorun functionality
- isAutoRun = getParameter("autoRun");
- if ((isAutoRun != null) && isAutoRun.equals("true")) {
+ _sIsAutoRun = getParameter("autoRun");
+ if ((_sIsAutoRun != null) && _sIsAutoRun.equals("true")) {
pub_errmsg = "Test in progress.";
runtest();
}

}
-
- /* Method to display status
- * @param String value of status
- * @return void */
- public void showStatus(String msg) {
- if (!isApplication) {
- super.showStatus(msg);
- }
- }
-
- /* Utility method to get parameter value
- * @param Key String whose value has to be found
- * @return Value of key requested for */
- public String getParameter(String name) {
- if (!isApplication) {
- return super.getParameter(name);
- }
- return null;
- }
-
- /*
- class ResultsTextPane extends JTextPane
- {
- public void append(String text)
- {
- try {
- getStyledDocument().insertString(getStyledDocument().getLength(), text, null);
- }
- catch (BadLocationException e) {
- System.out.println("WARNING: failed to append text to the text pane! [" + text + "]");
- }
- }
-
- public void insertComponent(Component c)
- {
- setSelectionStart(results.getStyledDocument().getLength());
- setSelectionEnd(results.getStyledDocument().getLength());
- super.insertComponent(c);
- }
- }
- */
-
- /*
- class StatusPanel extends JPanel
- {
- private int _testNo;
- private int _testsNum;
- private boolean _stop = false;
-
- private JLabel testNoLabel = new JLabel();
- private JButton stopButton;
- private JProgressBar progressBar = new JProgressBar();
-
- StatusPanel(int testsNum) {
- this._testNo = 1;
- this._testsNum = testsNum;
-
- setTestNoLabelText();
-
- //If multiple tests are enabled, then add label indicating test number being run.
- //** Also provide a way to "stop" current test being run
- if (getParameter("enableMultipleTests") != null) {
- add(testNoLabel);
- }
-
- //DEBUG
- System.out.println("Debug valuer = "+ getParameter("enableMultipleTests") );
- progressBar.setMinimum(0);
- progressBar.setMaximum(_testsNum);
- progressBar.setValue(0);
- progressBar.setStringPainted(true);
- if (_testsNum == 0) {
- progressBar.setString("");
- progressBar.setIndeterminate(true);
- }
- else {
- progressBar.setString(messages.getString("initialization"));
- }
- add(progressBar);
- stopButton= new JButton(messages.getString("stop"));
- stopButton.addActionListener(new ActionListener() {
-
- public void actionPerformed(ActionEvent e) {
- _stop = true;
- stopButton.setEnabled(false);
- StatusPanel.this.setText(messages.getString("stopping"));
- }
-
- });
- if (getParameter("enableMultipleTests") != null) {
- add(stopButton);
- }
- }
-
- private void setTestNoLabelText() {
- testNoLabel.setText(messages.getString("test") + " " + _testNo + " " + messages.getString("of") + " " +_testsNum + "HEREEEEE");
- }
-
- public boolean wantToStop() {
- return _stop;
- }
-
- public void endTest() {
- progressBar.setValue(_testNo);
- _testNo++;
- setTestNoLabelText();
- }
-
- public void setText(String text) {
- if (!progressBar.isIndeterminate()) {
- progressBar.setString(text);
- }
- }
- }
-
- */
-
-
- class TestWorker implements Runnable
- {
- public void run()
- {
+
+ /* Method that initializes the "main" window
+ * @param none
+ * @returns void*/
+
+ private void createMainWindow () {
+ getContentPane().setLayout(new BorderLayout());
+ showStatus(_resBundleMessages.getString("ready"));
+ _bFailed = false ;
+ _bRandomize = false; //what is this used for?
+ _bCanCopy = false;
+ _resultsTxtPane = new ResultsTextPane();
+ _resultsTxtPane.append("TCP/Web100 Network Diagnostic Tool v" + NDTConstants.VERSION + "\n");
+ _resultsTxtPane.setEditable(false);
+ getContentPane().add(new JScrollPane(_resultsTxtPane));
+ _resultsTxtPane.append(_resBundleMessages.getString("clickStart") + "\n");
+ Panel mPanel = new Panel();
+ _buttonStartTest = new
JButton(_resBundleMessages.getString("start"));
+ _buttonStartTest.addActionListener(this);
+ mPanel.add(_buttonStartTest);
+ _buttonStatistics = new JButton(_resBundleMessages.getString("statistics"));
+ _buttonStatistics.addActionListener(this);
+ if (getParameter("disableStatistics") == null) {
+ mPanel.add(_buttonStatistics);
+ }
+ _buttonStatistics.setEnabled(false);
+ _buttonDetails = new JButton(_resBundleMessages.getString("moreDetails"));
+ _buttonDetails.addActionListener(this);
+ if (getParameter("disableDetails") == null) {
+ mPanel.add(_buttonDetails);
+ }
+ _buttonDetails.setEnabled(false);
+ _buttonMailTo = new JButton(_resBundleMessages.getString("reportProblem"));
+ _buttonMailTo.addActionListener(this);
+ if (getParameter("disableMailto") == null) {
+ mPanel.add(_buttonMailTo);
+ }
+ _buttonMailTo.setEnabled(false);
+ _buttonOptions = new JButton(_resBundleMessages.getString("options") + "...");
+ _buttonOptions.addActionListener(new ActionListener() {
+
+ public void actionPerformed(ActionEvent e) {
+ _buttonOptions.setEnabled(false);
+ createOptionsWindow();
+ _buttonOptions.setEnabled(true);
+ }
+
+ });
+ if (getParameter("disableOptions") == null) {
+ mPanel.add(_buttonOptions);
+ }
+ getContentPane().add(BorderLayout.SOUTH, mPanel);
+ _chkboxPreferIPv6 = new JCheckBox(_resBundleMessages.getString("preferIPv6"));
+ _chkboxPreferIPv6.setSelected(true);
+ _chkboxDefaultTest = new JCheckBox(_resBundleMessages.getString("defaultTests"));
+ _chkboxDefaultTest.setSelected(true);
+ _chkboxDefaultTest.setEnabled(false);
+ SpinnerNumberModel model = new SpinnerNumberModel();
+ model.setMinimum(new Integer(0));
+ model.setValue(new Integer(1));
+ _spinnerTestCount.setModel(model);
+ _spinnerTestCount.setPreferredSize(new Dimension(60, 20));
+ _cmboboxDelay = new JComboBox();
+ for (int i = 0; i < _saDelays.length; i++) {
+
_cmboboxDelay.addItem(_resBundleMessages.getString(_saDelays[i]));
+ }
+ _cmboboxDelay.setSelectedIndex(0);
+
+ }
+
+
+ public void createDiagnoseWindow() {
+ showStatus(_resBundleMessages.getString("getWeb100Var"));
+
+ if (_frameWeb100Vars == null) {
+ _frameWeb100Vars = new NewFrame();
+ }
+
_frameWeb100Vars.setTitle(_resBundleMessages.getString("web100Var"));
+ Panel buttons = new Panel();
+ _frameWeb100Vars.getContentPane().add("South", buttons);
+
+ _buttonDismiss = new
JButton(_resBundleMessages.getString("close"));
+ _buttonDismiss.addActionListener(this);
+
+ _buttonCopy = new
JButton(_resBundleMessages.getString("copy"));
+ _buttonCopy.addActionListener(this);
+
+ _txtDiagnosis = new JTextArea(_resBundleMessages.getString("web100KernelVar") + ":\n", 15,30);
+ _txtDiagnosis.setEditable(true);
+ _buttonDismiss.setEnabled(true);
+ _buttonCopy.setEnabled(_bCanCopy);
+
+ buttons.add("West", _buttonDismiss);
+ buttons.add("East", _buttonCopy);
+ _frameWeb100Vars.getContentPane().add(new
JScrollPane(_txtDiagnosis));
+ _frameWeb100Vars.pack();
+ } // diagnose()
+
+
+
+ public void createStatsWindow() {
+
showStatus(_resBundleMessages.getString("printDetailedStats"));
+
+ if (_frameDetailedStats == null) {
+ _frameDetailedStats = new NewFrame();
+ }
+ _frameDetailedStats.setTitle(_resBundleMessages.getString("detailedStats"));
+ Panel buttons = new Panel();
+ _frameDetailedStats.getContentPane().add("South", buttons);
+
+ _buttonStatsDismiss = new
JButton(_resBundleMessages.getString("close"));
+ _buttonStatsDismiss.addActionListener(this);
+
+ _buttonStatsCopy = new
JButton(_resBundleMessages.getString("copy"));
+ _buttonStatsCopy.addActionListener(this);
+
+ _txtStatistics = new JTextArea(_resBundleMessages.getString("web100Stats") + ":\n", 25,70);
+ _txtStatistics.setEditable(true);
+ _buttonStatsDismiss.setEnabled(true);
+ _buttonStatsCopy.setEnabled(_bCanCopy);
+
+ buttons.add("West", _buttonStatsDismiss);
+ buttons.add("East", _buttonStatsCopy);
+ _frameDetailedStats.getContentPane().add(new JScrollPane(_txtStatistics));
+ _frameDetailedStats.pack();
+ } // statistics()
+
+
+ public void createOptionsWindow() {
+ showStatus(_resBundleMessages.getString("showOptions"));
+
+ if (_frameOptions == null) {
+ _frameOptions = new NewFrame();
+
_frameOptions.setTitle(_resBundleMessages.getString("options"));
+
+ JPanel optionsPanel = new JPanel();
+ optionsPanel.setLayout(new BoxLayout(optionsPanel,
BoxLayout.Y_AXIS));
+
+ JPanel testsPanel = new JPanel();
+ testsPanel.setBorder(BorderFactory.createTitledBorder(_resBundleMessages.getString("performedTests")));
+ testsPanel.add(_chkboxDefaultTest);
+ optionsPanel.add(testsPanel);
+
+ JPanel protocolPanel = new JPanel();
+ protocolPanel.setBorder(BorderFactory.createTitledBorder(_resBundleMessages.getString("ipProtocol")));
+ protocolPanel.add(_chkboxPreferIPv6);
+ optionsPanel.add(protocolPanel);
+
+ if (getParameter("enableMultipleTests") != null) {
+ JPanel generalPanel = new JPanel();
+ generalPanel.setLayout(new
BoxLayout(generalPanel, BoxLayout.Y_AXIS));
+ generalPanel.setBorder(BorderFactory.createTitledBorder(_resBundleMessages.getString("general")));
+ JPanel tmpPanel = new JPanel();
+ tmpPanel.add(new JLabel(_resBundleMessages.getString("numberOfTests") + ":"));
+ tmpPanel.add(_spinnerTestCount);
+ generalPanel.add(tmpPanel);
+ tmpPanel = new JPanel();
+ tmpPanel.add(new JLabel(_resBundleMessages.getString("delayBetweenTests") + ":"));
+ tmpPanel.add(_cmboboxDelay);
+ generalPanel.add(tmpPanel);
+
+ optionsPanel.add(generalPanel);
+ }
+
+ _frameOptions.getContentPane().add(optionsPanel);
+ Panel buttons = new Panel();
+ _frameOptions.getContentPane().add("South", buttons);
+
+ JButton okButton= new
JButton(_resBundleMessages.getString("ok"));
+ okButton.addActionListener(new ActionListener() {
+
+ public void actionPerformed(ActionEvent e) {
+ _frameOptions.toBack();
+ _frameOptions.dispose();
+ }
+
+ });
+
+ buttons.add("West", okButton);
+
+ _frameOptions.pack();
+ }
+ _frameOptions.setResizable(false);
+ _frameOptions.setVisible(true);
+ }
+
+
+
+
+ /*Method to run the Thread that calls the "dottcp" method to run tests
+ * This method is called by the Applet's init method if user selected
an
+ * "autorun" option, is run individually if user presses the "start button",
+ * and is internally run by API call */
+ synchronized public void runtest() {
+ pub_status = "notStarted";
+ new Thread(new TestWorker()).start();
+ }
+
+
+ class TestWorker implements Runnable {
+ public void run() {
if (!testInProgress) {
int testNo = 1;
- int testsNum =
((Integer)numOfTests.getValue()).intValue();
+ int testsNum =
((Integer)_spinnerTestCount.getValue()).intValue();
testInProgress = true;
- diagnose();
- statistics();
- startTest.setEnabled(false);
- deTails.setEnabled(false);
- sTatistics.setEnabled(false);
- mailTo.setEnabled(false);
- options.setEnabled(false);
- numOfTests.setEnabled(false);
+ createDiagnoseWindow();
+ createStatsWindow();
+ _buttonStartTest.setEnabled(false);
+ _buttonDetails.setEnabled(false);
+ _buttonStatistics.setEnabled(false);
+ _buttonMailTo.setEnabled(false);
+ _buttonOptions.setEnabled(false);
+ _spinnerTestCount.setEnabled(false);

//StatusPanel sPanel = new
StatusPanel(testsNum);
//re-arch. Replaced above by the line below
- String sTempEnableMany =
getParameter("enableMultipleTests");
- StatusPanel sPanel = new
StatusPanel(testsNum, sTempEnableMany);
+ String sTempEnable =
getParameter("enableMultipleTests");
+ StatusPanel sPanel = new
StatusPanel(testsNum, sTempEnable);
getContentPane().add(BorderLayout.NORTH,
sPanel);
getContentPane().validate();
getContentPane().repaint();
@@ -714,10 +841,10 @@
break;
}
if (testsNum == 0) {
- results.append("\n** " + messages.getString("startingTest") + " " + testNo + " **\n");
+ _resultsTxtPane.append("\n** " + _resBundleMessages.getString("startingTest") + " " + testNo + " **\n");
}
else {
- results.append("\n** " + messages.getString("startingTest") + " " + testNo + " " + messages.getString("of") + " " + testsNum + " **\n");
+ _resultsTxtPane.append("\n** " + _resBundleMessages.getString("startingTest") + " " + testNo + " " + _resBundleMessages.getString("of") + " " + testsNum + " **\n");
}
dottcp(sPanel);
if (testNo == testsNum) {
@@ -729,40 +856,40 @@
sPanel.setText("");
sPanel.endTest();
testNo += 1;
- deTails.setEnabled(true);
- sTatistics.setEnabled(true);
- mailTo.setEnabled(true);
- options.setEnabled(true);
- _txtStatistics.append("\n** " + messages.getString("test") + " " + testNo + " **\n");
- _txtDiagnosis.append("\n** " + messages.getString("test") + " " + testNo + " **\n");
+
_buttonDetails.setEnabled(true);
+
_buttonStatistics.setEnabled(true);
+
_buttonMailTo.setEnabled(true);
+
_buttonOptions.setEnabled(true);
+ _txtStatistics.append("\n** " + _resBundleMessages.getString("test") + " " + testNo + " **\n");
+ _txtDiagnosis.append("\n** " + _resBundleMessages.getString("test") + " " + testNo + " **\n");
try {
- switch
(delay.getSelectedIndex()) {
+ switch
(_cmboboxDelay.getSelectedIndex()) {
case 1:
- results.append("\n** " +
messages.getString("sleep1m") + " **\n");
+ _resultsTxtPane.append("\n** " + _resBundleMessages.getString("sleep1m") + " **\n");

Thread.sleep(1000 * 60);
break;
case 2:
- results.append("\n** " +
messages.getString("sleep5m") + " **\n");
+ _resultsTxtPane.append("\n** " + _resBundleMessages.getString("sleep5m") + " **\n");

Thread.sleep(1000 * 60 * 5);
break;
case 3:
- results.append("\n** " +
messages.getString("sleep10m") + " **\n");
+ _resultsTxtPane.append("\n** " + _resBundleMessages.getString("sleep10m") + " **\n");

Thread.sleep(1000 * 60 * 10);
break;
case 4:
- results.append("\n** " +
messages.getString("sleep30m") + " **\n");
+ _resultsTxtPane.append("\n** " + _resBundleMessages.getString("sleep30m") + " **\n");

Thread.sleep(1000 * 60 * 30);
break;
case 5:
- results.append("\n** " +
messages.getString("sleep2h") + " **\n");
+ _resultsTxtPane.append("\n** " + _resBundleMessages.getString("sleep2h") + " **\n");

Thread.sleep(1000 * 60 * 120);
break;
case 6:
- results.append("\n** " +
messages.getString("sleep12h") + " **\n");
+ _resultsTxtPane.append("\n** " + _resBundleMessages.getString("sleep12h") + " **\n");

Thread.sleep(1000 * 60 * 720);
break;
case 7:
- results.append("\n** " +
messages.getString("sleep1d") + " **\n");
+ _resultsTxtPane.append("\n** " + _resBundleMessages.getString("sleep1d") + " **\n");

Thread.sleep(1000 * 60 * 1440);
break;
}
@@ -773,25 +900,25 @@
}
} catch(IOException e) {
e.printStackTrace();
- failed=true;
- errmsg = messages.getString("serverBusy30s") +
"\n";
+ _bFailed=true;
+ _sErrMsg =
_resBundleMessages.getString("serverBusy30s") + "\n";
}

- if (failed) {
- results.append(errmsg);
+ if (_bFailed) {
+ _resultsTxtPane.append(_sErrMsg);

pub_isReady = "failed";
- pub_errmsg = errmsg;
+ pub_errmsg = _sErrMsg;
}

- deTails.setEnabled(true);
- sTatistics.setEnabled(true);
- mailTo.setEnabled(true);
- options.setEnabled(true);
- numOfTests.setEnabled(true);
- showStatus(messages.getString("done2"));
- results.append("\n" + messages.getString("clickStart2")
+ "\n");
- startTest.setEnabled(true);
+ _buttonDetails.setEnabled(true);
+ _buttonStatistics.setEnabled(true);
+ _buttonMailTo.setEnabled(true);
+ _buttonOptions.setEnabled(true);
+ _spinnerTestCount.setEnabled(true);
+
showStatus(_resBundleMessages.getString("done2"));
+ _resultsTxtPane.append("\n" + _resBundleMessages.getString("clickStart2") + "\n");
+ _buttonStartTest.setEnabled(true);
testInProgress = false;
getContentPane().remove(sPanel);
getContentPane().validate();
@@ -800,90 +927,127 @@
}
}

- /*Method to run the Thread that calls the "dottcp" method to run tests
- * This method is called by the Applet's init method if user selected
an
- * "autorun" option, is run individually if user presses the "start button",
- * and is internally run by API call */
- synchronized public void runtest() {
- pub_status = "notStarted";
- new Thread(new TestWorker()).start();
- }
-
- /*
- class Message {
- byte type;
- byte[] body;
- }
-
- class Protocol {
- private InputStream _ctlin;
- private OutputStream _ctlout;
-
- public Protocol(Socket ctlSocket) throws IOException
- {
- _ctlin = ctlSocket.getInputStream();
- _ctlout = ctlSocket.getOutputStream();
- }
-
- public void send_msg(byte type, byte toSend) throws IOException
- {
- byte[] tab = new byte[] { toSend };
- send_msg(type, tab);
- }
-
- public void send_msg(byte type, byte[] tab) throws IOException
- {
- byte[] header = new byte[3];
- header[0] = type;
- header[1] = (byte) (tab.length >> 8);
- header[2] = (byte) tab.length;
-
- _ctlout.write(header);
- _ctlout.write(tab);
- }
-
- public int readn(Message msg, int amount) throws IOException
- {
- int read = 0;
- int tmp;
- msg.body = new byte[amount];
- while (read != amount) {
- tmp = _ctlin.read(msg.body, read, amount - read);
- if (tmp <= 0) {
- return read;
- }
- read += tmp;
- }
- return read;
- }
-
- public int recv_msg(Message msg) throws IOException
- {
- int length;
- if (readn(msg, 3) != 3) {
- return 1;
- }
- msg.type = msg.body[0];
- length = ((int) msg.body[1] & 0xFF) << 8;
- length += (int) msg.body[2] & 0xFF;
- if (readn(msg, length) != length) {
- return 3;
- }
- return 0;
- }
-
- public void close()
- {
- try {
- _ctlin.close();
- _ctlout.close();
- }
- catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- */
+ public void actionPerformed(ActionEvent event) {
+ Object source = event.getSource();
+ // System.err.println("Processing WINDOW event #"
+event.getID());
+ // System.err.println("Processing event " + source);
+
+ if (source == _buttonStartTest) {
+ if(_frameWeb100Vars != null) {
+ _frameWeb100Vars.toBack();
+ _frameWeb100Vars.dispose();
+ _frameWeb100Vars = null;
+ }
+
+ if(_frameDetailedStats != null) {
+ _frameDetailedStats.toBack();
+ _frameDetailedStats.dispose();
+ _frameDetailedStats = null;
+ }
+
+ pub_errmsg = "Test in progress.";
+ runtest();
+ }
+
+ else if (source == _buttonDetails) {
+ _buttonDetails.setEnabled(false);
+ _frameWeb100Vars.setResizable(true);
+ _frameWeb100Vars.setVisible(true);
+ _buttonDetails.setEnabled(true);
+ }
+
+ else if (source == _buttonDismiss) {
+ _frameWeb100Vars.toBack();
+ _frameWeb100Vars.dispose();
+ }
+
+ else if (source == _buttonStatsDismiss) {
+ _frameDetailedStats.toBack();
+ _frameDetailedStats.dispose();
+ }
+
+ else if (source == _buttonCopy) {
+ try {
+ Clipboard clipbd =
getToolkit().getSystemClipboard();
+ _bCanCopy = true;
+ String s = _txtDiagnosis.getText();
+ StringSelection ss = new StringSelection(s);
+ clipbd.setContents(ss, ss);
+ _txtDiagnosis.selectAll();
+ } catch (SecurityException e) {
+ _bCanCopy = false;
+ }
+ }
+
+ else if (source == _buttonStatsCopy) {
+ Clipboard clipbd = getToolkit().getSystemClipboard();
+ String sTemp = _txtStatistics.getText();
+ StringSelection ssTemp = new StringSelection(sTemp);
+ clipbd.setContents(ssTemp, ssTemp);
+ _txtStatistics.selectAll();
+ }
+
+ else if (source == _buttonStatistics) {
+ _buttonStatistics.setEnabled(false);
+ _frameDetailedStats.setResizable(true);
+ _frameDetailedStats.setVisible(true);
+ _buttonStatistics.setEnabled(true);
+ }
+
+ else if (source == _buttonMailTo) {
+ //int i; //did'nt need it
+ //char key; comment out. seems unused
+ String to[], from[], comments[];
+ String sName, sHost;
+
+ _buttonMailTo.setEnabled(false);
+ // envoke mailto: function
+ showStatus(_resBundleMessages.getString("invokingMailtoFunction") + "...");
+
+ _resultsTxtPane.append(_resBundleMessages.getString("generatingReport") + "\n");
+ try {
+ //TODO exception here occasionaly. Check out if my changes introduced these
+ if ((sName =
getParameter(NDTConstants.TARGET1)) == null) {
+ throw new IllegalArgumentException("U
parameter Required:");
+ }
+ if ((sHost =
getParameter(NDTConstants.TARGET2)) == null) {
+ throw new IllegalArgumentException("H
parameter Required:");
+ }
+
+ String theURL = "; + sName + "@" +
sHost;
+ String subject = getParameter("subject");
+
+ if (subject == null) {
+ subject = _resBundleMessages.getString("troubleReportFrom") + " " + getCodeBase().getHost();
+ }
***The diff for this file has been truncated for email.***


  • [ndt-dev] [ndt] r488 committed - Made osfwWorker an outer public class, reorganized methods in Tcpbw100..., ndt, 08/12/2011

Archive powered by MHonArc 2.6.16.

Top of Page