19 package org.sleuthkit.autopsy.timeline;
21 import java.io.IOException;
23 import java.util.List;
24 import java.util.logging.Level;
25 import javafx.collections.FXCollections;
26 import javafx.scene.Node;
27 import javafx.scene.control.Alert;
28 import javafx.scene.control.ButtonBar;
29 import javafx.scene.control.ButtonType;
30 import javafx.scene.control.Dialog;
31 import javafx.scene.control.DialogPane;
32 import javafx.scene.control.ListView;
33 import javafx.scene.image.Image;
34 import javafx.stage.Modality;
35 import javafx.stage.Stage;
36 import org.controlsfx.dialog.ProgressDialog;
37 import org.controlsfx.tools.Borders;
38 import org.openide.util.NbBundle;
50 @NbBundle.Messages(
"PrompDialogManager.buttonType.showTimeline=Continue")
51 private static final ButtonType
CONTINUE =
new ButtonType(Bundle.PrompDialogManager_buttonType_showTimeline(), ButtonBar.ButtonData.OK_DONE);
53 @NbBundle.Messages(
"PrompDialogManager.buttonType.continueNoUpdate=Continue Without Updating")
54 private static final ButtonType
CONTINUE_NO_UPDATE =
new ButtonType(Bundle.PrompDialogManager_buttonType_continueNoUpdate(), ButtonBar.ButtonData.CANCEL_CLOSE);
56 @NbBundle.Messages(
"PrompDialogManager.buttonType.update=Update DB")
57 private static final ButtonType
UPDATE =
new ButtonType(Bundle.PrompDialogManager_buttonType_update(), ButtonBar.ButtonData.OK_DONE);
67 tempImg =
new Image(
new URL(
"nbresloc:/org/netbeans/core/startup/frame.gif").openStream());
68 }
catch (IOException ex) {
69 LOGGER.log(Level.WARNING,
"Failed to load branded icon for progress dialog.", ex);
71 AUTOPSY_ICON = tempImg;
95 boolean bringCurrentDialogToFront() {
97 ((Stage)
currentDialog.getDialogPane().getScene().getWindow()).toFront();
108 @NbBundle.Messages({
"PromptDialogManager.progressDialog.title=Populating Timeline Data"})
109 @ThreadConfined(type = ThreadConfined.ThreadType.JFX)
110 void showDBPopulationProgressDialog(CancellationProgressTask<?> task) {
113 currentDialog.setTitle(Bundle.PromptDialogManager_progressDialog_title());
115 currentDialog.headerTextProperty().bind(task.titleProperty());
118 dialogPane.setPrefSize(400, 200);
125 dialogPane.getButtonTypes().setAll(ButtonType.CANCEL);
126 final Node cancelButton = dialogPane.lookupButton(ButtonType.CANCEL);
127 cancelButton.disableProperty().bind(task.cancellableProperty().not());
129 if (task.isRunning()) {
130 closeRequest.consume();
132 if (task.isCancellable() && task.isCancelRequested() ==
false) {
133 task.requestCancel();
145 @ThreadConfined(type = ThreadConfined.ThreadType.JFX)
147 ((Stage) dialog.getDialogPane().getScene().getWindow()).getIcons().setAll(AUTOPSY_ICON);
157 "PromptDialogManager.confirmDuringIngest.headerText=You are trying to update the Timeline DB before ingest has been completed. The Timeline DB may be incomplete.",
158 "PromptDialogManager.confirmDuringIngest.contentText=Do you want to continue?"})
159 @ThreadConfined(type = ThreadConfined.ThreadType.JFX)
160 boolean confirmDuringIngest() {
161 currentDialog =
new Alert(Alert.AlertType.CONFIRMATION, Bundle.PromptDialogManager_confirmDuringIngest_contentText(),
CONTINUE, ButtonType.CANCEL);
165 currentDialog.setHeaderText(Bundle.PromptDialogManager_confirmDuringIngest_headerText());
168 return currentDialog.showAndWait().map(CONTINUE::equals).orElse(
false);
180 "PromptDialogManager.rebuildPrompt.headerText=The Timeline DB is incomplete and/or out of date. Some events may be missing or inaccurate and some features may be unavailable.",
181 "PromptDialogManager.rebuildPrompt.details=Details"})
182 @ThreadConfined(type = ThreadConfined.ThreadType.JFX)
183 boolean confirmRebuild(List<String> rebuildReasons) {
189 currentDialog.setHeaderText(Bundle.PromptDialogManager_rebuildPrompt_headerText());
192 ListView<String> listView =
new ListView<>(FXCollections.observableArrayList(rebuildReasons));
193 listView.setCellFactory(lstView ->
new WrappingListCell());
194 listView.setMaxHeight(75);
197 Node wrappedListView = Borders.wrap(listView)
199 .title(Bundle.PromptDialogManager_rebuildPrompt_details())
203 dialogPane.setExpandableContent(wrappedListView);
204 dialogPane.setMaxWidth(500);
207 return currentDialog.showAndWait().map(UPDATE::equals).orElse(
false);
static final ButtonType CONTINUE_NO_UPDATE
static final Image AUTOPSY_ICON
static final ButtonType UPDATE
static final ButtonType CONTINUE
final TimeLineController controller
synchronized static Logger getLogger(String name)
static void setDialogIcons(Dialog<?> dialog)
static final Logger LOGGER