* @param mailFolder
* @return
*/
public static GWTMailFolder convert( IMailFolder mailFolder, boolean completeTree ) {
GWTMailFolder result = new GWTMailFolder();
result.setId( mailFolder.getId() );
result.setName( mailFolder.getName() );
// result.setUnreadMessagesCount( mailFolder.getUnreadMessageCount() );
result.setInbox( mailFolder.isInbox() );
result.setDraft( mailFolder.isDraft() );
result.setSent( mailFolder.isSent() );
result.setTrash( mailFolder.isTrash() );
result.setCreateSubfolderSupported( mailFolder.isCreateSubfolderSupported() );
result.setMoveSupported( mailFolder.isMoveSupported() );
result.setRenameSupported( mailFolder.isRenameSupported() );
result.setDeleteSupported( mailFolder.isDeleteSupported() );
result.setEmptySupported( mailFolder.isEmptySupported() );
if ( completeTree ) {
IMailFolder[] subfolders = mailFolder.getSubfolders();
if ( subfolders.length > 0 ) {
GWTMailFolder[] gwtSubfolders = new GWTMailFolder[subfolders.length];
for (int i = 0; i < subfolders.length; i++) {
IMailFolder subfolder = mailFolder.getSubfolders()[i];
gwtSubfolders[i] = convert( subfolder, completeTree );
gwtSubfolders[i].setParent( result );
}
result.setSubfolders( gwtSubfolders );
}
}
return result;
}