Methods Summary |
---|
public int | getChildCount()return the number of children for this folder node. The first
time this method is called we load up all of the folders
under the store's defaultFolder
if (!hasLoaded) {
loadChildren();
}
return super.getChildCount();
|
public javax.mail.Folder | getFolder()returns the folder for this node
return folder;
|
public boolean | isLeaf()a Folder is a leaf if it cannot contain sub folders
try {
if ((folder.getType() & Folder.HOLDS_FOLDERS) == 0)
return true;
} catch (MessagingException me) { }
// otherwise it does hold folders, and therefore not
// a leaf
return false;
|
protected void | loadChildren()
// if it is a leaf, just say we have loaded them
if (isLeaf()) {
hasLoaded = true;
return;
}
try {
// Folder[] sub = folder.listSubscribed();
Folder[] sub = folder.list();
// add a FolderTreeNode for each Folder
int num = sub.length;
for(int i = 0; i < num; i++) {
FolderTreeNode node = new FolderTreeNode(sub[i]);
// we used insert here, since add() would make
// another recursive call to getChildCount();
insert(node, i);
}
} catch (MessagingException me) {
me.printStackTrace();
}
|
public java.lang.String | toString()override toString() since we only want to display a folder's
name, and not the full path of the folder
return folder.getName();
|