mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
improve initial dialog
This commit is contained in:
parent
894209cc2d
commit
0fc0b1347c
@ -18,7 +18,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.imagegallery;
|
package org.sleuthkit.autopsy.imagegallery;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -26,7 +28,6 @@ import javafx.application.Platform;
|
|||||||
import javafx.embed.swing.JFXPanel;
|
import javafx.embed.swing.JFXPanel;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.ChoiceDialog;
|
import javafx.scene.control.ChoiceDialog;
|
||||||
import javafx.scene.control.Dialog;
|
|
||||||
import javafx.scene.control.SplitPane;
|
import javafx.scene.control.SplitPane;
|
||||||
import javafx.scene.control.TabPane;
|
import javafx.scene.control.TabPane;
|
||||||
import javafx.scene.layout.BorderPane;
|
import javafx.scene.layout.BorderPane;
|
||||||
@ -133,9 +134,10 @@ public final class ImageGalleryTopComponent extends TopComponent implements Expl
|
|||||||
if (tc.isOpened() == false) {
|
if (tc.isOpened() == false) {
|
||||||
try {
|
try {
|
||||||
List<DataSource> dataSources = ((ImageGalleryTopComponent) tc).controller.getSleuthKitCase().getDataSources();
|
List<DataSource> dataSources = ((ImageGalleryTopComponent) tc).controller.getSleuthKitCase().getDataSources();
|
||||||
|
Map<String, DataSource> dataSourceNames = new HashMap<>();
|
||||||
|
dataSources.forEach(dataSource -> dataSourceNames.put(dataSource.getName(), dataSource));
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
Dialog<DataSource> d = new ChoiceDialog<>(null, dataSources);
|
ChoiceDialog<String> d = new ChoiceDialog<>(null, dataSourceNames.keySet());
|
||||||
d.setTitle("Image Gallery");
|
d.setTitle("Image Gallery");
|
||||||
d.setHeaderText("Choose a data source to view.");
|
d.setHeaderText("Choose a data source to view.");
|
||||||
d.setContentText("Data source:");
|
d.setContentText("Data source:");
|
||||||
@ -143,8 +145,8 @@ public final class ImageGalleryTopComponent extends TopComponent implements Expl
|
|||||||
d.initModality(Modality.WINDOW_MODAL);
|
d.initModality(Modality.WINDOW_MODAL);
|
||||||
GuiUtils.setDialogIcons(d);
|
GuiUtils.setDialogIcons(d);
|
||||||
|
|
||||||
Optional<DataSource> dataSource = d.showAndWait();
|
Optional<String> dataSourceName = d.showAndWait();
|
||||||
dataSource.ifPresent(ds -> ((ImageGalleryTopComponent) tc).controller.getGroupManager().setDataSource(ds));
|
dataSourceName.map(dataSourceNames::get).ifPresent(ds -> ((ImageGalleryTopComponent) tc).controller.getGroupManager().setDataSource(ds));
|
||||||
});
|
});
|
||||||
} catch (TskCoreException tskCoreException) {
|
} catch (TskCoreException tskCoreException) {
|
||||||
logger.log(Level.SEVERE, "Unable to get data sourcecs.", tskCoreException);
|
logger.log(Level.SEVERE, "Unable to get data sourcecs.", tskCoreException);
|
||||||
|
@ -55,6 +55,7 @@ import javafx.scene.layout.BorderPane;
|
|||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
import javafx.scene.text.Text;
|
import javafx.scene.text.Text;
|
||||||
import javafx.util.StringConverter;
|
import javafx.util.StringConverter;
|
||||||
|
import static org.apache.commons.lang3.ObjectUtils.defaultIfNull;
|
||||||
import org.controlsfx.control.Notifications;
|
import org.controlsfx.control.Notifications;
|
||||||
import org.controlsfx.control.PopOver;
|
import org.controlsfx.control.PopOver;
|
||||||
import org.openide.util.NbBundle;
|
import org.openide.util.NbBundle;
|
||||||
@ -117,8 +118,10 @@ public class Toolbar extends ToolBar {
|
|||||||
private final InvalidationListener queryInvalidationListener = new InvalidationListener() {
|
private final InvalidationListener queryInvalidationListener = new InvalidationListener() {
|
||||||
@Override
|
@Override
|
||||||
public void invalidated(Observable invalidated) {
|
public void invalidated(Observable invalidated) {
|
||||||
controller.getGroupManager().regroup(
|
Optional<DataSource> selectedItem = dataSourceComboBox.getSelectionModel().getSelectedItem();
|
||||||
dataSourceComboBox.getSelectionModel().getSelectedItem().orElse(null),
|
selectedItem = defaultIfNull(selectedItem, Optional.empty());
|
||||||
|
|
||||||
|
controller.getGroupManager().regroup(selectedItem.orElse(null),
|
||||||
groupByBox.getSelectionModel().getSelectedItem(),
|
groupByBox.getSelectionModel().getSelectedItem(),
|
||||||
sortChooser.getComparator(),
|
sortChooser.getComparator(),
|
||||||
sortChooser.getSortOrder(),
|
sortChooser.getSortOrder(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user