01: /*
02: * Copyright 2006-2007 Pentaho Corporation. All rights reserved.
03: * This software was developed by Pentaho Corporation and is provided under the terms
04: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
05: * this file except in compliance with the license. If you need a copy of the license,
06: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt.
07: *
08: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
09: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
10: * the license for the specific language governing your rights and limitations.
11: *
12: * Additional Contributor(s): Martin Schmid gridvision engineering GmbH
13: */
14: package org.pentaho.reportdesigner.crm.report.util;
15:
16: import org.jetbrains.annotations.NotNull;
17: import org.jfree.report.JFreeReportBoot;
18: import org.pentaho.reportdesigner.lib.client.components.ProgressDialog;
19: import org.pentaho.reportdesigner.lib.client.i18n.TranslationManager;
20: import org.pentaho.reportdesigner.lib.client.util.UncaughtExcpetionsModel;
21:
22: import java.awt.*;
23:
24: /**
25: * User: Martin
26: * Date: 28.02.2006
27: * Time: 09:36:04
28: */
29: public class JFreeReportBootingHelper {
30: private JFreeReportBootingHelper() {
31: }
32:
33: public static void boot(@NotNull
34: Component parent) {
35: if (!JFreeReportBoot.getInstance().isBootDone()) {
36: final ProgressDialog progressDialog = ProgressDialog
37: .createProgressDialog(
38: parent,
39: TranslationManager
40: .getInstance()
41: .getTranslation("R",
42: "ReportDialog.BootingReportingEngine.Title"),
43: "");
44:
45: Thread t = new Thread(new Runnable() {
46: public void run() {
47: try {
48: JFreeReportBoot.getInstance()
49: .getEditableConfig().setConfigProperty(
50: "org.jfree.base.LogLevel",
51: "Error");//NON-NLS
52: JFreeReportBoot
53: .getInstance()
54: .getEditableConfig()
55: .setConfigProperty(
56: "org.jfree.report.NoPrinterAvailable",
57: Boolean.TRUE.toString());
58: JFreeReportBoot.getInstance().start();
59: } catch (Throwable e) {
60: UncaughtExcpetionsModel.getInstance()
61: .addException(e);
62: }
63:
64: EventQueue.invokeLater(new Runnable() {
65: public void run() {
66: progressDialog.dispose();
67: }
68: });
69: }
70: });
71:
72: t.setPriority(Thread.NORM_PRIORITY - 1);
73: t.setDaemon(true);
74: t.start();
75: if (t.isAlive()) {
76: progressDialog.setVisible(true);
77: } else {
78: progressDialog.dispose();
79: }
80: }
81: }
82: }
|