本文整理汇总了Java中org.jdesktop.swingx.error.ErrorInfo类的典型用法代码示例。如果您正苦于以下问题:Java ErrorInfo类的具体用法?Java ErrorInfo怎么用?Java ErrorInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ErrorInfo类属于org.jdesktop.swingx.error包,在下文中一共展示了ErrorInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: reinit
import org.jdesktop.swingx.error.ErrorInfo; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void reinit() {
super.reinit();
ErrorInfo info = pane == null ? null : pane.getErrorInfo();
titleLabel.setText(info == null ? "Unknown Error" : info.getTitle());
Object finePrint = pane.getClientProperty("fine-print");
String text = finePrint == null ? null : finePrint.toString();
disclaimerText.setText(text);
disclaimerText.setVisible(text != null);
if ((info != null) && (info.getErrorLevel() == ErrorLevel.FATAL)) {
closeButton.setText(UIManagerExt.getString(CLASS_NAME + ".fatal_button_text", closeButton.getLocale()));
} else {
closeButton.setText(UIManagerExt.getString(CLASS_NAME + ".ok_button_text", closeButton.getLocale()));
}
}
示例2: showExceptionDialog
import org.jdesktop.swingx.error.ErrorInfo; //导入依赖的package包/类
public static void showExceptionDialog(Throwable e) {
e.printStackTrace();
if (Build.CURRENT.isRobotTest()) {
DebugEventQueue.dump();
History.showHistory();
Toolkit.getDefaultToolkit().beep();
playWarningSound();
}
Frame parent = getParentForDialogs();
String basicErrorMessage = "An exception occurred: " + e.getMessage();
ErrorInfo ii = new ErrorInfo("Program error", basicErrorMessage, null, null, e, Level.SEVERE, null);
JXErrorPane.showDialog(parent, ii);
}
示例3: reinit
import org.jdesktop.swingx.error.ErrorInfo; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void reinit() {
super.reinit();
ErrorInfo info = pane == null ? null : pane.getErrorInfo();
titleLabel.setText(info == null ? "Unknown Error" : info.getTitle());
Object finePrint = pane.getClientProperty("fine-print");
String text = finePrint == null ? null : finePrint.toString();
disclaimerText.setText(text);
disclaimerText.setVisible(text != null);
if (info != null && info.getErrorLevel() == ErrorLevel.FATAL) {
closeButton.setText(UIManagerExt.getString(CLASS_NAME + ".fatal_button_text", closeButton.getLocale()));
} else {
closeButton.setText(UIManagerExt.getString(CLASS_NAME + ".ok_button_text", closeButton.getLocale()));
}
}
示例4: interactiveMinimalError
import org.jdesktop.swingx.error.ErrorInfo; //导入依赖的package包/类
/**
* Custom details
*/
public void interactiveMinimalError() {
Exception e = new NullPointerException("something ...");
StringBuffer html = new StringBuffer("<html>");
html.append("<h2>" + "Error" + "</h2>");
html.append("<HR size='1' noshade>");
html.append("<div></div>");
html.append("<b>Message:</b>");
html.append("<pre>");
html.append(" " + e.toString());
html.append("</pre>");
html.append("<b>Level:</b>");
html.append("<pre>");
html.append(" " + ErrorLevel.SEVERE);
html.append("</pre>");
html.append("</html>");
ErrorInfo errorInfo = new ErrorInfo("Error", e.getMessage(),
html.toString(), null, e, ErrorLevel.SEVERE, null);
JXErrorPane.showDialog(null,
errorInfo);
}
示例5: interactiveNPEAfterChangeLAF
import org.jdesktop.swingx.error.ErrorInfo; //导入依赖的package包/类
/**
* Issue #1212-swingx: NullPointerException in BasicErrorPaneUI.initWindow listener
*/
public void interactiveNPEAfterChangeLAF() {
JComponent pane = new JPanel();
JButton showErrorPane = new JButton("show error pane");
pane.add(showErrorPane);
final JXFrame frame = showInFrame(showErrorPane, "NPE on closing");
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
showErrorPane.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JXErrorPane.showDialog(frame, new ErrorInfo("Title",
"Message", "Details", null, null, null, null));
}
});
addStatusMessage(frame, "1. show error, 2. change laf, 3. close frame - NPE");
show(frame);
}
示例6: reinit
import org.jdesktop.swingx.error.ErrorInfo; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
protected void reinit() {
super.reinit();
ErrorInfo info = pane == null ? null : pane.getErrorInfo();
titleLabel.setText(info == null ? "Unknown Error" : info.getTitle());
Object finePrint = pane.getClientProperty("fine-print");
String text = finePrint == null ? null : finePrint.toString();
disclaimerText.setText(text);
disclaimerText.setVisible(text != null);
if (info != null && info.getErrorLevel() == ErrorLevel.FATAL) {
closeButton.setText(UIManagerExt.getString(CLASS_NAME + ".fatal_button_text", closeButton.getLocale()));
} else {
closeButton.setText(UIManagerExt.getString(CLASS_NAME + ".ok_button_text", closeButton.getLocale()));
}
}
示例7: showErrorMessage
import org.jdesktop.swingx.error.ErrorInfo; //导入依赖的package包/类
public static void showErrorMessage(final String shortMessage, final String detailedMessage,
final Throwable exception) {
final Throwable presentedException = ErrorUtils.unwrapForPresentation(exception);
if (exception == null) {
showErrorMessage(shortMessage, detailedMessage);
return;
}
final String finalDetailedMessage = detailedMessage == null ? "" : detailedMessage;
final String finalShortMessage = shortMessage == null ? "" : shortMessage;
final ErrorInfo info = new ErrorInfo(finalShortMessage, finalDetailedMessage, null, "error", presentedException,
ErrorLevel.SEVERE, null);
final JXErrorPane errorPane = new JXErrorPane();
errorPane.setErrorInfo(info);
final JDialog dialog = JXErrorPane.createDialog(null, errorPane);
centerOnScreen(dialog);
JXErrorPane.setDefaultLocale(Locale.ENGLISH);
dialog.setLocale(Locale.ENGLISH);
dialog.setModal(true);
dialog.setTitle(finalShortMessage);
dialog.setVisible(true);
dialog.toFront();
}
示例8: openLink
import org.jdesktop.swingx.error.ErrorInfo; //导入依赖的package包/类
private void openLink(String link) {
Exception error = null;
if (Desktop.isDesktopSupported()) {
try {
Desktop.getDesktop().browse(new URI(link));
} catch (IOException | URISyntaxException ex) {
error = ex;
}
} else {
error = new BrowserException();
}
if (error != null) {
JXErrorPane.showDialog(null, new ErrorInfo("Open link error",
"Can not open link", null, "Error", error,
java.util.logging.Level.SEVERE, null));
}
}
示例9: showSQLExceptionErrorDialog
import org.jdesktop.swingx.error.ErrorInfo; //导入依赖的package包/类
public static void showSQLExceptionErrorDialog(SQLException sqlException)
{
String title = RcpSupport.getMessage(null, RcpSupport.ERROR_KEY, RcpSupport.TITLE);
String shortMessage = RcpSupport.getMessage(sqlException.getClass().getName() + "."
+ sqlException.getErrorCode() + "." + RcpSupport.MESSAGE);
if (!StringUtils.hasText(shortMessage))
{
shortMessage = RcpSupport
.getMessage(sqlException.getClass().getName() + "." + RcpSupport.MESSAGE);
shortMessage += "\nSQL error " + sqlException.getErrorCode();
}
if (shortMessage == null || "".equals(shortMessage))
{
shortMessage = sqlException.getMessage();
if (shortMessage == null || "".equals(shortMessage))
{
shortMessage = RcpSupport.getMessage(null, RcpSupport.ERROR_KEY, RcpSupport.MESSAGE);
}
}
showErrorDialog(null, new ErrorInfo(title, shortMessage, getDetailsAsHTML(title, Level.SEVERE,
sqlException), null, sqlException, Level.SEVERE, null));
}
示例10: showErrorDialog
import org.jdesktop.swingx.error.ErrorInfo; //导入依赖的package包/类
public static void showErrorDialog(Component parent, ErrorInfo errorInfo)
{
if (parent == null)
{
if (org.springframework.richclient.application.Application.isLoaded())
{
ApplicationWindow activeWindow = org.springframework.richclient.application.Application
.instance().getActiveWindow();
if (activeWindow != null)
parent = activeWindow.getControl();
}
}
JXErrorPane pane = new JXErrorPane();
pane.setErrorInfo(errorInfo);
pane.setErrorReporter(new JdicEmailNotifierErrorReporter());
JXErrorPane.showDialog(parent, pane);
}
示例11: reportError
import org.jdesktop.swingx.error.ErrorInfo; //导入依赖的package包/类
public void reportError(ErrorInfo errorInfo) throws NullPointerException {
try {
DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
UserAccount userAccount = (UserAccount) GlobalLookup.getUserAccountDispatcher().getValueObject();
Email email = new HtmlEmail();
email.setHostName("mbarimail.mbari.org");
email.setFrom(getEmail(userAccount), getName(userAccount));
email.addTo("[email protected]");
email.setSubject("VARS Error Report: " + errorInfo.getTitle());
email.setMsg("<html><body>" + df.format(new Date()) + "\n\n" +
errorInfo.getDetailedErrorMessage() + "</body></html>");
email.send();
}
catch (Exception e) {
log.warn("Failed to send email error report", e);
}
Frame frame = AwtUtilities.getFrame(errorPane);
frame.dispose();
}
示例12: onEvent
import org.jdesktop.swingx.error.ErrorInfo; //导入依赖的package包/类
/**
*
* @param topic
* @param data
*/
public void onEvent(String topic, Exception data) {
String msg = randomHaiku();
String details = formatStackTraceForDialogs(data, false);
/*
* Create an error pane to display the error stuff
*/
JXErrorPane errorPane = new JXErrorPane();
Icon errorIcon = randomImage();
ErrorInfo errorInfo = new ErrorInfo("VARS - Fatal Error", msg, details, null, data, ErrorLevel.FATAL, null);
errorPane.setIcon(errorIcon);
errorPane.setErrorInfo(errorInfo);
errorPane.setErrorReporter(new EmailErrorReporter(errorPane));
JXErrorPane.showDialog(null, errorPane);
}
示例13: setErrorInfo
import org.jdesktop.swingx.error.ErrorInfo; //导入依赖的package包/类
/**
* Sets the ErrorInfo for this dialog. ErrorInfo can't be null.
*
* @param info ErrorInfo that incorporates all the details about the error. Null value is not supported.
*/
public void setErrorInfo(ErrorInfo info) {
if (info == null) {
throw new NullPointerException("ErrorInfo can't be null. Provide valid ErrorInfo object.");
}
ErrorInfo old = this.errorInfo;
this.errorInfo = info;
firePropertyChange("errorInfo", old, this.errorInfo);
}
示例14: getDetailsAsHTML
import org.jdesktop.swingx.error.ErrorInfo; //导入依赖的package包/类
/**
* Creates and returns HTML representing the details of this incident info. This
* method is only called if the details needs to be generated: ie: the detailed
* error message property of the incident info is null.
*/
protected String getDetailsAsHTML(ErrorInfo errorInfo) {
if (errorInfo.getErrorException() != null) {
//convert the stacktrace into a more pleasent bit of HTML
StringBuffer html = new StringBuffer("<html>");
html.append("<h2>" + escapeXml(errorInfo.getTitle()) + "</h2>");
html.append("<HR size='1' noshade>");
html.append("<div></div>");
html.append("<b>Message:</b>");
html.append("<pre>");
html.append(" " + escapeXml(errorInfo.getErrorException().toString()));
html.append("</pre>");
html.append("<b>Level:</b>");
html.append("<pre>");
html.append(" " + errorInfo.getErrorLevel());
html.append("</pre>");
html.append("<b>Stack Trace:</b>");
Throwable ex = errorInfo.getErrorException();
while (ex != null) {
html.append("<h4>" + ex.getMessage() + "</h4>");
html.append("<pre>");
for (StackTraceElement el : ex.getStackTrace()) {
html.append(" " + el.toString().replace("<init>", "<init>") + "\n");
}
html.append("</pre>");
ex = ex.getCause();
}
html.append("</html>");
return html.toString();
} else {
return null;
}
}
示例15: exitIfFatal
import org.jdesktop.swingx.error.ErrorInfo; //导入依赖的package包/类
private void exitIfFatal() {
ErrorInfo info = pane.getErrorInfo();
// FYI: info can be null
if ((info != null) && (info.getErrorLevel() == ErrorLevel.FATAL)) {
Action fatalAction = pane.getActionMap().get(JXErrorPane.FATAL_ACTION_KEY);
if (fatalAction == null) {
System.exit(1);
} else {
ActionEvent ae = new ActionEvent(closeButton, -1, "fatal");
fatalAction.actionPerformed(ae);
}
}
}