Jwma

dtw.webmail.model
Class JwmaDisplayMessage

java.lang.Object
  |
  +--dtw.webmail.model.JwmaDisplayMessage
All Implemented Interfaces:
JwmaMessage

public class JwmaDisplayMessage
extends java.lang.Object
implements JwmaMessage

Class implementing the JwmaMessage model.

This implementation is specialized to wrap a javax.mail.Message for displaying it.

Version:
0.9.7 07/02/2003
Author:
Dieter Wimberger

Constructor Summary
protected JwmaDisplayMessage(javax.mail.Message msg, int number)
          Constructs a JwmaDisplayMessage instance.
 
Method Summary
static JwmaDisplayMessage createJwmaDisplayMessage(JwmaMessageInfoImpl msginfo, javax.mail.Message msg, JwmaPreferences prefs)
          Creates a JwmaDisplayMessage instance.
static JwmaDisplayMessage createJwmaDisplayMessage(javax.mail.Message msg, JwmaPreferences prefs)
          Creates a JwmaDisplayMessage instance.
 java.lang.String getBCCTo()
          Returns a String representing the blind carbon copy receivers(s) of the message.
 java.lang.String getBody()
          Returns a String representing the body of the message.
 java.lang.String getCCTo()
          Returns a String representing the carbon copy receivers(s) of the message.
 java.util.Date getDate()
          Convenience method that returns a Date representing the received or sent date of the message.
 java.lang.String getFrom()
          Returns a String representing the sender(s) of the message.
 java.lang.String getFullHeader()
          Returns the full message header as String.
 javax.mail.Message getMessage()
           
 int getMessageNumber()
          Returns an int representing the number of this message.
 JwmaMessagePart getMessagePart(int number)
          Returns the message part with the given number.
 JwmaMessagePart[] getMessageParts()
          Returns an array of JwmaMessagePart objects.
 java.util.Date getReceivedDate()
          Returns a Date representing the date when the message was received.
 java.lang.String getReplyTo()
          Returns a String representing the Reply-To address(es) of the message.
 java.util.Date getSentDate()
          Returns a Date representing the date when the message was sent.
 java.lang.String getSubject()
          Returns a String representing the subject of the message.
 java.lang.String getTo()
          Returns a String representing the receivers(s) of the message.
 boolean isMultipart()
          Tests if the message is multipart.
 boolean isReceived()
          Tests if the message was received.
 boolean isSent()
          Tests if the message was sent.
 boolean isSinglepart()
          Tests if the message is singlepart.
 void setBody(java.lang.String body)
          Sets the body of the message.
 void setReplyTo(java.lang.String replyto)
          Set the Reply-To address(es) of the message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JwmaDisplayMessage

protected JwmaDisplayMessage(javax.mail.Message msg,
                             int number)
Constructs a JwmaDisplayMessage instance.

Parameters:
number - the number of the message as int
Method Detail

getMessage

public javax.mail.Message getMessage()

getFullHeader

public java.lang.String getFullHeader()
Returns the full message header as String.

Specified by:
getFullHeader in interface JwmaMessage
Returns:
Full message header as String.

getMessageNumber

public int getMessageNumber()
Description copied from interface: JwmaMessage
Returns an int representing the number of this message.

This number is the unique identifier for a message within a folder, or -1 in case of a message created for being composed.

Specified by:
getMessageNumber in interface JwmaMessage
Returns:
the number of this message, or -1 if newly created for composing.

isReceived

public boolean isReceived()
Description copied from interface: JwmaMessage
Tests if the message was received.

Specified by:
isReceived in interface JwmaMessage
Returns:
true if the message was received, false otherwise.

isSent

public boolean isSent()
Description copied from interface: JwmaMessage
Tests if the message was sent.

Note that this method will always return the opposite of isReceived() (i.e. represents !getReceived()).

Specified by:
isSent in interface JwmaMessage
Returns:
true if the message was sent, false otherwise.

getReceivedDate

public java.util.Date getReceivedDate()
Description copied from interface: JwmaMessage
Returns a Date representing the date when the message was received.

Specified by:
getReceivedDate in interface JwmaMessage
Returns:
the received date of the message.

getSentDate

public java.util.Date getSentDate()
Description copied from interface: JwmaMessage
Returns a Date representing the date when the message was sent.

Specified by:
getSentDate in interface JwmaMessage
Returns:
the sent date of the message.

getDate

public java.util.Date getDate()
Description copied from interface: JwmaMessage
Convenience method that returns a Date representing the received or sent date of the message. (Depending on whether it was sent or received).

Specified by:
getDate in interface JwmaMessage
Returns:
the received or sent date of the message.

getFrom

public java.lang.String getFrom()
Description copied from interface: JwmaMessage
Returns a String representing the sender(s) of the message.

Specified by:
getFrom in interface JwmaMessage
Returns:
the sender(s) of the message as String.

getReplyTo

public java.lang.String getReplyTo()
Description copied from interface: JwmaMessage
Returns a String representing the Reply-To address(es) of the message.

Specified by:
getReplyTo in interface JwmaMessage
Returns:
the Reply-To address(es) of the message as String.

setReplyTo

public void setReplyTo(java.lang.String replyto)
Set the Reply-To address(es) of the message.


getTo

public java.lang.String getTo()
Description copied from interface: JwmaMessage
Returns a String representing the receivers(s) of the message.

Specified by:
getTo in interface JwmaMessage
Returns:
the receiver(s) of the message as String.

getCCTo

public java.lang.String getCCTo()
Description copied from interface: JwmaMessage
Returns a String representing the carbon copy receivers(s) of the message.

Specified by:
getCCTo in interface JwmaMessage
Returns:
the carbon copy receiver(s) of the message as String.

getBCCTo

public java.lang.String getBCCTo()
Description copied from interface: JwmaMessage
Returns a String representing the blind carbon copy receivers(s) of the message.

Specified by:
getBCCTo in interface JwmaMessage
Returns:
the blind carbon copy receiver(s) of the message as String.

getSubject

public java.lang.String getSubject()
Description copied from interface: JwmaMessage
Returns a String representing the subject of the message.

Specified by:
getSubject in interface JwmaMessage
Returns:
the subject of the message as String.

isSinglepart

public boolean isSinglepart()
Description copied from interface: JwmaMessage
Tests if the message is singlepart.

A singlepart message does not have any attachments.

Specified by:
isSinglepart in interface JwmaMessage
Returns:
true if the message is singlepart, false otherwise.

isMultipart

public boolean isMultipart()
Description copied from interface: JwmaMessage
Tests if the message is multipart.

A multipart message has attachments or is composed out of different parts. Note that this method will always return the opposite of isSinglepart() (i.e. represents !isSinglepart()).

Specified by:
isMultipart in interface JwmaMessage
Returns:
true if the message is multipart, false otherwise.

getBody

public java.lang.String getBody()
Description copied from interface: JwmaMessage
Returns a String representing the body of the message.

Note that the body will be the (plain text) content of a singlepart message. The method will return an empty String for a multipart message.

A view programmer should base display decisions on the isSinglepart() (or isMultipart() method.

Specified by:
getBody in interface JwmaMessage
Returns:
the content of the message as String.
See Also:
JwmaMessage.isSinglepart(), JwmaMessage.isMultipart()

setBody

public void setBody(java.lang.String body)
Sets the body of the message.

Parameters:
body - the text/plain content of the message as String.

getMessagePart

public JwmaMessagePart getMessagePart(int number)
                               throws JwmaException
Returns the message part with the given number.

Parameters:
number - the number of the requested part as int.
Returns:
the reference to wrapper instance of the requested part.
Throws:
JwmaException - if the part does not exist.

getMessageParts

public JwmaMessagePart[] getMessageParts()
Description copied from interface: JwmaMessage
Returns an array of JwmaMessagePart objects.

If this message does not contain any parts, then this method returns an empty array. Otherwise it contains one JwmaMessagePart object for each part of this message representing information about the part.

A view programmer should base display decisions on the isSinglepart() (or isMultipart() method.

Specified by:
getMessageParts in interface JwmaMessage
Returns:
an array of JwmaMessagePart objects each representing information about a part of this message. The array will be empty if this message has no parts.
See Also:
JwmaMessagePart, JwmaMessage.isSinglepart(), JwmaMessage.isMultipart()

createJwmaDisplayMessage

public static JwmaDisplayMessage createJwmaDisplayMessage(JwmaMessageInfoImpl msginfo,
                                                          javax.mail.Message msg,
                                                          JwmaPreferences prefs)
                                                   throws JwmaException
Creates a JwmaDisplayMessage instance. At the moment it just delegates the call to createJwmaDisplayMessage(Message,boolean), but the idea is to recycle the passed in JwmaMessageInfoImpl instance somewhen.

Parameters:
msginfo - the JwmaMessageInfoImpl to create this instance from.
msg - the Message to create this instance from.
prefs - the user's preferences.
Returns:
the created JwmaDisplayMessage instance.
Throws:
JwmaException - if it fails to create the new instance.

createJwmaDisplayMessage

public static JwmaDisplayMessage createJwmaDisplayMessage(javax.mail.Message msg,
                                                          JwmaPreferences prefs)
                                                   throws JwmaException
Creates a JwmaDisplayMessage instance.

Parameters:
msg - the Message to create this instance from.
prefs - the user's preferences.
Returns:
the newly created instance.
Throws:
JwmaException - if it fails to create the new instance.

Jwma

Copyright © 2000-2003 jwma team (All Rights Reserved.)