KickJava   Java API By Example, From Geeks To Geeks.

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


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 AddToHAMAction extends AbstractAction
20 {
21   FolderView folderView;
22
23   public AddToHAMAction(FolderView _folderView)
24   {
25      super(Language.translate("Set selected messages as HAM"));
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
46   /** ActionListener
47   */

48   public void actionPerformed(ActionEvent e)
49   {
50      MailMessage[] messs = folderView.getSelectedMessages();
51      for(MailMessage mess: messs)
52      {
53         mess.setHAM(true);
54
55         // ### should update here the stat
56
/* SnowMailClientApp.getInstance().getWordStatistic().addText(
57           mess.getMessageBody(), true); */

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