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);
134 SwingUtilities.invokeLater(() -> {
135 progressPanel.setIndeterminate(
false);
136 progressPanel.setMessage(cancellingMessage);
149 SwingUtilities.invokeLater(() -> {
150 progressPanel.setIndeterminate(
true);
151 progressPanel.setMessage(message);
165 public synchronized void switchToDeterminate(String message,
int workUnitsCompleted,
int totalWorkUnits) {
167 SwingUtilities.invokeLater(() -> {
168 progressPanel.setIndeterminate(
false);
169 progressPanel.setMessage(message);
170 progressPanel.setMaximum(totalWorkUnits);
171 progressPanel.setCurrent(workUnitsCompleted);
182 public synchronized void progress(String message) {
184 SwingUtilities.invokeLater(() -> {
185 progressPanel.setMessage(message);
198 public synchronized void progress(
int workUnitsCompleted) {
200 SwingUtilities.invokeLater(() -> {
201 progressPanel.setCurrent(workUnitsCompleted);
215 public synchronized void progress(String message,
int workUnitsCompleted) {
217 SwingUtilities.invokeLater(() -> {
218 progressPanel.setMessage(message);
219 progressPanel.setCurrent(workUnitsCompleted);
229 SwingUtilities.invokeLater(() -> {
230 this.dialog.setVisible(
false);
231 this.dialog.dispose();
239 if (null != buttonLabels && null != focusedButtonLabel && null != buttonListener) {
243 DialogDescriptor dialogDescriptor =
new DialogDescriptor(
249 DialogDescriptor.BOTTOM_ALIGN,
250 HelpCtx.DEFAULT_HELP,
252 dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor, parent);
257 dialog =
new JDialog(parent, title,
true);
258 dialog.add(progressPanel);
261 dialog.setResizable(
false);
262 dialog.setLocationRelativeTo(parent);
263 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()