mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
Deleted old ContactArtifactViewer and renamed ContactArtifactViewerNew to ContactArtifactViewer.
This commit is contained in:
parent
48f0fbee55
commit
d9ff5d9f68
@ -93,6 +93,10 @@ public class CallLogArtifactViewer extends javax.swing.JPanel implements Artifac
|
||||
public void setArtifact(BlackboardArtifact artifact) {
|
||||
resetComponent();
|
||||
|
||||
if (artifact == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
CallLogViewData callLogViewData = null;
|
||||
try {
|
||||
callLogViewData = getCallLogViewData(artifact);
|
||||
@ -458,7 +462,9 @@ public class CallLogArtifactViewer extends javax.swing.JPanel implements Artifac
|
||||
|
||||
@Override
|
||||
public boolean isSupported(BlackboardArtifact artifact) {
|
||||
return artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_CALLLOG.getTypeID();
|
||||
|
||||
return (artifact != null)
|
||||
&& (artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_CALLLOG.getTypeID());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Form version="1.4" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="toolTipText" type="java.lang.String" value="" noResource="true"/>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
@ -11,217 +14,8 @@
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,-57,0,0,2,31"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="namePanel">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="1" gridWidth="5" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="19" insetsBottom="0" insetsRight="0" anchor="18" weightX="1.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
|
||||
<SubComponents>
|
||||
<Component class="javax.swing.JLabel" name="contactNameLabel">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
|
||||
<FontInfo relative="true">
|
||||
<Font bold="true" component="contactNameLabel" italic="true" property="font" relativeSize="true" size="6"/>
|
||||
</FontInfo>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/Bundle.properties" key="ContactArtifactViewer.contactNameLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="2" ipadX="111" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="18" weightX="1.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
<Component class="javax.swing.JLabel" name="phonesLabel">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
|
||||
<FontInfo relative="true">
|
||||
<Font bold="true" component="phonesLabel" property="font" relativeSize="true" size="2"/>
|
||||
</FontInfo>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/Bundle.properties" key="ContactArtifactViewer.phonesLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="2" gridWidth="3" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="19" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="phoneNumbersPanel">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="3" gridWidth="4" gridHeight="1" fill="3" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="19" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
|
||||
</Container>
|
||||
<Component class="javax.swing.JLabel" name="emailsLabel">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
|
||||
<FontInfo relative="true">
|
||||
<Font bold="true" component="emailsLabel" property="font" relativeSize="true" size="2"/>
|
||||
</FontInfo>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/Bundle.properties" key="ContactArtifactViewer.emailsLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="4" gridWidth="2" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="19" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="emailsPanel">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="5" gridWidth="4" gridHeight="1" fill="3" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="19" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
|
||||
</Container>
|
||||
<Component class="javax.swing.JLabel" name="othersLabel">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
|
||||
<FontInfo relative="true">
|
||||
<Font bold="true" component="othersLabel" property="font" relativeSize="true" size="2"/>
|
||||
</FontInfo>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/Bundle.properties" key="ContactArtifactViewer.othersLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="6" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="19" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="otherAttrsPanel">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="7" gridWidth="4" gridHeight="1" fill="3" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="19" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
|
||||
</Container>
|
||||
<Component class="javax.swing.Box$Filler" name="interPanelfiller">
|
||||
<Properties>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[0, 32767]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.VerticalGlue"/>
|
||||
</AuxValues>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="8" gridWidth="1" gridHeight="2" fill="3" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.1"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="personasLabel">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
|
||||
<FontInfo relative="true">
|
||||
<Font bold="true" component="personasLabel" property="font" relativeSize="true" size="2"/>
|
||||
</FontInfo>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/Bundle.properties" key="ContactArtifactViewer.personasLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[90, 19]"/>
|
||||
</Property>
|
||||
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[90, 19]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[90, 19]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="9" gridWidth="3" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="19" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Container class="javax.swing.JPanel" name="personasPanel">
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="10" gridWidth="4" gridHeight="1" fill="3" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="19" insetsBottom="0" insetsRight="0" anchor="18" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
|
||||
</Container>
|
||||
<Component class="javax.swing.Box$Filler" name="bottomFiller">
|
||||
<Properties>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[0, 32767]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.VerticalGlue"/>
|
||||
</AuxValues>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="11" gridWidth="4" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="1.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.Box$Filler" name="rightFiller">
|
||||
<Properties>
|
||||
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[32767, 0]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="classDetails" type="java.lang.String" value="Box.Filler.HorizontalGlue"/>
|
||||
</AuxValues>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="4" gridY="3" gridWidth="1" gridHeight="8" fill="1" ipadX="2" ipadY="0" insetsTop="0" insetsLeft="0" insetsBottom="0" insetsRight="0" anchor="10" weightX="1.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="contactImage">
|
||||
<Properties>
|
||||
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
|
||||
<Image iconType="3" name="/org/sleuthkit/autopsy/images/defaultContact.png"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||
<ResourceString bundle="org/sleuthkit/autopsy/contentviewers/Bundle.properties" key="ContactArtifactViewer.contactImage.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<Constraints>
|
||||
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
|
||||
<GridBagConstraints gridX="0" gridY="0" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="6" insetsLeft="19" insetsBottom="0" insetsRight="0" anchor="10" weightX="0.0" weightY="0.0"/>
|
||||
</Constraint>
|
||||
</Constraints>
|
||||
</Component>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,21 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<Form version="1.4" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
|
||||
<Properties>
|
||||
<Property name="toolTipText" type="java.lang.String" value="" noResource="true"/>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
|
||||
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
|
||||
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
|
||||
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
|
||||
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
|
||||
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
|
||||
</AuxValues>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
|
||||
</Form>
|
@ -1,863 +0,0 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2020 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> 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.contentviewers;
|
||||
|
||||
import java.awt.Component;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CancellationException;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.SwingWorker;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.lookup.ServiceProvider;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoAccount;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.Persona;
|
||||
import org.sleuthkit.autopsy.centralrepository.datamodel.PersonaAccount;
|
||||
import org.sleuthkit.autopsy.centralrepository.persona.PersonaDetailsDialog;
|
||||
import org.sleuthkit.autopsy.centralrepository.persona.PersonaDetailsDialogCallback;
|
||||
import org.sleuthkit.autopsy.centralrepository.persona.PersonaDetailsMode;
|
||||
import org.sleuthkit.autopsy.centralrepository.persona.PersonaDetailsPanel;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
import org.sleuthkit.datamodel.AbstractFile;
|
||||
import org.sleuthkit.datamodel.BlackboardArtifact;
|
||||
import org.sleuthkit.datamodel.BlackboardAttribute;
|
||||
import org.sleuthkit.datamodel.Content;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
|
||||
/**
|
||||
* This class displays the TSK_CONTACT artifact.
|
||||
*/
|
||||
@ServiceProvider(service = ArtifactContentViewer.class)
|
||||
public class ContactArtifactViewerNew extends javax.swing.JPanel implements ArtifactContentViewer {
|
||||
|
||||
private final static Logger logger = Logger.getLogger(ContactArtifactViewer.class.getName());
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
//private final static int LEFT_INSET = 12;
|
||||
private GridBagLayout m_gridBagLayout = new GridBagLayout();
|
||||
private GridBagConstraints m_constraints = new GridBagConstraints();
|
||||
|
||||
private JLabel personaSearchStatusLabel;
|
||||
|
||||
private BlackboardArtifact contactArtifact;
|
||||
private String contactName;
|
||||
private String datasourceName;
|
||||
|
||||
private List<BlackboardAttribute> phoneNumList = new ArrayList<>();
|
||||
private List<BlackboardAttribute> emailList = new ArrayList<>();
|
||||
private List<BlackboardAttribute> nameList = new ArrayList<>();
|
||||
private List<BlackboardAttribute> otherList = new ArrayList<>();
|
||||
private List<BlackboardAttribute> accountAttributesList = new ArrayList<>();
|
||||
|
||||
private final static String DEFAULT_IMAGE_PATH = "/org/sleuthkit/autopsy/images/defaultContact.png";
|
||||
private final ImageIcon defaultImage;
|
||||
|
||||
// A list of unique accounts matching the attributes of the contact artifact.
|
||||
private final List<CentralRepoAccount> contactUniqueAccountsList = new ArrayList<>();
|
||||
|
||||
// A list of all unique personas and their account, found by searching on the
|
||||
// account identifier attributes of the Contact artifact.
|
||||
private final Map<Persona, ArrayList<CentralRepoAccount>> contactUniquePersonasMap = new HashMap<>();
|
||||
|
||||
private ContactPersonaSearcherTask personaSearchTask;
|
||||
|
||||
/**
|
||||
* Creates new form ContactArtifactViewer
|
||||
*/
|
||||
public ContactArtifactViewerNew() {
|
||||
initComponents();
|
||||
|
||||
defaultImage = new ImageIcon(ContactArtifactViewer.class.getResource(DEFAULT_IMAGE_PATH));
|
||||
}
|
||||
|
||||
/**
|
||||
* 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")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
setToolTipText(""); // NOI18N
|
||||
setLayout(new java.awt.GridBagLayout());
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
@Override
|
||||
public void setArtifact(BlackboardArtifact artifact) {
|
||||
// Reset the panel.
|
||||
resetComponent();
|
||||
|
||||
if (artifact == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
extractArtifactData(artifact);
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.SEVERE, String.format("Error getting attributes for artifact (artifact_id=%d, obj_id=%d)", artifact.getArtifactID(), artifact.getObjectID()), ex);
|
||||
return;
|
||||
}
|
||||
|
||||
updateView();
|
||||
|
||||
this.setLayout(this.m_gridBagLayout);
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getComponent() {
|
||||
// Slap a vertical scrollbar on the panel.
|
||||
return new JScrollPane(this, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSupported(BlackboardArtifact artifact) {
|
||||
return artifact.getArtifactTypeID() == BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT.getTypeID();
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts data from the artifact to be displayed in the panel.
|
||||
*
|
||||
* @param artifact Artifact to show.
|
||||
* @throws TskCoreException
|
||||
*/
|
||||
private void extractArtifactData(BlackboardArtifact artifact) throws TskCoreException {
|
||||
|
||||
this.contactArtifact = artifact;
|
||||
|
||||
phoneNumList = new ArrayList<>();
|
||||
emailList = new ArrayList<>();
|
||||
nameList = new ArrayList<>();
|
||||
otherList = new ArrayList<>();
|
||||
accountAttributesList = new ArrayList<>();
|
||||
|
||||
// Get all the attributes and group them by the section panels they go in
|
||||
for (BlackboardAttribute bba : contactArtifact.getAttributes()) {
|
||||
if (bba.getAttributeType().getTypeName().startsWith("TSK_PHONE")) {
|
||||
phoneNumList.add(bba);
|
||||
accountAttributesList.add(bba);
|
||||
} else if (bba.getAttributeType().getTypeName().startsWith("TSK_EMAIL")) {
|
||||
emailList.add(bba);
|
||||
accountAttributesList.add(bba);
|
||||
} else if (bba.getAttributeType().getTypeName().startsWith("TSK_NAME")) {
|
||||
nameList.add(bba);
|
||||
} else {
|
||||
otherList.add(bba);
|
||||
if (bba.getAttributeType().getTypeName().equalsIgnoreCase("TSK_ID")) {
|
||||
accountAttributesList.add(bba);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
datasourceName = contactArtifact.getDataSource().getName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the view with the data extracted from the artifact.
|
||||
*/
|
||||
private void updateView() {
|
||||
|
||||
// Update contact name, image, phone numbers
|
||||
updateContactDetails();
|
||||
|
||||
// update artifact source panel
|
||||
updateSource();
|
||||
|
||||
// show a empty Personas panel and kick off a serch for personas
|
||||
initiatePersonasSearch();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the view with contact's details.
|
||||
*/
|
||||
@NbBundle.Messages({
|
||||
"ContactArtifactViewer_phones_header=Phone",
|
||||
"ContactArtifactViewer_emails_header=Email",
|
||||
"ContactArtifactViewer_others_header=Other",})
|
||||
private void updateContactDetails() {
|
||||
|
||||
// update image and name.
|
||||
updateContactImage(m_gridBagLayout, m_constraints);
|
||||
updateContactName(m_gridBagLayout, m_constraints);
|
||||
|
||||
// update contact attributes sections
|
||||
updateContactMethodSection(phoneNumList, Bundle.ContactArtifactViewer_phones_header(), m_gridBagLayout, m_constraints);
|
||||
updateContactMethodSection(emailList, Bundle.ContactArtifactViewer_emails_header(), m_gridBagLayout, m_constraints);
|
||||
updateContactMethodSection(otherList, Bundle.ContactArtifactViewer_others_header(), m_gridBagLayout, m_constraints);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the contact image in the view.
|
||||
*
|
||||
* @param contactPanelLayout Panel layout.
|
||||
* @param contactPanelConstraints Layout constraints.
|
||||
*
|
||||
*/
|
||||
@NbBundle.Messages({
|
||||
"ContactArtifactViewer.contactImage.text=",})
|
||||
private void updateContactImage(GridBagLayout contactPanelLayout, GridBagConstraints contactPanelConstraints) {
|
||||
// place the image on the top right corner
|
||||
Insets savedInsets = contactPanelConstraints.insets;
|
||||
contactPanelConstraints.gridy = 0;
|
||||
contactPanelConstraints.gridx = 0;
|
||||
contactPanelConstraints.insets = new Insets(0, 0, 0, 0);
|
||||
|
||||
javax.swing.JLabel contactImage = new javax.swing.JLabel();
|
||||
contactImage.setIcon(getImageFromArtifact(contactArtifact));
|
||||
contactImage.setText(Bundle.ContactArtifactViewer_contactImage_text());
|
||||
|
||||
// add image to top left corner of the page.
|
||||
CommunicationArtifactViewerHelper.addComponent(this, contactPanelLayout, contactPanelConstraints, contactImage);
|
||||
CommunicationArtifactViewerHelper.addLineEndGlue(this, contactPanelLayout, contactPanelConstraints);
|
||||
contactPanelConstraints.gridy++;
|
||||
|
||||
contactPanelConstraints.insets = savedInsets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the contact name in the view.
|
||||
*
|
||||
* @param contactPanelLayout Panel layout.
|
||||
* @param contactPanelConstraints Layout constraints.
|
||||
*
|
||||
*/
|
||||
@NbBundle.Messages({
|
||||
"ContactArtifactViewer_contactname_unknown=Unknown",})
|
||||
private void updateContactName(GridBagLayout contactPanelLayout, GridBagConstraints contactPanelConstraints) {
|
||||
|
||||
boolean foundName = false;
|
||||
for (BlackboardAttribute bba : this.nameList) {
|
||||
if (StringUtils.isEmpty(bba.getValueString()) == false) {
|
||||
contactName = bba.getDisplayString();
|
||||
|
||||
CommunicationArtifactViewerHelper.addHeader(this, contactPanelLayout, contactPanelConstraints, contactName);
|
||||
foundName = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (foundName == false) {
|
||||
CommunicationArtifactViewerHelper.addHeader(this, contactPanelLayout, contactPanelConstraints, Bundle.ContactArtifactViewer_contactname_unknown());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the view by displaying the given list of attributes in the given
|
||||
* section panel.
|
||||
*
|
||||
* @param sectionAttributesList List of attributes to display.
|
||||
* @param sectionLabel Section name label.
|
||||
* @param contactPanelLayout Panel layout.
|
||||
* @param contactPanelConstraints Layout constraints.
|
||||
*
|
||||
*/
|
||||
@NbBundle.Messages({
|
||||
"ContactArtifactViewer_plural_suffix=s",})
|
||||
private void updateContactMethodSection(List<BlackboardAttribute> sectionAttributesList, String sectionHeader, GridBagLayout contactPanelLayout, GridBagConstraints contactPanelConstraints) {
|
||||
|
||||
// If there are no attributes for this section, do nothing
|
||||
if (sectionAttributesList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
String sectionHeaderString = sectionHeader;
|
||||
if (sectionAttributesList.size() > 1) {
|
||||
sectionHeaderString = sectionHeaderString.concat(Bundle.ContactArtifactViewer_plural_suffix());
|
||||
}
|
||||
CommunicationArtifactViewerHelper.addHeader(this, contactPanelLayout, contactPanelConstraints, sectionHeaderString);
|
||||
for (BlackboardAttribute bba : sectionAttributesList) {
|
||||
CommunicationArtifactViewerHelper.addKey(this, contactPanelLayout, contactPanelConstraints, bba.getAttributeType().getDisplayName());
|
||||
CommunicationArtifactViewerHelper.addValue(this, contactPanelLayout, contactPanelConstraints, bba.getDisplayString());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the source section.
|
||||
*/
|
||||
@NbBundle.Messages({
|
||||
"ContactArtifactViewer_heading_Source=Source",
|
||||
"ContactArtifactViewer_label_datasource=Data Source",})
|
||||
private void updateSource() {
|
||||
CommunicationArtifactViewerHelper.addHeader(this, this.m_gridBagLayout, m_constraints, Bundle.ContactArtifactViewer_heading_Source());
|
||||
CommunicationArtifactViewerHelper.addKey(this, m_gridBagLayout, m_constraints, Bundle.ContactArtifactViewer_label_datasource());
|
||||
CommunicationArtifactViewerHelper.addValue(this, m_gridBagLayout, m_constraints, datasourceName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Kicks off a search for personas, based in the given list of attributes.
|
||||
*
|
||||
* @param accountAttributesList a list of account identifying attributes.
|
||||
*
|
||||
* @throws CentralRepoException
|
||||
*/
|
||||
@NbBundle.Messages({
|
||||
"ContactArtifactViewer_persona_header=Persona",
|
||||
"ContactArtifactViewer_persona_searching=Searching...",
|
||||
"ContactArtifactViewer_cr_disabled_message=Enable Central Repository to view, create and edit personas.",
|
||||
"ContactArtifactViewer_persona_unknown=Unknown"
|
||||
})
|
||||
|
||||
/**
|
||||
* Initiates a search for Personas for the accounts associated with the
|
||||
* Contact.
|
||||
*
|
||||
*/
|
||||
private void initiatePersonasSearch() {
|
||||
|
||||
// add a section header
|
||||
JLabel personaHeader = CommunicationArtifactViewerHelper.addHeader(this, m_gridBagLayout, m_constraints, Bundle.ContactArtifactViewer_persona_header());
|
||||
|
||||
m_constraints.gridy++;
|
||||
|
||||
// add a status label
|
||||
String personaStatusLabelText = CentralRepository.isEnabled()
|
||||
? Bundle.ContactArtifactViewer_persona_searching()
|
||||
: Bundle.ContactArtifactViewer_persona_unknown();
|
||||
|
||||
this.personaSearchStatusLabel = new javax.swing.JLabel();
|
||||
personaSearchStatusLabel.setText(personaStatusLabelText);
|
||||
|
||||
m_constraints.gridx = 0;
|
||||
|
||||
CommunicationArtifactViewerHelper.addComponent(this, m_gridBagLayout, m_constraints, personaSearchStatusLabel);
|
||||
|
||||
if (CentralRepository.isEnabled()) {
|
||||
// Kick off a background task to serach for personas for the contact
|
||||
personaSearchTask = new ContactPersonaSearcherTask(accountAttributesList);
|
||||
personaSearchTask.execute();
|
||||
} else {
|
||||
personaHeader.setEnabled(false);
|
||||
personaSearchStatusLabel.setEnabled(false);
|
||||
|
||||
CommunicationArtifactViewerHelper.addBlankLine(this, m_gridBagLayout, m_constraints);
|
||||
m_constraints.gridy++;
|
||||
CommunicationArtifactViewerHelper.addMessageRow(this, m_gridBagLayout, m_constraints, Bundle.ContactArtifactViewer_cr_disabled_message());
|
||||
m_constraints.gridy++;
|
||||
|
||||
CommunicationArtifactViewerHelper.addPageEndGlue(this, m_gridBagLayout, this.m_constraints);
|
||||
}
|
||||
|
||||
//m_constraints.insets = savedInsets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the Persona panel with the gathered persona information.
|
||||
*/
|
||||
private void updatePersonas() {
|
||||
|
||||
// Remove the "Searching....." label
|
||||
this.remove(personaSearchStatusLabel);
|
||||
|
||||
m_constraints.gridx = 0;
|
||||
if (contactUniquePersonasMap.isEmpty()) {
|
||||
// No persona found - show a button to create one.
|
||||
showPersona(null, 0, Collections.emptyList(), this.m_gridBagLayout, this.m_constraints);
|
||||
} else {
|
||||
int matchCounter = 0;
|
||||
for (Map.Entry<Persona, ArrayList<CentralRepoAccount>> entry : contactUniquePersonasMap.entrySet()) {
|
||||
List<CentralRepoAccount> missingAccounts = new ArrayList<>();
|
||||
ArrayList<CentralRepoAccount> personaAccounts = entry.getValue();
|
||||
matchCounter++;
|
||||
|
||||
// create a list of accounts missing from this persona
|
||||
for (CentralRepoAccount account : contactUniqueAccountsList) {
|
||||
if (personaAccounts.contains(account) == false) {
|
||||
missingAccounts.add(account);
|
||||
}
|
||||
}
|
||||
|
||||
showPersona(entry.getKey(), matchCounter, missingAccounts, m_gridBagLayout, m_constraints);
|
||||
m_constraints.gridy += 2;
|
||||
}
|
||||
}
|
||||
|
||||
// add veritcal glue at the end
|
||||
CommunicationArtifactViewerHelper.addPageEndGlue(this, m_gridBagLayout, this.m_constraints);
|
||||
|
||||
// redraw the panel
|
||||
this.setLayout(this.m_gridBagLayout);
|
||||
this.revalidate();
|
||||
this.repaint();
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays the given persona in the persona panel.
|
||||
*
|
||||
* @param persona Persona to display.
|
||||
* @param missingAccountsList List of contact accounts this persona may be
|
||||
* missing.
|
||||
* @param gridBagLayout Layout to use.
|
||||
* @param constraints layout constraints.
|
||||
*
|
||||
* @throws CentralRepoException
|
||||
*/
|
||||
@NbBundle.Messages({
|
||||
"ContactArtifactViewer_persona_label=Persona ",
|
||||
"ContactArtifactViewer_persona_no_match=No matches found",
|
||||
"ContactArtifactViewer_persona_button_view=View",
|
||||
"ContactArtifactViewer_persona_button_new=Create",
|
||||
"ContactArtifactViewer_persona_match_num=Match ",
|
||||
"ContactArtifactViewer_missing_account_label=Missing contact account",
|
||||
"ContactArtifactViewer_found_all_accounts_label=All accounts found."
|
||||
})
|
||||
private void showPersona(Persona persona, int matchNumber, List<CentralRepoAccount> missingAccountsList, GridBagLayout gridBagLayout, GridBagConstraints constraints) {
|
||||
|
||||
// save the original insets
|
||||
Insets savedInsets = constraints.insets;
|
||||
|
||||
// some label are indented 2x to appear indented w.r.t column above
|
||||
Insets extraIndentInsets = new java.awt.Insets(0, 2 * CommunicationArtifactViewerHelper.LEFT_INSET, 0, 0);
|
||||
|
||||
// Add a Match X label in col 0.
|
||||
constraints.gridx = 0;
|
||||
javax.swing.JLabel matchNumberLabel = CommunicationArtifactViewerHelper.addKey(this, gridBagLayout, constraints, String.format("%s %d", Bundle.ContactArtifactViewer_persona_match_num(), matchNumber));
|
||||
|
||||
javax.swing.JLabel personaNameLabel = new javax.swing.JLabel();
|
||||
javax.swing.JButton personaButton = new javax.swing.JButton();
|
||||
|
||||
String personaName;
|
||||
String personaButtonText;
|
||||
ActionListener personaButtonListener;
|
||||
if (persona != null) {
|
||||
personaName = persona.getName();
|
||||
personaButtonText = Bundle.ContactArtifactViewer_persona_button_view();
|
||||
personaButtonListener = new ViewPersonaButtonListener(this, persona);
|
||||
} else {
|
||||
matchNumberLabel.setVisible(false);
|
||||
personaName = Bundle.ContactArtifactViewer_persona_no_match();
|
||||
personaButtonText = Bundle.ContactArtifactViewer_persona_button_new();
|
||||
personaButtonListener = new CreatePersonaButtonListener(this, new PersonaUIComponents(personaNameLabel, personaButton));
|
||||
}
|
||||
|
||||
//constraints.gridwidth = 1; // TBD: this may not be needed if we use single panel
|
||||
constraints.gridx++;
|
||||
personaNameLabel.setText(personaName);
|
||||
gridBagLayout.setConstraints(personaNameLabel, constraints);
|
||||
CommunicationArtifactViewerHelper.addComponent(this, gridBagLayout, constraints, personaNameLabel);
|
||||
//personasPanel.add(personaNameLabel);
|
||||
|
||||
// Add a Persona action button
|
||||
constraints.gridx++;
|
||||
//constraints.gridwidth = 1;
|
||||
personaButton.setText(personaButtonText);
|
||||
personaButton.addActionListener(personaButtonListener);
|
||||
|
||||
// Shirnk the button height.
|
||||
personaButton.setMargin(new Insets(0, 5, 0, 5));
|
||||
gridBagLayout.setConstraints(personaButton, constraints);
|
||||
CommunicationArtifactViewerHelper.addComponent(this, gridBagLayout, constraints, personaButton);
|
||||
CommunicationArtifactViewerHelper.addLineEndGlue(this, gridBagLayout, constraints);
|
||||
|
||||
constraints.insets = savedInsets;
|
||||
|
||||
// if we have a persona, indicate if any of the contact's accounts are missing from it.
|
||||
if (persona != null) {
|
||||
if (missingAccountsList.isEmpty()) {
|
||||
constraints.gridy++;
|
||||
constraints.gridx = 1;
|
||||
//constraints.insets = labelInsets;
|
||||
|
||||
javax.swing.JLabel accountsStatus = new javax.swing.JLabel(Bundle.ContactArtifactViewer_found_all_accounts_label());
|
||||
constraints.insets = extraIndentInsets;
|
||||
CommunicationArtifactViewerHelper.addComponent(this, gridBagLayout, constraints, accountsStatus);
|
||||
constraints.insets = savedInsets;
|
||||
|
||||
CommunicationArtifactViewerHelper.addLineEndGlue(this, gridBagLayout, constraints);
|
||||
} else {
|
||||
// show missing accounts.
|
||||
for (CentralRepoAccount missingAccount : missingAccountsList) {
|
||||
//constraints.weightx = 0;
|
||||
constraints.gridx = 0;
|
||||
constraints.gridy++;
|
||||
|
||||
// this needs an extra indent
|
||||
constraints.insets = extraIndentInsets;
|
||||
CommunicationArtifactViewerHelper.addKeyAtCol(this, gridBagLayout, constraints, Bundle.ContactArtifactViewer_missing_account_label(), 1);
|
||||
constraints.insets = savedInsets;
|
||||
|
||||
CommunicationArtifactViewerHelper.addValueAtCol(this, gridBagLayout, constraints, missingAccount.getIdentifier(), 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// restore insets
|
||||
constraints.insets = savedInsets;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets all artifact specific state.
|
||||
*/
|
||||
private void resetComponent() {
|
||||
|
||||
contactArtifact = null;
|
||||
contactName = null;
|
||||
datasourceName = null;
|
||||
|
||||
contactUniqueAccountsList.clear();
|
||||
contactUniquePersonasMap.clear();
|
||||
|
||||
phoneNumList.clear();
|
||||
emailList.clear();
|
||||
nameList.clear();
|
||||
otherList.clear();
|
||||
accountAttributesList.clear();
|
||||
|
||||
if (personaSearchTask != null) {
|
||||
personaSearchTask.cancel(Boolean.TRUE);
|
||||
personaSearchTask = null;
|
||||
}
|
||||
|
||||
// clear the panel
|
||||
this.removeAll();
|
||||
this.setLayout(null);
|
||||
|
||||
m_gridBagLayout = new GridBagLayout();
|
||||
m_constraints = new GridBagConstraints();
|
||||
|
||||
m_constraints.anchor = GridBagConstraints.FIRST_LINE_START;
|
||||
m_constraints.gridy = 0;
|
||||
m_constraints.gridx = 0;
|
||||
m_constraints.weighty = 0.0;
|
||||
m_constraints.weightx = 0.0; // keep components fixed horizontally.
|
||||
m_constraints.insets = new java.awt.Insets(0, CommunicationArtifactViewerHelper.LEFT_INSET, 0, 0);
|
||||
m_constraints.fill = GridBagConstraints.NONE;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets an image from a TSK_CONTACT artifact.
|
||||
*
|
||||
* @param artifact
|
||||
*
|
||||
* @return Image from a TSK_CONTACT artifact or default image if none was
|
||||
* found or the artifact is not a TSK_CONTACT
|
||||
*/
|
||||
private ImageIcon getImageFromArtifact(BlackboardArtifact artifact) {
|
||||
ImageIcon imageIcon = defaultImage;
|
||||
|
||||
if (artifact == null) {
|
||||
return imageIcon;
|
||||
}
|
||||
|
||||
BlackboardArtifact.ARTIFACT_TYPE artifactType = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID());
|
||||
if (artifactType != BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT) {
|
||||
return imageIcon;
|
||||
}
|
||||
|
||||
try {
|
||||
for (Content content : artifact.getChildren()) {
|
||||
if (content instanceof AbstractFile) {
|
||||
AbstractFile file = (AbstractFile) content;
|
||||
|
||||
try {
|
||||
BufferedImage image = ImageIO.read(new File(file.getLocalAbsPath()));
|
||||
imageIcon = new ImageIcon(image);
|
||||
break;
|
||||
} catch (IOException ex) {
|
||||
// ImageIO.read will throw an IOException if file is not an image
|
||||
// therefore we don't need to report this exception just try
|
||||
// the next file.
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (TskCoreException ex) {
|
||||
logger.log(Level.WARNING, String.format("Unable to load image for contact: %d", artifact.getId()), ex);
|
||||
}
|
||||
|
||||
return imageIcon;
|
||||
}
|
||||
|
||||
/**
|
||||
* Thread to search for a personas for all account identifier attributes for
|
||||
* a contact.
|
||||
*/
|
||||
private class ContactPersonaSearcherTask extends SwingWorker<Map<Persona, ArrayList<CentralRepoAccount>>, Void> {
|
||||
|
||||
private final List<BlackboardAttribute> accountAttributesList;
|
||||
private final List<CentralRepoAccount> uniqueAccountsList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Creates a persona searcher task.
|
||||
*
|
||||
* @param accountAttributesList List of attributes that may map to
|
||||
* accounts.
|
||||
*/
|
||||
ContactPersonaSearcherTask(List<BlackboardAttribute> accountAttributesList) {
|
||||
this.accountAttributesList = accountAttributesList;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<Persona, ArrayList<CentralRepoAccount>> doInBackground() throws Exception {
|
||||
|
||||
Map<Persona, ArrayList<CentralRepoAccount>> uniquePersonas = new HashMap<>();
|
||||
|
||||
// TBD: this search needs to change to use the new method CommunicationsManager.getAccountsRelatedToArtifact
|
||||
for (BlackboardAttribute bba : accountAttributesList) {
|
||||
|
||||
// Get account, add to accounts list
|
||||
Collection<Persona> personas;
|
||||
|
||||
Collection<CentralRepoAccount> accountCandidates
|
||||
= CentralRepoAccount.getAccountsWithIdentifier(bba.getValueString());
|
||||
|
||||
if (accountCandidates.isEmpty() == false) {
|
||||
CentralRepoAccount account = accountCandidates.iterator().next();
|
||||
if (uniqueAccountsList.contains(account) == false) {
|
||||
uniqueAccountsList.add(account);
|
||||
}
|
||||
|
||||
// get personas for the account
|
||||
personas = PersonaAccount.getPersonaAccountsForAccount(account.getId())
|
||||
.stream()
|
||||
.map(PersonaAccount::getPersona)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// make a list of unique personas, along with all their accounts
|
||||
for (Persona persona : personas) {
|
||||
if (uniquePersonas.containsKey(persona) == false) {
|
||||
Collection<CentralRepoAccount> accounts = persona.getPersonaAccounts()
|
||||
.stream()
|
||||
.map(PersonaAccount::getAccount)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
ArrayList<CentralRepoAccount> personaAccountsList = new ArrayList<>(accounts);
|
||||
uniquePersonas.put(persona, personaAccountsList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return uniquePersonas;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void done() {
|
||||
|
||||
Map<Persona, ArrayList<CentralRepoAccount>> personasMap;
|
||||
try {
|
||||
personasMap = super.get();
|
||||
|
||||
if (this.isCancelled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
contactUniquePersonasMap.clear();
|
||||
contactUniquePersonasMap.putAll(personasMap);
|
||||
contactUniqueAccountsList.clear();
|
||||
contactUniqueAccountsList.addAll(uniqueAccountsList);
|
||||
|
||||
updatePersonas();
|
||||
|
||||
} catch (CancellationException ex) {
|
||||
logger.log(Level.INFO, "Persona searching was canceled."); //NON-NLS
|
||||
} catch (InterruptedException ex) {
|
||||
logger.log(Level.INFO, "Persona searching was interrupted."); //NON-NLS
|
||||
} catch (ExecutionException ex) {
|
||||
logger.log(Level.SEVERE, "Fatal error during Persona search.", ex); //NON-NLS
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A wrapper class that bags the UI components that need to be updated when
|
||||
* a persona search task or a create dialog returns.
|
||||
*/
|
||||
private class PersonaUIComponents {
|
||||
|
||||
private final JLabel personaNameLabel;
|
||||
private final JButton personaActionButton;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param personaNameLabel Persona name label.
|
||||
* @param personaActionButton Persona action button.
|
||||
*/
|
||||
PersonaUIComponents(JLabel personaNameLabel, JButton personaActionButton) {
|
||||
this.personaNameLabel = personaNameLabel;
|
||||
this.personaActionButton = personaActionButton;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns persona name label.
|
||||
*
|
||||
* @return Persona name label.
|
||||
*/
|
||||
public JLabel getPersonaNameLabel() {
|
||||
return personaNameLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns persona action button.
|
||||
*
|
||||
* @return Persona action button.
|
||||
*/
|
||||
public JButton getPersonaActionButton() {
|
||||
return personaActionButton;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Action listener for Create persona button.
|
||||
*/
|
||||
private class CreatePersonaButtonListener implements ActionListener {
|
||||
|
||||
private final Component parentComponent;
|
||||
private final PersonaUIComponents personaUIComponents;
|
||||
|
||||
/**
|
||||
* Constructs a listener for Create persona button..
|
||||
*
|
||||
* @param personaUIComponents UI components.
|
||||
*/
|
||||
CreatePersonaButtonListener(Component parentComponent, PersonaUIComponents personaUIComponents) {
|
||||
this.personaUIComponents = personaUIComponents;
|
||||
this.parentComponent = parentComponent;
|
||||
}
|
||||
|
||||
@NbBundle.Messages({
|
||||
"ContactArtifactViewer_persona_account_justification=Account found in Contact artifact"
|
||||
})
|
||||
|
||||
@Override
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
// Launch the Persona Create dialog - do not display immediately
|
||||
PersonaDetailsDialog createPersonaDialog = new PersonaDetailsDialog(parentComponent,
|
||||
PersonaDetailsMode.CREATE, null, new PersonaCreateCallbackImpl(parentComponent, personaUIComponents), false);
|
||||
|
||||
// Pre populate the persona name and accounts if we have them.
|
||||
PersonaDetailsPanel personaPanel = createPersonaDialog.getDetailsPanel();
|
||||
|
||||
if (contactName != null) {
|
||||
personaPanel.setPersonaName(contactName);
|
||||
}
|
||||
|
||||
// pass the list of accounts to the dialog
|
||||
for (CentralRepoAccount account : contactUniqueAccountsList) {
|
||||
personaPanel.addAccount(account, Bundle.ContactArtifactViewer_persona_account_justification(), Persona.Confidence.HIGH);
|
||||
}
|
||||
|
||||
// display the dialog now
|
||||
createPersonaDialog.display();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Action listener for View persona button.
|
||||
*/
|
||||
private class ViewPersonaButtonListener implements ActionListener {
|
||||
|
||||
private final Persona persona;
|
||||
private final Component parentComponent;
|
||||
|
||||
/**
|
||||
* Creates listener for View persona button.
|
||||
*
|
||||
* @param persona
|
||||
*/
|
||||
ViewPersonaButtonListener(Component parentComponent, Persona persona) {
|
||||
this.persona = persona;
|
||||
this.parentComponent = parentComponent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
new PersonaDetailsDialog(parentComponent,
|
||||
PersonaDetailsMode.VIEW, persona, new PersonaViewCallbackImpl());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback method for the create mode of the PersonaDetailsDialog
|
||||
*/
|
||||
class PersonaCreateCallbackImpl implements PersonaDetailsDialogCallback {
|
||||
|
||||
private final Component parentComponent;
|
||||
private final PersonaUIComponents personaUIComponents;
|
||||
|
||||
/**
|
||||
* Creates a callback to handle new persona creation.
|
||||
*
|
||||
* @param personaUIComponents UI Components.
|
||||
*/
|
||||
PersonaCreateCallbackImpl(Component parentComponent, PersonaUIComponents personaUIComponents) {
|
||||
this.parentComponent = parentComponent;
|
||||
this.personaUIComponents = personaUIComponents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void callback(Persona persona) {
|
||||
JButton personaButton = personaUIComponents.getPersonaActionButton();
|
||||
if (persona != null) {
|
||||
// update the persona name label with newly created persona,
|
||||
// and change the button to a "View" button
|
||||
personaUIComponents.getPersonaNameLabel().setText(persona.getName());
|
||||
personaUIComponents.getPersonaActionButton().setText(Bundle.ContactArtifactViewer_persona_button_view());
|
||||
|
||||
// replace action listener with a View button listener
|
||||
for (ActionListener act : personaButton.getActionListeners()) {
|
||||
personaButton.removeActionListener(act);
|
||||
}
|
||||
personaButton.addActionListener(new ViewPersonaButtonListener(parentComponent, persona));
|
||||
|
||||
}
|
||||
|
||||
personaButton.getParent().revalidate();
|
||||
personaButton.getParent().repaint();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback method for the view mode of the PersonaDetailsDialog
|
||||
*/
|
||||
class PersonaViewCallbackImpl implements PersonaDetailsDialogCallback {
|
||||
|
||||
@Override
|
||||
public void callback(Persona persona) {
|
||||
// nothing to do
|
||||
}
|
||||
}
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user