19package org.sleuthkit.autopsy.coreutils;
21import java.awt.event.ActionEvent;
22import java.awt.event.ActionListener;
23import java.text.SimpleDateFormat;
24import java.util.ArrayList;
25import java.util.Collections;
28import java.util.logging.Level;
29import javax.swing.Icon;
30import javax.swing.ImageIcon;
31import org.openide.DialogDisplayer;
32import org.openide.NotifyDescriptor;
33import org.openide.awt.Notification;
34import org.openide.awt.NotificationDisplayer;
35import org.openide.util.ImageUtilities;
54 INFO(NotifyDescriptor.INFORMATION_MESSAGE,
"info-icon-16.png"),
55 ERROR(NotifyDescriptor.ERROR_MESSAGE,
"error-icon-16.png"),
56 WARNING(NotifyDescriptor.WARNING_MESSAGE,
"warning-icon-16.png"),
57 CONFIRM(NotifyDescriptor.YES_NO_OPTION,
"warning-icon-16.png");
64 if (resourceName ==
null) {
65 icon =
new ImageIcon();
71 private static Icon
loadIcon(String resourceName) {
72 Icon
icon = ImageUtilities.loadImageIcon(
"org/sleuthkit/autopsy/images/" + resourceName,
false);
74 Logger logger =
Logger.
getLogger(org.sleuthkit.autopsy.coreutils.MessageNotifyUtil.MessageType.class.getName());
75 logger.log(Level.SEVERE,
"Failed to load icon resource: " + resourceName +
". Using blank image.");
76 icon =
new ImageIcon();
102 return DialogDisplayer.getDefault();
123 public static boolean confirm(String message) {
133 public static void info(String message) {
142 public static void error(String message) {
151 public static void warn(String message) {
162 private static final SimpleDateFormat
TIME_STAMP_FORMAT =
new SimpleDateFormat(
"MM/dd/yy HH:mm:ss z");
165 private static final List<Notification>
notifications = Collections.synchronizedList(
new ArrayList<Notification>());
188 public static void show(String title, String message,
MessageType type, ActionListener actionListener) {
189 Notification newNotification
204 ActionListener actionListener = (ActionEvent e) -> {
208 show(title, message, type, actionListener);
217 public static void info(String title, String message) {
227 public static void error(String title, String message) {
237 public static void warn(String title, String message) {
synchronized static Logger getLogger(String name)
static DialogDisplayer getDialogDisplayer()
static void error(String message)
static void warn(String message)
static void info(String message)
static void show(String message, MessageType messageType)
static boolean confirm(String message)
static void warn(String title, String message)
static void show(String title, final String message, final MessageType type)
static void error(String title, String message)
static void info(String title, String message)
static final List< Notification > notifications
static void show(String title, String message, MessageType type, ActionListener actionListener)
static final SimpleDateFormat TIME_STAMP_FORMAT
static String addTimeStampToTitle(String title)
static Icon loadIcon(String resourceName)
MessageType(int notifyDescriptorType, String resourceName)
int getNotifyDescriptorType()
final int notifyDescriptorType