diff --git a/Core/src/org/sleuthkit/autopsy/discovery/search/DiscoveryEventUtils.java b/Core/src/org/sleuthkit/autopsy/discovery/search/DiscoveryEventUtils.java index e224c02d51..18dd83dfe1 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/search/DiscoveryEventUtils.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/search/DiscoveryEventUtils.java @@ -19,12 +19,14 @@ package org.sleuthkit.autopsy.discovery.search; import com.google.common.eventbus.EventBus; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; import org.sleuthkit.autopsy.discovery.search.DiscoveryKeyUtils.GroupKey; import org.sleuthkit.autopsy.discovery.search.SearchData.Type; import org.sleuthkit.datamodel.AbstractFile; +import org.sleuthkit.datamodel.BlackboardArtifact; /** * Class to handle event bus and events for discovery tool. @@ -88,13 +90,13 @@ public final class DiscoveryEventUtils { //no arg constructor } } - + /** - * Event to signal that any background tasks currently running should - * be cancelled. + * Event to signal that any background tasks currently running should be + * cancelled. */ public static final class CancelBackgroundTasksEvent { - + public CancelBackgroundTasksEvent() { //no-arg constructor } @@ -203,6 +205,39 @@ public final class DiscoveryEventUtils { } + /** + * Event to signal the completion of a search being performed. + */ + public static final class ArtifactListRetrievedEvent { + + private final List listOfArtifacts = new ArrayList<>(); + private final BlackboardArtifact.ARTIFACT_TYPE artifactType; + + /** + * + * @param listOfArtifacts + */ + public ArtifactListRetrievedEvent(BlackboardArtifact.ARTIFACT_TYPE artifactType, List listOfArtifacts) { + if (listOfArtifacts != null) { + this.listOfArtifacts.addAll(listOfArtifacts); + } + this.artifactType = artifactType; + } + + public List getListOfArtifacts() { + return Collections.unmodifiableList(listOfArtifacts); + } + + /** + * Get the type of BlackboardArtifact type of which exist in the list. + * + * @return The BlackboardArtifact type of which exist in the list. + */ + public BlackboardArtifact.ARTIFACT_TYPE getArtifactType() { + return artifactType; + } + } + /** * Event to signal the completion of page retrieval and include the page * contents. diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/AbstractArtifactDetailsPanel.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/AbstractArtifactDetailsPanel.java new file mode 100644 index 0000000000..f1feb975a5 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/AbstractArtifactDetailsPanel.java @@ -0,0 +1,26 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.discovery.ui; + +import javax.swing.JPanel; +import org.sleuthkit.datamodel.BlackboardArtifact; + +/** + * + * @author wschaefer + */ +abstract class AbstractArtifactDetailsPanel extends JPanel { + + private static final long serialVersionUID = 1L; + + /** + * Called to display the contents of the given artifact. + * + * @param artifact the artifact to display. + */ + abstract void setArtifact(BlackboardArtifact artifact); + +} diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/ArtifactsListPanel.form b/Core/src/org/sleuthkit/autopsy/discovery/ui/ArtifactsListPanel.form new file mode 100644 index 0000000000..a5a6f66c1c --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/ArtifactsListPanel.form @@ -0,0 +1,31 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/ArtifactsListPanel.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/ArtifactsListPanel.java new file mode 100644 index 0000000000..4ae027cdc9 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/ArtifactsListPanel.java @@ -0,0 +1,135 @@ +/* + * Autopsy + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.discovery.ui; + +import java.util.ArrayList; +import java.util.List; +import javax.swing.event.ListSelectionListener; +import javax.swing.table.AbstractTableModel; +import org.openide.util.NbBundle; +import org.sleuthkit.datamodel.BlackboardArtifact; + +/** + * + * @author wschaefer + */ +public class ArtifactsListPanel extends javax.swing.JScrollPane { + + private static final long serialVersionUID = 1L; + + /** + * Creates new form ArtifactsListPanel + */ + public ArtifactsListPanel() { + initComponents(); + } + + public void addSelectionListener(ListSelectionListener listener) { + jTable1.getSelectionModel().addListSelectionListener(listener); + } + + public BlackboardArtifact getSelectedArtifact() { + return ((DomainArtifactTableModel) jTable1.getSelectionModel()).getArtifactByRow(jTable1.getSelectionModel().getLeadSelectionIndex()); + } + + public boolean isEmpty() { + return false; + } + + public void addArtifacts(List artifactList) { + jTable1.setModel(new DomainArtifactTableModel(artifactList)); + } + + public void clearArtifacts() { + jTable1.setModel(new DomainArtifactTableModel()); + } + + /** + * 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 + * regenerated by the Form Editor. + */ + // //GEN-BEGIN:initComponents + private void initComponents() { + + jTable1 = new javax.swing.JTable(); + + setLayout(new java.awt.BorderLayout()); + + jTable1.setModel(new DomainArtifactTableModel()); + add(jTable1, java.awt.BorderLayout.PAGE_START); + }// //GEN-END:initComponents + private class DomainArtifactTableModel extends AbstractTableModel { + + private static final long serialVersionUID = 1L; + private final List artifactList = new ArrayList<>(); + + DomainArtifactTableModel(){ + //No arg constructor to create empty model + } + + DomainArtifactTableModel(List artifactList) { + this.artifactList.addAll(artifactList); + } + + @Override + public int getRowCount() { + return artifactList.size(); + } + + @Override + public int getColumnCount() { + return 2; + } + + public BlackboardArtifact getArtifactByRow(int rowIndex) { + return artifactList.get(rowIndex); + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + switch (columnIndex) { + case 0: + return getArtifactByRow(rowIndex); + case 1: + return getArtifactByRow(rowIndex); + default: + return getArtifactByRow(rowIndex); + } + } + + @NbBundle.Messages({"ArtifactsListPanel.urlColumn.name=URL", + "ArtifactsListPanel.dateColumn.name=Date/Time"}) + @Override + public String getColumnName(int column) { + switch (column) { + case 0: + return Bundle.ArtifactsListPanel_urlColumn_name(); + case 1: + return Bundle.ArtifactsListPanel_dateColumn_name(); + default: + return ""; + } + } + } + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JTable jTable1; + // End of variables declaration//GEN-END:variables +} diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/ArtifactsWorker.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/ArtifactsWorker.java new file mode 100644 index 0000000000..d07499583c --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/ArtifactsWorker.java @@ -0,0 +1,72 @@ +/* + * Autopsy + * + * Copyright 2019-2020 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.discovery.ui; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.ExecutionException; +import java.util.logging.Level; +import static javax.swing.JComponent.TOOL_TIP_TEXT_KEY; +import javax.swing.SwingWorker; +import org.apache.commons.lang3.StringUtils; +import org.openide.util.Exceptions; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException; +import org.sleuthkit.autopsy.casemodule.Case; +import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository; +import org.sleuthkit.autopsy.discovery.search.DiscoveryEventUtils; +import org.sleuthkit.autopsy.discovery.search.DomainSearch; +import org.sleuthkit.autopsy.discovery.search.DomainSearchArtifactsRequest; +import org.sleuthkit.datamodel.BlackboardArtifact; + +/** + * + * @author wschaefer + */ +public class ArtifactsWorker extends SwingWorker, Void> { + + private final BlackboardArtifact.ARTIFACT_TYPE artifactType = null; + private final static Logger logger = Logger.getLogger(ArtifactsWorker.class.getName()); + private final String domain = null; + + @Override + protected List doInBackground() throws Exception { + if (artifactType != null && !StringUtils.isBlank(domain)) { + DomainSearch domainSearch = new DomainSearch(); + return domainSearch.getArtifacts(new DomainSearchArtifactsRequest(Case.getCurrentCase().getSleuthkitCase(), domain, artifactType)); + } + return new ArrayList<>(); + } + + @Override + protected void done() { + List listOfArtifacts = new ArrayList<>(); + if (!isCancelled()) { + try { + listOfArtifacts.addAll(get()); + } catch (InterruptedException | ExecutionException ex) { + logger.log(Level.SEVERE, "Exception while trying to get list of artifacts for Domain details for artifact type: " + + artifactType.getDisplayName() + " and domain: " + domain, ex); + } + } + DiscoveryEventUtils.getDiscoveryEventBus().post(new DiscoveryEventUtils.ArtifactListRetrievedEvent(artifactType, listOfArtifacts)); + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/Bundle.properties b/Core/src/org/sleuthkit/autopsy/discovery/ui/Bundle.properties index 5fc4ff56e6..851045c71a 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/Bundle.properties @@ -51,10 +51,12 @@ HashSetFilterPanel.hashSetCheckbox.text=Hash Set: PastOccurrencesFilterPanel.pastOccurrencesCheckbox.text=Past Occurrences: DocumentFilterPanel.documentsFiltersSplitPane.border.title=Step 2: Filter which documents to show ObjectDetectedFilterPanel.text=Object Detected: -DetailsPanel.instancesList.border.title=Instances DateFilterPanel.mostRecentRadioButton.text=Only last: DateFilterPanel.dateFilterCheckBox.text=Date Filter: DomainSummaryPanel.activityLabel.text= DomainSummaryPanel.pagesLabel.text= DomainSummaryPanel.filesDownloadedLabel.text= DomainSummaryPanel.totalVisitsLabel.text= +FileDetailsPanel.instancesList.border.title=Instances +CookieDetailsPanel.jLabel1.text=Artifact: +CookieDetailsPanel.jLabel2.text= diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/discovery/ui/Bundle.properties-MERGED index 7c2c5e6757..a35e8113e2 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/Bundle.properties-MERGED @@ -133,6 +133,8 @@ DomainSummaryPanel.activityLabel.text= DomainSummaryPanel.pagesLabel.text= DomainSummaryPanel.filesDownloadedLabel.text= DomainSummaryPanel.totalVisitsLabel.text= +CookiesDetailsPanel.jLabel1.text=Artifact: +CookiesDetailsPanel.jLabel2.text= VideoThumbnailPanel.bytes.text=bytes VideoThumbnailPanel.deleted.text=All instances of file are deleted. VideoThumbnailPanel.gigaBytes.text=GB diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/CookieDetailsPanel.form b/Core/src/org/sleuthkit/autopsy/discovery/ui/CookieDetailsPanel.form new file mode 100644 index 0000000000..037c904fe5 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/CookieDetailsPanel.form @@ -0,0 +1,66 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/CookieDetailsPanel.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/CookieDetailsPanel.java new file mode 100644 index 0000000000..cf382d1795 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/CookieDetailsPanel.java @@ -0,0 +1,119 @@ +/* + * Autopsy + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.discovery.ui; + +import java.awt.Component; +import org.openide.util.lookup.ServiceProvider; +import org.sleuthkit.autopsy.contentviewers.artifactviewers.ArtifactContentViewer; +import org.sleuthkit.datamodel.BlackboardArtifact; + +/** + * + * @author wschaefer + */ +@ServiceProvider(service = ArtifactContentViewer.class) +public class CookieDetailsPanel extends AbstractArtifactDetailsPanel implements ArtifactContentViewer { + + private static final long serialVersionUID = 1L; + private BlackboardArtifact artifact; + + /** + * Creates new form CookiesDetailsPanel + */ + public CookieDetailsPanel() { + initComponents(); + } + + + /** + * 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 + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + jLabel1 = new javax.swing.JLabel(); + jLabel2 = new javax.swing.JLabel(); + + org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(CookieDetailsPanel.class, "CookieDetailsPanel.jLabel1.text")); // NOI18N + + org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(CookieDetailsPanel.class, "CookieDetailsPanel.jLabel2.text")); // NOI18N + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(120, 120, 120) + .addComponent(jLabel1) + .addContainerGap(234, Short.MAX_VALUE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(jLabel2) + .addGap(0, 0, Short.MAX_VALUE))) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addContainerGap(143, Short.MAX_VALUE) + .addComponent(jLabel1) + .addGap(141, 141, 141)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(jLabel2) + .addGap(0, 0, Short.MAX_VALUE))) + ); + }// //GEN-END:initComponents + + @Override + public void setArtifact(BlackboardArtifact artifact) { + this.artifact = artifact; + if (this.artifact == null) { + resetComponent(); + return; + } + jLabel2.setText(artifact.getDisplayName()); + + } + + private void resetComponent() { + jLabel2.setText(""); + } + + @Override + public Component getComponent() { + return this; + } + + @Override + public boolean isSupported(BlackboardArtifact artifact) { + return (artifact != null) + && (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID()); + } + + + // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JLabel jLabel1; + private javax.swing.JLabel jLabel2; + // End of variables declaration//GEN-END:variables +} diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/DiscoveryTopComponent.form b/Core/src/org/sleuthkit/autopsy/discovery/ui/DiscoveryTopComponent.form index 54630599ec..2c828a28bc 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/DiscoveryTopComponent.form +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/DiscoveryTopComponent.form @@ -1,6 +1,6 @@ -
+ @@ -50,6 +50,7 @@ + diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/DiscoveryTopComponent.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/DiscoveryTopComponent.java index 03a271dcdd..628b706e11 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/DiscoveryTopComponent.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/DiscoveryTopComponent.java @@ -55,7 +55,6 @@ public final class DiscoveryTopComponent extends TopComponent { private static final int ANIMATION_INCREMENT = 30; private volatile static int resultsAreaSize = 250; private final GroupListPanel groupListPanel; - private final DetailsPanel detailsPanel; private final ResultsPanel resultsPanel; private Type searchType; private int dividerLocation = -1; @@ -70,10 +69,7 @@ public final class DiscoveryTopComponent extends TopComponent { setName(Bundle.DiscoveryTopComponent_name()); groupListPanel = new GroupListPanel(); resultsPanel = new ResultsPanel(); - detailsPanel = new DetailsPanel(); mainSplitPane.setLeftComponent(groupListPanel); - rightSplitPane.setTopComponent(resultsPanel); - rightSplitPane.setBottomComponent(detailsPanel); //set color of divider rightSplitPane.setUI(new BasicSplitPaneUI() { @Override @@ -141,7 +137,6 @@ public final class DiscoveryTopComponent extends TopComponent { DiscoveryEventUtils.getDiscoveryEventBus().register(this); DiscoveryEventUtils.getDiscoveryEventBus().register(resultsPanel); DiscoveryEventUtils.getDiscoveryEventBus().register(groupListPanel); - DiscoveryEventUtils.getDiscoveryEventBus().register(detailsPanel); } @Override @@ -152,7 +147,10 @@ public final class DiscoveryTopComponent extends TopComponent { DiscoveryEventUtils.getDiscoveryEventBus().unregister(this); DiscoveryEventUtils.getDiscoveryEventBus().unregister(groupListPanel); DiscoveryEventUtils.getDiscoveryEventBus().unregister(resultsPanel); - DiscoveryEventUtils.getDiscoveryEventBus().unregister(detailsPanel); + DiscoveryEventUtils.getDiscoveryEventBus().unregister(rightSplitPane.getBottomComponent()); + setDetailsVisible(false); + rightSplitPane.setBottomComponent(null); + super.componentClosed(); } @@ -183,6 +181,9 @@ public final class DiscoveryTopComponent extends TopComponent { rightSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT); rightSplitPane.setResizeWeight(1.0); rightSplitPane.setPreferredSize(new java.awt.Dimension(800, 700)); + + setDetailsVisible(false); + mainSplitPane.setRightComponent(rightSplitPane); add(mainSplitPane, java.awt.BorderLayout.CENTER); @@ -293,8 +294,11 @@ public final class DiscoveryTopComponent extends TopComponent { progressMessageTextArea.setForeground(Color.red); searchType = searchStartedEvent.getType(); progressMessageTextArea.setText(Bundle.DiscoveryTopComponent_searchInProgress_text(searchType.name())); - rightSplitPane.getComponent(1).setVisible(searchStartedEvent.getType() != DOMAIN); - rightSplitPane.getComponent(2).setVisible(searchStartedEvent.getType() != DOMAIN); + } + + private void setDetailsVisible(boolean isVisible) { + rightSplitPane.getComponent(1).setVisible(isVisible); + rightSplitPane.getComponent(2).setVisible(isVisible); } /** @@ -319,7 +323,12 @@ public final class DiscoveryTopComponent extends TopComponent { if (!searchCompleteEvent.getFilters().isEmpty()) { descriptionText += Bundle.DiscoveryTopComponent_additionalFilters_text(); } + rightSplitPane.setBottomComponent(new DomainDetailsPanel()); + } else { + rightSplitPane.setBottomComponent(new FileDetailsPanel()); } + setDetailsVisible(true); + DiscoveryEventUtils.getDiscoveryEventBus().register(rightSplitPane.getBottomComponent()); descriptionText += searchCompleteEvent.getFilters().stream().map(AbstractFilter::getDesc).collect(Collectors.joining("; ")); progressMessageTextArea.setText(Bundle.DiscoveryTopComponent_searchComplete_text(descriptionText)); progressMessageTextArea.setCaretPosition(0); diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainArtifactsTabPanel.form b/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainArtifactsTabPanel.form new file mode 100644 index 0000000000..4f9abb50dc --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainArtifactsTabPanel.form @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainArtifactsTabPanel.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainArtifactsTabPanel.java new file mode 100644 index 0000000000..c9c1282329 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainArtifactsTabPanel.java @@ -0,0 +1,112 @@ +/* + * Autopsy + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.discovery.ui; + +import com.google.common.eventbus.Subscribe; +import javax.swing.JPanel; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import org.sleuthkit.autopsy.contentviewers.artifactviewers.ArtifactContentViewer; +import org.sleuthkit.autopsy.discovery.search.DiscoveryEventUtils; +import org.sleuthkit.datamodel.BlackboardArtifact; + +/** + * + * @author wschaefer + */ +public final class DomainArtifactsTabPanel extends javax.swing.JSplitPane { + + private static final long serialVersionUID = 1L; + private final ArtifactsListPanel listPanel = new ArtifactsListPanel(); + private final BlackboardArtifact.ARTIFACT_TYPE artifactType; + private AbstractArtifactDetailsPanel rightPanel = null; + + /** + * Creates new form CookiesPanel + */ + public DomainArtifactsTabPanel(BlackboardArtifact.ARTIFACT_TYPE artifactType) { + initComponents(); + this.artifactType = artifactType; + this.setLeftComponent(listPanel); + setRightComponent(); + update(); + } + + private void setRightComponent() { + + switch (artifactType) { + case TSK_WEB_COOKIE: + rightPanel = new CookieDetailsPanel(); + break; + default: + break; + } + if (rightPanel == null) { + getComponent(1).setVisible(false); + getComponent(2).setVisible(false); + } else { + this.setRightComponent(rightPanel); + getComponent(1).setVisible(true); + getComponent(2).setVisible(true); + } + } + + private void update() { + this.setEnabled(!this.listPanel.isEmpty()); + } + + @Subscribe + void handleArtifactListRetrievedEvent(DiscoveryEventUtils.ArtifactListRetrievedEvent artifactListEvent) { + if (artifactType == artifactListEvent.getArtifactType()) { + listPanel.addArtifacts(artifactListEvent.getListOfArtifacts()); + listPanel.addSelectionListener(new ListSelectionListener() { + public void valueChanged(ListSelectionEvent event) { + if (!event.getValueIsAdjusting()){ + rightPanel.setArtifact(listPanel.getSelectedArtifact()); + } + } + }); + } + } + + /** + * 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 + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); + this.setLayout(layout); + layout.setHorizontalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 400, Short.MAX_VALUE) + ); + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGap(0, 300, Short.MAX_VALUE) + ); + }// //GEN-END:initComponents + + + // Variables declaration - do not modify//GEN-BEGIN:variables + // End of variables declaration//GEN-END:variables +} diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainDetailsPanel.form b/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainDetailsPanel.form new file mode 100644 index 0000000000..b6bc3eb975 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainDetailsPanel.form @@ -0,0 +1,17 @@ + + +
+ + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainDetailsPanel.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainDetailsPanel.java new file mode 100644 index 0000000000..2a6fdfc4b0 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/DomainDetailsPanel.java @@ -0,0 +1,61 @@ +/* + * Autopsy + * + * Copyright 2020 Basis Technology Corp. + * Contact: carrier sleuthkit org + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.discovery.ui; + +import org.sleuthkit.datamodel.BlackboardArtifact; + +/** + * + * @author wschaefer + */ +final class DomainDetailsPanel extends javax.swing.JTabbedPane { + + private static final long serialVersionUID = 1L; + + /** + * Creates new form ArtifactDetailsPanel + */ + DomainDetailsPanel() { + initComponents(); + addArtifactTabs(); + } + + private void addArtifactTabs() { + DomainArtifactsTabPanel cookiesPanel = new DomainArtifactsTabPanel(BlackboardArtifact.ARTIFACT_TYPE.TSK_WEB_COOKIE); + cookiesPanel.setRightComponent(new CookieDetailsPanel()); + add(cookiesPanel); + } + + + /** + * 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 + * regenerated by the Form Editor. + */ + @SuppressWarnings("unchecked") + // //GEN-BEGIN:initComponents + private void initComponents() { + + setLayout(new java.awt.BorderLayout()); + }// //GEN-END:initComponents + + + // Variables declaration - do not modify//GEN-BEGIN:variables + // End of variables declaration//GEN-END:variables +} diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/DetailsPanel.form b/Core/src/org/sleuthkit/autopsy/discovery/ui/FileDetailsPanel.form similarity index 96% rename from Core/src/org/sleuthkit/autopsy/discovery/ui/DetailsPanel.form rename to Core/src/org/sleuthkit/autopsy/discovery/ui/FileDetailsPanel.form index bd3d8c5af9..1cac146780 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/DetailsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/FileDetailsPanel.form @@ -105,8 +105,8 @@ - - + + diff --git a/Core/src/org/sleuthkit/autopsy/discovery/ui/DetailsPanel.java b/Core/src/org/sleuthkit/autopsy/discovery/ui/FileDetailsPanel.java similarity index 98% rename from Core/src/org/sleuthkit/autopsy/discovery/ui/DetailsPanel.java rename to Core/src/org/sleuthkit/autopsy/discovery/ui/FileDetailsPanel.java index e302669278..b38ff7aaa4 100644 --- a/Core/src/org/sleuthkit/autopsy/discovery/ui/DetailsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/discovery/ui/FileDetailsPanel.java @@ -48,7 +48,7 @@ import org.sleuthkit.datamodel.TskCoreException; /** * Panel to display the details of the selected result. */ -final class DetailsPanel extends javax.swing.JPanel { +final class FileDetailsPanel extends javax.swing.JPanel { private static final long serialVersionUID = 1L; @@ -59,7 +59,7 @@ final class DetailsPanel extends javax.swing.JPanel { /** * Creates new form DetailsPanel. */ - DetailsPanel() { + FileDetailsPanel() { initComponents(); dataContentPanel = DataContentPanel.createInstance(); detailsSplitPane.setBottomComponent(dataContentPanel); @@ -186,7 +186,7 @@ final class DetailsPanel extends javax.swing.JPanel { instancesScrollPane.setPreferredSize(new java.awt.Dimension(775, 60)); - instancesList.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(DetailsPanel.class, "DetailsPanel.instancesList.border.title"))); // NOI18N + instancesList.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(FileDetailsPanel.class, "FileDetailsPanel.instancesList.border.title"))); // NOI18N instancesList.setModel(instancesListModel); instancesList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); instancesList.setCellRenderer(new InstancesCellRenderer());