19 package org.sleuthkit.autopsy.coreutils;
 
   21 import java.awt.event.ActionEvent;
 
   22 import java.awt.event.ActionListener;
 
   23 import java.text.SimpleDateFormat;
 
   24 import java.util.ArrayList;
 
   25 import java.util.Collections;
 
   26 import java.util.Date;
 
   27 import java.util.List;
 
   28 import java.util.logging.Level;
 
   29 import javax.swing.Icon;
 
   30 import javax.swing.ImageIcon;
 
   31 import org.openide.DialogDisplayer;
 
   32 import org.openide.NotifyDescriptor;
 
   33 import org.openide.awt.Notification;
 
   34 import org.openide.awt.NotificationDisplayer;
 
   35 import 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"); 
 
   62         private MessageType(
int notifyDescriptorType, String resourceName) {
 
   63             this.notifyDescriptorType = notifyDescriptorType;
 
   64             if (resourceName == null) {
 
   65                 icon = 
new ImageIcon();
 
   67                 icon = loadIcon(resourceName);
 
   71         private static Icon 
loadIcon(String resourceName) {
 
   72             Icon icon = ImageUtilities.loadImageIcon(
"org/sleuthkit/autopsy/images/" + resourceName, 
false); 
 
   75                 logger.log(Level.SEVERE, 
"Failed to load icon resource: " + resourceName + 
". Using blank image."); 
 
   76                 icon = 
new ImageIcon();
 
   82             return notifyDescriptorType;
 
  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>());
 
  174             notifications.stream().forEach((n) -> {
 
  177             notifications.clear();
 
  188         public static void show(String title, String message, 
MessageType type, ActionListener actionListener) {
 
  189             Notification newNotification
 
  191             notifications.add(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) {
 
  251             return TIME_STAMP_FORMAT.format(
new Date()) + 
" " + title;
 
static DialogDisplayer getDialogDisplayer()
static void warn(String message)
MessageType(int notifyDescriptorType, String resourceName)
static void info(String title, String message)
static Icon loadIcon(String resourceName)
final int notifyDescriptorType
static final SimpleDateFormat TIME_STAMP_FORMAT
static boolean confirm(String message)
static void show(String message, MessageType messageType)
int getNotifyDescriptorType()
static String addTimeStampToTitle(String title)
static final List< Notification > notifications
static void error(String title, String message)
synchronized static Logger getLogger(String name)
static void show(String title, String message, MessageType type, ActionListener actionListener)
static void show(String title, final String message, final MessageType type)
static void info(String message)
static void warn(String title, String message)
static void error(String message)