Autopsy  4.10.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
MultiCaseKeywordSearchProgressIndicator.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2019 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.keywordsearch.multicase;
20 
21 import javax.swing.JProgressBar;
22 import javax.swing.SwingUtilities;
24 
28 final class MultiCaseKeywordSearchProgressIndicator implements ProgressIndicator {
29 
30  private final JProgressBar progress;
31 
37  MultiCaseKeywordSearchProgressIndicator(JProgressBar progressBar) {
38  progress = progressBar;
39  progress.setStringPainted(true);
40  }
41 
49  @Override
50  public void start(String message, int max) {
51  SwingUtilities.invokeLater(() -> {
52  progress.setIndeterminate(false);
53  progress.setMinimum(0);
54  progress.setString(message); //the message
55  progress.setValue(0);
56  progress.setMaximum(max);
57  progress.setVisible(true);
58  });
59  }
60 
67  @Override
68  public void start(String message) {
69  SwingUtilities.invokeLater(() -> {
70  progress.setIndeterminate(true);
71  progress.setMinimum(0);
72  progress.setString(message);
73  progress.setValue(0);
74  progress.setVisible(true);
75  });
76  }
77 
85  @Override
86  public void switchToIndeterminate(String message) {
87  SwingUtilities.invokeLater(() -> {
88  progress.setIndeterminate(true);
89  progress.setString(message);
90  });
91  }
92 
102  @Override
103  public void switchToDeterminate(String message, int current, int max) {
104  SwingUtilities.invokeLater(() -> {
105  progress.setIndeterminate(false);
106  progress.setMinimum(0);
107  progress.setString(message);
108  progress.setValue(current);
109  progress.setMaximum(max);
110  });
111  }
112 
119  @Override
120  public void progress(String message) {
121  SwingUtilities.invokeLater(() -> {
122  progress.setString(message);
123  });
124  }
125 
133  @Override
134  public void progress(int current) {
135  SwingUtilities.invokeLater(() -> {
136  progress.setValue(current);
137  });
138  }
139 
149  @Override
150  public void progress(String message, int current) {
151  SwingUtilities.invokeLater(() -> {
152  progress.setString(message);
153  progress.setValue(current);
154  });
155  }
156 
160  @Override
161  public void finish() {
162  SwingUtilities.invokeLater(() -> {
163  progress.setVisible(false);
164  });
165  }
166 
167 }

Copyright © 2012-2018 Basis Technology. Generated on: Fri Mar 22 2019
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.