1 21 22 27 28 package javax.mail.event; 29 30 import java.util.*; 31 import javax.mail.*; 32 33 38 39 public class ConnectionEvent extends MailEvent { 40 41 42 public static final int OPENED = 1; 43 44 public static final int DISCONNECTED = 2; 45 46 public static final int CLOSED = 3; 47 48 53 protected int type; 54 55 private static final long serialVersionUID = -1855480171284792957L; 56 57 61 public ConnectionEvent(Object source, int type) { 62 super(source); 63 this.type = type; 64 } 65 66 70 public int getType() { 71 return type; 72 } 73 74 77 public void dispatch(Object listener) { 78 if (type == OPENED) 79 ((ConnectionListener )listener).opened(this); 80 else if (type == DISCONNECTED) 81 ((ConnectionListener )listener).disconnected(this); 82 else if (type == CLOSED) 83 ((ConnectionListener )listener).closed(this); 84 } 85 } 86 | Popular Tags |