Additional fields in the Persona Details Panel

This commit is contained in:
Ethan Roseman 2020-06-09 13:57:43 -04:00
parent 8b01f3b86b
commit 1e3e62304c
4 changed files with 215 additions and 104 deletions

View File

@ -254,6 +254,18 @@ public class Persona {
return getPersonaByUUID(uuidStr);
}
/**
* Sets the comment of this persona
*
* @param name The new comment.
*
* @throws CentralRepoException If there is an error.
*/
public void setComment(String comment) throws CentralRepoException {
String updateClause = "UPDATE personas SET comment = \"" + comment + "\" WHERE id = " + id;
CentralRepository.getInstance().executeUpdateSQL(updateClause);
}
/**
* Sets the name of this persona
*

View File

@ -14,20 +14,6 @@ AddAccountDialog.okBtn.text=OK
PersonaManagerTopComponent.editBtn.text=Edit Persona
PersonaDetailsDialog.cancelBtn.text=Cancel
PersonaDetailsDialog.okBtn.text=OK
PersonaDetailsPanel.deleteCaseBtn.text=Delete
PersonaDetailsPanel.addCaseBtn.text=Add
PersonaDetailsPanel.casesLbl.text=Cases found in:
PersonaDetailsPanel.deleteAliasBtn.text=Delete
PersonaDetailsPanel.addAliasBtn.text=Add
PersonaDetailsPanel.aliasesLabel.text=Aliases:
PersonaDetailsPanel.deleteMetadataBtn.text=Delete
PersonaDetailsPanel.addMetadataBtn.text=Add
PersonaDetailsPanel.metadataLabel.text=Metadata:
PersonaDetailsPanel.deleteAccountBtn.text=Delete
PersonaDetailsPanel.addAccountBtn.text=Add
PersonaDetailsPanel.accountsLbl.text=Accounts:
PersonaDetailsPanel.nameField.text=
PersonaDetailsPanel.nameLbl.text=Name:
AddAliasDialog.accountsLbl.text=Account:
AddAliasDialog.okBtn.text=OK
AddAliasDialog.cancelBtn.text=Cancel
@ -54,3 +40,21 @@ AddAccountDialog.typeLbl.text=Type:
AddAccountDialog.identiferLbl.text=Identifier:
AddAccountDialog.identifierTextField.text=
PersonaManagerTopComponent.deleteBtn.text=Delete Persona
PersonaDetailsPanel.casesLbl.text=Cases found in:
PersonaDetailsPanel.deleteAliasBtn.text=Delete
PersonaDetailsPanel.addAliasBtn.text=Add
PersonaDetailsPanel.aliasesLabel.text=Aliases:
PersonaDetailsPanel.deleteMetadataBtn.text=Delete
PersonaDetailsPanel.addMetadataBtn.text=Add
PersonaDetailsPanel.metadataLabel.text=Metadata:
PersonaDetailsPanel.deleteAccountBtn.text=Delete
PersonaDetailsPanel.addAccountBtn.text=Add
PersonaDetailsPanel.accountsLbl.text=Accounts:
PersonaDetailsPanel.commentField.text=
PersonaDetailsPanel.commentLbl.text=Comment:
PersonaDetailsPanel.nameField.text=
PersonaDetailsPanel.nameLbl.text=Name:
PersonaDetailsPanel.examinerLbl.text=Created by:
PersonaDetailsPanel.examinerField.text=
PersonaDetailsPanel.creationDateLbl.text=Created on:
PersonaDetailsPanel.creationDateField.text=

View File

@ -37,18 +37,12 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="561" max="32767" attributes="0"/>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Component id="detailsPanel" alignment="0" max="32767" attributes="0"/>
</Group>
<Component id="detailsPanel" alignment="1" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<EmptySpace min="0" pref="559" max="32767" attributes="0"/>
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
<Component id="detailsPanel" alignment="0" max="32767" attributes="0"/>
</Group>
<Component id="detailsPanel" min="-2" max="-2" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
@ -61,12 +55,7 @@
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="accountsTablePane" alignment="1" pref="549" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="nameLbl" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="nameField" max="32767" attributes="0"/>
</Group>
<Component id="accountsTablePane" alignment="1" max="32767" attributes="0"/>
<Component id="accountsLbl" alignment="0" max="32767" attributes="0"/>
<Component id="metadataLabel" alignment="0" max="32767" attributes="0"/>
<Component id="metadataTablePane" alignment="1" max="32767" attributes="0"/>
@ -74,13 +63,22 @@
<Component id="aliasesTablePane" alignment="0" max="32767" attributes="0"/>
<Component id="casesLbl" alignment="0" max="32767" attributes="0"/>
<Component id="casesTablePane" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="commentLbl" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="commentField" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="examinerLbl" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="examinerField" min="-2" pref="222" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="creationDateLbl" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="creationDateField" min="-2" pref="222" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="addCaseBtn" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="deleteCaseBtn" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Component id="addAccountBtn" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
@ -99,6 +97,11 @@
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="nameLbl" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="nameField" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@ -107,7 +110,19 @@
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="examinerLbl" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="examinerField" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="creationDateLbl" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="creationDateField" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="commentField" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="commentLbl" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="20" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="nameLbl" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="nameField" alignment="3" min="-2" max="-2" attributes="0"/>
@ -143,17 +158,57 @@
<Component id="casesLbl" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="casesTablePane" min="-2" pref="63" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="addCaseBtn" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="deleteCaseBtn" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="examinerLbl">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/persona/Bundle.properties" key="PersonaDetailsPanel.examinerLbl.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="examinerField">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/persona/Bundle.properties" key="PersonaDetailsPanel.examinerField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="creationDateLbl">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/persona/Bundle.properties" key="PersonaDetailsPanel.creationDateLbl.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="creationDateField">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/persona/Bundle.properties" key="PersonaDetailsPanel.creationDateField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="commentLbl">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/persona/Bundle.properties" key="PersonaDetailsPanel.commentLbl.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="commentField">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/persona/Bundle.properties" key="PersonaDetailsPanel.commentField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="nameLbl">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
@ -168,9 +223,6 @@
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/persona/Bundle.properties" key="PersonaDetailsPanel.nameField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="nameFieldActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="accountsLbl">
<Properties>
@ -312,22 +364,6 @@
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="addCaseBtn">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/persona/Bundle.properties" key="PersonaDetailsPanel.addCaseBtn.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="deleteCaseBtn">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/persona/Bundle.properties" key="PersonaDetailsPanel.deleteCaseBtn.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>

View File

@ -20,8 +20,10 @@ package org.sleuthkit.autopsy.centralrepository.persona;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import javax.swing.JButton;
@ -34,7 +36,9 @@ import org.openide.windows.TopComponent;
import org.openide.util.NbBundle.Messages;
import org.openide.windows.RetainLocation;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoAccount;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoExaminer;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoException;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationCase;
import org.sleuthkit.autopsy.centralrepository.datamodel.Persona;
import org.sleuthkit.autopsy.centralrepository.datamodel.PersonaAccount;
@ -282,6 +286,12 @@ public final class PersonaDetailsPanel extends javax.swing.JPanel {
private void initComponents() {
detailsPanel = new javax.swing.JPanel();
examinerLbl = new javax.swing.JLabel();
examinerField = new javax.swing.JTextField();
creationDateLbl = new javax.swing.JLabel();
creationDateField = new javax.swing.JTextField();
commentLbl = new javax.swing.JLabel();
commentField = new javax.swing.JTextField();
nameLbl = new javax.swing.JLabel();
nameField = new javax.swing.JTextField();
accountsLbl = new javax.swing.JLabel();
@ -302,18 +312,26 @@ public final class PersonaDetailsPanel extends javax.swing.JPanel {
casesLbl = new javax.swing.JLabel();
casesTablePane = new javax.swing.JScrollPane();
casesTable = new javax.swing.JTable();
addCaseBtn = new javax.swing.JButton();
deleteCaseBtn = new javax.swing.JButton();
org.openide.awt.Mnemonics.setLocalizedText(examinerLbl, org.openide.util.NbBundle.getMessage(PersonaDetailsPanel.class, "PersonaDetailsPanel.examinerLbl.text")); // NOI18N
examinerField.setEditable(false);
examinerField.setText(org.openide.util.NbBundle.getMessage(PersonaDetailsPanel.class, "PersonaDetailsPanel.examinerField.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(creationDateLbl, org.openide.util.NbBundle.getMessage(PersonaDetailsPanel.class, "PersonaDetailsPanel.creationDateLbl.text")); // NOI18N
creationDateField.setEditable(false);
creationDateField.setText(org.openide.util.NbBundle.getMessage(PersonaDetailsPanel.class, "PersonaDetailsPanel.creationDateField.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(commentLbl, org.openide.util.NbBundle.getMessage(PersonaDetailsPanel.class, "PersonaDetailsPanel.commentLbl.text")); // NOI18N
commentField.setEditable(false);
commentField.setText(org.openide.util.NbBundle.getMessage(PersonaDetailsPanel.class, "PersonaDetailsPanel.commentField.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(nameLbl, org.openide.util.NbBundle.getMessage(PersonaDetailsPanel.class, "PersonaDetailsPanel.nameLbl.text")); // NOI18N
nameField.setEditable(false);
nameField.setText(org.openide.util.NbBundle.getMessage(PersonaDetailsPanel.class, "PersonaDetailsPanel.nameField.text")); // NOI18N
nameField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
nameFieldActionPerformed(evt);
}
});
org.openide.awt.Mnemonics.setLocalizedText(accountsLbl, org.openide.util.NbBundle.getMessage(PersonaDetailsPanel.class, "PersonaDetailsPanel.accountsLbl.text")); // NOI18N
@ -393,12 +411,6 @@ public final class PersonaDetailsPanel extends javax.swing.JPanel {
));
casesTablePane.setViewportView(casesTable);
org.openide.awt.Mnemonics.setLocalizedText(addCaseBtn, org.openide.util.NbBundle.getMessage(PersonaDetailsPanel.class, "PersonaDetailsPanel.addCaseBtn.text")); // NOI18N
addCaseBtn.setEnabled(false);
org.openide.awt.Mnemonics.setLocalizedText(deleteCaseBtn, org.openide.util.NbBundle.getMessage(PersonaDetailsPanel.class, "PersonaDetailsPanel.deleteCaseBtn.text")); // NOI18N
deleteCaseBtn.setEnabled(false);
javax.swing.GroupLayout detailsPanelLayout = new javax.swing.GroupLayout(detailsPanel);
detailsPanel.setLayout(detailsPanelLayout);
detailsPanelLayout.setHorizontalGroup(
@ -406,11 +418,7 @@ public final class PersonaDetailsPanel extends javax.swing.JPanel {
.addGroup(detailsPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(accountsTablePane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 549, Short.MAX_VALUE)
.addGroup(detailsPanelLayout.createSequentialGroup()
.addComponent(nameLbl)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(nameField))
.addComponent(accountsTablePane, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(accountsLbl, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(metadataLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(metadataTablePane, javax.swing.GroupLayout.Alignment.TRAILING)
@ -419,11 +427,19 @@ public final class PersonaDetailsPanel extends javax.swing.JPanel {
.addComponent(casesLbl, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(casesTablePane)
.addGroup(detailsPanelLayout.createSequentialGroup()
.addGroup(detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(commentLbl)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(commentField))
.addGroup(detailsPanelLayout.createSequentialGroup()
.addComponent(addCaseBtn)
.addGap(18, 18, 18)
.addComponent(deleteCaseBtn))
.addComponent(examinerLbl)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(examinerField, javax.swing.GroupLayout.PREFERRED_SIZE, 222, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(creationDateLbl)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(creationDateField, javax.swing.GroupLayout.PREFERRED_SIZE, 222, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(detailsPanelLayout.createSequentialGroup()
.addGroup(detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(detailsPanelLayout.createSequentialGroup()
.addComponent(addAccountBtn)
.addGap(18, 18, 18)
@ -436,13 +452,27 @@ public final class PersonaDetailsPanel extends javax.swing.JPanel {
.addComponent(addAliasBtn)
.addGap(18, 18, 18)
.addComponent(deleteAliasBtn)))
.addGap(0, 0, Short.MAX_VALUE)))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(detailsPanelLayout.createSequentialGroup()
.addComponent(nameLbl)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(nameField)))
.addContainerGap())
);
detailsPanelLayout.setVerticalGroup(
detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(detailsPanelLayout.createSequentialGroup()
.addContainerGap()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(examinerLbl)
.addComponent(examinerField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(creationDateLbl)
.addComponent(creationDateField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(commentField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(commentLbl))
.addGap(20, 20, 20)
.addGroup(detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(nameLbl)
.addComponent(nameField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
@ -474,40 +504,27 @@ public final class PersonaDetailsPanel extends javax.swing.JPanel {
.addComponent(casesLbl)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(casesTablePane, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(detailsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(addCaseBtn)
.addComponent(deleteCaseBtn))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 561, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(detailsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(detailsPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 559, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(detailsPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(detailsPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
}// </editor-fold>//GEN-END:initComponents
private void nameFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nameFieldActionPerformed
}//GEN-LAST:event_nameFieldActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel accountsLbl;
private javax.swing.JTable accountsTable;
private javax.swing.JScrollPane accountsTablePane;
private javax.swing.JButton addAccountBtn;
private javax.swing.JButton addAliasBtn;
private javax.swing.JButton addCaseBtn;
private javax.swing.JButton addMetadataBtn;
private javax.swing.JLabel aliasesLabel;
private javax.swing.JTable aliasesTable;
@ -515,11 +532,16 @@ public final class PersonaDetailsPanel extends javax.swing.JPanel {
private javax.swing.JLabel casesLbl;
private javax.swing.JTable casesTable;
private javax.swing.JScrollPane casesTablePane;
private javax.swing.JTextField commentField;
private javax.swing.JLabel commentLbl;
private javax.swing.JTextField creationDateField;
private javax.swing.JLabel creationDateLbl;
private javax.swing.JButton deleteAccountBtn;
private javax.swing.JButton deleteAliasBtn;
private javax.swing.JButton deleteCaseBtn;
private javax.swing.JButton deleteMetadataBtn;
private javax.swing.JPanel detailsPanel;
private javax.swing.JTextField examinerField;
private javax.swing.JLabel examinerLbl;
private javax.swing.JLabel metadataLabel;
private javax.swing.JTable metadataTable;
private javax.swing.JScrollPane metadataTablePane;
@ -531,12 +553,22 @@ public final class PersonaDetailsPanel extends javax.swing.JPanel {
"PersonaDetailsPanel_load_exception_Title=Initialization failure",
"PersonaDetailsPanel_load_exception_msg=Failed to load persona",})
private void loadPersona(Component parent, Persona persona) {
String examiner;
String creationDate;
String comment;
String name;
Collection<PersonaAccount> accounts;
Collection<PersonaMetadata> metadata;
Collection<PersonaAlias> aliases;
Collection<CorrelationCase> cases;
try {
examiner = persona.getExaminer().getLoginName();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date cDate = new Date(persona.getCreatedDate());
creationDate = dateFormat.format(cDate);
comment = persona.getComment();
name = persona.getName();
accounts = persona.getPersonaAccounts();
metadata = persona.getMetadata();
@ -551,6 +583,9 @@ public final class PersonaDetailsPanel extends javax.swing.JPanel {
return;
}
this.currentPersona = persona;
this.examinerField.setText(examiner);
this.creationDateField.setText(creationDate);
this.commentField.setText(comment);
this.nameField.setText(name);
this.currentAccounts.addAll(accounts);
this.currentMetadata.addAll(metadata);
@ -560,6 +595,9 @@ public final class PersonaDetailsPanel extends javax.swing.JPanel {
void clear() {
currentPersona = null;
examinerField.setText("");
creationDateField.setText("");
commentField.setText("");
nameField.setText(mode == PersonaDetailsMode.CREATE ? Persona.getDefaultName() : "");
currentAccounts = new ArrayList<>();
currentMetadata = new ArrayList<>();
@ -569,17 +607,16 @@ public final class PersonaDetailsPanel extends javax.swing.JPanel {
metadataToAdd.clear();
aliasesToAdd.clear();
nameField.setEditable(false);
commentField.setEditable(false);
initializeFields();
addAccountBtn.setEnabled(false);
addMetadataBtn.setEnabled(false);
addAliasBtn.setEnabled(false);
addCaseBtn.setEnabled(false);
deleteAccountBtn.setEnabled(false);
deleteMetadataBtn.setEnabled(false);
deleteAliasBtn.setEnabled(false);
deleteCaseBtn.setEnabled(false);
}
/**
@ -678,14 +715,26 @@ public final class PersonaDetailsPanel extends javax.swing.JPanel {
}
void enableEditUIComponents() {
commentField.setEditable(true);
nameField.setEditable(true);
addAccountBtn.setEnabled(true);
addMetadataBtn.setEnabled(true);
addAliasBtn.setEnabled(true);
//addCaseBtn.setEnabled(true); //todo
}
void initializeFields() {
if (mode == PersonaDetailsMode.CREATE) {
try {
CentralRepoExaminer examiner = CentralRepository.getInstance().getOrInsertExaminer(System.getProperty("user.name"));
examinerField.setText(examiner.getLoginName());
} catch (CentralRepoException e) {
logger.log(Level.SEVERE, "Failed to access central repository", e);
JOptionPane.showMessageDialog(this,
Bundle.PersonaDetailsPanel_CentralRepoErr_msg(),
Bundle.PersonaDetailsPanel_CentralRepoErr_Title(),
JOptionPane.ERROR_MESSAGE);
}
}
updateAccountsTable();
updateMetadataTable();
updateAliasesTable();
@ -719,7 +768,9 @@ public final class PersonaDetailsPanel extends javax.swing.JPanel {
"PersonaDetailsPanel_CentralRepoErr_msg=Failure to write to Central Repository",
"PersonaDetailsPanel_CentralRepoErr_Title=Central Repository failure",
"PersonaDetailsPanel_EmptyName_msg=Persona name cannot be empty",
"PersonaDetailsPanel_EmptyName_Title=Empty persona name",})
"PersonaDetailsPanel_EmptyName_Title=Empty persona name",
"PersonaDetailsPanel_EmptyComment_msg=Persona comment cannot be empty",
"PersonaDetailsPanel_EmptyComment_Title=Empty persona comment",})
Persona okHandler() {
if (accountsToAdd.size() + currentAccounts.size() < 1) {
JOptionPane.showMessageDialog(this,
@ -729,6 +780,13 @@ public final class PersonaDetailsPanel extends javax.swing.JPanel {
return null;
}
if (commentField.getText().isEmpty()) {
JOptionPane.showMessageDialog(this,
Bundle.PersonaDetailsPanel_EmptyComment_msg(),
Bundle.PersonaDetailsPanel_EmptyComment_Title(),
JOptionPane.ERROR_MESSAGE);
return null;
}
if (nameField.getText().isEmpty()) {
JOptionPane.showMessageDialog(this,
Bundle.PersonaDetailsPanel_EmptyName_msg(),
@ -743,7 +801,7 @@ public final class PersonaDetailsPanel extends javax.swing.JPanel {
try {
PAccount firstAccount = accountsToAdd.get(0);
ret = Persona.createPersonaForAccount(nameField.getText(),
"", Persona.PersonaStatus.ACTIVE, firstAccount.account,
commentField.getText(), Persona.PersonaStatus.ACTIVE, firstAccount.account,
firstAccount.justification, firstAccount.confidence);
for (int i = 1; i < accountsToAdd.size(); i++) {
ret.addAccount(accountsToAdd.get(i).account,
@ -768,6 +826,7 @@ public final class PersonaDetailsPanel extends javax.swing.JPanel {
case EDIT:
try {
ret = currentPersona;
currentPersona.setComment(commentField.getText());
currentPersona.setName(nameField.getText());
for (PAccount acc : accountsToAdd) {
ret.addAccount(acc.account, acc.justification, acc.confidence);