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 * NewTransactionCategoryAction is an action for making account types.
30 *
31 * @author $Author: bereza $
32 * @version $Revision: 1.3 $
33 * <p>
34 * $Log: NewTransactionCategoryAction.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:56:52 bereza
42 * Initial revision
43 *
44 * <p>
45 * $Id: NewTransactionCategoryAction.java,v 1.3 2000/03/30 01:57:31 bereza Exp $
46 */
47 public class NewTransactionCategoryAction extends AbstractAction
48 {
49 java.util.ResourceBundle guiRes;
50 java.awt.Frame parentFrame;
51
52 public NewTransactionCategoryAction(java.awt.Frame parent,
53 java.util.ResourceBundle gui)
54 {
55 guiRes=gui;
56 parentFrame=parent;
57
58 putValue(NAME,
59 guiRes.getString("action.newtransactioncategory.name"));
60 putValue(SHORT_DESCRIPTION,
61 guiRes.getString("action.newtransactioncategory.description"));
62 putValue(SMALL_ICON, kiwi.util.KiwiUtils.getResourceManager()
63 .getIcon(guiRes.getString(
64 "action.newtransactioncategory.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 String catClassName=net.bereza.money.db.TransactionCategory.class.getName();
76
77 NewCategoryDialog maker=
78 new NewCategoryDialog(parentFrame,
79 guiRes.getString("dialog.newcategory."+
80 catClassName+".title"),
81 guiRes.getString("dialog.newcategory."+
82 catClassName+".comment"),
83 catClassName);
84
85 kiwi.util.KiwiUtils.cascadeWindow(parentFrame, maker);
86
87 maker.show();
88
89 if(!maker.isCancelled())
90 {
91 ItemLists.getItemLists().transactionCategoryModel
92 .addElement(maker.getCategory());
93 }
94 }
95 });
96 }
97 }
98 }