01: //The contents of this file are subject to the Mozilla Public License Version 1.1
02: //(the "License"); you may not use this file except in compliance with the
03: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
04: //
05: //Software distributed under the License is distributed on an "AS IS" basis,
06: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
07: //for the specific language governing rights and
08: //limitations under the License.
09: //
10: //The Original Code is "The Columba Project"
11: //
12: //The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14: //
15: //All Rights Reserved.
16: package org.columba.mail.gui.composer.action;
17:
18: import java.awt.Toolkit;
19: import java.awt.event.ActionEvent;
20: import java.awt.event.KeyEvent;
21:
22: import javax.swing.KeyStroke;
23:
24: import org.columba.api.gui.frame.IFrameMediator;
25: import org.columba.core.command.CommandProcessor;
26: import org.columba.core.gui.action.AbstractColumbaAction;
27: import org.columba.core.resourceloader.ImageLoader;
28: import org.columba.mail.command.ComposerCommandReference;
29: import org.columba.mail.folder.outbox.OutboxFolder;
30: import org.columba.mail.gui.composer.ComposerController;
31: import org.columba.mail.gui.tree.FolderTreeModel;
32: import org.columba.mail.resourceloader.MailImageLoader;
33: import org.columba.mail.smtp.command.SendMessageCommand;
34: import org.columba.mail.util.MailResourceLoader;
35:
36: /**
37: * @author frd
38: *
39: * To change this generated comment go to
40: * Window>Preferences>Java>Code Generation>Code and Comments
41: */
42: public class SendAction extends AbstractColumbaAction {
43: public SendAction(IFrameMediator frameMediator) {
44: super (frameMediator, MailResourceLoader.getString("menu",
45: "composer", "menu_file_send"));
46:
47: // tooltip text
48: putValue(SHORT_DESCRIPTION, MailResourceLoader.getString(
49: "menu", "composer", "menu_file_send_tooltip")
50: .replaceAll("&", ""));
51:
52: // toolbar text
53: putValue(TOOLBAR_NAME, MailResourceLoader.getString("menu",
54: "composer", "menu_file_send_toolbar"));
55:
56: // large icon for toolbar
57: putValue(LARGE_ICON, MailImageLoader.getIcon("send.png"));
58:
59: // small icon for menu
60: putValue(SMALL_ICON, MailImageLoader.getSmallIcon("send.png"));
61:
62: // shortcut key
63: putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(
64: KeyEvent.VK_ENTER, Toolkit.getDefaultToolkit()
65: .getMenuShortcutKeyMask()));
66: }
67:
68: /* (non-Javadoc)
69: * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
70: */
71: public void actionPerformed(ActionEvent evt) {
72: final ComposerController composerController = (ComposerController) getFrameMediator();
73:
74: if (composerController.checkState()) {
75: return;
76: }
77:
78: OutboxFolder outboxFolder = (OutboxFolder) FolderTreeModel
79: .getInstance().getFolder("103");
80:
81: ComposerCommandReference r = new ComposerCommandReference(
82: composerController, outboxFolder);
83:
84: SendMessageCommand c = new SendMessageCommand(r);
85:
86: CommandProcessor.getInstance().addOp(c);
87: }
88: }
|