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:
-
DecodeMessageEvent
to
-
MimeDecoderBean
for decoding a message.
-
RequestMessageEvent
to
-
CoreProtocolBean
for requesting it to receive new messages
-
ConfigEvent
to
-
CoreProtocolBean
for setting server and user options.
It supports the following event listener interfaces:
-
MessageListener
which is called by
-
CoreProtocolBean
to inform that a
new message has been received
-
DecodeListener
which is called by
-
MimeDecoderBean
to inform that MIME
data has been decoded.
-
StatusListener
which is called by
-
CoreProtocolBean
to convey status
of requested operation (receiving mail)
- Author:
- Mohit M Sant, Abdul Majeed Ghadialy
- See Also:
- RequestMessageEvent, DecodeMessageEvent, ConfigEvent, MessageListener, StatusListener, DecodeListener
-
UserInterfaceBean()
- Constructor for
UserInterfaceBean
.
-
actionPerformed(ActionEvent)
- This method was created by a SmartGuide.
-
addConfigListener(ConfigListener)
- Adds a listener for
ConfigEvent
.
-
addDecodeMessageListener(DecodeMessageListener)
- Adds a listener for
DecodeMessageEvent
.
-
addPropertyChangeListener(PropertyChangeListener)
- Adds the specified
PropertyChangeListener
for receiving PropertyChangeEvent
from this bean.
-
addRequestMessageListener(RequestMessageListener)
- Adds a listener for
RequestMessageEvent
.
-
changeUserPassword()
- Displays a dialog box for entering new user password.
-
configure()
- Allows user to set various server and user options.
-
decodePerformed()
- Notifies the
UserInterfaceBean
that decoding of bodypart is complete.
-
deleteSelectedMessage()
- Deletes the selected message from current folder.
-
emptyTrashFolder()
- Empties the Trash folder.
-
getBCCRecipients()
- Returns the list of 'BCC' recipients.
-
getBody()
- Returns the body of the current message.
-
getBodyPartToDecode()
- Returns the bodypart which the
UserInterfaceBean
wants to be decoded.
-
getCCRecipients()
- Returns the list of 'CC' recipients.
-
getFolderDirectory()
- Returns the directory where the file containing all messages is stored.
-
getHeaderCaptionWidths()
- Returns the widths of the header captions.
-
getLoginId()
- Returns the POP3 login ID of the user.
-
getMessage()
- Returns the message.
-
getPOP3Server()
- Returns the current POP3 server settings.
-
getPOP3ServerHost()
- Returns the host name of the POP3 server.
-
getPOP3ServerPort()
- Returns the port number of the POP3 server.
-
getSender()
- Returns the mail-id of sender of current message.
-
getSocksServer()
- Returns the current socks server settings.
-
getSocksServerHost()
- Returns the host name of socks server.
-
getSocksServerPort()
- Returns the port number of the socks server.
-
getStatus()
- Returns the status information about the operation of receiving new messages.
-
getSubject()
- Returns the "Subject" of the current message.
-
getTORecipients()
- Returns the list of 'TO' recipients.
-
getUserOptions()
- Returns the current POP3 user settings.
-
getUserPassword()
- Returns the login password of POP3 user.
-
isDisplayAllHeaders()
- Returns 'true' if all headers of a message are being displayed.
-
isLeaveMessagesOnServer()
- Returns true if messages are being left on server after receiving.
-
isRememberPassword()
- Returns true if user login password is to be remembered.
-
isSocksified()
- Returns true if socks server is being used.
-
isStatusVisible()
- Returns 'true' if status bar of GUI is shown.
-
messageReceived(MessageEvent)
- Processes the received messages and stores in Inbox.
-
messageReceived(MimeMessage)
- Processes the received messages and stores in Inbox.
-
mouseClicked(MouseEvent)
- Method to handle events for the MouseListener interface.
-
mouseEntered(MouseEvent)
- Method to handle events for the MouseListener interface.
-
mouseExited(MouseEvent)
- Method to handle events for the MouseListener interface.
-
mousePressed(MouseEvent)
- Method to handle events for the MouseListener interface.
-
mouseReleased(MouseEvent)
- Method to handle events for the MouseListener interface.
-
moveSelectedMessage(String)
- Moves message from current folder to destination folder.
-
processStatus(StatusEvent)
- Part of StatusListener and it processes the status information.
-
processStatus(String)
- Processes the status information.
-
readExternal(ObjectInput)
- NOT FOR DEVELOPER USE.
-
receiveMessage()
- Receives new messages.
-
removeConfigListener(ConfigListener)
- Removes the listener of
ConfigEvent
.
-
removeDecodeMessageListener(DecodeMessageListener)
- Removes listener of
DecodeMessageEvent
.
-
removePropertyChangeListener(PropertyChangeListener)
- Removes a listener of change of read-only bound property
Status
.
-
removeRequestMessageListener(RequestMessageListener)
- Removes listener of
RequestMessageEvent
.
-
setDisplayAllHeaders(boolean)
- Indicate whether all headers of a message are to be displayed.
-
setFolderDirectory(String)
- Sets the directory where the folders containing messages are to be stored.
-
setHeaderCaptionWidths(int[])
- Sets the widths of the header captions.
-
setLeaveMessagesOnServer(boolean)
- Indicates whether messages are to be left on POP3 server after receiving.
-
setLoginId(String)
- Sets the POP3 login ID of the user.
-
setPOP3Server(ServerOptions)
- Sets POP3 server settings.
-
setPOP3ServerHost(String)
- Sets the host name of the POP3 server.
-
setPOP3ServerPort(int)
- Sets port number of the POP3 server.
-
setRememberPassword(boolean)
- Indicates whether user login password is to be remembered.
-
setSocksified(boolean)
- Indicates whether socks server is to be used
while receiving messages from POP3 server.
-
setSocksServer(ServerOptions)
- Sets socks server options.
-
setSocksServerHost(String)
- Sets the socks server host name.
-
setSocksServerPort(int)
- Sets the port number of the socks server.
-
setStatusVisible(boolean)
- Indicates whether status bar of GUI is to be shown.
-
setUserOptions(UserOptions)
- Sets POP3 user options.
-
setUserPassword(String)
- Sets the login password of POP3 user.
-
writeExternal(ObjectOutput)
- NOT FOR DEVELOPER USE.
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
actionPerformed
public void actionPerformed(ActionEvent evt)
- This method was created by a SmartGuide.
- Parameters:
- evt - java.awt.event.ActionEvent
addConfigListener
public void addConfigListener(ConfigListener cl)
- Adds a listener for
ConfigEvent
.
For adding the listeners which need to be notified about changes to:
- user options (
CoreProtocolBean
)
- POP3 and socks server options (
CoreProtocolBean
)
- Parameters:
- cl - com.ibm.network.mail.pop3.event.ConfigListener.
addDecodeMessageListener
public void addDecodeMessageListener(DecodeMessageListener dml)
- Adds a listener for
DecodeMessageEvent
.
For adding the listeners which:
- decode MIME data (
MimeDecoderBean
)
- Parameters:
- ml - com.ibm.network.mail.pop3.event.DecodeMessageListener.
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
.
addRequestMessageListener
public void addRequestMessageListener(RequestMessageListener rml)
- Adds a listener for
RequestMessageEvent
.
For adding the listeners which:
- receive new messages (
CoreProtocolBean
)
- Parameters:
- ml - com.ibm.network.mail.pop3.event.RequestMessageListener.
changeUserPassword
public void changeUserPassword()
- Displays a dialog box for entering new user password.
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:
- POP3 server host name and port number
- Socks server host name and port number
- User options
- folder directory
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.
deleteSelectedMessage
public void deleteSelectedMessage()
- Deletes the selected message from current folder.
The message is moved to the Trash folder.
- See Also:
- Folder
emptyTrashFolder
public synchronized void emptyTrashFolder()
- Empties the Trash folder.
The Trash folder is purged and all messages in it are removed.
- See Also:
- Folder
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.
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.
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.
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.
getFolderDirectory
public String getFolderDirectory()
- Returns the directory where the file containing all messages is stored.
All folders use the message file.
- See Also:
- Folder
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.
getLoginId
public String getLoginId()
- Returns the POP3 login ID of the user.
- Returns:
- login ID of user.
- See Also:
- UserOptions
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
.
getPOP3Server
public ServerOptions getPOP3Server()
- Returns the current POP3 server settings.
- Returns:
- POP3 server options.
- See Also:
- ServerOptions
getPOP3ServerHost
public String getPOP3ServerHost()
- Returns the host name of the POP3 server.
- Returns:
- POP3 server's host name/IP address.
- See Also:
- ServerOptions
getPOP3ServerPort
public int getPOP3ServerPort()
- Returns the port number of the POP3 server.
- Returns:
- POP3 server's port number.
- See Also:
- ServerOptions
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.
getSocksServer
public ServerOptions getSocksServer()
- Returns the current socks server settings.
- Returns:
- socks server options.
- See Also:
- ServerOptions
getSocksServerHost
public String getSocksServerHost()
- Returns the host name of socks server.
- Returns:
- socks server's host name/IP address.
- See Also:
- ServerOptions
getSocksServerPort
public int getSocksServerPort()
- Returns the port number of the socks server.
- Returns:
- socks server's port number.
- See Also:
- ServerOptions
getStatus
public String getStatus()
- Returns the status information about the operation of receiving new messages.
- Returns:
- status information.
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.
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.
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
getUserPassword
public String getUserPassword()
- Returns the login password of POP3 user.
- Returns:
- password of user.
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
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
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
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
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.
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
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
mouseClicked
public void mouseClicked(MouseEvent e)
- Method to handle events for the MouseListener interface.
- Parameters:
- e - java.awt.event.MouseEvent
mouseEntered
public void mouseEntered(MouseEvent e)
- Method to handle events for the MouseListener interface.
- Parameters:
- e - java.awt.event.MouseEvent
mouseExited
public void mouseExited(MouseEvent e)
- Method to handle events for the MouseListener interface.
- Parameters:
- e - java.awt.event.MouseEvent
mousePressed
public void mousePressed(MouseEvent e)
- Method to handle events for the MouseListener interface.
- Parameters:
- e - java.awt.event.MouseEvent
mouseReleased
public void mouseReleased(MouseEvent e)
- Method to handle events for the MouseListener interface.
- Parameters:
- e - java.awt.event.MouseEvent
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
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
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
readExternal
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
- NOT FOR DEVELOPER USE.
This is part of the mechanism for serializing the bean.
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.
removeConfigListener
public void removeConfigListener(ConfigListener cl)
- Removes the listener of
ConfigEvent
.
For removing the listeners which need to be notified of changes to:
- user options (
CoreProtocolBean
)
- POP3 and socks server options (
CoreProtocolBean
)
- Parameters:
- cl - com.ibm.network.mail.pop3.event.ConfigListener.
removeDecodeMessageListener
public void removeDecodeMessageListener(DecodeMessageListener dml)
- Removes listener of
DecodeMessageEvent
.
For removing the listeners which:
- decode MIME data (
MimeDecoderBean
)
- Parameters:
- ml - com.ibm.network.mail.pop3.event.MessageListener.
removePropertyChangeListener
public void removePropertyChangeListener(PropertyChangeListener listener)
- Removes a listener of change of read-only bound property
Status
.
- Parameters:
- listener - PropertyChangeListener.
removeRequestMessageListener
public void removeRequestMessageListener(RequestMessageListener rml)
- Removes listener of
RequestMessageEvent
.
For removing the listeners which:
- receive new messages (
CoreProtocolBean
)
- Parameters:
- ml - com.ibm.network.mail.pop3.event.MessageListener.
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
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
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.
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
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
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
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
setPOP3ServerPort
public void setPOP3ServerPort(int port)
- Sets port number of the POP3 server.
- Parameters:
- port - POP3 server's port number (default=110).
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
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
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
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
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
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.
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
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.
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