KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > SnowMailClient > view > actions > AddToSpamAction


1 package SnowMailClient.view.actions;
2
3 import SnowMailClient.SnowMailClientApp;
4 import SnowMailClient.model.folders.*;
5 import SnowMailClient.model.*;
6 import SnowMailClient.view.folders.*;
7 import SnowMailClient.view.*;
8 import SnowMailClient.Language.Language;
9
10 import java.awt.*;
11 import java.awt.event.*;
12 import javax.swing.*;
13 import javax.swing.event.*;
14 import javax.swing.table.*;
15
16
17 /** delete the selected mail (move in the deleted folder)
18 */

19 public final class AddToSpamAction extends AbstractAction
20 {
21   FolderView folderView;
22
23   public AddToSpamAction(FolderView _folderView)
24   {
25      super(Language.translate("Set selected messages as Spam"));
26      this.folderView = _folderView;
27
28 /* putValue(AbstractAction.ACCELERATOR_KEY,
29                 KeyStroke.getKeyStroke( KeyEvent.VK_D, KeyEvent.CTRL_MASK ) );*/

30
31      putValue(AbstractAction.SMALL_ICON, SnowMailClientApp.loadImageIcon("pics/addtospam.PNG"));
32
33
34      folderView.getTableSelectionModel().addListSelectionListener( new ListSelectionListener()
35      {
36         public void valueChanged(ListSelectionEvent e)
37         {
38            setEnabled(folderView.getTableSelectionCount()>0);
39         }
40      });
41      setEnabled(folderView.getTableSelectionCount()>0);
42
43   } // Constructor
44

45   public void actionPerformed(ActionEvent e)
46   {
47      MailMessage[] messs = folderView.getSelectedMessages();
48      for(MailMessage mess: messs)
49      {
50         mess.setSPAM(true);
51
52         // NO, don't fill the address book with that...
53
//AddressBook spamBook = SnowMailClientApp.getInstance().getSpamBook();
54
//spamBook.addAddress( mess.getFromAddress() );
55

56         // ### should update here the stat
57
/* SnowMailClientApp.getInstance().getWordStatistic().addText(
58           mess.getMessageBody(), true); */

59      }
60     // folderView.getMailFolder().notifyMailFolderListener_of_ContentEdited();
61
}
62
63
64
65 } // AddToSpamAction
Popular Tags