/** * Displays a modal dialog with the provided error message text. * * @param title The dialog title. May be {@code null}. * @param message The error message text to be displayed. */ public static void showError(String title, String message) { showMessage(title != null ? title : Bundle.LBL_Error(), message, JOptionPane.ERROR_MESSAGE, null); }
/** * Displays a modal dialog with the provided information message text. * * @param title The dialog title. May be {@code null}. * @param message The information message text to be displayed. * @param preferencesKey If not {@code null}, a checkbox is displayed, and if checked the dialog will not be displayed again which lets users store the answer */ public static void showInformation(String title, String message, String preferencesKey) { showMessage(title != null ? title : Bundle.LBL_Information(), message, JOptionPane.INFORMATION_MESSAGE, preferencesKey); }
/** * Displays a modal dialog with the provided warning message text. * * @param title The dialog title. May be {@code null}. * @param message The warning message text to be displayed. * @param preferencesKey If not {@code null}, a checkbox is displayed, and if checked the dialog will not be displayed again which lets users store the answer */ public static void showWarning(String title, String message, String preferencesKey) { showMessage(title != null ? title : Bundle.LBL_Warning(), message, JOptionPane.WARNING_MESSAGE, preferencesKey); }
void showErrorDialog(final String message) { Dialogs.showMessage(maskTopComponent.getDisplayName() + " - Error", message, JOptionPane.ERROR_MESSAGE, null); }
@Override protected void done() { try { get(); if (exportAsCsvAction == null) { exportAsCsvAction = new ExportStatisticsAsCsvAction(StatisticsPanel.this); } exportAsCsvAction.setSelectedMasks(selectedMasks); if (putStatisticsIntoVectorDataAction == null) { putStatisticsIntoVectorDataAction = new PutStatisticsIntoVectorDataAction(StatisticsPanel.this); } putStatisticsIntoVectorDataAction.setSelectedMasks(selectedMasks); exportButton.setEnabled(true); } catch (Exception e) { e.printStackTrace(); Dialogs.showMessage("<html>Statistics", "Failed to compute statistics.<br/>An error occurred:" + e.getMessage() + "</html>", JOptionPane.ERROR_MESSAGE, null); } } };
@Override public void actionPerformed(ActionEvent e) { Mask mask = getMaskForm().getSelectedMask(); ImageType imageType = mask.getImageType(); ProductSceneView productSceneView = topComponent.getSelectedProductSceneView(); if (productSceneView != null) { Rectangle2D modelBounds; if (imageType == Mask.VectorDataType.INSTANCE) { modelBounds = handleVectorMask(mask); } else { modelBounds = handleImageMask(mask, productSceneView.getBaseImageLayer().getImageToModelTransform()); } if (modelBounds != null) { Viewport viewport = productSceneView.getViewport(); final AffineTransform m2vTransform = viewport.getModelToViewTransform(); final AffineTransform v2mTransform = viewport.getViewToModelTransform(); final Rectangle2D viewBounds = m2vTransform.createTransformedShape(modelBounds).getBounds2D(); viewBounds.setFrameFromDiagonal(viewBounds.getMinX() - 10, viewBounds.getMinY() - 10, viewBounds.getMaxX() + 10, viewBounds.getMaxY() + 10); final Shape transformedModelBounds = v2mTransform.createTransformedShape(viewBounds); viewport.zoom(transformedModelBounds.getBounds2D()); } else { Dialogs.showMessage("Zoom to Mask", "The selected mask is empty.", JOptionPane.INFORMATION_MESSAGE, null); } } }
double maxY = axisRangeControls[Y_VAR].getMax(); if (minX > maxX || minY > maxY) { Dialogs.showMessage(/*I18N*/ CHART_TITLE, /*I18N*/ "Failed to compute scatter plot.\n" + "No Pixels considered..", Dialogs.showMessage(CHART_TITLE, String.format("%s:\n%s", msg, reason), messageType, null);
Dialogs.showMessage("Extending vector data with statistics", "The vector data have successfully been extended with the computed statistics.", JOptionPane.INFORMATION_MESSAGE, null);
metadataWriter.finaliseOutput(); } catch (IOException exception) { Dialogs.showMessage("Statistics export", "Failed to export statistics.\nAn error occurred:" + exception.getMessage(), JOptionPane.ERROR_MESSAGE, null); } finally { Dialogs.showMessage("Statistics export", "The statistics have successfully been exported to '" + outputAsciiFile + "'.", JOptionPane.INFORMATION_MESSAGE, null);
} catch (InterruptedException | CancellationException e) { SystemUtils.LOG.log(Level.WARNING, "Failed to compute correlative plot.", e); Dialogs.showMessage(CHART_TITLE, "Failed to compute correlative plot.\n" + "Calculation canceled.", } catch (ExecutionException e) { SystemUtils.LOG.log(Level.WARNING, "Failed to compute correlative plot.", e); Dialogs.showMessage(CHART_TITLE, "Failed to compute correlative plot.\n" + "An error occurred:\n" + e.getCause().getMessage(),