001: /**
002: * ===========================================
003: * JFreeReport : a free Java reporting library
004: * ===========================================
005: *
006: * Project Info: http://reporting.pentaho.org/
007: *
008: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
009: *
010: * This library is free software; you can redistribute it and/or modify it under the terms
011: * of the GNU Lesser General Public License as published by the Free Software Foundation;
012: * either version 2.1 of the License, or (at your option) any later version.
013: *
014: * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
015: * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
016: * See the GNU Lesser General Public License for more details.
017: *
018: * You should have received a copy of the GNU Lesser General Public License along with this
019: * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
020: * Boston, MA 02111-1307, USA.
021: *
022: * [Java is a trademark or registered trademark of Sun Microsystems, Inc.
023: * in the United States and other countries.]
024: *
025: * ------------
026: * ExitActionPlugin.java
027: * ------------
028: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
029: */package org.jfree.report.modules.gui.base.actions;
030:
031: import java.util.Locale;
032: import javax.swing.Icon;
033: import javax.swing.KeyStroke;
034:
035: import org.jfree.report.modules.gui.base.PreviewPane;
036: import org.jfree.report.modules.gui.base.SwingPreviewModule;
037: import org.jfree.report.modules.gui.commonswing.AbstractActionPlugin;
038: import org.jfree.report.modules.gui.commonswing.SwingGuiContext;
039: import org.jfree.util.ResourceBundleSupport;
040:
041: /**
042: * Creation-Date: 16.11.2006, 16:34:55
043: *
044: * @author Thomas Morgner
045: */
046: public class ExitActionPlugin extends AbstractActionPlugin implements
047: ControlActionPlugin {
048: private ResourceBundleSupport resources;
049:
050: public ExitActionPlugin() {
051: }
052:
053: public boolean initialize(final SwingGuiContext context) {
054: super .initialize(context);
055: resources = new ResourceBundleSupport(context.getLocale(),
056: SwingPreviewModule.BUNDLE_NAME);
057: return true;
058: }
059:
060: protected String getConfigurationPrefix() {
061: return "org.jfree.report.modules.gui.base.close."; //$NON-NLS-1$
062: }
063:
064: /**
065: * Returns the display name for the export action.
066: *
067: * @return The display name.
068: */
069: public String getDisplayName() {
070: return resources.getString("action.close.name"); //$NON-NLS-1$
071: }
072:
073: /**
074: * Returns the short description for the export action.
075: *
076: * @return The short description.
077: */
078: public String getShortDescription() {
079: return resources.getString("action.close.description"); //$NON-NLS-1$
080: }
081:
082: /**
083: * Returns the small icon for the export action.
084: *
085: * @return The icon.
086: */
087: public Icon getSmallIcon() {
088: final Locale locale = getContext().getLocale();
089: return getIconTheme().getSmallIcon(locale,
090: "action.close.small-icon"); //$NON-NLS-1$
091: }
092:
093: /**
094: * Returns the large icon for the export action.
095: *
096: * @return The icon.
097: */
098: public Icon getLargeIcon() {
099: final Locale locale = getContext().getLocale();
100: return getIconTheme().getLargeIcon(locale, "action.close.icon"); //$NON-NLS-1$
101: }
102:
103: /**
104: * Returns the accelerator key for the export action.
105: *
106: * @return The accelerator key.
107: */
108: public KeyStroke getAcceleratorKey() {
109: return resources
110: .getOptionalKeyStroke("action.close.accelerator"); //$NON-NLS-1$
111: }
112:
113: /**
114: * Returns the mnemonic key code.
115: *
116: * @return The code.
117: */
118: public Integer getMnemonicKey() {
119: return resources.getOptionalMnemonic("action.close.mnemonic"); //$NON-NLS-1$
120: }
121:
122: public boolean configure(final PreviewPane reportPane) {
123: reportPane.setClosed(true);
124: return true;
125: }
126:
127: }
|