19 package org.sleuthkit.autopsy.communications.relationships;
21 import java.awt.CardLayout;
22 import java.awt.Component;
23 import java.awt.GridLayout;
24 import java.awt.event.ActionEvent;
25 import java.awt.event.ActionListener;
26 import java.util.ArrayList;
27 import java.util.Collection;
28 import java.util.HashMap;
29 import java.util.Iterator;
30 import java.util.List;
32 import java.util.logging.Level;
33 import javax.swing.Box;
34 import javax.swing.JButton;
35 import javax.swing.JPanel;
36 import org.openide.util.NbBundle;
69 personaMap =
new HashMap<>();
83 void showMessagePanel() {
84 CardLayout layout = (CardLayout) getLayout();
85 layout.show(
this,
"message");
93 void setMessage(String message) {
102 void updatePersonaList(Account account, CentralRepoAccount crAccount, List<Persona> personaList) {
103 JPanel panel =
new JPanel();
104 currentCRAccount = crAccount;
105 currentAccount = account;
107 CardLayout layout = (CardLayout) getLayout();
108 if (personaList.isEmpty()) {
109 layout.show(
this,
"create");
111 panel.setLayout(
new GridLayout(personaList.size() + 1, 1));
113 List<PersonaPanel> panelList =
new ArrayList<>();
114 for (Persona persona : personaList) {
115 PersonaPanel personaPanel =
new PersonaPanel(persona);
116 JButton viewButton = personaPanel.getViewButton();
117 panel.add(personaPanel);
119 personaMap.put(viewButton, persona);
120 viewButton.addActionListener(viewButtonHandler);
122 panelList.add(personaPanel);
123 maxWidth = Math.max(personaPanel.getPersonaLabelPreferedWidth(), maxWidth);
127 if (panelList.size() > 1) {
128 for (PersonaPanel ppanel : panelList) {
129 ppanel.setPersonalLabelPreferredWidth(maxWidth);
133 panel.add(Box.createVerticalGlue());
135 layout.show(
this,
"persona");
148 Persona persona = personaMap.get((Component) e.getSource());
173 if (persona != null) {
174 List<Persona> list =
new ArrayList<>();
178 Collection<PersonaAccount> personaAccounts = null;
182 logger.log(Level.WARNING, String.format(
"Failed to get cr account from person %s (%d)", persona.
getName(), persona.
getId()), ex);
185 if (personaAccounts != null) {
186 Iterator<PersonaAccount> iterator = personaAccounts.iterator();
187 if (iterator.hasNext()) {
188 crAccount = iterator.next().getAccount();
192 updatePersonaList(currentAccount, crAccount, list);
202 @SuppressWarnings(
"unchecked")
205 java.awt.GridBagConstraints gridBagConstraints;
214 setLayout(
new java.awt.CardLayout());
219 messagePane.setLayout(
new java.awt.GridBagLayout());
223 gridBagConstraints =
new java.awt.GridBagConstraints();
224 gridBagConstraints.gridx = 0;
225 gridBagConstraints.gridy = 0;
226 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
227 gridBagConstraints.weighty = 1.0;
236 gridBagConstraints =
new java.awt.GridBagConstraints();
237 gridBagConstraints.gridx = 0;
238 gridBagConstraints.gridy = 0;
239 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
240 gridBagConstraints.weighty = 1.0;
241 gridBagConstraints.insets =
new java.awt.Insets(7, 5, 0, 0);
245 createButton.setMargin(
new java.awt.Insets(0, 5, 0, 5));
246 createButton.addActionListener(
new java.awt.event.ActionListener() {
247 public void actionPerformed(java.awt.event.ActionEvent evt) {
251 gridBagConstraints =
new java.awt.GridBagConstraints();
252 gridBagConstraints.gridx = 1;
253 gridBagConstraints.gridy = 0;
254 gridBagConstraints.gridheight = 2;
255 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
256 gridBagConstraints.weightx = 1.0;
257 gridBagConstraints.weighty = 1.0;
258 gridBagConstraints.insets =
new java.awt.Insets(5, 5, 0, 0);
265 "# {0} - accountIdentifer",
266 "SummaryPersonaPane_not_account_in_cr=Unable to find an account with identifier {0} in the Central Repository."
275 if (currentCRAccount != null) {
279 createPersonaDialog.
setStartupPopupMessage(Bundle.SummaryPersonaPane_not_account_in_cr(currentAccount.getTypeSpecificID()));
boolean addAccount(CentralRepoAccount account, String justification, Persona.Confidence confidence)
static final Logger logger
CentralRepoAccount currentCRAccount
void setStartupPopupMessage(String message)
Collection< PersonaAccount > getPersonaAccounts()
javax.swing.JScrollPane personaScrollPane
PersonaDetailsPanel getDetailsPanel()
void callback(Persona persona)
final Map< Component, Persona > personaMap
static final long serialVersionUID
javax.swing.JLabel noPersonaLabel
final ViewButtonHandler viewButtonHandler
void createButtonActionPerformed(java.awt.event.ActionEvent evt)
void setPersonaName(String name)
synchronized static Logger getLogger(String name)
void callback(Persona persona)
javax.swing.JButton createButton
javax.swing.JLabel messageLabel
javax.swing.JPanel createPersonaPanel
javax.swing.JPanel messagePane