01: /**
02: * ===========================================
03: * JFreeReport : a free Java reporting library
04: * ===========================================
05: *
06: * Project Info: http://reporting.pentaho.org/
07: *
08: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
09: *
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: * SwingCommonModule.java
27: * ------------
28: * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
29: */package org.jfree.report.modules.gui.commonswing;
30:
31: import java.util.Enumeration;
32: import java.util.ResourceBundle;
33: import javax.swing.UIDefaults;
34: import javax.swing.UIManager;
35:
36: import org.jfree.base.modules.AbstractModule;
37: import org.jfree.base.modules.ModuleInitializeException;
38: import org.jfree.base.modules.SubSystem;
39:
40: /**
41: * Creation-Date: 17.11.2006, 14:40:24
42: *
43: * @author Thomas Morgner
44: */
45: public class SwingCommonModule extends AbstractModule {
46: public static final String BUNDLE_NAME = "org.jfree.report.modules.gui.commonswing.messages.messages"; //$NON-NLS-1$
47: public static final String LARGE_ICON_PROPERTY = "Icon24"; //$NON-NLS-1$
48:
49: public SwingCommonModule() throws ModuleInitializeException {
50: loadModuleInfo();
51: }
52:
53: /**
54: * Initializes the module. Use this method to perform all initial setup
55: * operations. This method is called only once in a modules lifetime. If the
56: * initializing cannot be completed, throw a ModuleInitializeException to
57: * indicate the error,. The module will not be available to the system.
58: *
59: * @param subSystem the subSystem.
60: * @throws org.jfree.base.modules.ModuleInitializeException
61: * if an error ocurred while initializing the module.
62: */
63: public void initialize(final SubSystem subSystem)
64: throws ModuleInitializeException {
65: if (subSystem
66: .getExtendedConfig()
67: .getBoolProperty(
68: "org.jfree.report.modules.gui.base.SwingDialogTranslation")) //$NON-NLS-1$
69: {
70: final ResourceBundle resources = ResourceBundle
71: .getBundle(BUNDLE_NAME);
72: final UIDefaults defaults = UIManager.getDefaults();
73: final Enumeration en = resources.getKeys();
74: while (en.hasMoreElements()) {
75: try {
76: final String keyName = (String) en.nextElement();
77: defaults.put(keyName, resources.getObject(keyName));
78: } catch (Exception e) {
79: // Ignored; if it happens, we would not care that much ..
80: }
81: }
82: }
83: }
84: }
|