All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.ibm.network.mail.pop3.ui.UserInterfaceBean

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----com.ibm.network.mail.pop3.ui.UserInterfaceBean

public class UserInterfaceBean
extends Panel
implements MouseListener, ActionListener, Externalizable
This bean presents the GUI and allows the user to view/store received messages. It works in co-ordination with a CoreProtocolBean which provides it with new messages received from a POP3 server. It also requires a MimeDecoderBean which decodes the messages, so that received messages can be either rendered if its MIME type is supported, or shown as attachment(s) otherwise. Attachments can be saved to a file.

At present, the bean supports two folders, Inbox, which contains received messages and Trash, which contains the deleted messages. The header information of all the messages in the current folder is shown and any message can be viewed by clicking on its header.

The UserInterfaceBean also allows configuration of user options and server options. These option settings are communicated to the protocol bean. The bean also has a status bar for displaying status of operation (of receiving mails) as conveyed by the protocol bean.

The bean can be serialized to store all configuration information. Also, all the messages in the folders are stored and can be retrieved by deserializing the bean.

This bean throws the following events:

  1. DecodeMessageEvent to
  2. RequestMessageEvent to
  3. ConfigEvent to

It supports the following event listener interfaces:

  1. MessageListener which is called by
  2. DecodeListener which is called by
  3. StatusListener which is called by

Author:
Mohit M Sant, Abdul Majeed Ghadialy
See Also:
RequestMessageEvent, DecodeMessageEvent, ConfigEvent, MessageListener, StatusListener, DecodeListener

Constructor Index

 o UserInterfaceBean()
Constructor for UserInterfaceBean.

Method Index

 o actionPerformed(ActionEvent)
This method was created by a SmartGuide.
 o addConfigListener(ConfigListener)
Adds a listener for ConfigEvent.
 o addDecodeMessageListener(DecodeMessageListener)
Adds a listener for DecodeMessageEvent.
 o addPropertyChangeListener(PropertyChangeListener)
Adds the specified PropertyChangeListener for receiving PropertyChangeEvent from this bean.
 o addRequestMessageListener(RequestMessageListener)
Adds a listener for RequestMessageEvent.
 o changeUserPassword()
Displays a dialog box for entering new user password.
 o configure()
Allows user to set various server and user options.
 o decodePerformed()
Notifies the UserInterfaceBean that decoding of bodypart is complete.
 o deleteSelectedMessage()
Deletes the selected message from current folder.
 o emptyTrashFolder()
Empties the Trash folder.
 o getBCCRecipients()
Returns the list of 'BCC' recipients.
 o getBody()
Returns the body of the current message.
 o getBodyPartToDecode()
Returns the bodypart which the UserInterfaceBean wants to be decoded.
 o getCCRecipients()
Returns the list of 'CC' recipients.
 o getFolderDirectory()
Returns the directory where the file containing all messages is stored.
 o getHeaderCaptionWidths()
Returns the widths of the header captions.
 o getLoginId()
Returns the POP3 login ID of the user.
 o getMessage()
Returns the message.
 o getPOP3Server()
Returns the current POP3 server settings.
 o getPOP3ServerHost()
Returns the host name of the POP3 server.
 o getPOP3ServerPort()
Returns the port number of the POP3 server.
 o getSender()
Returns the mail-id of sender of current message.
 o getSocksServer()
Returns the current socks server settings.
 o getSocksServerHost()
Returns the host name of socks server.
 o getSocksServerPort()
Returns the port number of the socks server.
 o getStatus()
Returns the status information about the operation of receiving new messages.
 o getSubject()
Returns the "Subject" of the current message.
 o getTORecipients()
Returns the list of 'TO' recipients.
 o getUserOptions()
Returns the current POP3 user settings.
 o getUserPassword()
Returns the login password of POP3 user.
 o isDisplayAllHeaders()
Returns 'true' if all headers of a message are being displayed.
 o isLeaveMessagesOnServer()
Returns true if messages are being left on server after receiving.
 o isRememberPassword()
Returns true if user login password is to be remembered.
 o isSocksified()
Returns true if socks server is being used.
 o isStatusVisible()
Returns 'true' if status bar of GUI is shown.
 o messageReceived(MessageEvent)
Processes the received messages and stores in Inbox.
 o messageReceived(MimeMessage)
Processes the received messages and stores in Inbox.
 o mouseClicked(MouseEvent)
Method to handle events for the MouseListener interface.
 o mouseEntered(MouseEvent)
Method to handle events for the MouseListener interface.
 o mouseExited(MouseEvent)
Method to handle events for the MouseListener interface.
 o mousePressed(MouseEvent)
Method to handle events for the MouseListener interface.
 o mouseReleased(MouseEvent)
Method to handle events for the MouseListener interface.
 o moveSelectedMessage(String)
Moves message from current folder to destination folder.
 o processStatus(StatusEvent)
Part of StatusListener and it processes the status information.
 o processStatus(String)
Processes the status information.
 o readExternal(ObjectInput)
NOT FOR DEVELOPER USE.
 o receiveMessage()
Receives new messages.
 o removeConfigListener(ConfigListener)
Removes the listener of ConfigEvent.
 o removeDecodeMessageListener(DecodeMessageListener)
Removes listener of DecodeMessageEvent.
 o removePropertyChangeListener(PropertyChangeListener)
Removes a listener of change of read-only bound property Status.
 o removeRequestMessageListener(RequestMessageListener)
Removes listener of RequestMessageEvent.
 o setDisplayAllHeaders(boolean)
Indicate whether all headers of a message are to be displayed.
 o setFolderDirectory(String)
Sets the directory where the folders containing messages are to be stored.
 o setHeaderCaptionWidths(int[])
Sets the widths of the header captions.
 o setLeaveMessagesOnServer(boolean)
Indicates whether messages are to be left on POP3 server after receiving.
 o setLoginId(String)
Sets the POP3 login ID of the user.
 o setPOP3Server(ServerOptions)
Sets POP3 server settings.
 o setPOP3ServerHost(String)
Sets the host name of the POP3 server.
 o setPOP3ServerPort(int)
Sets port number of the POP3 server.
 o setRememberPassword(boolean)
Indicates whether user login password is to be remembered.
 o setSocksified(boolean)
Indicates whether socks server is to be used while receiving messages from POP3 server.
 o setSocksServer(ServerOptions)
Sets socks server options.
 o setSocksServerHost(String)
Sets the socks server host name.
 o setSocksServerPort(int)
Sets the port number of the socks server.
 o setStatusVisible(boolean)
Indicates whether status bar of GUI is to be shown.
 o setUserOptions(UserOptions)
Sets POP3 user options.
 o setUserPassword(String)
Sets the login password of POP3 user.
 o writeExternal(ObjectOutput)
NOT FOR DEVELOPER USE.

Constructors

 o UserInterfaceBean
 public UserInterfaceBean()
Constructor for UserInterfaceBean. Constructs a UserInterfaceBean with default settings. The GUI is constructed and initialized with pre-set values. The two serialized folders Inbox and Trash are read and Inbox is made the current folder.

See Also:
Folder

Methods

 o actionPerformed
 public void actionPerformed(ActionEvent evt)
This method was created by a SmartGuide.

Parameters:
evt - java.awt.event.ActionEvent
 o addConfigListener
 public void addConfigListener(ConfigListener cl)
Adds a listener for ConfigEvent. For adding the listeners which need to be notified about changes to:

Parameters:
cl - com.ibm.network.mail.pop3.event.ConfigListener.
 o addDecodeMessageListener
 public void addDecodeMessageListener(DecodeMessageListener dml)
Adds a listener for DecodeMessageEvent. For adding the listeners which:

Parameters:
ml - com.ibm.network.mail.pop3.event.DecodeMessageListener.
 o addPropertyChangeListener
 public void addPropertyChangeListener(PropertyChangeListener listener)
Adds the specified PropertyChangeListener for receiving PropertyChangeEvent from this bean. Adds the specified property change listener to receive property change events about all the bound properties in this bean.

Note: This event is thrown for all the bound properties in this bean. Currently, it is thrown for the only bound property, Status whenever the bean's status changes.

Parameters:
listener - PropertyChangeListener.
 o addRequestMessageListener
 public void addRequestMessageListener(RequestMessageListener rml)
Adds a listener for RequestMessageEvent. For adding the listeners which:

Parameters:
ml - com.ibm.network.mail.pop3.event.RequestMessageListener.
 o changeUserPassword
 public void changeUserPassword()
Displays a dialog box for entering new user password.

 o configure
 public void configure()
Allows user to set various server and user options. A GUI interface is popped up and the following options can be set:

 o decodePerformed
 public void decodePerformed()
Notifies the UserInterfaceBean that decoding of bodypart is complete. This method is invoked by MimeDecoderBean to indicate that the bodypart which had been requested by the UserInterfaceBean to be decoded, is now ready for use. The UserInterfaceBean will either render the bodypart or save it to a local file if its MIME content cannot be rendered.

 o deleteSelectedMessage
 public void deleteSelectedMessage()
Deletes the selected message from current folder. The message is moved to the Trash folder.

See Also:
Folder
 o emptyTrashFolder
 public synchronized void emptyTrashFolder()
Empties the Trash folder. The Trash folder is purged and all messages in it are removed.

See Also:
Folder
 o getBCCRecipients
 public String getBCCRecipients()
Returns the list of 'BCC' recipients. The recipient list is comma (',') separated.

Returns:
list of BCC recipients.
Throws: NullPointerException
if no message is selected by user or no message is currently available.
 o getBody
 public String getBody()
Returns the body of the current message. The message body consists of the text being currently displayed in the text area of the UserInterfaceBean. This text is comprised of all the bodyparts which are INLINE and "text/plain".

Returns:
body of message.
Throws: NullPointerException
if no message is selected by user or no message is currently available.
 o getBodyPartToDecode
 public Decodable getBodyPartToDecode()
Returns the bodypart which the UserInterfaceBean wants to be decoded. This method has been provided to facilitate alternate mechanism for linking with a decoder bean which can accept a Decodable bodypart for decoding.

Returns:
bodypart to be decoded.
Throws: NullPointerException
if no body part was requested to be decoded.
 o getCCRecipients
 public String getCCRecipients()
Returns the list of 'CC' recipients. The recipient list is comma (',') separated.

Returns:
list of 'CC' recipients.
Throws: NullPointerException
if no message is selected by user or no message is currently available.
 o getFolderDirectory
 public String getFolderDirectory()
Returns the directory where the file containing all messages is stored. All folders use the message file.

See Also:
Folder
 o getHeaderCaptionWidths
 public int[] getHeaderCaptionWidths()
Returns the widths of the header captions. This in effect is the width of each of the header elements that are displayed in the header list. Sizes are returned in an array for the fields "Date", "Sender", "Subject" and "Status", in that order.

Returns:
the array of integers with the header caption widths.
 o getLoginId
 public String getLoginId()
Returns the POP3 login ID of the user.

Returns:
login ID of user.
See Also:
UserOptions
 o getMessage
 public MimeMessage getMessage()
Returns the message. This message is the one that is currently in use by UserInterfaceBean.

Returns:
com.ibm.network.mail.base.MimeMessage currently available with UserInterfaceBean.
Throws: NullPointerException
if no message is currently available with UserInterfaceBean.
 o getPOP3Server
 public ServerOptions getPOP3Server()
Returns the current POP3 server settings.

Returns:
POP3 server options.
See Also:
ServerOptions
 o getPOP3ServerHost
 public String getPOP3ServerHost()
Returns the host name of the POP3 server.

Returns:
POP3 server's host name/IP address.
See Also:
ServerOptions
 o getPOP3ServerPort
 public int getPOP3ServerPort()
Returns the port number of the POP3 server.

Returns:
POP3 server's port number.
See Also:
ServerOptions
 o getSender
 public String getSender()
Returns the mail-id of sender of current message. This value is same as "From" field of header.

Returns:
mail-id of sender of message.
Throws: NullPointerException
if no message is selected by user or no message currently available.
 o getSocksServer
 public ServerOptions getSocksServer()
Returns the current socks server settings.

Returns:
socks server options.
See Also:
ServerOptions
 o getSocksServerHost
 public String getSocksServerHost()
Returns the host name of socks server.

Returns:
socks server's host name/IP address.
See Also:
ServerOptions
 o getSocksServerPort
 public int getSocksServerPort()
Returns the port number of the socks server.

Returns:
socks server's port number.
See Also:
ServerOptions
 o getStatus
 public String getStatus()
Returns the status information about the operation of receiving new messages.

Returns:
status information.
 o getSubject
 public String getSubject()
Returns the "Subject" of the current message.

Returns:
subject of the message.
Throws: NullPointerException
if no message is selected by user or no message currently available.
 o getTORecipients
 public String getTORecipients()
Returns the list of 'TO' recipients. The recipient list is comma (',') separated.

Returns:
list of 'TO' recipients.
Throws: NullPointerException
if no message is selected by user or no message is currently available.
 o getUserOptions
 public UserOptions getUserOptions()
Returns the current POP3 user settings.

Returns:
user options. This would be either TransientUserOptions if rememberPassword is false, or PersistantUserOptions if rememberPassword is true.
See Also:
UserOptions, TransientUserOptions, PersistantUserOptions
 o getUserPassword
 public String getUserPassword()
Returns the login password of POP3 user.

Returns:
password of user.
 o isDisplayAllHeaders
 public boolean isDisplayAllHeaders()
Returns 'true' if all headers of a message are being displayed. The message headers are displayed in the text area of the GUI.

Returns:
true if all headers are being displayed, false otherwise.
See Also:
UserOptions
 o isLeaveMessagesOnServer
 public boolean isLeaveMessagesOnServer()
Returns true if messages are being left on server after receiving.

Returns:
true if messages are not deleted after receiving, false otherwise.
See Also:
UserOptions
 o isRememberPassword
 public boolean isRememberPassword()
Returns true if user login password is to be remembered. If so user is not prompted for password at login.

Returns:
true if password of user is being remembered, false otherwise.
See Also:
UserOptions
 o isSocksified
 public boolean isSocksified()
Returns true if socks server is being used. Socksification is required while receiving messages from POP3 server running outside a firewall.

Returns:
true if socksification has been applied, false otherwise.
See Also:
UserOptions
 o isStatusVisible
 public boolean isStatusVisible()
Returns 'true' if status bar of GUI is shown. The status bar displays status information and error messages sent by CoreProtocolBean.

Returns:
true if status bar is shown in GUI, false otherwise.
 o messageReceived
 public void messageReceived(MimeMessage msg)
Processes the received messages and stores in Inbox. This method is invoked by CoreProtocolBean after it has received a new message from the POP3 server. When the CoreProtocolBean receives new messages this method is called for processing and displaying. The message is stored in the Inbox (identified by Folder.INBOX) folder. If the active folder is Inbox, the header information is displayed in the GUI.

Parameters:
msg - MimeMessage that has been received.
Throws: IllegalArgumentException
if MimeMessage is null.
See Also:
MessageEvent, MessageListener, MimeMessage, Folder
 o messageReceived
 public void messageReceived(MessageEvent msgEvt)
Processes the received messages and stores in Inbox. It is part of the MessageListener interface. This method is invoked by CoreProtocolBean after it has received a new message from the POP3 server. When the CoreProtocolBean receives new messages this method is called for processing and displaying. The message is stored in the Inbox (identified by Folder.INBOX) folder. If the active folder is Inbox, the header information is displayed in the GUI.

Parameters:
msgEvt - event containing newly received MimeMessage
See Also:
MessageEvent, MessageListener, MimeMessage, Folder
 o mouseClicked
 public void mouseClicked(MouseEvent e)
Method to handle events for the MouseListener interface.

Parameters:
e - java.awt.event.MouseEvent
 o mouseEntered
 public void mouseEntered(MouseEvent e)
Method to handle events for the MouseListener interface.

Parameters:
e - java.awt.event.MouseEvent
 o mouseExited
 public void mouseExited(MouseEvent e)
Method to handle events for the MouseListener interface.

Parameters:
e - java.awt.event.MouseEvent
 o mousePressed
 public void mousePressed(MouseEvent e)
Method to handle events for the MouseListener interface.

Parameters:
e - java.awt.event.MouseEvent
 o mouseReleased
 public void mouseReleased(MouseEvent e)
Method to handle events for the MouseListener interface.

Parameters:
e - java.awt.event.MouseEvent
 o moveSelectedMessage
 public synchronized void moveSelectedMessage(String folderName)
Moves message from current folder to destination folder.

Parameters:
folderName - destination folder.
Throws: IllegalArgumentException
if Destination folder is null or not supported.
See Also:
Folder
 o processStatus
 public void processStatus(StatusEvent statEvt)
Part of StatusListener and it processes the status information. This method is invoked by CoreProtocolBean when it is communicating with the POP3 server in the process of receiving new messages. When the CoreProtocolBean receives server response this method is invoked to display the status. If the status bar is set visible, the status information is displayed in the GUI.

Parameters:
statEvt - event containing status information.
See Also:
StatusEvent, StatusListener
 o processStatus
 public void processStatus(String status)
Processes the status information. This method is invoked by CoreProtocolBean when its communicating with the POP3 server in the process of receiving new messages. When the CoreProtocolBean receives server response this method is invoked to display the status. If the status bar is set visible, the status information is displayed in the GUI.

Parameters:
status - status informtion.
Throws: IllegalArgumentException
if status value is null.
See Also:
StatusEvent, StatusListener
 o readExternal
 public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
NOT FOR DEVELOPER USE. This is part of the mechanism for serializing the bean.

 o receiveMessage
 public void receiveMessage()
Receives new messages. This method prompts the user for a POP3 login password and requests the CoreProtocolBean to receive new messages from the POP3 server.

 o removeConfigListener
 public void removeConfigListener(ConfigListener cl)
Removes the listener of ConfigEvent. For removing the listeners which need to be notified of changes to:

Parameters:
cl - com.ibm.network.mail.pop3.event.ConfigListener.
 o removeDecodeMessageListener
 public void removeDecodeMessageListener(DecodeMessageListener dml)
Removes listener of DecodeMessageEvent. For removing the listeners which:

Parameters:
ml - com.ibm.network.mail.pop3.event.MessageListener.
 o removePropertyChangeListener
 public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a listener of change of read-only bound property Status.

Parameters:
listener - PropertyChangeListener.
 o removeRequestMessageListener
 public void removeRequestMessageListener(RequestMessageListener rml)
Removes listener of RequestMessageEvent. For removing the listeners which:

Parameters:
ml - com.ibm.network.mail.pop3.event.MessageListener.
 o setDisplayAllHeaders
 public void setDisplayAllHeaders(boolean b)
Indicate whether all headers of a message are to be displayed. Message header information is displayed in the text area of the GUI.

Parameters:
b - true if headers are to be displayed.
See Also:
UserOptions
 o setFolderDirectory
 public void setFolderDirectory(String dir)
Sets the directory where the folders containing messages are to be stored. All folders use a common "message" file. In addition there are files created for every folder. All these files will be stored in the folder directory.

Parameters:
dir - directory name.
Throws: IllegalArgumentException
if Directory value is null.
See Also:
Folder
 o setHeaderCaptionWidths
 public void setHeaderCaptionWidths(int widths[])
Sets the widths of the header captions. In effect it also sets the width of each of the header elements that are displayed in the header list. Sizes are to be set in an array for the fields "Date", "Sender", "Subject" and "Status", in that order.

Parameters:
widths - array of integers containing caption widths.
Throws: IllegalArgumentException
if caption widths values are null.
Throws: IllegalArgumentException
if caption widths array is empty.
 o setLeaveMessagesOnServer
 public void setLeaveMessagesOnServer(boolean b)
Indicates whether messages are to be left on POP3 server after receiving.

Parameters:
b - true if messages are to be left on server, false otherwise.
See Also:
UserOptions
 o setLoginId
 public void setLoginId(String id)
Sets the POP3 login ID of the user.

Parameters:
id - login ID of user.
Throws: IllegalArgumentException
if POP3 Login name is null or blank.
See Also:
UserOptions
 o setPOP3Server
 public void setPOP3Server(ServerOptions pop3Server)
Sets POP3 server settings.

Parameters:
pop3Server - POP3 server options.
Throws: IllegalArgumentException
if POP3 server option is null.
See Also:
ServerOptions
 o setPOP3ServerHost
 public void setPOP3ServerHost(String server)
Sets the host name of the POP3 server.

Parameters:
server - POP3 server's host name/IP address.
Throws: IllegalArgumentException
if POP3 Server name is null or blank.
See Also:
ServerOptions
 o setPOP3ServerPort
 public void setPOP3ServerPort(int port)
Sets port number of the POP3 server.

Parameters:
port - POP3 server's port number (default=110).
 o setRememberPassword
 public void setRememberPassword(boolean b)
Indicates whether user login password is to be remembered. If so specified, user is not prompted for password at login.

Parameters:
b - true if password of user is to be remembered, false otherwise.
See Also:
UserOptions
 o setSocksified
 public void setSocksified(boolean b)
Indicates whether socks server is to be used while receiving messages from POP3 server.

Parameters:
b - true if socksification is to be applied, false otherwise.
See Also:
ServerOptions
 o setSocksServer
 public void setSocksServer(ServerOptions socksServer)
Sets socks server options.

Parameters:
socksServer - socks server options.
Throws: IllegalArgumentException
if socksServer option is null.
See Also:
ServerOptions
 o setSocksServerHost
 public void setSocksServerHost(String server)
Sets the socks server host name.

Parameters:
server - socks server's host name/IP address.
Throws: IllegalArgumentException
if Socks host name is null or blank.
See Also:
ServerOptions
 o setSocksServerPort
 public void setSocksServerPort(int port)
Sets the port number of the socks server.

Parameters:
port - socks server's port number.
Throws: IllegalArgumentException
if socks port is below 1.
See Also:
ServerOptions
 o setStatusVisible
 public void setStatusVisible(boolean b)
Indicates whether status bar of GUI is to be shown. The status bar displays status information and error messages sent by CoreProtocolBean.

Parameters:
b - true if status bar is to be shown in GUI, false otherwise.
 o setUserOptions
 public void setUserOptions(UserOptions user)
Sets POP3 user options.

Parameters:
user - user options. This would be either TransientUserOptions if rememberPassword is false, or PersistantUserOptions if rememberPassword is true.
See Also:
UserOptions, TransientUserOptions, PersistantUserOptions
 o setUserPassword
 public void setUserPassword(String password)
Sets the login password of POP3 user.

Parameters:
password - password of user.
Throws: IllegalArgumentException
if user password is null.
 o writeExternal
 public void writeExternal(ObjectOutput out) throws IOException
NOT FOR DEVELOPER USE. This is part of the mechanism for serializing the bean.


All Packages  Class Hierarchy  This Package  Previous  Next  Index