1 21 22 27 28 package javax.mail.event; 29 30 import java.util.*; 31 import javax.mail.*; 32 33 48 49 public class MessageCountEvent extends MailEvent { 50 51 52 public static final int ADDED = 1; 53 54 public static final int REMOVED = 2; 55 56 61 protected int type; 62 63 72 protected boolean removed; 73 74 77 transient protected Message[] msgs; 78 79 private static final long serialVersionUID = -7447022340837897369L; 80 81 93 public MessageCountEvent(Folder folder, int type, 94 boolean removed, Message[] msgs) { 95 super(folder); 96 this.type = type; 97 this.removed = removed; 98 this.msgs = msgs; 99 } 100 101 105 public int getType() { 106 return type; 107 } 108 109 120 public boolean isRemoved() { 121 return removed; 122 } 123 124 128 public Message[] getMessages() { 129 return msgs; 130 } 131 132 135 public void dispatch(Object listener) { 136 if (type == ADDED) 137 ((MessageCountListener )listener).messagesAdded(this); 138 else ((MessageCountListener )listener).messagesRemoved(this); 140 } 141 } 142 | Popular Tags |