001: /*
002: * Copyright (C) 2005 - 2008 JasperSoft Corporation. All rights reserved.
003: * http://www.jaspersoft.com.
004: *
005: * Unless you have purchased a commercial license agreement from JasperSoft,
006: * the following license terms apply:
007: *
008: * This program is free software; you can redistribute it and/or modify
009: * it under the terms of the GNU General Public License version 2 as published by
010: * the Free Software Foundation.
011: *
012: * This program is distributed WITHOUT ANY WARRANTY; and without the
013: * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
014: * See the GNU General Public License for more details.
015: *
016: * You should have received a copy of the GNU General Public License
017: * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
018: * or write to:
019: *
020: * Free Software Foundation, Inc.,
021: * 59 Temple Place - Suite 330,
022: * Boston, MA USA 02111-1307
023: *
024: *
025: *
026: *
027: * ActionShrinkSelected.java
028: *
029: * Created on 12 juni 2005, 12:39
030: *
031: */
032:
033: package it.businesslogic.ireport.gui.actions;
034:
035: import it.businesslogic.ireport.OperationType;
036: import it.businesslogic.ireport.gui.command.FormatCommand;
037: import it.businesslogic.ireport.util.I18n;
038: import it.businesslogic.ireport.util.LanguageChangedEvent;
039: import it.businesslogic.ireport.util.LanguageChangedListener;
040: import javax.swing.AbstractAction;
041: import javax.swing.ButtonModel;
042: import javax.swing.ImageIcon;
043: import javax.swing.KeyStroke;
044:
045: /**
046: *
047: * @author Fourdim
048: */
049: public class ActionShrinkSelected extends AbstractAction implements
050: LanguageChangedListener {
051:
052: // /**
053: // * The key used for storing the <code>String</code> name
054: // * for the action, used for a menu or button.
055: // */
056: // public static final String NAME = "Name";
057: //
058: // /**
059: // * The key used for storing a short <code>String</code>
060: // * description for the action, used for tooltip text.
061: // */
062: // public static String SHORT_DESCRIPTION = "ShortDescription";
063: // /**
064: // * The key used for storing a longer <code>String</code>
065: // * description for the action, could be used for context-sensitive help.
066: // */
067: // public static String LONG_DESCRIPTION = "LongDescription";
068: //
069: // /**
070: // * The key used for storing a small <code>Icon</code>, such
071: // * as <code>ImageIcon</code>, for the action, used for toolbar buttons.
072: // */
073: // public static final String SMALL_ICON = "SmallIcon";
074: //
075: // /**
076: // * The key used to determine the command <code>String</code> for the
077: // * <code>ActionEvent</code> that will be created when an
078: // * <code>Action</code> is going to be notified as the result of
079: // * residing in a <code>Keymap</code> associated with a
080: // * <code>JComponent</code>.
081: // */
082: // public static final String ACTION_COMMAND_KEY = "ActionCommandKey";
083: //
084: // /**
085: // * The key used for storing a <code>KeyStroke</code> to be used as the
086: // * accelerator for the action.
087: // *
088: // * @since 1.3
089: // */
090: // public static final String ACCELERATOR_KEY="AcceleratorKey";
091: //
092: // /**
093: // * The key used for storing a <code>KeyEvent</code> to be used as
094: // * the mnemonic for the action.
095: // *
096: // * @since 1.3
097: // */
098: // public static final String MNEMONIC_KEY="MnemonicKey";
099:
100: /** Creates a new instance of ActionShrinkSelected */
101: public ActionShrinkSelected() {
102: // putValue( MNEMONIC_KEY, new Integer(KeyEvent.VK_S));
103: // http://java.sun.com/docs/books/tutorial/uiswing/components/tooltip.html
104:
105: putValue(ACTION_COMMAND_KEY, "shrinkselected");
106: //putValue(SMALL_ICON, "/it/businesslogic/ireport/icons/menu/elem_shrink.gif");
107: ImageIcon imageIcon = new javax.swing.ImageIcon(
108: getClass()
109: .getResource(
110: "/it/businesslogic/ireport/icons/menu/elem_shrink.png"));
111: putValue(SMALL_ICON, imageIcon);
112:
113: this .putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(
114: java.awt.event.KeyEvent.VK_S, java.awt.Event.CTRL_MASK
115: + java.awt.Event.SHIFT_MASK));
116:
117: applyI18n();
118: I18n.addOnLanguageChangedListener(this );
119: }
120:
121: public void languageChanged(LanguageChangedEvent evt) {
122: applyI18n();
123: }
124:
125: public void actionPerformed(java.awt.event.ActionEvent evt) {
126: FormatCommand.getCommand(OperationType.SHRINK).execute();
127: }
128:
129: public void applyI18n() {
130: String description = it.businesslogic.ireport.util.I18n
131: .getString("gui.MainFrame.ShrinkSelected",
132: "Shrink selected");
133: putValue(NAME, description);
134: putValue(SHORT_DESCRIPTION, description);
135: }
136:
137: }
|