19 package org.sleuthkit.autopsy.progress;
21 import java.awt.Dialog;
22 import java.awt.Frame;
23 import java.awt.event.ActionListener;
24 import javax.annotation.concurrent.GuardedBy;
25 import javax.annotation.concurrent.ThreadSafe;
26 import javax.swing.JDialog;
27 import javax.swing.SwingUtilities;
28 import org.apache.commons.lang3.SerializationUtils;
29 import org.openide.DialogDescriptor;
30 import org.openide.DialogDisplayer;
31 import org.openide.util.HelpCtx;
67 progressPanel =
new ProgressPanel();
68 progressPanel.setIndeterminate(
true);
69 this.buttonLabels = SerializationUtils.clone(buttonLabels);
84 progressPanel =
new ProgressPanel();
85 progressPanel.setIndeterminate(
true);
86 this.buttonLabels = null;
87 this.focusedButtonLabel = null;
88 this.buttonListener = null;
99 public synchronized void start(String message,
int totalWorkUnits) {
101 SwingUtilities.invokeLater(() -> {
102 progressPanel.setIndeterminate(
false);
103 progressPanel.setMessage(message);
104 progressPanel.setMaximum(totalWorkUnits);
116 public synchronized void start(String message) {
118 SwingUtilities.invokeLater(() -> {
119 progressPanel.setIndeterminate(
true);
120 progressPanel.setMessage(message);
135 SwingUtilities.invokeLater(() -> {
136 progressPanel.setIndeterminate(
false);
137 progressPanel.setMessage(cancellingMessage);
150 SwingUtilities.invokeLater(() -> {
151 progressPanel.setIndeterminate(
true);
152 progressPanel.setMessage(message);
166 public synchronized void switchToDeterminate(String message,
int workUnitsCompleted,
int totalWorkUnits) {
168 SwingUtilities.invokeLater(() -> {
169 progressPanel.setIndeterminate(
false);
170 progressPanel.setMessage(message);
171 progressPanel.setMaximum(totalWorkUnits);
172 progressPanel.setCurrent(workUnitsCompleted);
183 public synchronized void progress(String message) {
185 SwingUtilities.invokeLater(() -> {
186 progressPanel.setMessage(message);
199 public synchronized void progress(
int workUnitsCompleted) {
201 SwingUtilities.invokeLater(() -> {
202 progressPanel.setCurrent(workUnitsCompleted);
216 public synchronized void progress(String message,
int workUnitsCompleted) {
218 SwingUtilities.invokeLater(() -> {
219 progressPanel.setMessage(message);
220 progressPanel.setCurrent(workUnitsCompleted);
230 SwingUtilities.invokeLater(() -> {
231 this.dialog.setVisible(
false);
232 this.dialog.dispose();
240 if (null != buttonLabels && null != focusedButtonLabel && null != buttonListener) {
244 DialogDescriptor dialogDescriptor =
new DialogDescriptor(
250 DialogDescriptor.BOTTOM_ALIGN,
251 HelpCtx.DEFAULT_HELP,
253 dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor, parent);
258 dialog =
new JDialog(parent, title,
true);
259 dialog.add(progressPanel);
262 dialog.setResizable(
false);
263 dialog.setLocationRelativeTo(parent);
264 this.dialog.setVisible(
true);
synchronized void start(String message)
synchronized void progress(String message, int workUnitsCompleted)
final Object focusedButtonLabel
final ProgressPanel progressPanel
synchronized void start(String message, int totalWorkUnits)
final Object[] buttonLabels
synchronized void setCancelling(String cancellingMessage)
synchronized void progress(int workUnitsCompleted)
synchronized void switchToIndeterminate(String message)
ModalDialogProgressIndicator(Frame parent, String title)
synchronized void switchToDeterminate(String message, int workUnitsCompleted, int totalWorkUnits)
final ActionListener buttonListener
synchronized void progress(String message)
synchronized void finish()