cleanup filtersPane, clear devices on case change. Devices unselected by default to simplify adding new ones and maintaining results

This commit is contained in:
millmanorama 2017-11-17 09:42:04 +01:00
parent c3b00d7f3d
commit f8e5ea0bbb
4 changed files with 39 additions and 67 deletions

View File

@ -17,10 +17,10 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="filtersPane" min="-2" pref="251" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="splitPane" pref="1344" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Component id="filtersPane" min="-2" pref="250" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="splitPane" pref="1334" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
@ -28,7 +28,7 @@
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="filtersPane" max="32767" attributes="0"/>
<Component id="splitPane" max="32767" attributes="0"/>
@ -95,12 +95,12 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="602" max="32767" attributes="0"/>
<EmptySpace min="0" pref="591" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="718" max="32767" attributes="0"/>
<EmptySpace min="0" pref="725" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>

View File

@ -77,11 +77,11 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 602, Short.MAX_VALUE)
.addGap(0, 591, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 718, Short.MAX_VALUE)
.addGap(0, 725, Short.MAX_VALUE)
);
BrowseVisualizeTabPane.addTab(org.openide.util.NbBundle.getMessage(CVTTopComponent.class, "CVTTopComponent.TabConstraints.tabTitle"), new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/emblem-web.png")), jPanel1); // NOI18N
@ -95,16 +95,16 @@ public final class CVTTopComponent extends TopComponent implements ExplorerManag
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(filtersPane, javax.swing.GroupLayout.PREFERRED_SIZE, 251, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(splitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1344, Short.MAX_VALUE)
.addGap(6, 6, 6)
.addComponent(filtersPane, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(splitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1334, Short.MAX_VALUE)
.addGap(0, 0, 0))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGap(6, 6, 6)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(filtersPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(splitPane))

View File

@ -1,33 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JList" name="jList1">
<Properties>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
<StringArray count="5">
<StringItem index="0" value="Item 1"/>
<StringItem index="1" value="Item 2"/>
<StringItem index="2" value="Item 3"/>
<StringItem index="3" value="Item 4"/>
<StringItem index="4" value="Item 5"/>
</StringArray>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
</SubComponents>
</Container>
</NonVisualComponents>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>

View File

@ -22,6 +22,7 @@ import java.beans.PropertyChangeListener;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.format.TextStyle;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
@ -75,8 +76,6 @@ final public class FiltersPanel extends javax.swing.JPanel {
setPreferredTimeZone();
updateFilters();
setAllAccountTypesSelected(true);
setAllDevicesSelected(true);
UserPreferences.addChangeListener(preferenceChangeEvent -> {
if (preferenceChangeEvent.getKey().equals(UserPreferences.DISPLAY_TIMES_IN_LOCAL_TIME)) {
setPreferredTimeZone();
@ -91,7 +90,6 @@ final public class FiltersPanel extends javax.swing.JPanel {
applyFiltersButton.setIcon(new ImageIcon("org/sleuthkit/autopsy/communications/images/reload.png"));
} else if (eventType.equals(COMPLETED.toString())) {
} else if (eventType.equals(CANCELLED.toString())) {
} else if (eventType.equals(CURRENT_CASE.toString())) {
}
};
@ -106,7 +104,7 @@ final public class FiltersPanel extends javax.swing.JPanel {
if (em != null) {
applyFilters();
}
}
}
private void setPreferredTimeZone() {
dateRangeLabel.setText("Date Range ( " + Utils.getUserPreferredZoneId().getDisplayName(TextStyle.NARROW, Locale.getDefault()) + "):");
@ -125,8 +123,17 @@ final public class FiltersPanel extends javax.swing.JPanel {
* till this FiltersPanel is actaully added to a parent.
*/
em = ExplorerManager.find(this);
IngestManager.getInstance().removeIngestModuleEventListener(ingestListener);
IngestManager.getInstance().addIngestModuleEventListener(ingestListener);
Case.addEventTypeSubscriber(EnumSet.of(CURRENT_CASE), evt -> {
devicesMap.clear();
devicesPane.removeAll();
});
}
@Override
public void removeNotify() {
super.removeNotify();
IngestManager.getInstance().removeIngestModuleEventListener(ingestListener);
}
/**
@ -152,7 +159,7 @@ final public class FiltersPanel extends javax.swing.JPanel {
+ FiltersPanel.class.getResource("/org/sleuthkit/autopsy/communications/images/"
+ Utils.getIconFileName(type))
+ "\"/></td><td width=" + 3 + "><td>" + type.getDisplayName() + "</td></tr></table></html>",
false
true
);
accountTypePane.add(jCheckBox);
return jCheckBox;
@ -167,14 +174,16 @@ final public class FiltersPanel extends javax.swing.JPanel {
*/
private void updateDeviceFilter() {
try {
final List<DataSource> dataSources = Case.getCurrentCase().getSleuthkitCase().getDataSources();
dataSources.forEach(
dataSource -> devicesMap.computeIfAbsent(dataSource.getDeviceId(), ds -> {
final JCheckBox jCheckBox = new JCheckBox(dataSource.getDeviceId(), false);
Case.getCurrentCase()
.getSleuthkitCase()
.getDataSources().stream().map(DataSource::getDeviceId)
.forEach(
deviceID -> devicesMap.computeIfAbsent(deviceID, ds -> {
final JCheckBox jCheckBox = new JCheckBox(deviceID, false);
devicesPane.add(jCheckBox);
return jCheckBox;
})
);
}));
} catch (IllegalStateException ex) {
logger.log(Level.WARNING, "Communications Visualization Tool opened with no open case.", ex);
} catch (TskCoreException tskCoreException) {
@ -191,13 +200,6 @@ final public class FiltersPanel extends javax.swing.JPanel {
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jList1.setModel(new javax.swing.AbstractListModel<String>() {
String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" };
public int getSize() { return strings.length; }
public String getElementAt(int i) { return strings[i]; }
});
jScrollPane1.setViewportView(jList1);
applyFiltersButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/communications/images/control-double.png"))); // NOI18N
applyFiltersButton.setText(org.openide.util.NbBundle.getMessage(FiltersPanel.class, "FiltersPanel.applyFiltersButton.text")); // NOI18N
applyFiltersButton.setHorizontalTextPosition(javax.swing.SwingConstants.LEADING);
@ -429,7 +431,6 @@ final public class FiltersPanel extends javax.swing.JPanel {
logger.log(Level.SEVERE, "There was a error loading the accounts.", ex);
}
applyFiltersButton.setText("Apply");
applyFiltersButton.setIcon(new ImageIcon("org/sleuthkit/autopsy/communications/images/control-double.png"));
@ -534,11 +535,9 @@ final public class FiltersPanel extends javax.swing.JPanel {
private final javax.swing.JCheckBox endCheckBox = new javax.swing.JCheckBox();
private final com.github.lgooddatepicker.datepicker.DatePicker endDatePicker = new com.github.lgooddatepicker.datepicker.DatePicker();
private final javax.swing.JLabel filtersTitleLabel = new javax.swing.JLabel();
private final javax.swing.JList<String> jList1 = new javax.swing.JList<>();
private final javax.swing.JPanel jPanel2 = new javax.swing.JPanel();
private final javax.swing.JPanel jPanel3 = new javax.swing.JPanel();
private final javax.swing.JPanel jPanel4 = new javax.swing.JPanel();
private final javax.swing.JScrollPane jScrollPane1 = new javax.swing.JScrollPane();
private final javax.swing.JScrollPane jScrollPane2 = new javax.swing.JScrollPane();
private final javax.swing.JScrollPane jScrollPane3 = new javax.swing.JScrollPane();
private final javax.swing.JCheckBox startCheckBox = new javax.swing.JCheckBox();