1 /*
2 * Copyright (C) 2000 Bill Bereza
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 * Author: Bill Bereza
19 * email : bereza@pobox.com
20 * url : http://www.pobox.com/~bereza/
21 */
22 package net.bereza.money.gui.action;
23
24 import net.bereza.money.gui;
25
26 import javax.swing;
27
28 /**
29 * NewAccountAction is an action for making accounts.
30 *
31 * @author $Author: bereza $
32 * @version $Revision: 1.3 $
33 * <p>
34 * $Log: NewAccountAction.java,v $
35 * Revision 1.3 2000/03/30 01:57:31 bereza
36 * Added copyright header
37 *
38 * Revision 1.2 2000/03/29 02:14:36 bereza
39 * new package name
40 *
41 * Revision 1.1 2000/03/24 00:48:55 bereza
42 * Initial revision
43 *
44 * <p>
45 * $Id: NewAccountAction.java,v 1.3 2000/03/30 01:57:31 bereza Exp $
46 */
47 public class NewAccountAction extends AbstractAction
48 {
49 java.util.ResourceBundle guiRes;
50 java.awt.Frame parentFrame;
51
52 public NewAccountAction(java.awt.Frame parent,
53 java.util.ResourceBundle gui)
54 {
55 guiRes=gui;
56 parentFrame=parent;
57
58 putValue(NAME,
59 guiRes.getString("action.newaccount.name"));
60 putValue(SHORT_DESCRIPTION,
61 guiRes.getString("action.newaccount.description"));
62 putValue(SMALL_ICON, kiwi.util.KiwiUtils.getResourceManager()
63 .getIcon(guiRes.getString(
64 "action.newaccount.icon")));
65 }
66
67 public void actionPerformed(java.awt.event.ActionEvent e)
68 {
69 if(isEnabled())
70 {
71 SwingUtilities.invokeLater(new Runnable()
72 {
73 public void run()
74 {
75 NewAccountDialog accountMaker=
76 new NewAccountDialog(parentFrame,
77 guiRes.getString("dialog.newaccount.title"),
78 guiRes.getString("dialog.newaccount.comment"));
79
80 kiwi.util.KiwiUtils.cascadeWindow(parentFrame, accountMaker);
81
82 accountMaker.show();
83
84 if(!accountMaker.isCancelled())
85 {
86 ItemLists.getItemLists().accountModel
87 .addElement(accountMaker.getAccount());
88 }
89 }
90 });
91 }
92 }
93 }