diff --git a/Core/src/org/sleuthkit/autopsy/discovery/search/DomainSearch.java b/Core/src/org/sleuthkit/autopsy/discovery/search/DomainSearch.java index c83f14333b..8bcd92705c 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/search/DomainSearch.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/search/DomainSearch.java @@ -186,6 +186,18 @@ public class DomainSearch { return artifactsCache.get(artifactsRequest); } + /** + * Get a list of MiniTimelineResults one for each date any TSK_WEB artifacts + * existed for, which contains a list of artifacts observed on that date. + * + * @param sleuthkitCase The case database for the search. + * @param domain The domain that artifacts are being requested for. + * + * @return The list of MiniTimelineResults + * + * @throws DiscoveryException if unable to get the artifacts or the date + * attributes from an artifact. + */ public List getAllArtifactsForDomain(SleuthkitCase sleuthkitCase, String domain) throws DiscoveryException { List artifacts = new ArrayList<>(); Map> dateMap = new HashMap<>(); @@ -220,11 +232,21 @@ public class DomainSearch { return dateArtifactList; } + /** + * Private helper method to get a date from the artifact. + * + * @param artifact The artifact to get a date from. + * + * @return The date as a string in the form YYYY-MM-DD. + * + * @throws TskCoreException when unable to get the attributes for the + * artifact. + */ private String getDate(BlackboardArtifact artifact) throws TskCoreException { for (BlackboardAttribute attribute : artifact.getAttributes()) { if (attribute.getAttributeType().getTypeName().startsWith("TSK_DATETIME")) { String dateString = attribute.getDisplayString(); - if (dateString.length()>=10){ + if (dateString.length() >= 10) { return dateString.substring(0, 10); } } diff --git a/Core/src/org/sleuthkit/autopsy/discovery/search/MiniTimelineResult.java b/Core/src/org/sleuthkit/autopsy/discovery/search/MiniTimelineResult.java index 7b153f2cca..557c2187d0 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/search/MiniTimelineResult.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/search/MiniTimelineResult.java @@ -56,7 +56,7 @@ public class MiniTimelineResult { /** * Get the number of artifacts observed on the specified date. * - * @return the count + * @return The number of artifacts observed on the specified date. */ public int getCount() { return artifactList.size(); diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/Bundle.properties b/Core/src/org/sleuthkit/autopsy/discovery/ui/Bundle.properties index 409d8b087f..851045c71a 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/Bundle.properties @@ -60,4 +60,3 @@ DomainSummaryPanel.totalVisitsLabel.text= FileDetailsPanel.instancesList.border.title=Instances CookieDetailsPanel.jLabel1.text=Artifact: CookieDetailsPanel.jLabel2.text= -MiniTimelinePanel.mainSplitPane.toolTipText= diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainDetailsPanel.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainDetailsPanel.java index 902c5517ad..b71b5adfd3 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainDetailsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainDetailsPanel.java @@ -123,6 +123,10 @@ final class DomainDetailsPanel extends JPanel { } + /** + * Run the worker which retrieves the list of MiniTimelineResults for the + * mini timeline view to populate. + */ private void runMiniTimelineWorker(MiniTimelinePanel miniTimelinePanel) { if (miniTimelineWorker != null && !miniTimelineWorker.isDone()) { miniTimelineWorker.cancel(true); diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelineArtifactListPanel.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelineArtifactListPanel.java index 0b33eb4ef8..7a07108d9d 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelineArtifactListPanel.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelineArtifactListPanel.java @@ -137,8 +137,11 @@ class MiniTimelineArtifactListPanel extends JPanel { tableModel.fireTableDataChanged(); } + /** + * Initialize the UI components. + */ private void initComponents() { - + //This class is a refactored copy of ArtifactsListPanel so lacks the form however the init method still constructs the proper UI elements. javax.swing.JScrollPane jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); @@ -234,7 +237,7 @@ class MiniTimelineArtifactListPanel extends JPanel { } } } catch (TskCoreException ex) { - logger.log(Level.WARNING, "Unable to get description attribute for artifact id " + artifact.getArtifactID()); + logger.log(Level.WARNING, "Unable to get description attribute for artifact id {0}", artifact.getArtifactID()); } return Bundle.MiniTimelineArtifactListPanel_value_noValue(); } diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelineDateListPanel.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelineDateListPanel.java index f25b95ef38..99455ee967 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelineDateListPanel.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelineDateListPanel.java @@ -36,8 +36,6 @@ class MiniTimelineDateListPanel extends JPanel { private static final long serialVersionUID = 1L; private final DateCountTableModel tableModel = new DateCountTableModel(); - ; - /** * Creates new form DiscoveryTimelineListPanel. */ @@ -92,6 +90,13 @@ class MiniTimelineDateListPanel extends JPanel { } } + /** + * Retrieves the list of BlackboardArtifacts for the selected date in the + * list. + * + * @return The list of BlackboardArtifacts for the selected date in the + * list, or an empty list if a valid selection does not exist. + */ List getArtifactsForSelectedDate() { int selectedIndex = jTable1.getSelectionModel().getLeadSelectionIndex(); if (selectedIndex < jTable1.getSelectionModel().getMinSelectionIndex() || jTable1.getSelectionModel().getMaxSelectionIndex() < 0 || selectedIndex > jTable1.getSelectionModel().getMaxSelectionIndex()) { @@ -123,8 +128,11 @@ class MiniTimelineDateListPanel extends JPanel { tableModel.fireTableDataChanged(); } + /** + * Initialize the UI components. + */ private void initComponents() { - + //This class is a refactored copy of ArtifactsListPanel so lacks the form however the init method still constructs the proper UI elements. javax.swing.JScrollPane jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new javax.swing.JTable(); diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.form b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.form index 71cec059ea..0689e6b316 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.form +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.form @@ -27,9 +27,7 @@ - - - + diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java index 76f612dedb..ee1dc6a4b5 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelinePanel.java @@ -30,6 +30,9 @@ import org.sleuthkit.autopsy.coreutils.ThreadConfined; import org.sleuthkit.autopsy.discovery.search.DiscoveryEventUtils; import org.sleuthkit.datamodel.BlackboardArtifact; +/** + * Panel to display the entire mini timeline feature. + */ class MiniTimelinePanel extends javax.swing.JPanel { private static final long serialVersionUID = 1L; @@ -39,44 +42,45 @@ class MiniTimelinePanel extends javax.swing.JPanel { private DomainArtifactsTabPanel.ArtifactRetrievalStatus status = DomainArtifactsTabPanel.ArtifactRetrievalStatus.UNPOPULATED; private AbstractArtifactDetailsPanel rightPanel = new GeneralPurposeArtifactViewer(); private static final Logger logger = Logger.getLogger(MiniTimelinePanel.class.getName()); - - private final ListSelectionListener artifactListener = new ListSelectionListener() { - @Override - public void valueChanged(ListSelectionEvent event) { - if (!event.getValueIsAdjusting()) { - BlackboardArtifact artifact = artifactListPanel.getSelectedArtifact(); - if (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID() || artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()) { - rightPanel = new ContentViewerDetailsPanel(); - } else { - rightPanel = new GeneralPurposeArtifactViewer(); - } - rightPanel.setArtifact(artifact); - mainSplitPane.setRightComponent(new JScrollPane(rightPanel)); - validate(); - repaint(); - } - } - }; - private final ListSelectionListener dateListener = new ListSelectionListener() { - @Override - public void valueChanged(ListSelectionEvent event) { - if (!event.getValueIsAdjusting()) { - artifactListPanel.removeListSelectionListener(artifactListener); - artifactListPanel.addArtifacts(dateListPanel.getArtifactsForSelectedDate()); - artifactListPanel.addSelectionListener(artifactListener); - artifactListPanel.selectFirst(); - validate(); - repaint(); - } - } - }; + private final ListSelectionListener artifactListener; + private final ListSelectionListener dateListener; /** - * Creates new form MiniTimelinePanel + * Creates new form MiniTimelinePanel. */ @ThreadConfined(type = ThreadConfined.ThreadType.AWT) MiniTimelinePanel() { initComponents(); + artifactListener = new ListSelectionListener() { + @Override + public void valueChanged(ListSelectionEvent event) { + if (!event.getValueIsAdjusting()) { + BlackboardArtifact artifact = artifactListPanel.getSelectedArtifact(); + if (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_CACHE.getTypeID() || artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()) { + rightPanel = new ContentViewerDetailsPanel(); + } else { + rightPanel = new GeneralPurposeArtifactViewer(); + } + rightPanel.setArtifact(artifact); + mainSplitPane.setRightComponent(new JScrollPane(rightPanel)); + validate(); + repaint(); + } + } + }; + dateListener = new ListSelectionListener() { + @Override + public void valueChanged(ListSelectionEvent event) { + if (!event.getValueIsAdjusting()) { + artifactListPanel.removeListSelectionListener(artifactListener); + artifactListPanel.addArtifacts(dateListPanel.getArtifactsForSelectedDate()); + artifactListPanel.addSelectionListener(artifactListener); + artifactListPanel.selectFirst(); + validate(); + repaint(); + } + } + }; dateListPanel.addSelectionListener(dateListener); artifactListPanel.addSelectionListener(artifactListener); leftSplitPane.setLeftComponent(dateListPanel); @@ -110,8 +114,8 @@ class MiniTimelinePanel extends javax.swing.JPanel { /** * Handle the event which indicates the artifacts have been retrieved. * - * @param artifactresultEvent The event which indicates the artifacts have - * been retrieved. + * @param miniTimelineResultEvent The event which indicates the artifacts + * have been retrieved. */ @Subscribe void handleMiniTimelineResultEvent(DiscoveryEventUtils.MiniTimelineResultEvent miniTimelineResultEvent) { @@ -152,7 +156,7 @@ class MiniTimelinePanel extends javax.swing.JPanel { setLayout(new java.awt.BorderLayout()); mainSplitPane.setResizeWeight(0.4); - mainSplitPane.setToolTipText(org.openide.util.NbBundle.getMessage(MiniTimelinePanel.class, "MiniTimelinePanel.mainSplitPane.toolTipText")); // NOI18N + mainSplitPane.setToolTipText(""); mainSplitPane.setMinimumSize(new java.awt.Dimension(0, 0)); mainSplitPane.setPreferredSize(new java.awt.Dimension(0, 0)); diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelineWorker.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelineWorker.java index 218d53b231..8bb994d745 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelineWorker.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/MiniTimelineWorker.java @@ -38,7 +38,7 @@ class MiniTimelineWorker extends SwingWorker, Void> { private final static Logger logger = Logger.getLogger(MiniTimelineWorker.class.getName()); private final String domain; - + /** * Construct a new ArtifactsWorker. *