19 package org.sleuthkit.autopsy.casemodule;
21 import java.awt.Cursor;
22 import java.util.logging.Level;
23 import javax.swing.JComboBox;
24 import org.openide.util.NbBundle.Messages;
38 @SuppressWarnings(
"PMD.SingularField")
39 final class OptionalCasePropertiesPanel extends javax.swing.JPanel {
41 private final static Logger logger = Logger.getLogger(OptionalCasePropertiesPanel.class.getName());
42 private static final long serialVersionUID = 1L;
43 private CentralRepoOrganization selectedOrg = null;
44 private java.util.List<CentralRepoOrganization> orgs = null;
49 OptionalCasePropertiesPanel() {
51 caseDisplayNameLabel.setVisible(
false);
52 caseDisplayNameTextField.setVisible(
false);
53 lbPointOfContactNameLabel.setVisible(
false);
54 lbPointOfContactNameText.setVisible(
false);
55 lbPointOfContactPhoneLabel.setVisible(
false);
56 lbPointOfContactPhoneText.setVisible(
false);
57 lbPointOfContactEmailLabel.setVisible(
false);
58 lbPointOfContactEmailText.setVisible(
false);
59 setUpCaseDetailsFields();
62 OptionalCasePropertiesPanel(
boolean editCurrentCase) {
64 if (editCurrentCase) {
67 openCase = Case.getCurrentCaseThrows();
68 }
catch (NoCurrentCaseException ex) {
69 logger.log(Level.SEVERE,
"Exception while getting open case.", ex);
72 caseDisplayNameTextField.setText(openCase.getDisplayName());
73 caseNumberTextField.setText(openCase.getNumber());
74 examinerTextField.setText(openCase.getExaminer());
75 tfExaminerEmailText.setText(openCase.getExaminerEmail());
76 tfExaminerPhoneText.setText(openCase.getExaminerPhone());
77 taNotesText.setText(openCase.getCaseNotes());
78 setUpCaseDetailsFields();
79 setUpOrganizationData();
81 caseDisplayNameLabel.setVisible(
false);
82 caseDisplayNameTextField.setVisible(
false);
83 lbPointOfContactNameLabel.setVisible(
false);
84 lbPointOfContactNameText.setVisible(
false);
85 lbPointOfContactPhoneLabel.setVisible(
false);
86 lbPointOfContactPhoneText.setVisible(
false);
87 lbPointOfContactEmailLabel.setVisible(
false);
88 lbPointOfContactEmailText.setVisible(
false);
89 setUpCaseDetailsFields();
94 private void setUpOrganizationData() {
95 if (CentralRepository.isEnabled()) {
97 Case currentCase = Case.getCurrentCaseThrows();
98 if (currentCase != null) {
99 CentralRepository dbManager = CentralRepository.getInstance();
100 selectedOrg = dbManager.getCase(currentCase).getOrg();
102 }
catch (CentralRepoException ex) {
103 logger.log(Level.SEVERE,
"Unable to get Organization associated with the case from Central Repo", ex);
104 }
catch (NoCurrentCaseException ex) {
105 logger.log(Level.SEVERE,
"Exception while getting open case.", ex);
108 if (selectedOrg != null) {
109 setCurrentlySelectedOrganization(selectedOrg.getName());
112 setCurrentlySelectedOrganization(CentralRepoDbUtil.getDefaultOrgName());
117 void setUpCaseDetailsFields() {
118 boolean cREnabled = CentralRepository.isEnabled();
119 comboBoxOrgName.setEnabled(cREnabled);
120 bnNewOrganization.setEnabled(cREnabled);
121 lbPointOfContactNameText.setEnabled(cREnabled);
122 lbPointOfContactEmailText.setEnabled(cREnabled);
123 lbPointOfContactPhoneText.setEnabled(cREnabled);
124 lbOrganizationNameLabel.setEnabled(cREnabled);
125 lbPointOfContactNameLabel.setEnabled(cREnabled);
126 lbPointOfContactEmailLabel.setEnabled(cREnabled);
127 lbPointOfContactPhoneLabel.setEnabled(cREnabled);
128 orgainizationPanel.setEnabled(cREnabled);
132 loadOrganizationData();
137 private void loadOrganizationData() {
138 Object selectedBeforeLoad = comboBoxOrgName.getSelectedItem();
139 comboBoxOrgName.removeAllItems();
141 CentralRepository dbManager = CentralRepository.getInstance();
142 orgs = dbManager.getOrganizations();
143 orgs.forEach((
org) -> {
144 comboBoxOrgName.addItem(
org.getName());
146 comboBoxOrgName.setSelectedItem(selectedBeforeLoad);
147 }
catch (CentralRepoException ex) {
148 logger.log(Level.WARNING,
"Unable to populate list of Organizations from Central Repo", ex);
152 private void clearOrganization() {
154 lbPointOfContactNameText.setText(
"");
155 lbPointOfContactEmailText.setText(
"");
156 lbPointOfContactPhoneText.setText(
"");
159 String getCaseNumber() {
160 return caseNumberTextField.getText();
163 String getExaminerName() {
164 return examinerTextField.getText();
167 String getExaminerPhone() {
168 return tfExaminerPhoneText.getText();
171 String getExaminerEmail() {
172 return tfExaminerEmailText.getText();
175 String getCaseNotes() {
176 return taNotesText.getText();
179 String getOrganization() {
180 if (selectedOrg != null) {
181 return selectedOrg.getName();
183 return CentralRepoDbUtil.getDefaultOrgName();
187 void setCaseNumberField(String caseNumber) {
188 caseNumberTextField.setText(caseNumber == null ?
"" : caseNumber);
191 void setExaminerNameField(String examinerName) {
192 examinerTextField.setText(examinerName == null ?
"" : examinerName);
195 void setExaminerPhoneField(String examinerPhone) {
196 tfExaminerPhoneText.setText(examinerPhone == null ?
"" : examinerPhone);
199 void setExaminerEmailField(String examinerEmail) {
200 tfExaminerEmailText.setText(examinerEmail == null ?
"" : examinerEmail);
203 void setCaseNotesField(String caseNotes) {
204 taNotesText.setText(caseNotes == null ?
"" : caseNotes);
207 @Messages({
"OptionalCasePropertiesPanel.caseDisplayNameLabel.text=Name:",
208 "OptionalCasePropertiesPanel.lbPointOfContactEmailLabel.text=Email:",
209 "OptionalCasePropertiesPanel.lbOrganizationNameLabel.text=Organization analysis is being done for:",
210 "OptionalCasePropertiesPanel.bnNewOrganization.text=Manage Organizations",
211 "OptionalCasePropertiesPanel.lbPointOfContactNameLabel.text=Point of Contact:",
212 "OptionalCasePropertiesPanel.lbPointOfContactPhoneLabel.text=Phone:",
213 "OptionalCasePropertiesPanel.orgainizationPanel.border.title=Organization",
214 "OptionalCasePropertiesPanel.lbNotesLabel.text=Notes:",
215 "OptionalCasePropertiesPanel.examinerLabel.text=Name:",
216 "OptionalCasePropertiesPanel.lbExaminerEmailLabel.text=Email:",
217 "OptionalCasePropertiesPanel.lbExaminerPhoneLabel.text=Phone:",
218 "OptionalCasePropertiesPanel.examinerPanel.border.title=Examiner",
219 "OptionalCasePropertiesPanel.caseNumberLabel.text=Number:",
220 "OptionalCasePropertiesPanel.casePanel.border.title=Case"
227 @SuppressWarnings(
"unchecked")
229 private
void initComponents() {
231 casePanel =
new javax.swing.JPanel();
232 caseNumberLabel =
new javax.swing.JLabel();
233 caseNumberTextField =
new javax.swing.JTextField();
234 caseDisplayNameLabel =
new javax.swing.JLabel();
235 caseDisplayNameTextField =
new javax.swing.JTextField();
236 examinerPanel =
new javax.swing.JPanel();
237 tfExaminerPhoneText =
new javax.swing.JTextField();
238 lbExaminerPhoneLabel =
new javax.swing.JLabel();
239 caseNotesScrollPane =
new javax.swing.JScrollPane();
240 taNotesText =
new javax.swing.JTextArea();
241 tfExaminerEmailText =
new javax.swing.JTextField();
242 examinerTextField =
new javax.swing.JTextField();
243 lbExaminerEmailLabel =
new javax.swing.JLabel();
244 examinerLabel =
new javax.swing.JLabel();
245 lbNotesLabel =
new javax.swing.JLabel();
246 orgainizationPanel =
new javax.swing.JPanel();
247 lbPointOfContactPhoneLabel =
new javax.swing.JLabel();
248 comboBoxOrgName =
new javax.swing.JComboBox<>();
249 lbPointOfContactNameLabel =
new javax.swing.JLabel();
250 bnNewOrganization =
new javax.swing.JButton();
251 lbPointOfContactEmailText =
new javax.swing.JLabel();
252 lbPointOfContactNameText =
new javax.swing.JLabel();
253 lbOrganizationNameLabel =
new javax.swing.JLabel();
254 lbPointOfContactEmailLabel =
new javax.swing.JLabel();
255 lbPointOfContactPhoneText =
new javax.swing.JLabel();
257 casePanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.casePanel.border.title")));
259 org.openide.awt.Mnemonics.setLocalizedText(caseNumberLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.caseNumberLabel.text"));
260 caseNumberLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
261 caseNumberLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
262 caseNumberLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
264 org.openide.awt.Mnemonics.setLocalizedText(caseDisplayNameLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.caseDisplayNameLabel.text"));
265 caseDisplayNameLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
266 caseDisplayNameLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
267 caseDisplayNameLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
268 caseDisplayNameLabel.setVerifyInputWhenFocusTarget(
false);
270 javax.swing.GroupLayout casePanelLayout =
new javax.swing.GroupLayout(casePanel);
271 casePanel.setLayout(casePanelLayout);
272 casePanelLayout.setHorizontalGroup(
273 casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
274 .addGroup(casePanelLayout.createSequentialGroup()
276 .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
277 .addComponent(caseNumberLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
278 .addComponent(caseDisplayNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
279 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
280 .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
281 .addComponent(caseNumberTextField)
282 .addComponent(caseDisplayNameTextField))
285 casePanelLayout.setVerticalGroup(
286 casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
287 .addGroup(casePanelLayout.createSequentialGroup()
289 .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
290 .addComponent(caseDisplayNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
291 .addComponent(caseDisplayNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
292 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
293 .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
294 .addComponent(caseNumberLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
295 .addComponent(caseNumberTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
299 examinerPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.examinerPanel.border.title")));
301 org.openide.awt.Mnemonics.setLocalizedText(lbExaminerPhoneLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbExaminerPhoneLabel.text"));
302 lbExaminerPhoneLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
303 lbExaminerPhoneLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
304 lbExaminerPhoneLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
306 caseNotesScrollPane.setBorder(javax.swing.BorderFactory.createEtchedBorder());
308 taNotesText.setColumns(20);
309 taNotesText.setLineWrap(
true);
310 taNotesText.setRows(2);
311 taNotesText.setWrapStyleWord(
true);
312 taNotesText.setBorder(null);
313 caseNotesScrollPane.setViewportView(taNotesText);
315 org.openide.awt.Mnemonics.setLocalizedText(lbExaminerEmailLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbExaminerEmailLabel.text"));
316 lbExaminerEmailLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
317 lbExaminerEmailLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
318 lbExaminerEmailLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
320 org.openide.awt.Mnemonics.setLocalizedText(examinerLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.examinerLabel.text"));
321 examinerLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
322 examinerLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
323 examinerLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
325 org.openide.awt.Mnemonics.setLocalizedText(lbNotesLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbNotesLabel.text"));
326 lbNotesLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
327 lbNotesLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
328 lbNotesLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
330 javax.swing.GroupLayout examinerPanelLayout =
new javax.swing.GroupLayout(examinerPanel);
331 examinerPanel.setLayout(examinerPanelLayout);
332 examinerPanelLayout.setHorizontalGroup(
333 examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
334 .addGroup(examinerPanelLayout.createSequentialGroup()
336 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
337 .addGroup(examinerPanelLayout.createSequentialGroup()
338 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
339 .addComponent(lbNotesLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
340 .addComponent(lbExaminerPhoneLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
341 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
342 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
343 .addComponent(caseNotesScrollPane)
344 .addComponent(tfExaminerPhoneText)))
345 .addGroup(examinerPanelLayout.createSequentialGroup()
346 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
347 .addComponent(lbExaminerEmailLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
348 .addComponent(examinerLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
349 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
350 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
351 .addComponent(examinerTextField)
352 .addComponent(tfExaminerEmailText))))
356 examinerPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {examinerLabel, lbExaminerEmailLabel, lbExaminerPhoneLabel, lbNotesLabel});
358 examinerPanelLayout.setVerticalGroup(
359 examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
360 .addGroup(examinerPanelLayout.createSequentialGroup()
362 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
363 .addComponent(examinerLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
364 .addComponent(examinerTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
365 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
366 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
367 .addComponent(tfExaminerPhoneText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
368 .addComponent(lbExaminerPhoneLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
369 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
370 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
371 .addComponent(tfExaminerEmailText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
372 .addComponent(lbExaminerEmailLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
373 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
374 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
375 .addComponent(lbNotesLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
376 .addComponent(caseNotesScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
380 orgainizationPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.orgainizationPanel.border.title")));
382 org.openide.awt.Mnemonics.setLocalizedText(lbPointOfContactPhoneLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbPointOfContactPhoneLabel.text"));
383 lbPointOfContactPhoneLabel.setMaximumSize(
new java.awt.Dimension(82, 14));
384 lbPointOfContactPhoneLabel.setMinimumSize(
new java.awt.Dimension(82, 14));
385 lbPointOfContactPhoneLabel.setPreferredSize(
new java.awt.Dimension(82, 14));
387 comboBoxOrgName.addActionListener(
new java.awt.event.ActionListener() {
388 public void actionPerformed(java.awt.event.ActionEvent evt) {
389 comboBoxOrgNameActionPerformed(evt);
393 org.openide.awt.Mnemonics.setLocalizedText(lbPointOfContactNameLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbPointOfContactNameLabel.text"));
394 lbPointOfContactNameLabel.setMaximumSize(
new java.awt.Dimension(82, 14));
395 lbPointOfContactNameLabel.setMinimumSize(
new java.awt.Dimension(82, 14));
396 lbPointOfContactNameLabel.setPreferredSize(
new java.awt.Dimension(82, 14));
398 org.openide.awt.Mnemonics.setLocalizedText(bnNewOrganization,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.bnNewOrganization.text"));
399 bnNewOrganization.setMargin(
new java.awt.Insets(2, 6, 2, 6));
400 bnNewOrganization.setMaximumSize(
new java.awt.Dimension(123, 23));
401 bnNewOrganization.setMinimumSize(
new java.awt.Dimension(123, 23));
402 bnNewOrganization.setPreferredSize(
new java.awt.Dimension(123, 23));
403 bnNewOrganization.addActionListener(
new java.awt.event.ActionListener() {
404 public void actionPerformed(java.awt.event.ActionEvent evt) {
405 bnNewOrganizationActionPerformed(evt);
409 org.openide.awt.Mnemonics.setLocalizedText(lbOrganizationNameLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbOrganizationNameLabel.text"));
410 lbOrganizationNameLabel.setMaximumSize(
new java.awt.Dimension(189, 14));
411 lbOrganizationNameLabel.setMinimumSize(
new java.awt.Dimension(189, 14));
412 lbOrganizationNameLabel.setPreferredSize(
new java.awt.Dimension(189, 14));
414 org.openide.awt.Mnemonics.setLocalizedText(lbPointOfContactEmailLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbPointOfContactEmailLabel.text"));
415 lbPointOfContactEmailLabel.setMaximumSize(
new java.awt.Dimension(82, 14));
416 lbPointOfContactEmailLabel.setMinimumSize(
new java.awt.Dimension(82, 14));
417 lbPointOfContactEmailLabel.setPreferredSize(
new java.awt.Dimension(82, 14));
419 javax.swing.GroupLayout orgainizationPanelLayout =
new javax.swing.GroupLayout(orgainizationPanel);
420 orgainizationPanel.setLayout(orgainizationPanelLayout);
421 orgainizationPanelLayout.setHorizontalGroup(
422 orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
423 .addGroup(orgainizationPanelLayout.createSequentialGroup()
424 .addGroup(orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
425 .addGroup(orgainizationPanelLayout.createSequentialGroup()
426 .addGap(106, 106, 106)
427 .addGroup(orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
428 .addComponent(lbPointOfContactPhoneLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
429 .addComponent(lbPointOfContactEmailLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
430 .addComponent(lbPointOfContactNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE))
431 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
432 .addGroup(orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
433 .addComponent(lbPointOfContactPhoneText, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
434 .addComponent(lbPointOfContactNameText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
435 .addComponent(lbPointOfContactEmailText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
436 .addGroup(orgainizationPanelLayout.createSequentialGroup()
438 .addComponent(lbOrganizationNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 206, Short.MAX_VALUE)
440 .addComponent(comboBoxOrgName, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
441 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
442 .addComponent(bnNewOrganization, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)))
446 orgainizationPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {lbPointOfContactEmailLabel, lbPointOfContactNameLabel, lbPointOfContactPhoneLabel});
448 orgainizationPanelLayout.setVerticalGroup(
449 orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
450 .addGroup(orgainizationPanelLayout.createSequentialGroup()
452 .addGroup(orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
453 .addComponent(lbOrganizationNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
454 .addComponent(comboBoxOrgName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
455 .addComponent(bnNewOrganization, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
456 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
457 .addGroup(orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
458 .addComponent(lbPointOfContactNameText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
459 .addComponent(lbPointOfContactNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
460 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
461 .addGroup(orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
462 .addComponent(lbPointOfContactPhoneLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
463 .addComponent(lbPointOfContactPhoneText, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
464 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
465 .addGroup(orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
466 .addComponent(lbPointOfContactEmailLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
467 .addComponent(lbPointOfContactEmailText, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
471 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
472 this.setLayout(layout);
473 layout.setHorizontalGroup(
474 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
475 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
477 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
478 .addComponent(casePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
479 .addComponent(examinerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
480 .addComponent(orgainizationPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
483 layout.setVerticalGroup(
484 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
485 .addGroup(layout.createSequentialGroup()
487 .addComponent(casePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
489 .addComponent(examinerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
491 .addComponent(orgainizationPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
496 private void comboBoxOrgNameActionPerformed(java.awt.event.ActionEvent evt) {
497 @SuppressWarnings(
"unchecked")
498 JComboBox<String> cb = (JComboBox<String>) evt.getSource();
499 String orgName = (String) cb.getSelectedItem();
500 if (null == orgName) {
503 if (
"".equals(orgName)) {
507 for (CentralRepoOrganization
org : orgs) {
508 if (
org.getName().equals(orgName)) {
510 lbPointOfContactNameText.setText(selectedOrg.getPocName());
511 lbPointOfContactEmailText.setText(selectedOrg.getPocEmail());
512 lbPointOfContactPhoneText.setText(selectedOrg.getPocPhone());
518 private void bnNewOrganizationActionPerformed(java.awt.event.ActionEvent evt) {
519 ManageOrganizationsDialog dialog =
new ManageOrganizationsDialog();
521 loadOrganizationData();
522 if (dialog.isChanged()) {
523 selectedOrg = dialog.getNewOrg();
524 setCurrentlySelectedOrganization(dialog.getNewOrg().getName());
530 void setCurrentlySelectedOrganization(String orgName) {
531 comboBoxOrgName.setSelectedItem(orgName == null ? CentralRepoDbUtil.getDefaultOrgName() : orgName);
535 "OptionalCasePropertiesPanel.errorDialog.emptyCaseNameMessage=No case name entered.",
536 "OptionalCasePropertiesPanel.errorDialog.invalidCaseNameMessage=Case names cannot include the following symbols: \\, /, :, *, ?, \", <, >, |",
537 "OptionalCasePropertiesPanel.errorDialog.noOpenCase.errMsg=Exception while getting open case."
539 void saveUpdatedCaseDetails() {
540 if (caseDisplayNameTextField.getText().trim().isEmpty()) {
541 MessageNotifyUtil.Message.error(Bundle.OptionalCasePropertiesPanel_errorDialog_emptyCaseNameMessage());
544 if (!Case.isValidName(caseDisplayNameTextField.getText())) {
545 MessageNotifyUtil.Message.error(Bundle.OptionalCasePropertiesPanel_errorDialog_invalidCaseNameMessage());
550 }
catch (NoCurrentCaseException ex) {
551 MessageNotifyUtil.Message.error(Bundle.OptionalCasePropertiesPanel_errorDialog_noOpenCase_errMsg());
554 updateCorrelationCase();
557 private void updateCaseDetails() throws NoCurrentCaseException {
558 if (caseDisplayNameTextField.isVisible()) {
560 Case.getCurrentCaseThrows().updateCaseDetails(
new CaseDetails(
561 caseDisplayNameTextField.getText(), caseNumberTextField.getText(),
562 examinerTextField.getText(), tfExaminerPhoneText.getText(),
563 tfExaminerEmailText.getText(), taNotesText.getText()));
564 }
catch (CaseActionException ex) {
565 logger.log(Level.WARNING,
"Error updating case details", ex);
574 private void updateCorrelationCase() {
575 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
576 if (CentralRepository.isEnabled()) {
578 CentralRepository dbManager = CentralRepository.getInstance();
579 CorrelationCase correlationCase = dbManager.getCase(Case.getCurrentCaseThrows());
580 if (caseDisplayNameTextField.isVisible()) {
581 correlationCase.setDisplayName(caseDisplayNameTextField.getText());
583 correlationCase.setOrg(selectedOrg);
584 correlationCase.setCaseNumber(caseNumberTextField.getText());
585 correlationCase.setExaminerName(examinerTextField.getText());
586 correlationCase.setExaminerEmail(tfExaminerEmailText.getText());
587 correlationCase.setExaminerPhone(tfExaminerPhoneText.getText());
588 correlationCase.setNotes(taNotesText.getText());
589 dbManager.updateCase(correlationCase);
590 }
catch (CentralRepoException ex) {
591 logger.log(Level.SEVERE,
"Error connecting to central repository database", ex);
592 }
catch (NoCurrentCaseException ex) {
593 logger.log(Level.SEVERE,
"Exception while getting open case.", ex);
595 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
600 private javax.swing.JButton bnNewOrganization;
601 private javax.swing.JLabel caseDisplayNameLabel;
602 private javax.swing.JTextField caseDisplayNameTextField;
603 private javax.swing.JScrollPane caseNotesScrollPane;
604 private javax.swing.JLabel caseNumberLabel;
605 private javax.swing.JTextField caseNumberTextField;
606 private javax.swing.JPanel casePanel;
607 private javax.swing.JComboBox<String> comboBoxOrgName;
608 private javax.swing.JLabel examinerLabel;
609 private javax.swing.JPanel examinerPanel;
610 private javax.swing.JTextField examinerTextField;
611 private javax.swing.JLabel lbExaminerEmailLabel;
612 private javax.swing.JLabel lbExaminerPhoneLabel;
613 private javax.swing.JLabel lbNotesLabel;
614 private javax.swing.JLabel lbOrganizationNameLabel;
615 private javax.swing.JLabel lbPointOfContactEmailLabel;
616 private javax.swing.JLabel lbPointOfContactEmailText;
617 private javax.swing.JLabel lbPointOfContactNameLabel;
618 private javax.swing.JLabel lbPointOfContactNameText;
619 private javax.swing.JLabel lbPointOfContactPhoneLabel;
620 private javax.swing.JLabel lbPointOfContactPhoneText;
621 private javax.swing.JPanel orgainizationPanel;
622 private javax.swing.JTextArea taNotesText;
623 private javax.swing.JTextField tfExaminerEmailText;
624 private javax.swing.JTextField tfExaminerPhoneText;