19 package org.sleuthkit.autopsy.datasourcesummary.uiutils;
21 import java.awt.BorderLayout;
22 import java.beans.PropertyChangeListener;
24 import java.util.EnumSet;
25 import java.util.HashSet;
27 import javax.swing.ImageIcon;
28 import javax.swing.JLabel;
29 import javax.swing.JPanel;
30 import org.openide.util.NbBundle.Messages;
37 "IngestRunningLabel_defaultMessage=Ingest is currently running."
41 private static final long serialVersionUID = 1L;
42 public static final String DEFAULT_MESSAGE = Bundle.IngestRunningLabel_defaultMessage();
43 private static final URL DEFAULT_ICON =
IngestRunningLabel.class.getResource(
"/org/sleuthkit/autopsy/modules/filetypeid/warning16.png");
51 private static Set<IngestRunningLabel> activeLabels =
new HashSet<>();
52 private static PropertyChangeListener classListener = null;
53 private static Object lockObject =
new Object();
61 synchronized (lockObject) {
64 if (classListener == null) {
65 classListener = (evt) -> {
72 notifyListeners(
true);
77 notifyListeners(
false);
85 activeLabels.add(label);
95 synchronized (lockObject) {
97 label.refreshState(ingestIsRunning);
108 synchronized (lockObject) {
109 activeLabels.remove(label);
110 if (activeLabels.isEmpty() && classListener != null) {
112 classListener = null;
121 this(DEFAULT_MESSAGE,
true);
131 JLabel jlabel =
new JLabel();
132 jlabel.setText(message);
134 if (showWarningIcon) {
135 jlabel.setIcon(
new ImageIcon(DEFAULT_ICON));
138 setLayout(
new BorderLayout());
139 add(jlabel, BorderLayout.NORTH);
158 setVisible(ingestIsRunning);
165 removeListener(
this);
static synchronized IngestManager getInstance()
static void setupListener(IngestRunningLabel label)
boolean isIngestRunning()
final void refreshState()
void removeIngestJobEventListener(final PropertyChangeListener listener)
static void removeListener(IngestRunningLabel label)
void addIngestJobEventListener(final PropertyChangeListener listener)
final void refreshState(boolean ingestIsRunning)
IngestRunningLabel(String message, boolean showWarningIcon)
static void notifyListeners(boolean ingestIsRunning)