19 package org.sleuthkit.autopsy.datamodel.persons;
 
   21 import java.awt.Color;
 
   23 import java.util.Collection;
 
   25 import javax.swing.event.DocumentEvent;
 
   26 import javax.swing.event.DocumentListener;
 
   27 import org.openide.util.NbBundle.Messages;
 
   50         this(parent, currentPersons, null);
 
   63         "AddEditPersonDialog_addPerson_title=Add Person",
 
   64         "AddEditPersonDialog_editPerson_title=Edit Person" 
   69         setTitle(initialPerson == null ? Bundle.AddEditPersonDialog_addPerson_title() : Bundle.AddEditPersonDialog_editPerson_title());
 
   80         inputTextField.getDocument().addDocumentListener(
new DocumentListener() {
 
   82             public void changedUpdate(DocumentEvent e) {
 
   87             public void removeUpdate(DocumentEvent e) {
 
   92             public void insertUpdate(DocumentEvent e) {
 
  120         String newNameValueOrEmpty = newNameValue == null ? 
"" : newNameValue;
 
  122         if (!newNameValueOrEmpty.equals(
this.inputTextField.getText())) {
 
  131         okButton.setEnabled(validationMessage == null);
 
  132         validationLabel.setText(validationMessage == null ? 
"" : validationMessage);
 
  140     @SuppressWarnings(
"unchecked")
 
  145         javax.swing.JLabel nameLabel = 
new javax.swing.JLabel();
 
  147         okButton = 
new javax.swing.JButton();
 
  148         javax.swing.JButton cancelButton = 
new javax.swing.JButton();
 
  150         setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
 
  154         nameLabel.setText(
org.openide.util.NbBundle.getMessage(
AddEditPersonDialog.class, 
"AddEditPersonDialog.nameLabel.text_1")); 
 
  160         okButton.addActionListener(
new java.awt.event.ActionListener() {
 
  161             public void actionPerformed(java.awt.event.ActionEvent evt) {
 
  166         cancelButton.setText(
org.openide.util.NbBundle.getMessage(
AddEditPersonDialog.class, 
"AddEditPersonDialog.cancelButton.text_1")); 
 
  167         cancelButton.addActionListener(
new java.awt.event.ActionListener() {
 
  168             public void actionPerformed(java.awt.event.ActionEvent evt) {
 
  173         javax.swing.GroupLayout layout = 
new javax.swing.GroupLayout(getContentPane());
 
  174         getContentPane().setLayout(layout);
 
  175         layout.setHorizontalGroup(
 
  176             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  177             .addGroup(layout.createSequentialGroup()
 
  179                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  180                     .addComponent(
validationLabel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
 
  182                     .addGroup(layout.createSequentialGroup()
 
  183                         .addComponent(nameLabel)
 
  184                         .addGap(0, 0, Short.MAX_VALUE))
 
  185                     .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
 
  186                         .addGap(0, 288, Short.MAX_VALUE)
 
  188                         .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 
  189                         .addComponent(cancelButton)))
 
  192         layout.setVerticalGroup(
 
  193             layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  194             .addGroup(layout.createSequentialGroup()
 
  196                 .addComponent(nameLabel)
 
  197                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 
  198                 .addComponent(
inputTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  199                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 
  200                 .addComponent(
validationLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
 
  201                 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
 
  202                 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
 
  203                     .addComponent(cancelButton)
 
  205                 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
 
  218         this.changed = 
false;
 
AddEditPersonDialog(java.awt.Frame parent, Collection< Person > currentPersons, Person initialPerson)
static final long serialVersionUID
AddEditPersonDialog(java.awt.Frame parent, Collection< Person > currentPersons)
final Person initialPerson
void cancelButtonActionPerformed(java.awt.event.ActionEvent evt)
void onNameUpdate(String newNameValue)
javax.swing.JTextField inputTextField
static String getValidationMessage(String curName, String initialName, Set< String > currentPersonsTrimmedUpper)
final Set< String > personNamesSanitized
void okButtonActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JLabel validationLabel
static Set< String > getSanitizedPersonNames(Collection< Person > persons)
javax.swing.JButton okButton