diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/CheckBoxJList.java b/Core/src/org/sleuthkit/autopsy/geolocation/CheckBoxJList.java index 52276b6046..2f4247f3e6 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/CheckBoxJList.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/CheckBoxJList.java @@ -68,7 +68,7 @@ final class CheckBoxJList extends JLis CheckBoxJList() { initalize(); } - + /** * Do all of the UI initialization. */ @@ -103,6 +103,7 @@ final class CheckBoxJList extends JLis setBackground(list.getBackground()); setSelected(value.isChecked()); setText(value.getDisplayName()); + setEnabled(list.isEnabled()); return this; } } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/CheckBoxListPanel.form b/Core/src/org/sleuthkit/autopsy/geolocation/CheckBoxListPanel.form index 112b734f1e..75fb1d4c62 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/CheckBoxListPanel.form +++ b/Core/src/org/sleuthkit/autopsy/geolocation/CheckBoxListPanel.form @@ -37,10 +37,6 @@ - - - - @@ -56,10 +52,6 @@ - - - - diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/CheckBoxListPanel.java b/Core/src/org/sleuthkit/autopsy/geolocation/CheckBoxListPanel.java index 37dea163f5..ff3fd5b4a4 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/CheckBoxListPanel.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/CheckBoxListPanel.java @@ -61,6 +61,14 @@ final class CheckBoxListPanel extends javax.swing.JPanel { void clearList() { model.removeAllElements(); } + + @Override + public void setEnabled(boolean enabled) { + checkboxList.setEnabled(enabled); + checkButton.setEnabled(enabled); + uncheckButton.setEnabled(enabled); + checkboxList.setEnabled(enabled); + } /** * Returns a list of all of the selected elements. @@ -126,8 +134,8 @@ final class CheckBoxListPanel extends javax.swing.JPanel { java.awt.GridBagConstraints gridBagConstraints; titleLabel = new javax.swing.JLabel(); - javax.swing.JButton uncheckButton = new javax.swing.JButton(); - javax.swing.JButton checkButton = new javax.swing.JButton(); + uncheckButton = new javax.swing.JButton(); + checkButton = new javax.swing.JButton(); scrollPane = new javax.swing.JScrollPane(); setLayout(new java.awt.GridBagLayout()); @@ -186,8 +194,10 @@ final class CheckBoxListPanel extends javax.swing.JPanel { // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JButton checkButton; private javax.swing.JScrollPane scrollPane; private javax.swing.JLabel titleLabel; + private javax.swing.JButton uncheckButton; // End of variables declaration//GEN-END:variables /** diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/GeoFilterPanel.form b/Core/src/org/sleuthkit/autopsy/geolocation/GeoFilterPanel.form index 79a852b4d4..1b80568453 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/GeoFilterPanel.form +++ b/Core/src/org/sleuthkit/autopsy/geolocation/GeoFilterPanel.form @@ -115,10 +115,6 @@ - - - - diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/GeoFilterPanel.java b/Core/src/org/sleuthkit/autopsy/geolocation/GeoFilterPanel.java index 9e009d1245..fe20a9bceb 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/GeoFilterPanel.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/GeoFilterPanel.java @@ -74,6 +74,20 @@ class GeoFilterPanel extends javax.swing.JPanel { add(checkboxPanel, gridBagConstraints); } + @Override + public void setEnabled(boolean enabled) { + applyButton.setEnabled(enabled); + mostRecentButton.setEnabled(enabled); + allButton.setEnabled(enabled); + showWaypointsWOTSCheckBox.setEnabled(enabled && mostRecentButton.isSelected()); + checkboxPanel.setEnabled(enabled); + daysLabel.setEnabled(enabled); + daysSpinner.setEnabled(enabled); + } + + /** + * Update the data source list with the current data sources + */ void updateDataSourceList() { try { initCheckboxList(); @@ -155,7 +169,7 @@ class GeoFilterPanel extends javax.swing.JPanel { mostRecentButton = new javax.swing.JRadioButton(); showWaypointsWOTSCheckBox = new javax.swing.JCheckBox(); daysSpinner = new javax.swing.JSpinner(numberModel); - javax.swing.JLabel daysLabel = new javax.swing.JLabel(); + daysLabel = new javax.swing.JLabel(); javax.swing.JPanel buttonPanel = new javax.swing.JPanel(); applyButton = new javax.swing.JButton(); javax.swing.JLabel optionsLabel = new javax.swing.JLabel(); @@ -272,6 +286,7 @@ class GeoFilterPanel extends javax.swing.JPanel { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JRadioButton allButton; private javax.swing.JButton applyButton; + private javax.swing.JLabel daysLabel; private javax.swing.JSpinner daysSpinner; private javax.swing.JRadioButton mostRecentButton; private javax.swing.JCheckBox showWaypointsWOTSCheckBox; diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java index a653979bb6..1bf0aaabbf 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/GeolocationTopComponent.java @@ -22,6 +22,7 @@ import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeListener; +import java.util.ArrayList; import java.util.EnumSet; import java.util.List; import java.util.Set; @@ -171,6 +172,7 @@ public final class GeolocationTopComponent extends TopComponent { logger.log(Level.SEVERE, ex.getMessage(), ex); return; // Doen't set the waypoints. } + mapPanel.setWaypoints(new ArrayList<>()); updateWaypoints(); } @@ -213,36 +215,12 @@ public final class GeolocationTopComponent extends TopComponent { JOptionPane.INFORMATION_MESSAGE); return; } - - SwingUtilities.invokeLater(new Runnable() { - public void run() { - Case currentCase = Case.getCurrentCase(); - try { - WaypointBuilder.getAllWaypoints(currentCase.getSleuthkitCase(), filters.getDataSources(), filters.showAllWaypoints(), filters.getMostRecentNumDays(), filters.showWaypointsWithoutTimeStamp(), new WaypointFilterQueryCallBack() { - @Override - public void process(List waypoints) { - // If the list is empty, tell the user and do not change - // the visible waypoints. - if (waypoints == null || waypoints.isEmpty()) { - JOptionPane.showMessageDialog(GeolocationTopComponent.this, - Bundle.GeoTopComponent_no_waypoints_returned_Title(), - Bundle.GeoTopComponent_no_waypoints_returned_mgs(), - JOptionPane.INFORMATION_MESSAGE); - - return; - } - mapPanel.setWaypoints(MapWaypoint.getWaypoints(waypoints)); - } - }); - } catch (GeoLocationDataException ex) { - logger.log(Level.SEVERE, "Failed to filter waypoints.", ex); - JOptionPane.showMessageDialog(GeolocationTopComponent.this, - Bundle.GeoTopComponent_filter_exception_Title(), - Bundle.GeoTopComponent_filter_exception_msg(), - JOptionPane.ERROR_MESSAGE); - } - } - }); + + mapPanel.setWaypointLoading(true); + geoFilterPanel.setEnabled(false); + + Thread thread = new Thread(new WaypointRunner(filters)); + thread.start(); } /** @@ -269,4 +247,76 @@ public final class GeolocationTopComponent extends TopComponent { private org.sleuthkit.autopsy.geolocation.HidingPane filterPane; private org.sleuthkit.autopsy.geolocation.MapPanel mapPanel; // End of variables declaration//GEN-END:variables + + /** + * A runnable class for getting waypoints based on the current filters. + */ + private class WaypointRunner implements Runnable { + + private final GeoFilter filters; + + /** + * Constructs the Waypoint Runner + * + * @param filters + */ + WaypointRunner(GeoFilter filters) { + this.filters = filters; + } + + @Override + public void run() { + Case currentCase = Case.getCurrentCase(); + try { + WaypointBuilder.getAllWaypoints(currentCase.getSleuthkitCase(), + filters.getDataSources(), + filters.showAllWaypoints(), + filters.getMostRecentNumDays(), + filters.showWaypointsWithoutTimeStamp(), + new WaypointCallBack()); + + } catch (GeoLocationDataException ex) { + logger.log(Level.SEVERE, "Failed to filter waypoints.", ex); + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + JOptionPane.showMessageDialog(GeolocationTopComponent.this, + Bundle.GeoTopComponent_filter_exception_Title(), + Bundle.GeoTopComponent_filter_exception_msg(), + JOptionPane.ERROR_MESSAGE); + } + }); + } + } + + } + + /** + * Callback for getting waypoints. + */ + private class WaypointCallBack implements WaypointFilterQueryCallBack { + + @Override + public void process(List waypoints) { + // Make sure that the waypoints are added to the map panel in + // the correct thread. + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + // If the list is empty, tell the user and do not change + // the visible waypoints. + if (waypoints == null || waypoints.isEmpty()) { + JOptionPane.showMessageDialog(GeolocationTopComponent.this, + Bundle.GeoTopComponent_no_waypoints_returned_Title(), + Bundle.GeoTopComponent_no_waypoints_returned_mgs(), + JOptionPane.INFORMATION_MESSAGE); + + return; + } + mapPanel.setWaypoints(MapWaypoint.getWaypoints(waypoints)); + geoFilterPanel.setEnabled(true); + } + }); + } + } } diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.form b/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.form index 454008c062..5158982822 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.form +++ b/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.form @@ -98,7 +98,7 @@ - + @@ -107,8 +107,19 @@ - - + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java b/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java index fb5cdc23e5..03ec22cf2b 100755 --- a/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java +++ b/Core/src/org/sleuthkit/autopsy/geolocation/MapPanel.java @@ -178,6 +178,17 @@ final public class MapPanel extends javax.swing.JPanel { mapViewer.setOverlayPainter(waypointPainter); } + + /** + * Show or hide the waypoint loading progress bar. + * + * @param loading + */ + void setWaypointLoading(boolean loading) { + progressBar.setEnabled(true); + progressBar.setVisible(loading); + progressBar.setString("Loading Waypoints"); + } /** * Setup the zoom slider based on the current tileFactory. @@ -265,6 +276,7 @@ final public class MapPanel extends javax.swing.JPanel { } mapViewer.repaint(); + setWaypointLoading(false); } /** @@ -486,6 +498,7 @@ final public class MapPanel extends javax.swing.JPanel { zoomSlider = new javax.swing.JSlider(); infoPanel = new javax.swing.JPanel(); cordLabel = new javax.swing.JLabel(); + progressBar = new javax.swing.JProgressBar(); setFocusable(false); setLayout(new java.awt.BorderLayout()); @@ -553,10 +566,24 @@ final public class MapPanel extends javax.swing.JPanel { add(mapViewer, java.awt.BorderLayout.CENTER); - infoPanel.setLayout(new java.awt.BorderLayout()); + infoPanel.setLayout(new java.awt.GridBagLayout()); org.openide.awt.Mnemonics.setLocalizedText(cordLabel, org.openide.util.NbBundle.getMessage(MapPanel.class, "MapPanel.cordLabel.text")); // NOI18N - infoPanel.add(cordLabel, java.awt.BorderLayout.EAST); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 0; + gridBagConstraints.gridy = 0; + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; + gridBagConstraints.weightx = 1.0; + gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 5); + infoPanel.add(cordLabel, gridBagConstraints); + + progressBar.setIndeterminate(true); + progressBar.setStringPainted(true); + gridBagConstraints = new java.awt.GridBagConstraints(); + gridBagConstraints.gridx = 1; + gridBagConstraints.gridy = 0; + gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST; + infoPanel.add(progressBar, gridBagConstraints); add(infoPanel, java.awt.BorderLayout.SOUTH); }// //GEN-END:initComponents @@ -594,6 +621,7 @@ final public class MapPanel extends javax.swing.JPanel { private javax.swing.JLabel cordLabel; private javax.swing.JPanel infoPanel; private org.jxmapviewer.JXMapViewer mapViewer; + private javax.swing.JProgressBar progressBar; private javax.swing.JPanel zoomPanel; private javax.swing.JSlider zoomSlider; // End of variables declaration//GEN-END:variables