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.openide.DialogDescriptor;
29 import org.openide.DialogDisplayer;
30 import org.openide.util.HelpCtx;
66 progressPanel =
new ProgressPanel();
67 progressPanel.setIndeterminate(
true);
83 progressPanel =
new ProgressPanel();
84 progressPanel.setIndeterminate(
true);
85 this.buttonLabels = null;
86 this.focusedButtonLabel = null;
87 this.buttonListener = null;
98 public synchronized void start(String message,
int totalWorkUnits) {
100 SwingUtilities.invokeLater(() -> {
101 progressPanel.setIndeterminate(
false);
102 progressPanel.setMessage(message);
103 progressPanel.setMaximum(totalWorkUnits);
115 public synchronized void start(String message) {
117 SwingUtilities.invokeLater(() -> {
118 progressPanel.setIndeterminate(
true);
119 progressPanel.setMessage(message);
133 SwingUtilities.invokeLater(() -> {
134 progressPanel.setIndeterminate(
false);
135 progressPanel.setMessage(cancellingMessage);
148 SwingUtilities.invokeLater(() -> {
149 progressPanel.setIndeterminate(
true);
150 progressPanel.setMessage(message);
164 public synchronized void switchToDeterminate(String message,
int workUnitsCompleted,
int totalWorkUnits) {
166 SwingUtilities.invokeLater(() -> {
167 progressPanel.setIndeterminate(
false);
168 progressPanel.setMessage(message);
169 progressPanel.setMaximum(totalWorkUnits);
170 progressPanel.setCurrent(workUnitsCompleted);
181 public synchronized void progress(String message) {
183 SwingUtilities.invokeLater(() -> {
184 progressPanel.setMessage(message);
197 public synchronized void progress(
int workUnitsCompleted) {
199 SwingUtilities.invokeLater(() -> {
200 progressPanel.setCurrent(workUnitsCompleted);
214 public synchronized void progress(String message,
int workUnitsCompleted) {
216 SwingUtilities.invokeLater(() -> {
217 progressPanel.setMessage(message);
218 progressPanel.setCurrent(workUnitsCompleted);
228 SwingUtilities.invokeLater(() -> {
229 this.dialog.setVisible(
false);
230 this.dialog.dispose();
238 if (null != buttonLabels && null != focusedButtonLabel && null != buttonListener) {
242 DialogDescriptor dialogDescriptor =
new DialogDescriptor(
248 DialogDescriptor.BOTTOM_ALIGN,
249 HelpCtx.DEFAULT_HELP,
251 dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor, parent);
256 dialog =
new JDialog(parent, title,
true);
257 dialog.add(progressPanel);
260 dialog.setResizable(
false);
261 dialog.setLocationRelativeTo(parent);
262 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()