2774 functioning Manage Organizations Panel added

This commit is contained in:
William Schaefer 2017-10-06 14:28:39 -04:00
parent 9a36a85918
commit b87e6d6796
12 changed files with 1195 additions and 68 deletions

View File

@ -228,3 +228,8 @@ CasePropertiesPanel.lbCaseUUIDLabel.text=Case UUID:
CaseInformationPanel.centralRepoDetailsLabel.text=The Central Repository Details tab is only available when using a central repository.
CasePropertiesPanel.caseNumberTextField.text=jTextField1
CasePropertiesPanel.examinerTextField.text=jTextField2
NewCaseVisualPanel2.bnNewOrganization.text=New Organization
NewCaseVisualPanel2.lbOrganizationNameLabel.text=Organization:
NewCaseVisualPanel2.lbPointOfContactEmailLabel.text=Email:
NewCaseVisualPanel2.lbPointOfContactNameLabel.text=Point of Contact:
NewCaseVisualPanel2.lbPointOfContactPhoneLabel.text=Phone:

View File

@ -19,16 +19,39 @@
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="optionalLabel" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<Component id="caseNumberLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="25" max="-2" attributes="0"/>
<Component id="caseNumberTextField" pref="246" max="32767" attributes="1"/>
<Group type="102" attributes="0">
<Component id="optionalLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="150" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="examinerLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="45" max="-2" attributes="0"/>
<Component id="examinerTextField" pref="246" max="32767" attributes="1"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="examinerLabel" min="-2" max="-2" attributes="0"/>
<Component id="lbOrganizationNameLabel" min="-2" max="-2" attributes="0"/>
<Component id="caseNumberLabel" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="caseNumberTextField" max="32767" attributes="1"/>
<Component id="examinerTextField" max="32767" attributes="1"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="bnNewOrganization" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="comboBoxOrgName" alignment="1" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="lbPointOfContactPhoneLabel" min="-2" max="-2" attributes="0"/>
<Component id="lbPointOfContactEmailLabel" alignment="0" min="-2" pref="34" max="-2" attributes="0"/>
<Component id="lbPointOfContactNameLabel" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="lbPointOfContactNameText" max="32767" attributes="0"/>
<Component id="lbPointOfContactEmailText" max="32767" attributes="0"/>
<Component id="lbPointOfContactPhoneText" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
@ -50,7 +73,29 @@
<Component id="examinerLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="examinerTextField" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="lbOrganizationNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="comboBoxOrgName" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Component id="bnNewOrganization" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="lbPointOfContactNameLabel" alignment="0" max="32767" attributes="0"/>
<Component id="lbPointOfContactNameText" alignment="0" min="-2" pref="14" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="lbPointOfContactEmailLabel" alignment="0" max="32767" attributes="0"/>
<Component id="lbPointOfContactEmailText" alignment="0" min="-2" pref="14" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="lbPointOfContactPhoneLabel" alignment="0" max="32767" attributes="0"/>
<Component id="lbPointOfContactPhoneText" alignment="0" min="-2" pref="14" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="40" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -116,5 +161,62 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lbOrganizationNameLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="NewCaseVisualPanel2.lbOrganizationNameLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="comboBoxOrgName">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="0"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="comboBoxOrgNameActionPerformed"/>
</Events>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JButton" name="bnNewOrganization">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="NewCaseVisualPanel2.bnNewOrganization.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="bnNewOrganizationActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="lbPointOfContactNameLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="NewCaseVisualPanel2.lbPointOfContactNameLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lbPointOfContactNameText">
</Component>
<Component class="javax.swing.JLabel" name="lbPointOfContactEmailLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="NewCaseVisualPanel2.lbPointOfContactEmailLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lbPointOfContactEmailText">
</Component>
<Component class="javax.swing.JLabel" name="lbPointOfContactPhoneLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="NewCaseVisualPanel2.lbPointOfContactPhoneLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lbPointOfContactPhoneText">
</Component>
</SubComponents>
</Form>

View File

@ -1,15 +1,15 @@
/*
* Autopsy Forensic Browser
*
*
* Copyright 2011 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.
@ -17,7 +17,7 @@
* limitations under the License.
*/
/*
/*
* NewCaseVisualPanel2.java
*
* Created on Mar 7, 2012, 11:01:48 AM
@ -27,6 +27,11 @@ package org.sleuthkit.autopsy.casemodule;
import org.openide.util.NbBundle;
import java.awt.*;
import javax.swing.JComboBox;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamOrganization;
import org.sleuthkit.autopsy.centralrepository.optionspanel.ManageOrganizationsDialog;
/**
*
@ -34,11 +39,29 @@ import java.awt.*;
*/
class NewCaseVisualPanel2 extends javax.swing.JPanel {
private EamOrganization selectedOrg = null;
private java.util.List<EamOrganization> orgs = null;
private EamDb dbManager;
/**
* Creates new form NewCaseVisualPanel2
*/
public NewCaseVisualPanel2() {
initComponents();
try {
this.dbManager = EamDb.getInstance();
} catch (EamDbException ex) {
dbManager = null;
}
if (dbManager == null) {
comboBoxOrgName.setEnabled(false);
bnNewOrganization.setEnabled(false);
lbPointOfContactNameText.setEnabled(false);
lbPointOfContactEmailText.setEnabled(false);
lbPointOfContactPhoneText.setEnabled(false);
} else {
loadOrganizationData();
}
}
/**
@ -66,6 +89,15 @@ class NewCaseVisualPanel2 extends javax.swing.JPanel {
caseNumberLabel = new javax.swing.JLabel();
examinerLabel = new javax.swing.JLabel();
optionalLabel = new javax.swing.JLabel();
lbOrganizationNameLabel = new javax.swing.JLabel();
comboBoxOrgName = new javax.swing.JComboBox<>();
bnNewOrganization = new javax.swing.JButton();
lbPointOfContactNameLabel = new javax.swing.JLabel();
lbPointOfContactNameText = new javax.swing.JLabel();
lbPointOfContactEmailLabel = new javax.swing.JLabel();
lbPointOfContactEmailText = new javax.swing.JLabel();
lbPointOfContactPhoneLabel = new javax.swing.JLabel();
lbPointOfContactPhoneText = new javax.swing.JLabel();
caseNumberTextField.setFont(caseNumberTextField.getFont().deriveFont(caseNumberTextField.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
caseNumberTextField.setText(org.openide.util.NbBundle.getMessage(NewCaseVisualPanel2.class, "NewCaseVisualPanel2.caseNumberTextField.text")); // NOI18N
@ -82,6 +114,27 @@ class NewCaseVisualPanel2 extends javax.swing.JPanel {
optionalLabel.setFont(optionalLabel.getFont().deriveFont(optionalLabel.getFont().getStyle() | java.awt.Font.BOLD, 14));
optionalLabel.setText(org.openide.util.NbBundle.getMessage(NewCaseVisualPanel2.class, "NewCaseVisualPanel2.optionalLabel.text")); // NOI18N
lbOrganizationNameLabel.setText(org.openide.util.NbBundle.getMessage(NewCaseVisualPanel2.class, "NewCaseVisualPanel2.lbOrganizationNameLabel.text")); // NOI18N
comboBoxOrgName.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
comboBoxOrgNameActionPerformed(evt);
}
});
bnNewOrganization.setText(org.openide.util.NbBundle.getMessage(NewCaseVisualPanel2.class, "NewCaseVisualPanel2.bnNewOrganization.text")); // NOI18N
bnNewOrganization.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
bnNewOrganizationActionPerformed(evt);
}
});
lbPointOfContactNameLabel.setText(org.openide.util.NbBundle.getMessage(NewCaseVisualPanel2.class, "NewCaseVisualPanel2.lbPointOfContactNameLabel.text")); // NOI18N
lbPointOfContactEmailLabel.setText(org.openide.util.NbBundle.getMessage(NewCaseVisualPanel2.class, "NewCaseVisualPanel2.lbPointOfContactEmailLabel.text")); // NOI18N
lbPointOfContactPhoneLabel.setText(org.openide.util.NbBundle.getMessage(NewCaseVisualPanel2.class, "NewCaseVisualPanel2.lbPointOfContactPhoneLabel.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
@ -89,15 +142,32 @@ class NewCaseVisualPanel2 extends javax.swing.JPanel {
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(optionalLabel)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(caseNumberLabel)
.addGap(25, 25, 25)
.addComponent(caseNumberTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 246, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(examinerLabel)
.addGap(45, 45, 45)
.addComponent(examinerTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 246, Short.MAX_VALUE)))
.addGroup(layout.createSequentialGroup()
.addComponent(optionalLabel)
.addGap(0, 150, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(examinerLabel)
.addComponent(lbOrganizationNameLabel)
.addComponent(caseNumberLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(caseNumberTextField)
.addComponent(examinerTextField)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(bnNewOrganization))
.addComponent(comboBoxOrgName, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lbPointOfContactPhoneLabel)
.addComponent(lbPointOfContactEmailLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lbPointOfContactNameLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lbPointOfContactNameText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lbPointOfContactEmailText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lbPointOfContactPhoneText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))))
.addContainerGap())
);
layout.setVerticalGroup(
@ -113,14 +183,103 @@ class NewCaseVisualPanel2 extends javax.swing.JPanel {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(examinerLabel)
.addComponent(examinerTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lbOrganizationNameLabel)
.addComponent(comboBoxOrgName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bnNewOrganization)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(lbPointOfContactNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lbPointOfContactNameText, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(lbPointOfContactEmailLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lbPointOfContactEmailText, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(lbPointOfContactPhoneLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lbPointOfContactPhoneText, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(40, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void comboBoxOrgNameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_comboBoxOrgNameActionPerformed
JComboBox<String> cb = (JComboBox<String>) evt.getSource();
String orgName = (String) cb.getSelectedItem();
if (null == orgName) {
return;
}
if ("".equals(orgName)) {
selectedOrg = null;
lbPointOfContactNameText.setText("");
lbPointOfContactEmailText.setText("");
lbPointOfContactPhoneText.setText("");
return;
}
for (EamOrganization org : orgs) {
if (org.getName().equals(orgName)) {
selectedOrg = org;
lbPointOfContactNameText.setText(selectedOrg.getPocName());
lbPointOfContactEmailText.setText(selectedOrg.getPocEmail());
lbPointOfContactPhoneText.setText(selectedOrg.getPocPhone());
return;
}
}
}//GEN-LAST:event_comboBoxOrgNameActionPerformed
private void bnNewOrganizationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnNewOrganizationActionPerformed
ManageOrganizationsDialog dialog = new ManageOrganizationsDialog();
// update the combobox options and org data fields
if (dialog.isChanged()) {
selectedOrg = dialog.getNewOrg();
loadOrganizationData();
validate();
repaint();
}
}//GEN-LAST:event_bnNewOrganizationActionPerformed
private void loadOrganizationData() {
comboBoxOrgName.removeAllItems();
try {
orgs = dbManager.getOrganizations();
comboBoxOrgName.addItem(""); // for when a case has a null Org
orgs.forEach((org) -> {
comboBoxOrgName.addItem(org.getName());
});
} catch (EamDbException ex) {
}
if (!orgs.isEmpty() && null != selectedOrg) {
comboBoxOrgName.setSelectedItem(selectedOrg.getName());
lbPointOfContactNameText.setText(selectedOrg.getPocName());
lbPointOfContactEmailText.setText(selectedOrg.getPocEmail());
lbPointOfContactPhoneText.setText(selectedOrg.getPocPhone());
} else {
comboBoxOrgName.setSelectedItem("");
lbPointOfContactNameText.setText("");
lbPointOfContactEmailText.setText("");
lbPointOfContactPhoneText.setText("");
}
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton bnNewOrganization;
private javax.swing.JLabel caseNumberLabel;
private javax.swing.JTextField caseNumberTextField;
private javax.swing.JComboBox<String> comboBoxOrgName;
private javax.swing.JLabel examinerLabel;
private javax.swing.JTextField examinerTextField;
private javax.swing.JLabel lbOrganizationNameLabel;
private javax.swing.JLabel lbPointOfContactEmailLabel;
private javax.swing.JLabel lbPointOfContactEmailText;
private javax.swing.JLabel lbPointOfContactNameLabel;
private javax.swing.JLabel lbPointOfContactNameText;
private javax.swing.JLabel lbPointOfContactPhoneLabel;
private javax.swing.JLabel lbPointOfContactPhoneText;
private javax.swing.JLabel optionalLabel;
// End of variables declaration//GEN-END:variables

View File

@ -28,11 +28,13 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import java.time.LocalDate;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.openide.util.Exceptions;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger;
@ -451,7 +453,8 @@ public abstract class AbstractSqlEamDb implements EamDb {
/**
* Retrieves Data Source details based on data source device ID
*
* @param correlationCase the current CorrelationCase used for ensuring uniqueness of DataSource
* @param correlationCase the current CorrelationCase used for ensuring
* uniqueness of DataSource
* @param dataSourceDeviceId the data source device ID number
*
* @return The data source
@ -572,10 +575,11 @@ public abstract class AbstractSqlEamDb implements EamDb {
* Retrieves eamArtifact instances from the database that are associated
* with the eamArtifactType and eamArtifactValue of the given eamArtifact.
*
* @param aType The type of the artifact
* @param value The correlation value
* @param aType The type of the artifact
* @param value The correlation value
*
* @return List of artifact instances for a given type/value
*
* @throws EamDbException
*/
@Override
@ -675,8 +679,8 @@ public abstract class AbstractSqlEamDb implements EamDb {
* Retrieves number of artifact instances in the database that are
* associated with the ArtifactType and artifactValue of the given artifact.
*
* @param aType The type of the artifact
* @param value The correlation value
* @param aType The type of the artifact
* @param value The correlation value
*
* @return Number of artifact instances having ArtifactType and
* ArtifactValue.
@ -725,8 +729,8 @@ public abstract class AbstractSqlEamDb implements EamDb {
* database that are associated with the artifactType and artifactValue of
* the given artifact.
*
* @param aType The type of the artifact
* @param value The correlation value
* @param aType The type of the artifact
* @param value The correlation value
*
* @return Number of unique tuples
*/
@ -1019,7 +1023,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
* given status.
*
* @param eamArtifact Artifact containing exactly one (1) ArtifactInstance.
* @param knownStatus The status to change the artifact to
* @param knownStatus The status to change the artifact to
*/
@Override
public void setArtifactInstanceKnownStatus(CorrelationAttribute eamArtifact, TskData.FileKnown knownStatus) throws EamDbException {
@ -1290,25 +1294,33 @@ public abstract class AbstractSqlEamDb implements EamDb {
/**
* Add a new organization
*
* @return the Organization ID of the newly created organization.
*
* @param eamOrg The organization to add
*
* @throws EamDbException
*/
@Override
public void newOrganization(EamOrganization eamOrg) throws EamDbException {
public long newOrganization(EamOrganization eamOrg) throws EamDbException {
Connection conn = connect();
PreparedStatement preparedStatement = null;
String sql = "INSERT INTO organizations(org_name, poc_name, poc_email, poc_phone) VALUES (?, ?, ?, ?)";
try {
preparedStatement = conn.prepareStatement(sql);
preparedStatement = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
preparedStatement.setString(1, eamOrg.getName());
preparedStatement.setString(2, eamOrg.getPocName());
preparedStatement.setString(3, eamOrg.getPocEmail());
preparedStatement.setString(4, eamOrg.getPocPhone());
preparedStatement.executeUpdate();
ResultSet generatedKeys = preparedStatement.getGeneratedKeys();
if (generatedKeys.next()) {
return generatedKeys.getLong(1);
} else {
throw new SQLException("Creating user failed, no ID obtained.");
}
} catch (SQLException ex) {
throw new EamDbException("Error inserting new organization.", ex); // NON-NLS
} finally {
@ -1383,6 +1395,35 @@ public abstract class AbstractSqlEamDb implements EamDb {
}
}
/**
* Update an existing organization.
*
* @param updatedOrganization the values the Organization with the same ID
* will be updated to in the database.
*
* @throws EamDbException
*/
@Override
public void updateOrganization(EamOrganization updatedOrganization) throws EamDbException {
Connection conn = connect();
PreparedStatement preparedStatement = null;
String sql = "UPDATE organizations SET org_name = ?, poc_name = ?, poc_email = ?, poc_phone = ? WHERE id = ?";
try {
preparedStatement = conn.prepareStatement(sql);
preparedStatement.setString(1, updatedOrganization.getName());
preparedStatement.setString(2, updatedOrganization.getPocName());
preparedStatement.setString(3, updatedOrganization.getPocEmail());
preparedStatement.setString(4, updatedOrganization.getPocPhone());
preparedStatement.setInt(5, updatedOrganization.getOrgID());
preparedStatement.executeUpdate();
} catch (SQLException ex) {
throw new EamDbException("Error updating organization.", ex); // NON-NLS
} finally {
EamDbUtil.closePreparedStatement(preparedStatement);
EamDbUtil.closeConnection(conn);
}
}
/**
* Add a new Global Set
*
@ -1851,7 +1892,7 @@ public abstract class AbstractSqlEamDb implements EamDb {
resultSet.getInt("id"),
resultSet.getInt("case_id"),
resultSet.getString("device_id"),
resultSet.getString("name")
resultSet.getString("name")
);
return eamDataSource;

View File

@ -314,7 +314,7 @@ public interface EamDb {
* exists, it is updated. If eamArtifact does not exist nothing happens
*
* @param eamArtifact Artifact containing exactly one (1) ArtifactInstance.
* @param knownStatus The status to change the artifact to
* @param knownStatus The status to change the artifact to
*/
void setArtifactInstanceKnownStatus(CorrelationAttribute eamArtifact, TskData.FileKnown knownStatus) throws EamDbException;
@ -368,9 +368,11 @@ public interface EamDb {
*
* @param eamOrg The organization to add
*
* @return the Organization ID of the newly created organization.
*
* @throws EamDbException
*/
void newOrganization(EamOrganization eamOrg) throws EamDbException;
long newOrganization(EamOrganization eamOrg) throws EamDbException;
/**
* Get all organizations
@ -392,6 +394,16 @@ public interface EamDb {
*/
EamOrganization getOrganizationByID(int orgID) throws EamDbException;
/**
* Update an existing organization.
*
* @param updatedOrganization the values the Organization with the same ID
* will be updated to in the database.
*
* @throws EamDbException
*/
void updateOrganization(EamOrganization updatedOrganization) throws EamDbException;
/**
* Add a new Global Set
*

View File

@ -656,15 +656,17 @@ public class SqliteEamDb extends AbstractSqlEamDb {
/**
* Add a new organization
*
* @return the Organization ID of the newly created organization.
*
* @param eamOrg The organization to add
*
* @throws EamDbException
*/
@Override
public void newOrganization(EamOrganization eamOrg) throws EamDbException {
public long newOrganization(EamOrganization eamOrg) throws EamDbException {
try{
acquireExclusiveLock();
super.newOrganization(eamOrg);
return super.newOrganization(eamOrg);
} finally {
releaseExclusiveLock();
}

View File

@ -30,7 +30,6 @@ import javax.swing.event.DocumentListener;
import org.netbeans.spi.options.OptionsPanelController;
import org.openide.util.NbBundle.Messages;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamOrganization;
@ -47,6 +46,7 @@ public class AddNewOrganizationDialog extends javax.swing.JDialog {
private final TextBoxChangedListener textBoxChangedListener;
private boolean hasChanged;
private EamOrganization newOrg;
private final EamOrganization organizationToEdit;
/**
* Creates new form AddNewOrganizationDialog
@ -62,6 +62,25 @@ public class AddNewOrganizationDialog extends javax.swing.JDialog {
newOrg = null;
initComponents();
customizeComponents();
organizationToEdit = null;
display();
}
public AddNewOrganizationDialog(EamOrganization orgToEdit) {
super((JFrame) WindowManager.getDefault().getMainWindow(),
Bundle.AddNewOrganizationDialog_addNewOrg_msg(),
true); // NON-NLS
organizationToEdit = orgToEdit;
textBoxes = new ArrayList<>();
textBoxChangedListener = new TextBoxChangedListener();
hasChanged = false;
newOrg = null;
initComponents();
customizeComponents();
tfOrganizationName.setText(orgToEdit.getName());
tfPocName.setText(orgToEdit.getPocName());
tfPocEmail.setText(orgToEdit.getPocEmail());
tfPocPhone.setText(orgToEdit.getPocPhone());
display();
}
@ -179,7 +198,7 @@ public class AddNewOrganizationDialog extends javax.swing.JDialog {
public boolean isChanged() {
return hasChanged;
}
public EamOrganization getNewOrg() {
return newOrg;
}
@ -311,14 +330,25 @@ public class AddNewOrganizationDialog extends javax.swing.JDialog {
@Messages({"AddNewOrganizationDialog.bnOk.addFailed.text=Failed to add new organization."})
private void bnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnOKActionPerformed
newOrg = new EamOrganization(
tfOrganizationName.getText(),
tfPocName.getText(),
tfPocEmail.getText(),
tfPocPhone.getText());
try {
EamDb dbManager = EamDb.getInstance();
dbManager.newOrganization(newOrg);
if (organizationToEdit != null) {
//check if new name exists with ID other than the one in use here
newOrg = new EamOrganization(organizationToEdit.getOrgID(),
tfOrganizationName.getText(),
tfPocName.getText(),
tfPocEmail.getText(),
tfPocPhone.getText());
dbManager.updateOrganization(newOrg);
} else {
newOrg = new EamOrganization(
tfOrganizationName.getText(),
tfPocName.getText(),
tfPocEmail.getText(),
tfPocPhone.getText());
newOrg.setOrgID((int)dbManager.newOrganization(newOrg));
}
hasChanged = true;
dispose();
} catch (EamDbException ex) {

View File

@ -97,3 +97,15 @@ ExaminerDetailsPanel.lbExaminerNameLabel.text=Name:
ExaminerDetailsPanel.lbNotesLabel.text=Notes:
ExaminerDetailsPanel.lbExaminerPhoneLabel.text=Phone:
ExaminerDetailsPanel.lbExaminerEmailLabel.text=Email:
ManageOrganizationsDialog.jLabel2.text=Point of Contact Name:
ManageOrganizationsDialog.jLabel1.text=Organizations
ManageOrganizationsDialog.jButton3.text=Close
ManageOrganizationsDialog.jLabel8.text=Organization Name:
ManageOrganizationsDialog.jButton2.text=Delete
ManageOrganizationsDialog.jButton1.text=New
ManageOrganizationsDialog.jLabel6.text=Point of Contact Email:
ManageOrganizationsDialog.jLabel4.text=Point of Contact Phone:
ManageOrganizationsDialog.jTextArea1.text=Organizations are used to provide additional contact information for the content they are associated with.
ManageOrganizationsDialog.jButton4.text=Edit
ManageOrganizationsDialog.jLabel3.text=Organization Details
ManageOrganizationsDialog.pocNameTextField.text=

View File

@ -50,15 +50,15 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="lbOrganizationNameLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="lbOrganizationNameLabel" alignment="0" max="32767" attributes="0"/>
<Component id="lbPointOfContactEmailLabel" min="-2" pref="34" max="-2" attributes="0"/>
<Component id="lbPointOfContactPhoneLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="lbPointOfContactNameLabel" min="-2" pref="124" max="-2" attributes="0"/>
<Component id="lbPointOfContactNameLabel" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="comboBoxOrgName" alignment="0" max="32767" attributes="0"/>
<Component id="comboBoxOrgName" alignment="0" pref="269" max="32767" attributes="0"/>
<Component id="lbPointOfContactEmailText" max="32767" attributes="0"/>
<Component id="lbPointOfContactPhoneText" alignment="0" max="32767" attributes="0"/>
<Component id="bnNewOrganization" alignment="1" min="-2" max="-2" attributes="0"/>
@ -181,12 +181,12 @@
<Component id="lbExaminerPhoneLabel" alignment="0" min="-2" pref="87" max="-2" attributes="0"/>
<Component id="lbNotesLabel" alignment="0" min="-2" pref="87" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="25" max="-2" attributes="0"/>
<EmptySpace type="separate" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="tfExaminerEmailText" alignment="0" max="32767" attributes="0"/>
<Component id="tfExaminerPhoneText" alignment="0" max="32767" attributes="0"/>
<Component id="tfExaminerNameText" alignment="0" max="32767" attributes="0"/>
<Component id="jScrollPane2" alignment="0" pref="261" max="32767" attributes="0"/>
<Component id="jScrollPane2" alignment="0" pref="268" max="32767" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
@ -229,9 +229,6 @@
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="tfExaminerNameText">
<Properties>
<Property name="editable" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="lbExaminerEmailLabel">
<Properties>

View File

@ -6,6 +6,7 @@
package org.sleuthkit.autopsy.centralrepository.optionspanel;
import java.awt.Cursor;
import java.awt.Dialog;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@ -162,14 +163,14 @@ public class CentralRepoCaseOptionsPanel extends javax.swing.JPanel {
pnOrganizationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pnOrganizationLayout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(pnOrganizationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(lbOrganizationNameLabel)
.addGroup(pnOrganizationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(lbOrganizationNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lbPointOfContactEmailLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lbPointOfContactPhoneLabel)
.addComponent(lbPointOfContactNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(lbPointOfContactNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pnOrganizationLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(comboBoxOrgName, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(comboBoxOrgName, 0, 269, Short.MAX_VALUE)
.addComponent(lbPointOfContactEmailText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lbPointOfContactPhoneText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(bnNewOrganization, javax.swing.GroupLayout.Alignment.TRAILING)
@ -204,8 +205,6 @@ public class CentralRepoCaseOptionsPanel extends javax.swing.JPanel {
org.openide.awt.Mnemonics.setLocalizedText(lbExaminerNameLabel, org.openide.util.NbBundle.getMessage(CentralRepoCaseOptionsPanel.class, "CentralRepoCaseOptionsPanel.lbExaminerNameLabel.text")); // NOI18N
tfExaminerNameText.setEditable(false);
org.openide.awt.Mnemonics.setLocalizedText(lbExaminerEmailLabel, org.openide.util.NbBundle.getMessage(CentralRepoCaseOptionsPanel.class, "CentralRepoCaseOptionsPanel.lbExaminerEmailLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(lbExaminerPhoneLabel, org.openide.util.NbBundle.getMessage(CentralRepoCaseOptionsPanel.class, "CentralRepoCaseOptionsPanel.lbExaminerPhoneLabel.text")); // NOI18N
@ -236,12 +235,12 @@ public class CentralRepoCaseOptionsPanel extends javax.swing.JPanel {
.addComponent(lbExaminerNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lbExaminerPhoneLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lbNotesLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(25, 25, 25)
.addGap(18, 18, 18)
.addGroup(pnExaminerLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(tfExaminerEmailText)
.addComponent(tfExaminerPhoneText)
.addComponent(tfExaminerNameText)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 261, Short.MAX_VALUE))
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE))
.addContainerGap())
);
pnExaminerLayout.setVerticalGroup(
@ -313,10 +312,10 @@ public class CentralRepoCaseOptionsPanel extends javax.swing.JPanel {
}//GEN-LAST:event_comboBoxOrgNameActionPerformed
private void bnNewOrganizationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnNewOrganizationActionPerformed
AddNewOrganizationDialog dialogO = new AddNewOrganizationDialog();
ManageOrganizationsDialog dialog = new ManageOrganizationsDialog();
// update the combobox options and org data fields
if (dialogO.isChanged()) {
eamCase.setOrg(dialogO.getNewOrg());
if (dialog.isChanged()) {
eamCase.setOrg(dialog.getNewOrg());
loadOrganizationData();
updateDb();
validate();

View File

@ -0,0 +1,347 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo">
<Properties>
<Property name="iconImage" type="java.awt.Image" editor="org.netbeans.modules.form.ComponentChooserEditor">
<ComponentRef name="default"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[545, 450]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[545, 450]"/>
</Property>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="2"/>
</SyntheticProperties>
<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"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
<Component id="jScrollPane1" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
<Component id="jScrollPane1" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
<Properties>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="null"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[535, 415]"/>
</Property>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="jPanel1">
<Properties>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="null"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[527, 407]"/>
</Property>
</Properties>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane4" min="-2" pref="225" max="-2" attributes="0"/>
<Component id="jLabel1" alignment="0" min="-2" pref="73" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Component id="jButton1" linkSize="1" min="-2" pref="70" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jButton4" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jButton2" linkSize="1" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jScrollPane2" alignment="0" min="-2" pref="224" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jSeparator1" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace type="unrelated" pref="217" max="32767" attributes="0"/>
<Component id="jButton3" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="29" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="jLabel2" alignment="0" max="32767" attributes="0"/>
<Component id="jLabel8" alignment="0" max="32767" attributes="0"/>
<Component id="jLabel4" alignment="0" max="32767" attributes="0"/>
<Component id="jLabel6" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="pocNameTextField" alignment="0" pref="128" max="32767" attributes="0"/>
<Component id="pocPhoneTextField" alignment="0" max="32767" attributes="0"/>
<Component id="pocEmailTextField" alignment="1" max="32767" attributes="0"/>
<Component id="orgNameTextField" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jLabel3" min="-2" pref="115" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="orgNameTextField" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="pocNameTextField" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="pocPhoneTextField" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="pocEmailTextField" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel6" alignment="3" min="-2" pref="20" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="235" max="32767" attributes="0"/>
<Component id="jButton3" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="jSeparator1" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="jScrollPane4" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jScrollPane2" pref="288" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="jButton1" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton4" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JScrollPane" name="jScrollPane2">
<AuxValues>
<AuxValue name="autoScrollPane" type="java.lang.Boolean" value="true"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JList" name="jList1">
<Properties>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.editors2.ListModelEditor">
<StringArray count="0"/>
</Property>
<Property name="selectionMode" type="int" value="0"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;EamOrganization&gt;"/>
</AuxValues>
</Component>
</SubComponents>
</Container>
<Container class="javax.swing.JScrollPane" name="jScrollPane4">
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Component class="javax.swing.JTextArea" name="jTextArea1">
<Properties>
<Property name="editable" type="boolean" value="false"/>
<Property name="background" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
<Color blue="f0" green="f0" red="f0" type="rgb"/>
</Property>
<Property name="columns" type="int" value="20"/>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="Tahoma" size="11" style="0"/>
</Property>
<Property name="lineWrap" type="boolean" value="true"/>
<Property name="rows" type="int" value="3"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/optionspanel/Bundle.properties" key="ManageOrganizationsDialog.jTextArea1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="wrapStyleWord" type="boolean" value="true"/>
</Properties>
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="jButton1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/optionspanel/Bundle.properties" key="ManageOrganizationsDialog.jButton1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
<Insets value="[2, 6, 2, 6]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton1ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton2">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/optionspanel/Bundle.properties" key="ManageOrganizationsDialog.jButton2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
<Insets value="[2, 6, 2, 6]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="jButton2ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton3">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/optionspanel/Bundle.properties" key="ManageOrganizationsDialog.jButton3.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="jButton3ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/optionspanel/Bundle.properties" key="ManageOrganizationsDialog.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSeparator" name="jSeparator1">
<Properties>
<Property name="orientation" type="int" value="1"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel2">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/optionspanel/Bundle.properties" key="ManageOrganizationsDialog.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel4">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/optionspanel/Bundle.properties" key="ManageOrganizationsDialog.jLabel4.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel6">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/optionspanel/Bundle.properties" key="ManageOrganizationsDialog.jLabel6.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/optionspanel/Bundle.properties" key="ManageOrganizationsDialog.jLabel8.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="orgNameTextField">
<Properties>
<Property name="editable" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="orgNameTextFieldActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JTextField" name="pocNameTextField">
<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/optionspanel/Bundle.properties" key="ManageOrganizationsDialog.pocNameTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="pocPhoneTextField">
<Properties>
<Property name="editable" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="pocEmailTextField">
<Properties>
<Property name="editable" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="pocEmailTextFieldActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="jButton4">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/optionspanel/Bundle.properties" key="ManageOrganizationsDialog.jButton4.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="jButton4ActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="jLabel3">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/centralrepository/optionspanel/Bundle.properties" key="ManageOrganizationsDialog.jLabel3.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -0,0 +1,421 @@
/*
* 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.centralrepository.optionspanel;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.util.List;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import org.openide.util.Exceptions;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamOrganization;
/**
*
* @author wschaefer
*/
public class ManageOrganizationsDialog extends JDialog {
private EamDb dbManager;
private EamOrganization newOrg;
private final DefaultListModel<EamOrganization> rulesListModel = new DefaultListModel<>();
/**
* Creates new form ManageOrganizationsPanel
*/
public ManageOrganizationsDialog() {
super((JFrame) WindowManager.getDefault().getMainWindow(),
"Manage Organizations Dialog",
true); // NON-NLS
initComponents();
try {
this.dbManager = EamDb.getInstance();
jList1.setCellRenderer(new DefaultListCellRenderer() {
private static final long serialVersionUID = 1L;
@Override
public Component getListCellRendererComponent(javax.swing.JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
Component c = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
setText(((EamOrganization) value).getName());
return c;
}
});
jList1.setModel(rulesListModel);
jList1.addListSelectionListener(new OrganizationListSelectionListener());
populateList();
newOrg = null;
} catch (EamDbException ex) {
Exceptions.printStackTrace(ex);
}
display();
}
private void display() {
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
setLocation((screenDimension.width - getSize().width) / 2, (screenDimension.height - getSize().height) / 2);
setVisible(true);
}
private void populateListAndSelect(EamOrganization selected) throws EamDbException {
rulesListModel.clear();
if (selected != null) {
}
List<EamOrganization> orgs = dbManager.getOrganizations();
if (orgs.size() > 0) {
for (EamOrganization org : orgs) {
rulesListModel.addElement(org);
if (selected != null && org.getOrgID() == selected.getOrgID()) {
selected = org;
}
}
if (orgs.contains(selected)) {
jList1.setSelectedValue(selected, true);
} else {
jList1.setSelectedIndex(0);
}
jList1.validate();
jList1.repaint();
}
}
private void populateList() throws EamDbException {
EamOrganization selected = jList1.getSelectedValue();
populateListAndSelect(selected);
}
/**
* 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() {
jScrollPane1 = new javax.swing.JScrollPane();
jPanel1 = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
jList1 = new javax.swing.JList<>();
jScrollPane4 = new javax.swing.JScrollPane();
jTextArea1 = new javax.swing.JTextArea();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
jSeparator1 = new javax.swing.JSeparator();
jLabel2 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
orgNameTextField = new javax.swing.JTextField();
pocNameTextField = new javax.swing.JTextField();
pocPhoneTextField = new javax.swing.JTextField();
pocEmailTextField = new javax.swing.JTextField();
jButton4 = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
setMinimumSize(new java.awt.Dimension(545, 450));
setPreferredSize(new java.awt.Dimension(545, 450));
jScrollPane1.setMinimumSize(null);
jScrollPane1.setPreferredSize(new java.awt.Dimension(535, 415));
jPanel1.setMinimumSize(null);
jPanel1.setPreferredSize(new java.awt.Dimension(527, 407));
jList1.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
jScrollPane2.setViewportView(jList1);
jTextArea1.setEditable(false);
jTextArea1.setBackground(new java.awt.Color(240, 240, 240));
jTextArea1.setColumns(20);
jTextArea1.setFont(new java.awt.Font("Tahoma", 0, 11)); // NOI18N
jTextArea1.setLineWrap(true);
jTextArea1.setRows(3);
jTextArea1.setText(org.openide.util.NbBundle.getMessage(ManageOrganizationsDialog.class, "ManageOrganizationsDialog.jTextArea1.text")); // NOI18N
jTextArea1.setWrapStyleWord(true);
jScrollPane4.setViewportView(jTextArea1);
org.openide.awt.Mnemonics.setLocalizedText(jButton1, org.openide.util.NbBundle.getMessage(ManageOrganizationsDialog.class, "ManageOrganizationsDialog.jButton1.text")); // NOI18N
jButton1.setMargin(new java.awt.Insets(2, 6, 2, 6));
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
org.openide.awt.Mnemonics.setLocalizedText(jButton2, org.openide.util.NbBundle.getMessage(ManageOrganizationsDialog.class, "ManageOrganizationsDialog.jButton2.text")); // NOI18N
jButton2.setMargin(new java.awt.Insets(2, 6, 2, 6));
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
org.openide.awt.Mnemonics.setLocalizedText(jButton3, org.openide.util.NbBundle.getMessage(ManageOrganizationsDialog.class, "ManageOrganizationsDialog.jButton3.text")); // NOI18N
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(ManageOrganizationsDialog.class, "ManageOrganizationsDialog.jLabel1.text")); // NOI18N
jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);
org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(ManageOrganizationsDialog.class, "ManageOrganizationsDialog.jLabel2.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(ManageOrganizationsDialog.class, "ManageOrganizationsDialog.jLabel4.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(ManageOrganizationsDialog.class, "ManageOrganizationsDialog.jLabel6.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(jLabel8, org.openide.util.NbBundle.getMessage(ManageOrganizationsDialog.class, "ManageOrganizationsDialog.jLabel8.text")); // NOI18N
orgNameTextField.setEditable(false);
orgNameTextField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
orgNameTextFieldActionPerformed(evt);
}
});
pocNameTextField.setEditable(false);
pocNameTextField.setText(org.openide.util.NbBundle.getMessage(ManageOrganizationsDialog.class, "ManageOrganizationsDialog.pocNameTextField.text")); // NOI18N
pocPhoneTextField.setEditable(false);
pocEmailTextField.setEditable(false);
pocEmailTextField.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
pocEmailTextFieldActionPerformed(evt);
}
});
org.openide.awt.Mnemonics.setLocalizedText(jButton4, org.openide.util.NbBundle.getMessage(ManageOrganizationsDialog.class, "ManageOrganizationsDialog.jButton4.text")); // NOI18N
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(ManageOrganizationsDialog.class, "ManageOrganizationsDialog.jLabel3.text")); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 225, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton4)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jButton2))
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 224, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, 217, Short.MAX_VALUE)
.addComponent(jButton3))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(29, 29, 29)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(jLabel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel6, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(pocNameTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 128, Short.MAX_VALUE)
.addComponent(pocPhoneTextField)
.addComponent(pocEmailTextField, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(orgNameTextField))))
.addContainerGap())
.addGroup(jPanel1Layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 115, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
);
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jButton1, jButton2, jButton4});
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel8)
.addComponent(orgNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(pocNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(pocPhoneTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel4))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(pocEmailTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 235, Short.MAX_VALUE)
.addComponent(jButton3))
.addComponent(jSeparator1)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 288, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jButton1)
.addComponent(jButton2)
.addComponent(jButton4))))
.addContainerGap())
);
jScrollPane1.setViewportView(jPanel1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, 0)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jButton2ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
dispose();
}//GEN-LAST:event_jButton3ActionPerformed
private void pocEmailTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pocEmailTextFieldActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_pocEmailTextFieldActionPerformed
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
AddNewOrganizationDialog dialogO = new AddNewOrganizationDialog();
if (dialogO.isChanged()) {
try {
newOrg = dialogO.getNewOrg();
populateListAndSelect(newOrg);
} catch (EamDbException ex) {
}
}
}//GEN-LAST:event_jButton1ActionPerformed
private void orgNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orgNameTextFieldActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_orgNameTextFieldActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
EamOrganization orgToEdit = jList1.getSelectedValue();
AddNewOrganizationDialog dialogO = new AddNewOrganizationDialog(orgToEdit);
if (dialogO.isChanged()) {
try {
newOrg = dialogO.getNewOrg();
populateListAndSelect(newOrg);
} catch (EamDbException ex) {
}
}
}//GEN-LAST:event_jButton4ActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel8;
private javax.swing.JList<EamOrganization> jList1;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane4;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JTextArea jTextArea1;
private javax.swing.JTextField orgNameTextField;
private javax.swing.JTextField pocEmailTextField;
private javax.swing.JTextField pocNameTextField;
private javax.swing.JTextField pocPhoneTextField;
// End of variables declaration//GEN-END:variables
public boolean isChanged() {
return newOrg != null;
}
public EamOrganization getNewOrg() {
return newOrg;
}
/**
* A list events listener for the interesting files sets list component.
*/
private final class OrganizationListSelectionListener implements ListSelectionListener {
@Override
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting()) {
return;
}
EamOrganization selected;
if (newOrg != null) {
selected = newOrg;
} else {
selected = jList1.getSelectedValue();
}
if (selected != null) {
orgNameTextField.setText(selected.getName());
pocNameTextField.setText(selected.getPocName());
pocPhoneTextField.setText(selected.getPocPhone());
pocEmailTextField.setText(selected.getPocEmail());
} else {
orgNameTextField.setText("");
pocNameTextField.setText("");
pocPhoneTextField.setText("");
pocEmailTextField.setText("");
}
}
}
}