|
1 |
| -/* |
2 |
| - * Copyright (c) Mirth Corporation. All rights reserved. |
3 |
| - * |
4 |
| - * http://www.mirthcorp.com |
5 |
| - * |
6 |
| - * The software in this package is published under the terms of the MPL license a copy of which has |
7 |
| - * been included with this distribution in the LICENSE.txt file. |
8 |
| - */ |
9 |
| - |
10 |
| -package com.mirth.connect.client.ui; |
11 |
| - |
12 |
| -import java.awt.Dimension; |
13 |
| -import java.awt.Point; |
14 |
| - |
15 |
| -import javax.swing.Icon; |
16 |
| -import javax.swing.UIManager; |
17 |
| - |
18 |
| -/** Creates the error dialog. */ |
19 |
| -public class CustomErrorDialog extends MirthDialog { |
20 |
| - |
21 |
| - private Frame parent; |
22 |
| - public static final String ERROR_SAVING_CHANNEL = "There was an error in the validation of your channel. It has been DISABLED and saved. Before you can deploy you must fix the following error(s):"; |
23 |
| - public static final String ERROR_VALIDATING_CONNECTOR = "There was an error in the validation of your connector. Please fix the following error(s):"; |
24 |
| - public static final String ERROR_ENABLING_CHANNEL = "The channel was not configured properly. Please fix the following problem(s) in the channel before trying to enable it again:"; |
25 |
| - public static final String ERROR_VALIDATING_GLOBAL_SCRIPTS = "There was an error in the validation of your global scripts. Please fix the following error(s):"; |
26 |
| - |
27 |
| - public CustomErrorDialog(java.awt.Frame owner, String errorMessage, String errorQuestion) { |
28 |
| - super(owner); |
29 |
| - initialize(errorMessage, errorQuestion); |
30 |
| - } |
31 |
| - |
32 |
| - public CustomErrorDialog(java.awt.Dialog owner, String errorMessage, String errorQuestion) { |
33 |
| - super(owner); |
34 |
| - initialize(errorMessage, errorQuestion); |
35 |
| - } |
36 |
| - |
37 |
| - private void initialize(String errorMessage, String errorQuestion) { |
38 |
| - this.parent = PlatformUI.MIRTH_FRAME; |
39 |
| - initComponents(); |
40 |
| - |
41 |
| - question.setText(errorQuestion); |
42 |
| - |
43 |
| - question.setBackground(UIManager.getColor("Control")); |
44 |
| - errorContent.setBackground(UIManager.getColor("Control")); |
45 |
| - image.setIcon((Icon) UIManager.get("OptionPane.errorIcon")); |
46 |
| - questionPane.setBorder(null); |
47 |
| - errorContent.setText(errorMessage); |
48 |
| - errorContent.setCaretPosition(0); |
49 |
| - setDefaultCloseOperation(DISPOSE_ON_CLOSE); |
50 |
| - setModal(true); |
51 |
| - pack(); |
52 |
| - Dimension dlgSize = getPreferredSize(); |
53 |
| - Dimension frmSize = parent.getSize(); |
54 |
| - Point loc = parent.getLocation(); |
55 |
| - |
56 |
| - if ((frmSize.width == 0 && frmSize.height == 0) || (loc.x == 0 && loc.y == 0)) { |
57 |
| - setLocationRelativeTo(null); |
58 |
| - } else { |
59 |
| - setLocation((frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y); |
60 |
| - } |
61 |
| - |
62 |
| - cancel.requestFocusInWindow(); |
63 |
| - setVisible(true); |
64 |
| - } |
65 |
| - |
| 1 | +/* |
| 2 | + * Copyright (c) Mirth Corporation. All rights reserved. |
| 3 | + * |
| 4 | + * http://www.mirthcorp.com |
| 5 | + * |
| 6 | + * The software in this package is published under the terms of the MPL license a copy of which has |
| 7 | + * been included with this distribution in the LICENSE.txt file. |
| 8 | + */ |
| 9 | + |
| 10 | +package com.mirth.connect.client.ui; |
| 11 | + |
| 12 | +import java.awt.Dimension; |
| 13 | +import java.awt.Point; |
| 14 | + |
| 15 | +import javax.swing.Icon; |
| 16 | +import javax.swing.UIManager; |
| 17 | + |
| 18 | +/** Creates the error dialog. */ |
| 19 | +public class CustomErrorDialog extends MirthDialog { |
| 20 | + |
| 21 | + private Frame parent; |
| 22 | + public static final String ERROR_SAVING_CHANNEL = "There was an error in the validation of your channel. It has been DISABLED and saved. Before you can deploy you must fix the following error(s):"; |
| 23 | + public static final String ERROR_VALIDATING_CONNECTOR = "There was an error in the validation of your connector. Please fix the following error(s):"; |
| 24 | + public static final String ERROR_ENABLING_CHANNEL = "The channel was not configured properly. Please fix the following problem(s) in the channel before trying to enable it again:"; |
| 25 | + public static final String ERROR_VALIDATING_GLOBAL_SCRIPTS = "There was an error in the validation of your global scripts. Please fix the following error(s):"; |
| 26 | + |
| 27 | + public CustomErrorDialog(java.awt.Frame owner, String errorMessage, String errorQuestion) { |
| 28 | + super(owner); |
| 29 | + initialize(errorMessage, errorQuestion); |
| 30 | + } |
| 31 | + |
| 32 | + public CustomErrorDialog(java.awt.Dialog owner, String errorMessage, String errorQuestion) { |
| 33 | + super(owner); |
| 34 | + initialize(errorMessage, errorQuestion); |
| 35 | + } |
| 36 | + |
| 37 | + private void initialize(String errorMessage, String errorQuestion) { |
| 38 | + this.parent = PlatformUI.MIRTH_FRAME; |
| 39 | + initComponents(); |
| 40 | + |
| 41 | + question.setText(errorQuestion); |
| 42 | + |
| 43 | + question.setBackground(UIManager.getColor("Control")); |
| 44 | + errorContent.setBackground(UIManager.getColor("Control")); |
| 45 | + image.setIcon((Icon) UIManager.get("OptionPane.errorIcon")); |
| 46 | + questionPane.setBorder(null); |
| 47 | + errorContent.setText(errorMessage); |
| 48 | + errorContent.setCaretPosition(0); |
| 49 | + setDefaultCloseOperation(DISPOSE_ON_CLOSE); |
| 50 | + setModal(true); |
| 51 | + pack(); |
| 52 | + Dimension dlgSize = getPreferredSize(); |
| 53 | + Dimension frmSize = parent.getSize(); |
| 54 | + Point loc = parent.getLocation(); |
| 55 | + |
| 56 | + if ((frmSize.width == 0 && frmSize.height == 0) || (loc.x == 0 && loc.y == 0)) { |
| 57 | + setLocationRelativeTo(null); |
| 58 | + } else { |
| 59 | + setLocation((frmSize.width - dlgSize.width) / 2 + loc.x, (frmSize.height - dlgSize.height) / 2 + loc.y); |
| 60 | + } |
| 61 | + |
| 62 | + cancel.requestFocusInWindow(); |
| 63 | + setVisible(true); |
| 64 | + } |
| 65 | + |
66 | 66 | // @formatter:off
|
67 | 67 | /**
|
68 | 68 | * This method is called from within the constructor to initialize the form.
|
@@ -137,20 +137,20 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
|
137 | 137 | );
|
138 | 138 |
|
139 | 139 | pack();
|
140 |
| - }// </editor-fold>//GEN-END:initComponents |
141 |
| - // @formatter:on |
142 |
| - |
143 |
| - private void cancelActionPerformed(java.awt.event.ActionEvent evt)// GEN-FIRST:event_cancelActionPerformed |
144 |
| - {// GEN-HEADEREND:event_cancelActionPerformed |
145 |
| - this.dispose(); |
146 |
| - }// GEN-LAST:event_cancelActionPerformed |
147 |
| - // Variables declaration - do not modify//GEN-BEGIN:variables |
148 |
| - |
149 |
| - private javax.swing.JButton cancel; |
150 |
| - private javax.swing.JTextPane errorContent; |
151 |
| - private javax.swing.JLabel image; |
152 |
| - private javax.swing.JScrollPane jScrollPane1; |
153 |
| - private javax.swing.JTextPane question; |
154 |
| - private javax.swing.JScrollPane questionPane; |
155 |
| - // End of variables declaration//GEN-END:variables |
156 |
| -} |
| 140 | + }// </editor-fold>//GEN-END:initComponents |
| 141 | + // @formatter:on |
| 142 | + |
| 143 | + private void cancelActionPerformed(java.awt.event.ActionEvent evt)// GEN-FIRST:event_cancelActionPerformed |
| 144 | + {// GEN-HEADEREND:event_cancelActionPerformed |
| 145 | + this.dispose(); |
| 146 | + }// GEN-LAST:event_cancelActionPerformed |
| 147 | + // Variables declaration - do not modify//GEN-BEGIN:variables |
| 148 | + |
| 149 | + private javax.swing.JButton cancel; |
| 150 | + private javax.swing.JTextPane errorContent; |
| 151 | + private javax.swing.JLabel image; |
| 152 | + private javax.swing.JScrollPane jScrollPane1; |
| 153 | + private javax.swing.JTextPane question; |
| 154 | + private javax.swing.JScrollPane questionPane; |
| 155 | + // End of variables declaration//GEN-END:variables |
| 156 | +} |
0 commit comments