KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > it > businesslogic > ireport > gui > actions > ActionShrinkSelected


1 /*
2  * Copyright (C) 2005 - 2006 JasperSoft Corporation. All rights reserved.
3  * http://www.jaspersoft.com.
4  *
5  * Unless you have purchased a commercial license agreement from JasperSoft,
6  * the following license terms apply:
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as published by
10  * the Free Software Foundation.
11  *
12  * This program is distributed WITHOUT ANY WARRANTY; and without the
13  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
18  * or write to:
19  *
20  * Free Software Foundation, Inc.,
21  * 59 Temple Place - Suite 330,
22  * Boston, MA USA 02111-1307
23  *
24  *
25  *
26  *
27  * ActionShrinkSelected.java
28  *
29  * Created on 12 juni 2005, 12:39
30  *
31  */

32
33 package it.businesslogic.ireport.gui.actions;
34
35 import it.businesslogic.ireport.OperationType;
36 import it.businesslogic.ireport.gui.command.FormatCommand;
37 import it.businesslogic.ireport.util.I18n;
38 import it.businesslogic.ireport.util.LanguageChangedEvent;
39 import it.businesslogic.ireport.util.LanguageChangedListener;
40 import javax.swing.AbstractAction JavaDoc;
41 import javax.swing.ButtonModel JavaDoc;
42 import javax.swing.ImageIcon JavaDoc;
43 import javax.swing.KeyStroke JavaDoc;
44
45 /**
46  *
47  * @author Fourdim
48  */

49 public class ActionShrinkSelected extends AbstractAction JavaDoc implements LanguageChangedListener
50 {
51     
52 // /**
53
// * The key used for storing the <code>String</code> name
54
// * for the action, used for a menu or button.
55
// */
56
// public static final String NAME = "Name";
57
//
58
// /**
59
// * The key used for storing a short <code>String</code>
60
// * description for the action, used for tooltip text.
61
// */
62
// public static String SHORT_DESCRIPTION = "ShortDescription";
63
// /**
64
// * The key used for storing a longer <code>String</code>
65
// * description for the action, could be used for context-sensitive help.
66
// */
67
// public static String LONG_DESCRIPTION = "LongDescription";
68
//
69
// /**
70
// * The key used for storing a small <code>Icon</code>, such
71
// * as <code>ImageIcon</code>, for the action, used for toolbar buttons.
72
// */
73
// public static final String SMALL_ICON = "SmallIcon";
74
//
75
// /**
76
// * The key used to determine the command <code>String</code> for the
77
// * <code>ActionEvent</code> that will be created when an
78
// * <code>Action</code> is going to be notified as the result of
79
// * residing in a <code>Keymap</code> associated with a
80
// * <code>JComponent</code>.
81
// */
82
// public static final String ACTION_COMMAND_KEY = "ActionCommandKey";
83
//
84
// /**
85
// * The key used for storing a <code>KeyStroke</code> to be used as the
86
// * accelerator for the action.
87
// *
88
// * @since 1.3
89
// */
90
// public static final String ACCELERATOR_KEY="AcceleratorKey";
91
//
92
// /**
93
// * The key used for storing a <code>KeyEvent</code> to be used as
94
// * the mnemonic for the action.
95
// *
96
// * @since 1.3
97
// */
98
// public static final String MNEMONIC_KEY="MnemonicKey";
99

100     
101     /** Creates a new instance of ActionShrinkSelected */
102     public ActionShrinkSelected()
103     {
104         // putValue( MNEMONIC_KEY, new Integer(KeyEvent.VK_S));
105
// http://java.sun.com/docs/books/tutorial/uiswing/components/tooltip.html
106

107         putValue( ACTION_COMMAND_KEY, "shrinkselected");
108         //putValue(SMALL_ICON, "/it/businesslogic/ireport/icons/menu/elem_shrink.gif");
109
ImageIcon JavaDoc imageIcon = new javax.swing.ImageIcon JavaDoc(getClass().getResource("/it/businesslogic/ireport/icons/menu/elem_shrink.png"));
110         putValue(SMALL_ICON, imageIcon );
111         
112         this.
113         putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke( java.awt.event.KeyEvent.VK_S, java.awt.Event.CTRL_MASK + java.awt.Event.SHIFT_MASK ));
114         
115         applyI18n();
116         I18n.addOnLanguageChangedListener( this );
117     }
118     
119     public void languageChanged(LanguageChangedEvent evt)
120     {
121         applyI18n();
122     }
123     
124     public void actionPerformed( java.awt.event.ActionEvent JavaDoc evt)
125     {
126         FormatCommand.getCommand(OperationType.SHRINK).execute();
127     }
128     
129     public void applyI18n()
130     {
131         String JavaDoc description = it.businesslogic.ireport.util.I18n.getString( "gui.MainFrame.ShrinkSelected", "Shrink selected");
132         putValue( NAME, description);
133         putValue(SHORT_DESCRIPTION, description);
134     }
135     
136 }
137
Popular Tags