Frames | No Frames |
1: /** 2: * ======================================== 3: * JFreeReport : a free Java report library 4: * ======================================== 5: * 6: * Project Info: http://reporting.pentaho.org/ 7: * 8: * (C) Copyright 2000-2007, by Object Refinery Limited, Pentaho Corporation and Contributors. 9: * 10: * This library is free software; you can redistribute it and/or modify it under the terms 11: * of the GNU Lesser General Public License as published by the Free Software Foundation; 12: * either version 2.1 of the License, or (at your option) any later version. 13: * 14: * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 15: * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 16: * See the GNU Lesser General Public License for more details. 17: * 18: * You should have received a copy of the GNU Lesser General Public License along with this 19: * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, 20: * Boston, MA 02111-1307, USA. 21: * 22: * [Java is a trademark or registered trademark of Sun Microsystems, Inc. 23: * in the United States and other countries.] 24: * 25: * ------------ 26: * $Id: ZoomOutActionPlugin.java 3525 2007-10-16 11:43:48Z tmorgner $ 27: * ------------ 28: * (C) Copyright 2000-2005, by Object Refinery Limited. 29: * (C) Copyright 2005-2007, by Pentaho Corporation. 30: */ 31: 32: package org.jfree.report.modules.gui.swing.preview.actions; 33: 34: import java.util.Locale; 35: import javax.swing.Icon; 36: import javax.swing.KeyStroke; 37: 38: import org.jfree.report.modules.gui.swing.common.AbstractActionPlugin; 39: import org.jfree.report.modules.gui.swing.common.SwingGuiContext; 40: import org.jfree.report.modules.gui.swing.preview.PreviewPane; 41: import org.jfree.report.modules.gui.swing.preview.PreviewPaneUtilities; 42: import org.jfree.report.modules.gui.swing.preview.SwingPreviewModule; 43: import org.jfree.util.ResourceBundleSupport; 44: 45: /** 46: * Creation-Date: 16.11.2006, 18:52:30 47: * 48: * @author Thomas Morgner 49: */ 50: public class ZoomOutActionPlugin extends AbstractActionPlugin 51: implements ControlActionPlugin 52: { 53: private ResourceBundleSupport resources; 54: 55: public ZoomOutActionPlugin() 56: { 57: } 58: 59: public boolean initialize(final SwingGuiContext context) 60: { 61: super.initialize(context); 62: resources = new ResourceBundleSupport(context.getLocale(), 63: SwingPreviewModule.BUNDLE_NAME); 64: return true; 65: } 66: 67: protected String getConfigurationPrefix() 68: { 69: return "org.jfree.report.modules.gui.swing.preview.zoom-out."; 70: } 71: 72: /** 73: * Returns the display name for the export action. 74: * 75: * @return The display name. 76: */ 77: public String getDisplayName() 78: { 79: return resources.getString("action.zoomOut.name"); 80: } 81: 82: /** 83: * Returns the short description for the export action. 84: * 85: * @return The short description. 86: */ 87: public String getShortDescription() 88: { 89: return resources.getString("action.zoomOut.description"); 90: } 91: 92: /** 93: * Returns the small icon for the export action. 94: * 95: * @return The icon. 96: */ 97: public Icon getSmallIcon() 98: { 99: final Locale locale = getContext().getLocale(); 100: return getIconTheme().getSmallIcon(locale, "action.zoomOut.small-icon"); 101: } 102: 103: /** 104: * Returns the large icon for the export action. 105: * 106: * @return The icon. 107: */ 108: public Icon getLargeIcon() 109: { 110: final Locale locale = getContext().getLocale(); 111: return getIconTheme().getLargeIcon(locale, "action.zoomOut.icon"); 112: } 113: 114: /** 115: * Returns the accelerator key for the export action. 116: * 117: * @return The accelerator key. 118: */ 119: public KeyStroke getAcceleratorKey() 120: { 121: return resources.getOptionalKeyStroke("action.zoomOut.accelerator"); 122: } 123: 124: /** 125: * Returns the mnemonic key code. 126: * 127: * @return The code. 128: */ 129: public Integer getMnemonicKey() 130: { 131: return resources.getOptionalMnemonic("action.zoomOut.mnemonic"); 132: } 133: 134: public boolean configure(final PreviewPane reportPane) 135: { 136: final double nextZoomOut = PreviewPaneUtilities.getNextZoomOut 137: (reportPane.getZoom(), reportPane.getZoomFactors()); 138: if (nextZoomOut == 0) 139: { 140: return false; 141: } 142: reportPane.setZoom(nextZoomOut); 143: return true; 144: } 145: 146: }