1 21 22 27 28 package javax.mail.event; 29 30 import java.util.*; 31 import javax.mail.*; 32 33 50 51 public class FolderEvent extends MailEvent { 52 53 54 public static final int CREATED = 1; 55 56 public static final int DELETED = 2; 57 58 public static final int RENAMED = 3; 59 60 65 protected int type; 66 67 70 transient protected Folder folder; 71 72 77 transient protected Folder newFolder; 78 79 private static final long serialVersionUID = 5278131310563694307L; 80 81 88 public FolderEvent(Object source, Folder folder, int type) { 89 this(source, folder, folder, type); 90 } 91 92 101 public FolderEvent(Object source, Folder oldFolder, 102 Folder newFolder, int type) { 103 super(source); 104 this.folder = oldFolder; 105 this.newFolder = newFolder; 106 this.type = type; 107 } 108 109 114 public int getType() { 115 return type; 116 } 117 118 124 public Folder getFolder() { 125 return folder; 126 } 127 128 139 public Folder getNewFolder() { 140 return newFolder; 141 } 142 143 146 public void dispatch(Object listener) { 147 if (type == CREATED) 148 ((FolderListener )listener).folderCreated(this); 149 else if (type == DELETED) 150 ((FolderListener )listener).folderDeleted(this); 151 else if (type == RENAMED) 152 ((FolderListener )listener).folderRenamed(this); 153 } 154 } 155 | Popular Tags |