Source Code Cross Referenced for ReportDesignerWindows.java in  » Report » pentaho-report » org » pentaho » reportdesigner » crm » report » 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.pentaho.reportdesigner.crm.report 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006-2007 Pentaho Corporation.  All rights reserved.
003:         * This software was developed by Pentaho Corporation and is provided under the terms
004:         * of the Mozilla Public License, Version 1.1, or any later version. You may not use
005:         * this file except in compliance with the license. If you need a copy of the license,
006:         * please go to http://www.mozilla.org/MPL/MPL-1.1.txt.
007:         *
008:         * Software distributed under the Mozilla Public License is distributed on an "AS IS"
009:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or  implied. Please refer to
010:         * the license for the specific language governing your rights and limitations.
011:         *
012:         * Additional Contributor(s): Martin Schmid gridvision engineering GmbH
013:         */
014:        package org.pentaho.reportdesigner.crm.report;
015:
016:        import org.jetbrains.annotations.NotNull;
017:        import org.jetbrains.annotations.Nullable;
018:        import org.pentaho.reportdesigner.crm.report.commands.CloseReportCommand;
019:        import org.pentaho.reportdesigner.crm.report.model.Report;
020:        import org.pentaho.reportdesigner.crm.report.settings.ApplicationSettings;
021:        import org.pentaho.reportdesigner.crm.report.settings.WorkspaceSettings;
022:
023:        import javax.swing.*;
024:        import java.awt.event.WindowAdapter;
025:        import java.awt.event.WindowEvent;
026:        import java.io.File;
027:        import java.io.IOException;
028:        import java.util.LinkedList;
029:
030:        /**
031:         * User: Martin
032:         * Date: 01.01.2007
033:         * Time: 17:39:10
034:         */
035:        public class ReportDesignerWindows {
036:
037:            @NotNull
038:            private static final ReportDesignerWindows instance = new ReportDesignerWindows();
039:
040:            @NotNull
041:            public static ReportDesignerWindows getInstance() {
042:                return instance;
043:            }
044:
045:            private long nextAppicationID = 1;
046:
047:            @NotNull
048:            private final LinkedList<ReportDesignerWindowsListener> reportDesignerWindowsListeners;
049:
050:            @NotNull
051:            private final LinkedList<ReportDialog> reportDialogs;
052:
053:            private ReportDesignerWindows() {
054:                reportDesignerWindowsListeners = new LinkedList<ReportDesignerWindowsListener>();
055:                reportDialogs = new LinkedList<ReportDialog>();
056:            }
057:
058:            @NotNull
059:            public Long getNextAppicationID() {
060:                nextAppicationID++;
061:                return new Long(nextAppicationID);
062:            }
063:
064:            @NotNull
065:            public ReportDialog createNewReportDialog(@Nullable
066:            Report report) {
067:                final ReportDialog newReportDialog = new ReportDialog(
068:                        getNextAppicationID(), report);
069:                newReportDialog
070:                        .setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
071:                newReportDialog.addWindowListener(new WindowAdapter() {
072:                    public void windowClosing(@NotNull
073:                    WindowEvent e) {
074:                        CloseReportCommand.close(newReportDialog, true);
075:                    }
076:                });
077:
078:                newReportDialog.setVisible(true);
079:                registerReportDialog(newReportDialog);
080:
081:                return newReportDialog;
082:            }
083:
084:            @NotNull
085:            public LinkedList<ReportDialog> getReportDialogs() {
086:                return new LinkedList<ReportDialog>(reportDialogs);
087:            }
088:
089:            @Nullable
090:            public ReportDialog getReportDialog(@NotNull
091:            Report report) {
092:                //noinspection ConstantConditions
093:                if (report == null) {
094:                    throw new IllegalArgumentException(
095:                            "report must not be null");
096:                }
097:
098:                for (ReportDialog reportDialog : reportDialogs) {
099:                    //noinspection ObjectEquality
100:                    if (reportDialog.getReport() == report) {
101:                        return reportDialog;
102:                    }
103:                }
104:                return null;
105:            }
106:
107:            public void registerReportDialog(@NotNull
108:            ReportDialog reportDialog) {
109:                //noinspection ConstantConditions
110:                if (reportDialog == null) {
111:                    throw new IllegalArgumentException(
112:                            "reportDialog must not be null");
113:                }
114:
115:                if (!reportDialogs.contains(reportDialog)) {
116:                    reportDialogs.add(reportDialog);
117:
118:                    LinkedList<ReportDesignerWindowsListener> reportDesignerWindowsListeners = new LinkedList<ReportDesignerWindowsListener>(
119:                            this .reportDesignerWindowsListeners);
120:                    for (ReportDesignerWindowsListener reportDesignerWindowsListener : reportDesignerWindowsListeners) {
121:                        reportDesignerWindowsListener
122:                                .reportDialogOpened(reportDialog);
123:                    }
124:                }
125:            }
126:
127:            public void unregisterReportDialog(@NotNull
128:            ReportDialog reportDialog) {
129:                //noinspection ConstantConditions
130:                if (reportDialog == null) {
131:                    throw new IllegalArgumentException(
132:                            "reportDialog must not be null");
133:                }
134:
135:                if (reportDialogs.contains(reportDialog)) {
136:                    reportDialogs.remove(reportDialog);
137:
138:                    LinkedList<ReportDesignerWindowsListener> reportDesignerWindowsListeners = new LinkedList<ReportDesignerWindowsListener>(
139:                            this .reportDesignerWindowsListeners);
140:                    for (ReportDesignerWindowsListener reportDesignerWindowsListener : reportDesignerWindowsListeners) {
141:                        reportDesignerWindowsListener
142:                                .reportDialogClosed(reportDialog);
143:                    }
144:                }
145:            }
146:
147:            public void addReportDesignerWindowsListener(@NotNull
148:            ReportDesignerWindowsListener reportDesignerWindowsListener) {
149:                //noinspection ConstantConditions
150:                if (reportDesignerWindowsListener == null) {
151:                    throw new IllegalArgumentException(
152:                            "reportDesignerWindowsListener must not be null");
153:                }
154:
155:                if (!reportDesignerWindowsListeners
156:                        .contains(reportDesignerWindowsListener)) {
157:                    reportDesignerWindowsListeners
158:                            .add(reportDesignerWindowsListener);
159:                }
160:            }
161:
162:            public void removeReportDesignerWindowsListener(@Nullable
163:            ReportDesignerWindowsListener reportDesignerWindowsListener) {
164:                reportDesignerWindowsListeners
165:                        .remove(reportDesignerWindowsListener);
166:            }
167:
168:            public void saveApplicationSettings() throws IOException {
169:                File file = new File(System
170:                        .getProperty(ReportDialogConstants.USER_HOME),
171:                        ReportDialogConstants.REPORT_DIRECTORY);
172:                file.mkdirs();
173:                File workspaceSettingsFile = new File(file,
174:                        ReportDialogConstants.APPLICATION_SETTINGS_XML);
175:
176:                ApplicationSettings.getInstance().writeSettings(
177:                        workspaceSettingsFile);
178:            }
179:
180:            public void saveWorkspaceSettings() throws IOException {
181:                File file = new File(System
182:                        .getProperty(ReportDialogConstants.USER_HOME),
183:                        ReportDialogConstants.REPORT_DIRECTORY);
184:                file.mkdirs();
185:                File workspaceSettingsFile = new File(file,
186:                        ReportDialogConstants.WORKSPACE_SETTINGS_XML);
187:
188:                WorkspaceSettings.getInstance().writeSettings(
189:                        workspaceSettingsFile);
190:            }
191:
192:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.