com.isti.quakewatch.guiutil
Class MailServerTest

java.lang.Object
  extended by com.isti.quakewatch.guiutil.MailServerTest

public class MailServerTest
extends java.lang.Object

Class MailServerTest defines a mail server test object.


Field Summary
protected  boolean initialServerTestDoneFlag
          Flag set true after initial email-server test completed.
protected  boolean inSendTestEmailMessageFlag
          Flag set true while inside 'sendTestEmailMessage()' method.
 
Constructor Summary
MailServerTest(QWCfgSettingsDialog settingsDialog, IstiMenuLoader menuLoader)
          Creates a mail server test object.
MailServerTest(QWCfgSettingsDialog settingsDialog, IstiMenuLoader menuLoader, boolean checkServerFlag)
          Creates a mail server test object.
 
Method Summary
 void doInitialServerCheck(boolean showSuccessFlag, boolean waitFlag, boolean showTestDlgFlag, boolean checkPropsFlag)
          Performs the initial test of the connection to the SMTP server (if it has not yet been performed).
 void doInitialServerCheck(boolean showSuccessFlag, boolean waitFlag, boolean showTestDlgFlag, boolean checkPropsFlag, boolean chkPropsModalFlag)
          Performs the initial test of the connection to the SMTP server (if it has not yet been performed).
protected  void doTestMailServerConnection(boolean showSuccessFlag, boolean modalFlag, boolean showTestDlgFlag)
          Performs the work of testing the connection to the SMTP server.
 boolean getInitialServerTestDoneFlag()
          Determines if the initial server test has been performed.
 boolean processMenuItemEvent(java.lang.String nameStr)
          Called when a MenuItem event happens.
 void sendTestEmailMessage()
          Queries the user and sends a test email message.
 IstiDialogPopup showWaitingDialog(java.lang.String msgStr)
          Displays the given message in a popup dialog with no title and no buttons.
 void testMailServerConnection(boolean showSuccessFlag)
          Tests the connection to the SMTP server.
 void testMailServerConnection(boolean showSuccessFlag, boolean waitFlag, boolean showTestDlgFlag, boolean checkPropsFlag)
          Tests the connection to the SMTP server.
 void testMailServerConnection(boolean showSuccessFlag, boolean waitFlag, boolean showTestDlgFlag, boolean checkPropsFlag, boolean chkPropsModalFlag)
          Tests the connection to the SMTP server.
protected  void updateMenuItemShown()
          Update the menu items shown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inSendTestEmailMessageFlag

protected boolean inSendTestEmailMessageFlag
Flag set true while inside 'sendTestEmailMessage()' method.


initialServerTestDoneFlag

protected boolean initialServerTestDoneFlag
Flag set true after initial email-server test completed.

Constructor Detail

MailServerTest

public MailServerTest(QWCfgSettingsDialog settingsDialog,
                      IstiMenuLoader menuLoader,
                      boolean checkServerFlag)
Creates a mail server test object. Note that if this constructor performs an email-server test (via 'checkServerFlag'==true) then it will block until the test is complete.

Parameters:
settingsDialog - the settings dialog.
menuLoader - the menu loader.
checkServerFlag - true to check if email-server configuation properties are setup and test email server; false to not (in which case the 'doInitialServerCheck()' will usually want to be called later).

MailServerTest

public MailServerTest(QWCfgSettingsDialog settingsDialog,
                      IstiMenuLoader menuLoader)
Creates a mail server test object.

Parameters:
settingsDialog - the settings dialog.
menuLoader - the menu loader.
Method Detail

doInitialServerCheck

public void doInitialServerCheck(boolean showSuccessFlag,
                                 boolean waitFlag,
                                 boolean showTestDlgFlag,
                                 boolean checkPropsFlag,
                                 boolean chkPropsModalFlag)
Performs the initial test of the connection to the SMTP server (if it has not yet been performed).

Parameters:
showSuccessFlag - true to show a "success" dialog; false to not.
waitFlag - true to block until the test finishes; false to use a worker thread.
showTestDlgFlag - true to show popup dialog while email-server test is in progress; false to not.
checkPropsFlag - true to check email-server configuration properties and show a dialog if they are not setup; false to not.
chkPropsModalFlag - true for dialog shown via 'checkPropsFlag' == true to be modal; false for non-modal.

doInitialServerCheck

public void doInitialServerCheck(boolean showSuccessFlag,
                                 boolean waitFlag,
                                 boolean showTestDlgFlag,
                                 boolean checkPropsFlag)
Performs the initial test of the connection to the SMTP server (if it has not yet been performed).

Parameters:
showSuccessFlag - true to show a "success" dialog; false to not.
waitFlag - true to block until the test finishes; false to use a worker thread.
showTestDlgFlag - true to show popup dialog while email-server test is in progress; false to not.
checkPropsFlag - true to check email-server configuration properties and show a (modal) dialog if they are not setup; false to not.

updateMenuItemShown

protected void updateMenuItemShown()
Update the menu items shown.


processMenuItemEvent

public boolean processMenuItemEvent(java.lang.String nameStr)
Called when a MenuItem event happens.

Parameters:
nameStr - the name of the menu item.
Returns:
true if the MenuItem event is for a mail test, false otherwise.

sendTestEmailMessage

public void sendTestEmailMessage()
Queries the user and sends a test email message.


showWaitingDialog

public IstiDialogPopup showWaitingDialog(java.lang.String msgStr)
Displays the given message in a popup dialog with no title and no buttons. The returned dialog object may be used to close the dialog. This method does not block.

Parameters:
msgStr - the message to be displayed.
Returns:
A new 'IstiDialogPopup' object.

testMailServerConnection

public void testMailServerConnection(boolean showSuccessFlag,
                                     boolean waitFlag,
                                     boolean showTestDlgFlag,
                                     boolean checkPropsFlag,
                                     boolean chkPropsModalFlag)
Tests the connection to the SMTP server.

Parameters:
showSuccessFlag - true to show a "success" dialog; false to not.
waitFlag - true to block until the test finishes; false to use a worker thread.
showTestDlgFlag - true to show popup dialog while email-server test is in progress; false to not.
checkPropsFlag - true to check email-server configuration properties and show a dialog if they are not setup; false to not.
chkPropsModalFlag - true for dialog shown via 'checkPropsFlag' == true to be modal; false for non-modal.

testMailServerConnection

public void testMailServerConnection(boolean showSuccessFlag,
                                     boolean waitFlag,
                                     boolean showTestDlgFlag,
                                     boolean checkPropsFlag)
Tests the connection to the SMTP server.

Parameters:
showSuccessFlag - true to show a "success" dialog; false to not.
waitFlag - true to block until the test finishes; false to use a worker thread.
showTestDlgFlag - true to show popup dialog while email-server test is in progress; false to not.
checkPropsFlag - true to check email-server configuration properties and show a (modal) dialog if they are not setup; false to not.

testMailServerConnection

public void testMailServerConnection(boolean showSuccessFlag)
Tests the connection to the SMTP server. This method does not wait for the test to finish (a worker thread is used) and a popup dialog is shown while the test is in progress.

Parameters:
showSuccessFlag - true to check email-server configuration properties and show a (modal) dialog if they are not setup and to show a "success" dialog; false to not.

doTestMailServerConnection

protected void doTestMailServerConnection(boolean showSuccessFlag,
                                          boolean modalFlag,
                                          boolean showTestDlgFlag)
Performs the work of testing the connection to the SMTP server. This method blocks until the test is complete.

Parameters:
showSuccessFlag - true to show a "success" dialog; false to not.
modalFlag - true to make the "success" or "error" dialog modal; false for non-modal dialog.
showTestDlgFlag - true to show popup dialog while email-server test is in progress; false to not.

getInitialServerTestDoneFlag

public boolean getInitialServerTestDoneFlag()
Determines if the initial server test has been performed.

Returns:
true if the initial server test has been performed; false if not.