KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > suberic > pooka > filter > DeleteFilterAction


1 package net.suberic.pooka.filter;
2 import net.suberic.pooka.gui.MessageProxy;
3 import java.util.List JavaDoc;
4
5 /**
6  * A FilterActions which deletes all of the given Messages.
7  */

8 public class DeleteFilterAction implements FilterAction {
9   
10   public DeleteFilterAction() {
11     
12   }
13   
14   /**
15    * Runs the filterAction on each MessageProxy in the filteredMessages
16    * List.
17    *
18    * @param filteredMessages messages which have met the filter condition
19    * and need to have the FilterAction performed on them.
20    *
21    * @return messages which are removed from their original folder
22    * by the filter.
23    */

24   public List JavaDoc performFilter(List JavaDoc filteredMessages) {
25     List JavaDoc deleted = new java.util.LinkedList JavaDoc();
26     for (int i = 0; i < filteredMessages.size(); i++) {
27       MessageProxy current = (MessageProxy) filteredMessages.get(i);
28       current.deleteMessage(false);
29       deleted.add(current);
30     }
31     
32     return deleted;
33   }
34   
35   /**
36    * Initializes the FilterAction from the sourceProperty given.
37    */

38   
39   public void initializeFilter(String JavaDoc sourceProperty) {
40     // no initialization necessary.
41
}
42 }
43
Popular Tags