KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > mail > event > MessageChangedEvent


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the "License"). You may not use this file except
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * HEADER in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21
22 /*
23  * @(#)MessageChangedEvent.java 1.8 05/08/29
24  *
25  * Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved.
26  */

27
28 package javax.mail.event;
29
30 import java.util.*;
31 import javax.mail.*;
32
33 /**
34  * This class models Message change events.
35  *
36  * @author John Mani
37  */

38
39 public class MessageChangedEvent extends MailEvent JavaDoc {
40
41     /** The message's flags changed. */
42     public static final int FLAGS_CHANGED = 1;
43     /** The message's envelope (headers, but not body) changed. */
44     public static final int ENVELOPE_CHANGED = 2;
45
46     /**
47      * The event type.
48      *
49      * @serial
50      */

51     protected int type;
52
53     /**
54      * The message that changed.
55      */

56     transient protected Message msg;
57
58     private static final long serialVersionUID = -4974972972105535108L;
59
60     /**
61      * Constructor.
62      * @param source The folder that owns the message
63      * @param type The change type
64      * @param msg The changed message
65      */

66     public MessageChangedEvent(Object JavaDoc source, int type, Message msg) {
67     super(source);
68     this.msg = msg;
69     this.type = type;
70     }
71
72     /**
73      * Return the type of this event.
74      * @return type
75      */

76     public int getMessageChangeType() {
77     return type;
78     }
79
80     /**
81      * Return the changed Message.
82      * @return the message
83      */

84     public Message getMessage() {
85     return msg;
86     }
87
88     /**
89      * Invokes the appropriate MessageChangedListener method.
90      */

91     public void dispatch(Object JavaDoc listener) {
92     ((MessageChangedListener JavaDoc)listener).messageChanged(this);
93     }
94 }
95
Popular Tags