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: GoToNextPageActionPlugin.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.SwingPreviewModule; 42: import org.jfree.util.ResourceBundleSupport; 43: 44: /** 45: * Creation-Date: 16.11.2006, 16:34:55 46: * 47: * @author Thomas Morgner 48: */ 49: public class GoToNextPageActionPlugin extends AbstractActionPlugin 50: implements ControlActionPlugin 51: { 52: private ResourceBundleSupport resources; 53: 54: public GoToNextPageActionPlugin() 55: { 56: } 57: 58: public boolean initialize(final SwingGuiContext context) 59: { 60: super.initialize(context); 61: resources = new ResourceBundleSupport(context.getLocale(), 62: SwingPreviewModule.BUNDLE_NAME); 63: return true; 64: } 65: 66: protected String getConfigurationPrefix() 67: { 68: return "org.jfree.report.modules.gui.swing.preview.go-to-next."; 69: } 70: 71: /** 72: * Returns the display name for the export action. 73: * 74: * @return The display name. 75: */ 76: public String getDisplayName() 77: { 78: return resources.getString("action.forward.name"); 79: } 80: 81: /** 82: * Returns the short description for the export action. 83: * 84: * @return The short description. 85: */ 86: public String getShortDescription() 87: { 88: return resources.getString("action.forward.description"); 89: } 90: 91: /** 92: * Returns the small icon for the export action. 93: * 94: * @return The icon. 95: */ 96: public Icon getSmallIcon() 97: { 98: final Locale locale = getContext().getLocale(); 99: return getIconTheme().getSmallIcon(locale, "action.forward.small-icon"); 100: } 101: 102: /** 103: * Returns the large icon for the export action. 104: * 105: * @return The icon. 106: */ 107: public Icon getLargeIcon() 108: { 109: final Locale locale = getContext().getLocale(); 110: return getIconTheme().getLargeIcon(locale, "action.forward.icon"); 111: } 112: 113: /** 114: * Returns the accelerator key for the export action. 115: * 116: * @return The accelerator key. 117: */ 118: public KeyStroke getAcceleratorKey() 119: { 120: return resources.getKeyStroke("action.forward.accelerator"); 121: } 122: 123: /** 124: * Returns the mnemonic key code. 125: * 126: * @return The code. 127: */ 128: public Integer getMnemonicKey() 129: { 130: return resources.getMnemonic("action.forward.mnemonic"); 131: } 132: 133: public boolean configure(final PreviewPane reportPane) 134: { 135: reportPane.setPageNumber(Math.min 136: (reportPane.getNumberOfPages(), reportPane.getPageNumber() + 1)); 137: return true; 138: } 139: 140: }