Source Code Cross Referenced for AbstractActionPlugin.java in  » Report » pentaho-report » org » jfree » report » modules » gui » commonswing » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Report » pentaho report » org.jfree.report.modules.gui.commonswing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


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:         * AbstractActionPlugin.java
027:         * ------------
028:         * (C) Copyright 2001-2007, by Object Refinery Ltd, Pentaho Corporation and Contributors.
029:         */package org.jfree.report.modules.gui.commonswing;
030:
031:        import java.awt.Dialog;
032:        import java.awt.Frame;
033:        import java.awt.Window;
034:        import java.beans.PropertyChangeListener;
035:        import java.beans.PropertyChangeSupport;
036:
037:        import org.jfree.report.modules.gui.common.IconTheme;
038:        import org.jfree.util.ExtendedConfiguration;
039:        import org.jfree.util.ExtendedConfigurationWrapper;
040:        import org.jfree.util.ResourceBundleSupport;
041:
042:        /**
043:         * The AbstractExportPlugin provides a basic implementation of the ExportPlugin
044:         * interface.
045:         *
046:         * @author Thomas Morgner
047:         */
048:        public abstract class AbstractActionPlugin implements  ActionPlugin {
049:            public static final String ENABLED_PROPERTY = "enabled"; //$NON-NLS-1$
050:            private PropertyChangeSupport propertyChangeSupport;
051:
052:            /**
053:             * Localised resources.
054:             */
055:            private ResourceBundleSupport baseResources;
056:            private IconTheme iconTheme;
057:
058:            /**
059:             * The base resource class.
060:             */
061:            private SwingGuiContext context;
062:            private ExtendedConfiguration configuration;
063:            private boolean enabled;
064:
065:            protected AbstractActionPlugin() {
066:                enabled = true;
067:                propertyChangeSupport = new PropertyChangeSupport(this );
068:            }
069:
070:            public boolean isEnabled() {
071:                return enabled;
072:            }
073:
074:            public void setEnabled(final boolean enabled) {
075:                final boolean oldEnabled = this .enabled;
076:                this .enabled = enabled;
077:                propertyChangeSupport.firePropertyChange(ENABLED_PROPERTY,
078:                        oldEnabled, enabled);
079:            }
080:
081:            public boolean initialize(final SwingGuiContext context) {
082:                if (context == null) {
083:                    throw new NullPointerException(
084:                            "AbstractActionPlugin.initialize(..): Context parameter cannot be null");
085:                }
086:
087:                this .context = context;
088:                this .baseResources = new ResourceBundleSupport(context
089:                        .getLocale(), SwingCommonModule.BUNDLE_NAME);
090:                this .iconTheme = context.getIconTheme();
091:                this .configuration = new ExtendedConfigurationWrapper(context
092:                        .getConfiguration());
093:                return true;
094:            }
095:
096:            public ResourceBundleSupport getBaseResources() {
097:                return baseResources;
098:            }
099:
100:            protected PropertyChangeSupport getPropertyChangeSupport() {
101:                return propertyChangeSupport;
102:            }
103:
104:            public SwingGuiContext getContext() {
105:                return context;
106:            }
107:
108:            public ExtendedConfiguration getConfig() {
109:                return configuration;
110:            }
111:
112:            /**
113:             * Returns true if the action is separated, and false otherwise. A separated
114:             * action starts a new action group and will be spearated from previous
115:             * actions on the menu and toolbar.
116:             *
117:             * @return true, if the action should be separated from previous actions,
118:             *         false otherwise.
119:             */
120:            public boolean isSeparated() {
121:                return getConfig().getBoolProperty(
122:                        getConfigurationPrefix() + "separated"); //$NON-NLS-1$
123:            }
124:
125:            /**
126:             * Returns true if the action should be added to the toolbar, and false
127:             * otherwise.
128:             *
129:             * @return true, if the plugin should be added to the toolbar, false
130:             *         otherwise.
131:             */
132:            public boolean isAddToToolbar() {
133:                return getConfig().getBoolProperty(
134:                        getConfigurationPrefix() + "add-to-toolbar"); //$NON-NLS-1$
135:            }
136:
137:            /**
138:             * Returns true if the action should be added to the menu, and false
139:             * otherwise.
140:             *
141:             * @return A boolean.
142:             */
143:            public boolean isAddToMenu() {
144:                final String name = getConfigurationPrefix() + "add-to-menu"; //$NON-NLS-1$
145:                return getConfig().getBoolProperty(name);
146:            }
147:
148:            /**
149:             * Creates a progress dialog, and tries to assign a parent based on the given
150:             * preview proxy.
151:             *
152:             * @return the progress dialog.
153:             */
154:            protected ReportProgressDialog createProgressDialog() {
155:                final Window proxy = context.getWindow();
156:                if (proxy instanceof  Frame) {
157:                    return new ReportProgressDialog((Frame) proxy);
158:                } else if (proxy instanceof  Dialog) {
159:                    return new ReportProgressDialog((Dialog) proxy);
160:                } else {
161:                    return new ReportProgressDialog();
162:                }
163:            }
164:
165:            public void addPropertyChangeListener(final PropertyChangeListener l) {
166:                propertyChangeSupport.addPropertyChangeListener(l);
167:            }
168:
169:            public void addPropertyChangeListener(final String property,
170:                    final PropertyChangeListener l) {
171:                propertyChangeSupport.addPropertyChangeListener(property, l);
172:            }
173:
174:            public void removePropertyChangeListener(
175:                    final PropertyChangeListener l) {
176:                propertyChangeSupport.removePropertyChangeListener(l);
177:            }
178:
179:            public IconTheme getIconTheme() {
180:                return iconTheme;
181:            }
182:
183:            protected abstract String getConfigurationPrefix();
184:
185:            /**
186:             * A sort key used to enforce a certain order within the actions.
187:             *
188:             * @return
189:             */
190:            public int getMenuOrder() {
191:                return getConfig().getIntProperty(
192:                        getConfigurationPrefix() + "menu-order", 0); //$NON-NLS-1$
193:            }
194:
195:            public int getToolbarOrder() {
196:                return getConfig().getIntProperty(
197:                        getConfigurationPrefix() + "toolbar-order", 0); //$NON-NLS-1$
198:            }
199:
200:            public String getRole() {
201:                return getConfig().getConfigProperty(
202:                        getConfigurationPrefix() + "role"); //$NON-NLS-1$
203:            }
204:
205:            public int getRolePreference() {
206:                return getConfig().getIntProperty(
207:                        getConfigurationPrefix() + "role-preference", 0); //$NON-NLS-1$
208:            }
209:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.