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