Changes per Jonathan's review comments

This commit is contained in:
Kelly Kelly 2019-03-27 11:29:19 -04:00
parent b1ef186ab5
commit 851099cee2
7 changed files with 58 additions and 22 deletions

View File

@ -18,6 +18,7 @@
*/
package org.sleuthkit.autopsy.communications;
import com.google.common.collect.ImmutableSet;
import com.google.common.eventbus.Subscribe;
import java.awt.Component;
import java.util.logging.Level;
@ -36,7 +37,10 @@ import org.openide.util.lookup.ProxyLookup;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.CommunicationsFilter;
import org.sleuthkit.datamodel.CommunicationsManager;
import static org.sleuthkit.datamodel.Relationship.Type.CALL_LOG;
import static org.sleuthkit.datamodel.Relationship.Type.MESSAGE;
import org.sleuthkit.datamodel.TskCoreException;
/**
@ -131,6 +135,19 @@ public final class AccountsBrowser extends JPanel implements ExplorerManager.Pro
}
}
@Subscribe
void historyChange(CVTEvents.StateEvent event) {
try {
final CommunicationsManager commsManager = Case.getCurrentCaseThrows().getSleuthkitCase().getCommunicationsManager();
accountsTableEM.setRootContext(new AbstractNode(Children.create(new AccountDeviceInstanceNodeFactory(commsManager, event.getCommunicationsState().getCommunicationsFilter()), true)));
} catch (TskCoreException ex) {
logger.log(Level.SEVERE, "There was an error getting the CommunicationsManager for the current case.", ex);
} catch (NoCurrentCaseException ex) { //NOPMD empty catch clause
//Case is closed, do nothig.
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always

View File

@ -38,6 +38,9 @@ final class CVTEvents {
private CVTEvents() {
}
/**
* Invoked when a ComminucationsFilter change occures.
*/
static final class FilterChangeEvent {
private final CommunicationsFilter newFilter;
@ -52,6 +55,9 @@ final class CVTEvents {
}
/**
* Invoked when a change in the pinned accounts occures.
*/
static final class PinAccountsEvent {
private final ImmutableSet<AccountDeviceInstanceKey> accountDeviceInstances;
@ -71,6 +77,9 @@ final class CVTEvents {
}
}
/**
* Invoked when a change in the unpinned accounts occures.
*/
static final class UnpinAccountsEvent {
private final ImmutableSet<AccountDeviceInstanceKey> accountDeviceInstances;
@ -84,6 +93,9 @@ final class CVTEvents {
}
}
/**
* Invoked when there is a change in the state of the window.
*/
static final class StateEvent {
private final CommunicationsState newState;
@ -96,6 +108,9 @@ final class CVTEvents {
}
}
/**
* Invoked when change in the link analysis graph scale occures.
*/
static final class ZoomEvent {
private final double zoomValue;

View File

@ -305,12 +305,12 @@ final public class FiltersPanel extends JPanel {
private void setDateRangeFilter(DateRangeFilter dateFilter) {
ZonedDateTime zoneDate = ZonedDateTime.ofInstant(Instant.ofEpochSecond(dateFilter.getStartDate()), Utils.getUserPreferredZoneId());
startDatePicker.setEnabled(dateFilter.isStartDateEnabled());
startCheckBox.setEnabled(dateFilter.isStartDateEnabled());
startCheckBox.setSelected(dateFilter.isStartDateEnabled());
startDatePicker.setDate(zoneDate.toLocalDate());
zoneDate = ZonedDateTime.ofInstant(Instant.ofEpochSecond(dateFilter.getEndDate()), Utils.getUserPreferredZoneId());
endDatePicker.setEnabled(dateFilter.isEndDateEnabled());
endCheckBox.setEnabled(dateFilter.isEndDateEnabled());
endCheckBox.setSelected(dateFilter.isEndDateEnabled());
endDatePicker.setDate(zoneDate.toLocalDate());
}
@ -321,7 +321,6 @@ final public class FiltersPanel extends JPanel {
*/
private void setAccountTypeFilter(AccountTypeFilter typeFilter){
Collection<Account.Type> typeSet = typeFilter.getAccountTypes();
accountTypeMap.forEach((type, cb) -> {
cb.setSelected(typeFilter.getAccountTypes().contains(type));
});

View File

@ -18,6 +18,7 @@
*/
package org.sleuthkit.autopsy.communications;
import com.google.common.collect.ImmutableSet;
import com.google.common.eventbus.Subscribe;
import java.util.HashSet;
import java.util.List;
@ -25,6 +26,8 @@ import java.util.Set;
import org.sleuthkit.autopsy.coreutils.History;
import org.sleuthkit.datamodel.CommunicationsFilter;
import org.sleuthkit.datamodel.CommunicationsFilter.SubFilter;
import static org.sleuthkit.datamodel.Relationship.Type.CALL_LOG;
import static org.sleuthkit.datamodel.Relationship.Type.MESSAGE;
/**
* Manages the state history for the Communications window. History is currently
@ -133,7 +136,7 @@ final class StateManager {
final class CommunicationsState{
private final List<SubFilter> communcationFilters;
private final Set<AccountDeviceInstanceKey> pinnedList;
private double zoomValue = -1;
private final double zoomValue;
/**
* Stores all the properties of the current state of the Communications
@ -176,6 +179,22 @@ final class StateManager {
return communcationFilters;
}
/**
* Return a new CommunicationsFilter object based on the list of
* SubFilters
*
* @return CommunicationsFilter
*/
public CommunicationsFilter getCommunicationsFilter() {
CommunicationsFilter newFilters = new CommunicationsFilter();
newFilters.addAndFilter(new CommunicationsFilter.RelationshipTypeFilter(ImmutableSet.of(CALL_LOG, MESSAGE)));
communcationFilters.forEach(filter -> {
newFilters.addAndFilter(filter);
});
return newFilters;
}
/**
* Return the value for the % zoom.
*

View File

@ -663,15 +663,6 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider
get();
} catch (InterruptedException | ExecutionException ex) {
logger.log(Level.WARNING, "CVT graph layout failed.", ex);
String message = (lockedVertexModel.isEmpty())
? Bundle.VisualizationPanel_layoutFail_text(layout.getDisplayName())
: Bundle.VisualizationPanel_layoutFailWithLockedVertices_text(layout.getDisplayName());
Platform.runLater(()
-> Notifications.create().owner(notificationsJFXPanel.getScene().getWindow())
.text(message)
.showWarning()
);
}
}
}.execute();
@ -718,12 +709,7 @@ final public class VisualizationPanel extends JPanel implements Lookup.Provider
pinnedAccountModel.clear();
}
currentFilter = new CommunicationsFilter();
currentFilter.addAndFilter(new CommunicationsFilter.RelationshipTypeFilter(
ImmutableSet.of(CALL_LOG, MESSAGE)));
newState.getCommunicationsFilters().forEach(filter -> {
currentFilter.addAndFilter(filter);
});
currentFilter = newState.getCommunicationsFilter();
rebuildGraph();
// Updates the display

View File

@ -32,7 +32,7 @@ import org.sleuthkit.autopsy.timeline.TimeLineController;
//TODO: This and the corresponding imageanalyzer action are identical except for the type of the controller... abstract something! -jm
public class Back extends Action {
private static final Image BACK_IMAGE = new Image("/org/sleuthkit/autopsy/timeline/images/arrow-180.png", 16, 16, true, true, true); // NON-NLS
private static final Image BACK_IMAGE = new Image("/org/sleuthkit/autopsy/images/resultset_previous.png", 16, 16, true, true, true); // NON-NLS
private final TimeLineController controller;

View File

@ -32,7 +32,7 @@ import org.sleuthkit.autopsy.timeline.TimeLineController;
//TODO: This and the corresponding imageanalyzer action are identical except for the type of the controller... abstract something! -jm
public class Forward extends Action {
private static final Image FORWARD_IMAGE = new Image("/org/sleuthkit/autopsy/timeline/images/arrow.png", 16, 16, true, true, true); // NON-NLS
private static final Image FORWARD_IMAGE = new Image("/org/sleuthkit/autopsy/images/resultset_next.png", 16, 16, true, true, true); // NON-NLS
private final TimeLineController controller;