mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 00:16:16 +00:00
Merge pull request #5460 from kellykelly3/5796-5817-Geolocation-window-bug-fixes
5817, 5841, 5842, 5843 geolocation window bug fixes
This commit is contained in:
commit
010e5c5d19
@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.geolocation;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import javax.swing.DefaultListModel;
|
||||
import javax.swing.Icon;
|
||||
|
||||
@ -52,7 +53,11 @@ final class CheckBoxListPanel<T> extends javax.swing.JPanel {
|
||||
* @param obj Object that the checkbox represents
|
||||
*/
|
||||
void addElement(String displayName, T obj) {
|
||||
model.addElement(new ObjectCheckBox<>(displayName, true, obj));
|
||||
ObjectCheckBox<T> newCheckBox = new ObjectCheckBox<>(displayName, true, obj);
|
||||
|
||||
if(!model.contains(newCheckBox)) {
|
||||
model.addElement(newCheckBox);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -244,6 +249,21 @@ final class CheckBoxListPanel<T> extends javax.swing.JPanel {
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(obj instanceof ObjectCheckBox) {
|
||||
return object.equals(((ObjectCheckBox)obj).object);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hash = 7;
|
||||
hash = 31 * hash + Objects.hashCode(this.object);
|
||||
return hash;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -96,6 +96,13 @@ class GeoFilterPanel extends javax.swing.JPanel {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears the data source list.
|
||||
*/
|
||||
void clearDataSourceList() {
|
||||
checkboxPanel.clearList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an actionListener to listen for the filter apply action
|
||||
*
|
||||
@ -135,8 +142,6 @@ class GeoFilterPanel extends javax.swing.JPanel {
|
||||
private void initCheckboxList() throws TskCoreException {
|
||||
final SleuthkitCase sleuthkitCase = Case.getCurrentCase().getSleuthkitCase();
|
||||
|
||||
checkboxPanel.clearList();
|
||||
|
||||
for (DataSource dataSource : sleuthkitCase.getDataSources()) {
|
||||
String dsName = sleuthkitCase.getContentById(dataSource.getId()).getName();
|
||||
checkboxPanel.addElement(dsName, dataSource);
|
||||
|
@ -65,6 +65,7 @@ public final class GeolocationTopComponent extends TopComponent {
|
||||
private static final Set<IngestManager.IngestModuleEvent> INGEST_MODULE_EVENTS_OF_INTEREST = EnumSet.of(DATA_ADDED);
|
||||
|
||||
private final PropertyChangeListener ingestListener;
|
||||
private final PropertyChangeListener caseEventListener;
|
||||
private final GeoFilterPanel geoFilterPanel;
|
||||
|
||||
final RefreshPanel refreshPanel = new RefreshPanel();
|
||||
@ -101,6 +102,13 @@ public final class GeolocationTopComponent extends TopComponent {
|
||||
}
|
||||
};
|
||||
|
||||
this.caseEventListener = pce -> {
|
||||
mapPanel.clearWaypoints();
|
||||
if (pce.getNewValue() != null) {
|
||||
updateWaypoints();
|
||||
}
|
||||
};
|
||||
|
||||
refreshPanel.addCloseActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
@ -111,6 +119,7 @@ public final class GeolocationTopComponent extends TopComponent {
|
||||
refreshPanel.addRefreshActionListner(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
geoFilterPanel.updateDataSourceList();
|
||||
mapPanel.clearWaypoints();
|
||||
updateWaypoints();
|
||||
showRefreshPanel(false);
|
||||
@ -131,24 +140,21 @@ public final class GeolocationTopComponent extends TopComponent {
|
||||
public void addNotify() {
|
||||
super.addNotify();
|
||||
IngestManager.getInstance().addIngestModuleEventListener(INGEST_MODULE_EVENTS_OF_INTEREST, ingestListener);
|
||||
Case.addEventTypeSubscriber(EnumSet.of(CURRENT_CASE), evt -> {
|
||||
mapPanel.clearWaypoints();
|
||||
if (evt.getNewValue() != null) {
|
||||
updateWaypoints();
|
||||
}
|
||||
});
|
||||
Case.addEventTypeSubscriber(EnumSet.of(CURRENT_CASE), caseEventListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeNotify() {
|
||||
super.removeNotify();
|
||||
IngestManager.getInstance().removeIngestModuleEventListener(ingestListener);
|
||||
Case.removeEventTypeSubscriber(EnumSet.of(CURRENT_CASE), caseEventListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void componentOpened() {
|
||||
super.componentOpened();
|
||||
WindowManager.getDefault().setTopComponentFloating(this, true);
|
||||
|
||||
}
|
||||
|
||||
@Messages({
|
||||
@ -158,6 +164,7 @@ public final class GeolocationTopComponent extends TopComponent {
|
||||
@Override
|
||||
public void open() {
|
||||
super.open();
|
||||
geoFilterPanel.clearDataSourceList();
|
||||
geoFilterPanel.updateDataSourceList();
|
||||
try {
|
||||
mapPanel.initMap();
|
||||
|
@ -25,6 +25,7 @@ import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
@ -312,8 +313,10 @@ final public class MapPanel extends javax.swing.JPanel {
|
||||
// it the popup is currently visible
|
||||
if (waypoint != null && !waypoint.equals(currentlySelectedWaypoint)) {
|
||||
currentlySelectedWaypoint = waypoint;
|
||||
if(currentPopup != null) {
|
||||
showDetailsPopup();
|
||||
}
|
||||
}
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.WARNING, "Failed to show popup for waypoint", ex);
|
||||
}
|
||||
@ -340,7 +343,7 @@ final public class MapPanel extends javax.swing.JPanel {
|
||||
popupMenu.add(new JSeparator());
|
||||
}
|
||||
}
|
||||
popupMenu.show(this, point.x, point.y);
|
||||
popupMenu.show(mapViewer, point.x, point.y);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -612,8 +615,10 @@ final public class MapPanel extends javax.swing.JPanel {
|
||||
}//GEN-LAST:event_mapViewerMouseMoved
|
||||
|
||||
private void mapViewerMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mapViewerMouseClicked
|
||||
if(!evt.isPopupTrigger() && (evt.getButton() == MouseEvent.BUTTON1)) {
|
||||
currentlySelectedWaypoint = findClosestWaypoint(evt.getPoint());
|
||||
showDetailsPopup();
|
||||
}
|
||||
}//GEN-LAST:event_mapViewerMouseClicked
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user