001: // The contents of this file are subject to the Mozilla Public License Version
002: // 1.1
003: //(the "License"); you may not use this file except in compliance with the
004: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
005: //
006: //Software distributed under the License is distributed on an "AS IS" basis,
007: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
008: //for the specific language governing rights and
009: //limitations under the License.
010: //
011: //The Original Code is "The Columba Project"
012: //
013: //The Initial Developers of the Original Code are Frederik Dietz and Timo
014: // Stich.
015: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
016: //
017: //All Rights Reserved.
018: package org.columba.mail.folder;
019:
020: import java.util.Enumeration;
021:
022: import javax.swing.tree.MutableTreeNode;
023: import javax.swing.tree.TreeNode;
024: import javax.swing.tree.TreePath;
025:
026: import org.columba.api.plugin.IExtensionInterface;
027: import org.columba.core.folder.api.IFolder;
028: import org.columba.mail.config.IFolderItem;
029: import org.columba.mail.folder.event.IFolderListener;
030:
031: /**
032: * @author fdietz
033: *
034: */
035: public interface IMailFolder extends MutableTreeNode, IFolder,
036: IExtensionInterface {
037: /**
038: * Adds a listener.
039: */
040: void addFolderListener(IFolderListener l);
041:
042: /**
043: * Removes a previously registered listener.
044: */
045: void removeFolderListener(IFolderListener l);
046:
047: /**
048: * Method getSelectionTreePath.
049: *
050: * @return TreePath
051: */
052: TreePath getSelectionTreePath();
053:
054: /**
055: * Returns the folder's configuration.
056: */
057: IFolderItem getConfiguration();
058:
059: /**
060: * Sets the folder's configuration.
061: */
062: void setConfiguration(IFolderItem node);
063:
064: /**
065: * Sets the folder's name. This method notifies registered FolderListeners.
066: */
067: void setName(String newName) throws Exception;
068:
069: /**
070: * ************************** treenode management
071: * ******************************
072: */
073: void insert(IMailFolder newFolder, int newIndex);
074:
075: /**
076: * Removes this folder from its parent. This method will notify registered
077: * FolderListeners.
078: */
079: void removeFolder() throws Exception;
080:
081: /**
082: * Adds a child folder to this folder. This method will notify registered
083: * FolderListeners.
084: */
085: void addSubfolder(IMailFolder child) throws Exception;
086:
087: /**
088: *
089: * AbstractFolder wraps XmlElement
090: *
091: * all treenode manipulation is passed to the corresponding XmlElement
092: */
093: void moveTo(IMailFolder child);
094:
095: /** ******************* capabilities ************************************* */
096: boolean supportsAddMessage();
097:
098: /**
099: * Returns true if this folder can have sub folders of the specified type;
100: * false otherwise.
101: *
102: * @param newFolderType
103: * the folder that is going to be inserted as a child.
104: * @return true if this folder can have sub folders; false otherwise.
105: */
106: boolean supportsAddFolder(String newFolderType);
107:
108: /**
109: * Returns true if this folder type can be moved around in the folder tree.
110: *
111: * @return true if this folder type can be moved around in the folder tree.
112: */
113: boolean supportsMove();
114:
115: /**
116: * Return the root folder of this folder.
117: * <p>
118: * This is especially useful when using IMAP. IMAP has a root folder which
119: * is labelled with the account name.
120: *
121: * @return root parent folder of this folder
122: */
123: IMailFolder getRootFolder();
124:
125: void fireFolderPropertyChanged();
126:
127: void fireFolderAdded(IMailFolder folder);
128:
129: void fireFolderRemoved();
130:
131: TreeNode[] getPath();
132:
133: String getTreePath();
134:
135: Enumeration breadthFirstEnumeration();
136:
137: Enumeration depthFirstEnumeration();
138:
139: /**
140: * Add treenode as child to this parent node.
141: *
142: * @param treeNode new treenode
143: */
144: void add(IMailFolder treeNode);
145:
146: public String getType();
147: }
|