FileDocCategorySizeDatePackage
FolderEvent.javaAPI DocGlassfish v2 API5395Mon May 14 15:28:48 BST 2007javax.mail.event

FolderEvent

public class FolderEvent extends MailEvent
This class models Folder existence events. FolderEvents are delivered to FolderListeners registered on the affected Folder as well as the containing Store.

Service providers vary widely in their ability to notify clients of these events. At a minimum, service providers must notify listeners registered on the same Store or Folder object on which the operation occurs. Service providers may also notify listeners when changes are made through operations on other objects in the same virtual machine, or by other clients in the same or other hosts. Such notifications are not required and are typically not supported by mail protocols (including IMAP).

author
John Mani
author
Bill Shannon

Fields Summary
public static final int
CREATED
The folder was created.
public static final int
DELETED
The folder was deleted.
public static final int
RENAMED
The folder was renamed.
protected int
type
The event type.
protected transient Folder
folder
The folder the event occurred on.
protected transient Folder
newFolder
The folder that represents the new name, in case of a RENAMED event.
private static final long
serialVersionUID
Constructors Summary
public FolderEvent(Object source, Folder folder, int type)
Constructor.

param
source The source of the event
param
folder The affected folder
param
type The event type


          	      	    	       
           
	this(source, folder, folder, type);
    
public FolderEvent(Object source, Folder oldFolder, Folder newFolder, int type)
Constructor. Use for RENAMED events.

param
source The source of the event
param
oldFolder The folder that is renamed
param
newFolder The folder that represents the new name
param
type The event type
since
JavaMail 1.1

	super(source);
	this.folder = oldFolder;
	this.newFolder = newFolder;
	this.type = type;
    
Methods Summary
public voiddispatch(java.lang.Object listener)
Invokes the appropriate FolderListener method

	if (type == CREATED)
	    ((FolderListener)listener).folderCreated(this);
	else if (type == DELETED)
	    ((FolderListener)listener).folderDeleted(this);
	else if (type == RENAMED)
	    ((FolderListener)listener).folderRenamed(this);
    
public javax.mail.FoldergetFolder()
Return the affected folder.

return
the affected folder
see
#getNewFolder

	return folder;
    
public javax.mail.FoldergetNewFolder()
If this event indicates that a folder is renamed, (i.e, the event type is RENAMED), then this method returns the Folder object representing the new name.

The getFolder() method returns the folder that is renamed.

return
Folder representing the new name.
see
#getFolder
since
JavaMail 1.1

	return newFolder;
    
public intgetType()
Return the type of this event.

return
type

	return type;