mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 08:26:15 +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.ArrayList;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import javax.swing.DefaultListModel;
|
import javax.swing.DefaultListModel;
|
||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
|
|
||||||
@ -52,7 +53,11 @@ final class CheckBoxListPanel<T> extends javax.swing.JPanel {
|
|||||||
* @param obj Object that the checkbox represents
|
* @param obj Object that the checkbox represents
|
||||||
*/
|
*/
|
||||||
void addElement(String displayName, T obj) {
|
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() {
|
public String getDisplayName() {
|
||||||
return displayName;
|
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
|
* 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 {
|
private void initCheckboxList() throws TskCoreException {
|
||||||
final SleuthkitCase sleuthkitCase = Case.getCurrentCase().getSleuthkitCase();
|
final SleuthkitCase sleuthkitCase = Case.getCurrentCase().getSleuthkitCase();
|
||||||
|
|
||||||
checkboxPanel.clearList();
|
|
||||||
|
|
||||||
for (DataSource dataSource : sleuthkitCase.getDataSources()) {
|
for (DataSource dataSource : sleuthkitCase.getDataSources()) {
|
||||||
String dsName = sleuthkitCase.getContentById(dataSource.getId()).getName();
|
String dsName = sleuthkitCase.getContentById(dataSource.getId()).getName();
|
||||||
checkboxPanel.addElement(dsName, dataSource);
|
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 static final Set<IngestManager.IngestModuleEvent> INGEST_MODULE_EVENTS_OF_INTEREST = EnumSet.of(DATA_ADDED);
|
||||||
|
|
||||||
private final PropertyChangeListener ingestListener;
|
private final PropertyChangeListener ingestListener;
|
||||||
|
private final PropertyChangeListener caseEventListener;
|
||||||
private final GeoFilterPanel geoFilterPanel;
|
private final GeoFilterPanel geoFilterPanel;
|
||||||
|
|
||||||
final RefreshPanel refreshPanel = new RefreshPanel();
|
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() {
|
refreshPanel.addCloseActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
@ -111,6 +119,7 @@ public final class GeolocationTopComponent extends TopComponent {
|
|||||||
refreshPanel.addRefreshActionListner(new ActionListener() {
|
refreshPanel.addRefreshActionListner(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
geoFilterPanel.updateDataSourceList();
|
||||||
mapPanel.clearWaypoints();
|
mapPanel.clearWaypoints();
|
||||||
updateWaypoints();
|
updateWaypoints();
|
||||||
showRefreshPanel(false);
|
showRefreshPanel(false);
|
||||||
@ -131,24 +140,21 @@ public final class GeolocationTopComponent extends TopComponent {
|
|||||||
public void addNotify() {
|
public void addNotify() {
|
||||||
super.addNotify();
|
super.addNotify();
|
||||||
IngestManager.getInstance().addIngestModuleEventListener(INGEST_MODULE_EVENTS_OF_INTEREST, ingestListener);
|
IngestManager.getInstance().addIngestModuleEventListener(INGEST_MODULE_EVENTS_OF_INTEREST, ingestListener);
|
||||||
Case.addEventTypeSubscriber(EnumSet.of(CURRENT_CASE), evt -> {
|
Case.addEventTypeSubscriber(EnumSet.of(CURRENT_CASE), caseEventListener);
|
||||||
mapPanel.clearWaypoints();
|
|
||||||
if (evt.getNewValue() != null) {
|
|
||||||
updateWaypoints();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeNotify() {
|
public void removeNotify() {
|
||||||
super.removeNotify();
|
super.removeNotify();
|
||||||
IngestManager.getInstance().removeIngestModuleEventListener(ingestListener);
|
IngestManager.getInstance().removeIngestModuleEventListener(ingestListener);
|
||||||
|
Case.removeEventTypeSubscriber(EnumSet.of(CURRENT_CASE), caseEventListener);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentOpened() {
|
public void componentOpened() {
|
||||||
super.componentOpened();
|
super.componentOpened();
|
||||||
WindowManager.getDefault().setTopComponentFloating(this, true);
|
WindowManager.getDefault().setTopComponentFloating(this, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Messages({
|
@Messages({
|
||||||
@ -158,6 +164,7 @@ public final class GeolocationTopComponent extends TopComponent {
|
|||||||
@Override
|
@Override
|
||||||
public void open() {
|
public void open() {
|
||||||
super.open();
|
super.open();
|
||||||
|
geoFilterPanel.clearDataSourceList();
|
||||||
geoFilterPanel.updateDataSourceList();
|
geoFilterPanel.updateDataSourceList();
|
||||||
try {
|
try {
|
||||||
mapPanel.initMap();
|
mapPanel.initMap();
|
||||||
|
@ -25,6 +25,7 @@ import java.awt.event.ActionEvent;
|
|||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.ComponentAdapter;
|
import java.awt.event.ComponentAdapter;
|
||||||
import java.awt.event.ComponentEvent;
|
import java.awt.event.ComponentEvent;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
@ -312,8 +313,10 @@ final public class MapPanel extends javax.swing.JPanel {
|
|||||||
// it the popup is currently visible
|
// it the popup is currently visible
|
||||||
if (waypoint != null && !waypoint.equals(currentlySelectedWaypoint)) {
|
if (waypoint != null && !waypoint.equals(currentlySelectedWaypoint)) {
|
||||||
currentlySelectedWaypoint = waypoint;
|
currentlySelectedWaypoint = waypoint;
|
||||||
|
if(currentPopup != null) {
|
||||||
showDetailsPopup();
|
showDetailsPopup();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
logger.log(Level.WARNING, "Failed to show popup for waypoint", 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.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
|
}//GEN-LAST:event_mapViewerMouseMoved
|
||||||
|
|
||||||
private void mapViewerMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mapViewerMouseClicked
|
private void mapViewerMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_mapViewerMouseClicked
|
||||||
|
if(!evt.isPopupTrigger() && (evt.getButton() == MouseEvent.BUTTON1)) {
|
||||||
currentlySelectedWaypoint = findClosestWaypoint(evt.getPoint());
|
currentlySelectedWaypoint = findClosestWaypoint(evt.getPoint());
|
||||||
showDetailsPopup();
|
showDetailsPopup();
|
||||||
|
}
|
||||||
}//GEN-LAST:event_mapViewerMouseClicked
|
}//GEN-LAST:event_mapViewerMouseClicked
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user