1 /*
2 * (C) 2002 David Carr david@carr.name
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19 package net.sourceforge.mflow.action;
20
21 import java.awt.event;
22 import javax.swing;
23 import net.sourceforge.mflow;
24 import net.sourceforge.mflow.folder;
25
26 /**
27 * An Action to send all pending Msg's
28 *
29 * @author <a href="mailto:david@carr.name">David Carr</a>
30 */
31 public class SendAction extends AbstractAction {
32 /**
33 * Constructor to initialize the object
34 */
35 public SendAction() {
36 super("Send Messages");
37 putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_S));
38 putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_M, InputEvent.CTRL_MASK));
39 putValue(Action.SMALL_ICON, new ImageIcon(getClass().getResource("images/TrafficGreen.gif")));
40 }
41
42 /**
43 * Called when the menu is selected
44 * Sends all pending messages
45 *
46 * @param e the ActionEvent which has data describing the event
47 */
48 public void actionPerformed(ActionEvent e) {
49 SendFolder[] senders = MFlow.getSendFolders();
50 for(int i=0; i<senders.length; i++) {
51 senders[i].send();
52 }
53 }
54 }
55