19 package org.sleuthkit.autopsy.casemodule;
21 import java.awt.Cursor;
22 import java.awt.Dialog;
23 import java.util.logging.Level;
24 import javax.swing.JComboBox;
25 import javax.swing.SwingUtilities;
26 import org.openide.util.NbBundle.Messages;
40 @SuppressWarnings(
"PMD.SingularField")
41 final class OptionalCasePropertiesPanel extends javax.swing.JPanel {
43 private final static Logger logger = Logger.getLogger(OptionalCasePropertiesPanel.class.getName());
44 private static final long serialVersionUID = 1L;
45 private CentralRepoOrganization selectedOrg = null;
46 private java.util.List<CentralRepoOrganization> orgs = null;
51 OptionalCasePropertiesPanel() {
53 caseDisplayNameLabel.setVisible(
false);
54 caseDisplayNameTextField.setVisible(
false);
55 lbPointOfContactNameLabel.setVisible(
false);
56 lbPointOfContactNameText.setVisible(
false);
57 lbPointOfContactPhoneLabel.setVisible(
false);
58 lbPointOfContactPhoneText.setVisible(
false);
59 lbPointOfContactEmailLabel.setVisible(
false);
60 lbPointOfContactEmailText.setVisible(
false);
61 setUpCaseDetailsFields();
64 OptionalCasePropertiesPanel(
boolean editCurrentCase) {
66 if (editCurrentCase) {
69 openCase = Case.getCurrentCaseThrows();
70 }
catch (NoCurrentCaseException ex) {
71 logger.log(Level.SEVERE,
"Exception while getting open case.", ex);
74 caseDisplayNameTextField.setText(openCase.getDisplayName());
75 caseNumberTextField.setText(openCase.getNumber());
76 examinerTextField.setText(openCase.getExaminer());
77 tfExaminerEmailText.setText(openCase.getExaminerEmail());
78 tfExaminerPhoneText.setText(openCase.getExaminerPhone());
79 taNotesText.setText(openCase.getCaseNotes());
80 setUpCaseDetailsFields();
81 setUpOrganizationData();
83 caseDisplayNameLabel.setVisible(
false);
84 caseDisplayNameTextField.setVisible(
false);
85 lbPointOfContactNameLabel.setVisible(
false);
86 lbPointOfContactNameText.setVisible(
false);
87 lbPointOfContactPhoneLabel.setVisible(
false);
88 lbPointOfContactPhoneText.setVisible(
false);
89 lbPointOfContactEmailLabel.setVisible(
false);
90 lbPointOfContactEmailText.setVisible(
false);
91 setUpCaseDetailsFields();
96 private void setUpOrganizationData() {
97 if (CentralRepository.isEnabled()) {
99 Case currentCase = Case.getCurrentCaseThrows();
100 if (currentCase != null) {
101 CentralRepository dbManager = CentralRepository.getInstance();
102 selectedOrg = dbManager.getCase(currentCase).getOrg();
104 }
catch (CentralRepoException ex) {
105 logger.log(Level.SEVERE,
"Unable to get Organization associated with the case from Central Repo", ex);
106 }
catch (NoCurrentCaseException ex) {
107 logger.log(Level.SEVERE,
"Exception while getting open case.", ex);
110 if (selectedOrg != null) {
111 setCurrentlySelectedOrganization(selectedOrg.getName());
114 setCurrentlySelectedOrganization(CentralRepoDbUtil.getDefaultOrgName());
119 void setUpCaseDetailsFields() {
120 boolean cREnabled = CentralRepository.isEnabled();
121 comboBoxOrgName.setEnabled(cREnabled);
122 bnNewOrganization.setEnabled(cREnabled);
123 lbPointOfContactNameText.setEnabled(cREnabled);
124 lbPointOfContactEmailText.setEnabled(cREnabled);
125 lbPointOfContactPhoneText.setEnabled(cREnabled);
126 lbOrganizationNameLabel.setEnabled(cREnabled);
127 lbPointOfContactNameLabel.setEnabled(cREnabled);
128 lbPointOfContactEmailLabel.setEnabled(cREnabled);
129 lbPointOfContactPhoneLabel.setEnabled(cREnabled);
130 orgainizationPanel.setEnabled(cREnabled);
134 loadOrganizationData();
139 private void loadOrganizationData() {
140 Object selectedBeforeLoad = comboBoxOrgName.getSelectedItem();
141 comboBoxOrgName.removeAllItems();
143 CentralRepository dbManager = CentralRepository.getInstance();
144 orgs = dbManager.getOrganizations();
145 orgs.forEach((
org) -> {
146 comboBoxOrgName.addItem(
org.getName());
148 comboBoxOrgName.setSelectedItem(selectedBeforeLoad);
149 }
catch (CentralRepoException ex) {
150 logger.log(Level.WARNING,
"Unable to populate list of Organizations from Central Repo", ex);
154 private void clearOrganization() {
156 lbPointOfContactNameText.setText(
"");
157 lbPointOfContactEmailText.setText(
"");
158 lbPointOfContactPhoneText.setText(
"");
161 String getCaseNumber() {
162 return caseNumberTextField.getText();
165 String getExaminerName() {
166 return examinerTextField.getText();
169 String getExaminerPhone() {
170 return tfExaminerPhoneText.getText();
173 String getExaminerEmail() {
174 return tfExaminerEmailText.getText();
177 String getCaseNotes() {
178 return taNotesText.getText();
181 String getOrganization() {
182 if (selectedOrg != null) {
183 return selectedOrg.getName();
185 return CentralRepoDbUtil.getDefaultOrgName();
189 void setCaseNumberField(String caseNumber) {
190 caseNumberTextField.setText(caseNumber == null ?
"" : caseNumber);
193 void setExaminerNameField(String examinerName) {
194 examinerTextField.setText(examinerName == null ?
"" : examinerName);
197 void setExaminerPhoneField(String examinerPhone) {
198 tfExaminerPhoneText.setText(examinerPhone == null ?
"" : examinerPhone);
201 void setExaminerEmailField(String examinerEmail) {
202 tfExaminerEmailText.setText(examinerEmail == null ?
"" : examinerEmail);
205 void setCaseNotesField(String caseNotes) {
206 taNotesText.setText(caseNotes == null ?
"" : caseNotes);
209 @Messages({
"OptionalCasePropertiesPanel.caseDisplayNameLabel.text=Name:",
210 "OptionalCasePropertiesPanel.lbPointOfContactEmailLabel.text=Email:",
211 "OptionalCasePropertiesPanel.lbOrganizationNameLabel.text=Organization analysis is being done for:",
212 "OptionalCasePropertiesPanel.bnNewOrganization.text=Manage Organizations",
213 "OptionalCasePropertiesPanel.lbPointOfContactNameLabel.text=Point of Contact:",
214 "OptionalCasePropertiesPanel.lbPointOfContactPhoneLabel.text=Phone:",
215 "OptionalCasePropertiesPanel.orgainizationPanel.border.title=Organization",
216 "OptionalCasePropertiesPanel.lbNotesLabel.text=Notes:",
217 "OptionalCasePropertiesPanel.examinerLabel.text=Name:",
218 "OptionalCasePropertiesPanel.lbExaminerEmailLabel.text=Email:",
219 "OptionalCasePropertiesPanel.lbExaminerPhoneLabel.text=Phone:",
220 "OptionalCasePropertiesPanel.examinerPanel.border.title=Examiner",
221 "OptionalCasePropertiesPanel.caseNumberLabel.text=Number:",
222 "OptionalCasePropertiesPanel.casePanel.border.title=Case"
229 @SuppressWarnings(
"unchecked")
231 private
void initComponents() {
232 java.awt.GridBagConstraints gridBagConstraints;
234 casePanel =
new javax.swing.JPanel();
235 caseNumberLabel =
new javax.swing.JLabel();
236 caseNumberTextField =
new javax.swing.JTextField();
237 caseDisplayNameLabel =
new javax.swing.JLabel();
238 caseDisplayNameTextField =
new javax.swing.JTextField();
239 examinerPanel =
new javax.swing.JPanel();
240 tfExaminerPhoneText =
new javax.swing.JTextField();
241 lbExaminerPhoneLabel =
new javax.swing.JLabel();
242 caseNotesScrollPane =
new javax.swing.JScrollPane();
243 taNotesText =
new javax.swing.JTextArea();
244 tfExaminerEmailText =
new javax.swing.JTextField();
245 examinerTextField =
new javax.swing.JTextField();
246 lbExaminerEmailLabel =
new javax.swing.JLabel();
247 examinerLabel =
new javax.swing.JLabel();
248 lbNotesLabel =
new javax.swing.JLabel();
249 orgainizationPanel =
new javax.swing.JPanel();
250 lbPointOfContactPhoneLabel =
new javax.swing.JLabel();
251 comboBoxOrgName =
new javax.swing.JComboBox<>();
252 lbPointOfContactNameLabel =
new javax.swing.JLabel();
253 bnNewOrganization =
new javax.swing.JButton();
254 lbPointOfContactEmailText =
new javax.swing.JLabel();
255 lbPointOfContactNameText =
new javax.swing.JLabel();
256 lbOrganizationNameLabel =
new javax.swing.JLabel();
257 lbPointOfContactEmailLabel =
new javax.swing.JLabel();
258 lbPointOfContactPhoneText =
new javax.swing.JLabel();
260 casePanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.casePanel.border.title")));
262 org.openide.awt.Mnemonics.setLocalizedText(caseNumberLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.caseNumberLabel.text"));
263 caseNumberLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
264 caseNumberLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
265 caseNumberLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
267 org.openide.awt.Mnemonics.setLocalizedText(caseDisplayNameLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.caseDisplayNameLabel.text"));
268 caseDisplayNameLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
269 caseDisplayNameLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
270 caseDisplayNameLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
271 caseDisplayNameLabel.setVerifyInputWhenFocusTarget(
false);
273 javax.swing.GroupLayout casePanelLayout =
new javax.swing.GroupLayout(casePanel);
274 casePanel.setLayout(casePanelLayout);
275 casePanelLayout.setHorizontalGroup(
276 casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
277 .addGroup(casePanelLayout.createSequentialGroup()
279 .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
280 .addComponent(caseNumberLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
281 .addComponent(caseDisplayNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
282 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
283 .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
284 .addComponent(caseNumberTextField)
285 .addComponent(caseDisplayNameTextField))
288 casePanelLayout.setVerticalGroup(
289 casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
290 .addGroup(casePanelLayout.createSequentialGroup()
292 .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
293 .addComponent(caseDisplayNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
294 .addComponent(caseDisplayNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
295 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
296 .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
297 .addComponent(caseNumberLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
298 .addComponent(caseNumberTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
302 examinerPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.examinerPanel.border.title")));
304 org.openide.awt.Mnemonics.setLocalizedText(lbExaminerPhoneLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbExaminerPhoneLabel.text"));
305 lbExaminerPhoneLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
306 lbExaminerPhoneLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
307 lbExaminerPhoneLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
309 caseNotesScrollPane.setBorder(javax.swing.BorderFactory.createEtchedBorder());
311 taNotesText.setColumns(20);
312 taNotesText.setLineWrap(
true);
313 taNotesText.setRows(2);
314 taNotesText.setWrapStyleWord(
true);
315 taNotesText.setBorder(null);
316 caseNotesScrollPane.setViewportView(taNotesText);
318 org.openide.awt.Mnemonics.setLocalizedText(lbExaminerEmailLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbExaminerEmailLabel.text"));
319 lbExaminerEmailLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
320 lbExaminerEmailLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
321 lbExaminerEmailLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
323 org.openide.awt.Mnemonics.setLocalizedText(examinerLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.examinerLabel.text"));
324 examinerLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
325 examinerLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
326 examinerLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
328 org.openide.awt.Mnemonics.setLocalizedText(lbNotesLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbNotesLabel.text"));
329 lbNotesLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
330 lbNotesLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
331 lbNotesLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
333 javax.swing.GroupLayout examinerPanelLayout =
new javax.swing.GroupLayout(examinerPanel);
334 examinerPanel.setLayout(examinerPanelLayout);
335 examinerPanelLayout.setHorizontalGroup(
336 examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
337 .addGroup(examinerPanelLayout.createSequentialGroup()
339 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
340 .addGroup(examinerPanelLayout.createSequentialGroup()
341 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
342 .addComponent(lbNotesLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
343 .addComponent(lbExaminerPhoneLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
344 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
345 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
346 .addComponent(caseNotesScrollPane)
347 .addComponent(tfExaminerPhoneText)))
348 .addGroup(examinerPanelLayout.createSequentialGroup()
349 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
350 .addComponent(lbExaminerEmailLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
351 .addComponent(examinerLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
352 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
353 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
354 .addComponent(examinerTextField)
355 .addComponent(tfExaminerEmailText))))
359 examinerPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {examinerLabel, lbExaminerEmailLabel, lbExaminerPhoneLabel, lbNotesLabel});
361 examinerPanelLayout.setVerticalGroup(
362 examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
363 .addGroup(examinerPanelLayout.createSequentialGroup()
365 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
366 .addComponent(examinerLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
367 .addComponent(examinerTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
368 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
369 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
370 .addComponent(tfExaminerPhoneText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
371 .addComponent(lbExaminerPhoneLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
372 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
373 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
374 .addComponent(tfExaminerEmailText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
375 .addComponent(lbExaminerEmailLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
376 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
377 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
378 .addComponent(lbNotesLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
379 .addComponent(caseNotesScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
383 orgainizationPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.orgainizationPanel.border.title")));
384 orgainizationPanel.setLayout(
new java.awt.GridBagLayout());
386 org.openide.awt.Mnemonics.setLocalizedText(lbPointOfContactPhoneLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbPointOfContactPhoneLabel.text"));
387 lbPointOfContactPhoneLabel.setMaximumSize(
new java.awt.Dimension(182, 14));
388 lbPointOfContactPhoneLabel.setMinimumSize(
new java.awt.Dimension(82, 14));
389 lbPointOfContactPhoneLabel.setPreferredSize(
new java.awt.Dimension(120, 14));
390 gridBagConstraints =
new java.awt.GridBagConstraints();
391 gridBagConstraints.gridx = 0;
392 gridBagConstraints.gridy = 2;
393 gridBagConstraints.gridwidth = 2;
394 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
395 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
396 gridBagConstraints.insets =
new java.awt.Insets(7, 12, 0, 0);
397 orgainizationPanel.add(lbPointOfContactPhoneLabel, gridBagConstraints);
399 comboBoxOrgName.addActionListener(
new java.awt.event.ActionListener() {
400 public void actionPerformed(java.awt.event.ActionEvent evt) {
401 comboBoxOrgNameActionPerformed(evt);
404 gridBagConstraints =
new java.awt.GridBagConstraints();
405 gridBagConstraints.gridx = 2;
406 gridBagConstraints.gridy = 0;
407 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
408 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
409 gridBagConstraints.insets =
new java.awt.Insets(8, 18, 0, 0);
410 orgainizationPanel.add(comboBoxOrgName, gridBagConstraints);
412 org.openide.awt.Mnemonics.setLocalizedText(lbPointOfContactNameLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbPointOfContactNameLabel.text"));
413 lbPointOfContactNameLabel.setMaximumSize(
new java.awt.Dimension(182, 14));
414 lbPointOfContactNameLabel.setMinimumSize(
new java.awt.Dimension(82, 14));
415 lbPointOfContactNameLabel.setPreferredSize(
new java.awt.Dimension(120, 14));
416 gridBagConstraints =
new java.awt.GridBagConstraints();
417 gridBagConstraints.gridx = 0;
418 gridBagConstraints.gridy = 1;
419 gridBagConstraints.gridwidth = 2;
420 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
421 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
422 gridBagConstraints.insets =
new java.awt.Insets(13, 12, 0, 5);
423 orgainizationPanel.add(lbPointOfContactNameLabel, gridBagConstraints);
425 org.openide.awt.Mnemonics.setLocalizedText(bnNewOrganization,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.bnNewOrganization.text"));
426 bnNewOrganization.setMargin(
new java.awt.Insets(2, 6, 2, 6));
427 bnNewOrganization.setMaximumSize(
new java.awt.Dimension(160, 23));
428 bnNewOrganization.setMinimumSize(
new java.awt.Dimension(123, 23));
429 bnNewOrganization.setPreferredSize(
new java.awt.Dimension(140, 23));
430 bnNewOrganization.addActionListener(
new java.awt.event.ActionListener() {
431 public void actionPerformed(java.awt.event.ActionEvent evt) {
432 bnNewOrganizationActionPerformed(evt);
435 gridBagConstraints =
new java.awt.GridBagConstraints();
436 gridBagConstraints.gridx = 3;
437 gridBagConstraints.gridy = 0;
438 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
439 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
440 gridBagConstraints.insets =
new java.awt.Insets(8, 12, 0, 18);
441 orgainizationPanel.add(bnNewOrganization, gridBagConstraints);
442 gridBagConstraints =
new java.awt.GridBagConstraints();
443 gridBagConstraints.gridx = 2;
444 gridBagConstraints.gridy = 3;
445 gridBagConstraints.gridwidth = 2;
446 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
447 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
448 gridBagConstraints.insets =
new java.awt.Insets(7, 4, 13, 18);
449 orgainizationPanel.add(lbPointOfContactEmailText, gridBagConstraints);
450 gridBagConstraints =
new java.awt.GridBagConstraints();
451 gridBagConstraints.gridx = 2;
452 gridBagConstraints.gridy = 1;
453 gridBagConstraints.gridwidth = 2;
454 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
455 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
456 gridBagConstraints.insets =
new java.awt.Insets(13, 4, 0, 18);
457 orgainizationPanel.add(lbPointOfContactNameText, gridBagConstraints);
459 org.openide.awt.Mnemonics.setLocalizedText(lbOrganizationNameLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbOrganizationNameLabel.text"));
460 lbOrganizationNameLabel.setMaximumSize(
new java.awt.Dimension(300, 14));
461 lbOrganizationNameLabel.setMinimumSize(
new java.awt.Dimension(189, 14));
462 lbOrganizationNameLabel.setPreferredSize(
new java.awt.Dimension(220, 14));
463 gridBagConstraints =
new java.awt.GridBagConstraints();
464 gridBagConstraints.gridx = 0;
465 gridBagConstraints.gridy = 0;
466 gridBagConstraints.gridwidth = 2;
467 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
468 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
469 gridBagConstraints.insets =
new java.awt.Insets(12, 0, 0, 0);
470 orgainizationPanel.add(lbOrganizationNameLabel, gridBagConstraints);
472 org.openide.awt.Mnemonics.setLocalizedText(lbPointOfContactEmailLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbPointOfContactEmailLabel.text"));
473 lbPointOfContactEmailLabel.setMaximumSize(
new java.awt.Dimension(182, 14));
474 lbPointOfContactEmailLabel.setMinimumSize(
new java.awt.Dimension(82, 14));
475 lbPointOfContactEmailLabel.setPreferredSize(
new java.awt.Dimension(120, 14));
476 gridBagConstraints =
new java.awt.GridBagConstraints();
477 gridBagConstraints.gridx = 0;
478 gridBagConstraints.gridy = 3;
479 gridBagConstraints.gridwidth = 2;
480 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
481 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
482 gridBagConstraints.insets =
new java.awt.Insets(7, 12, 13, 0);
483 orgainizationPanel.add(lbPointOfContactEmailLabel, gridBagConstraints);
484 gridBagConstraints =
new java.awt.GridBagConstraints();
485 gridBagConstraints.gridx = 2;
486 gridBagConstraints.gridy = 2;
487 gridBagConstraints.gridwidth = 2;
488 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
489 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
490 gridBagConstraints.insets =
new java.awt.Insets(7, 4, 0, 18);
491 orgainizationPanel.add(lbPointOfContactPhoneText, gridBagConstraints);
493 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
494 this.setLayout(layout);
495 layout.setHorizontalGroup(
496 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
497 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
499 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
500 .addComponent(casePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
501 .addComponent(examinerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
502 .addComponent(orgainizationPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
505 layout.setVerticalGroup(
506 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
507 .addGroup(layout.createSequentialGroup()
509 .addComponent(casePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
511 .addComponent(examinerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
513 .addComponent(orgainizationPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
518 private void comboBoxOrgNameActionPerformed(java.awt.event.ActionEvent evt) {
519 @SuppressWarnings(
"unchecked")
520 JComboBox<String> cb = (JComboBox<String>) evt.getSource();
521 String orgName = (String) cb.getSelectedItem();
522 if (null == orgName) {
525 if (
"".equals(orgName)) {
529 for (CentralRepoOrganization
org : orgs) {
530 if (
org.getName().equals(orgName)) {
532 lbPointOfContactNameText.setText(selectedOrg.getPocName());
533 lbPointOfContactEmailText.setText(selectedOrg.getPocEmail());
534 lbPointOfContactPhoneText.setText(selectedOrg.getPocPhone());
540 private void bnNewOrganizationActionPerformed(java.awt.event.ActionEvent evt) {
541 ManageOrganizationsDialog dialog =
new ManageOrganizationsDialog((Dialog) SwingUtilities.getWindowAncestor(
this));
543 loadOrganizationData();
544 if (dialog.isChanged()) {
545 selectedOrg = dialog.getNewOrg();
546 setCurrentlySelectedOrganization(dialog.getNewOrg().getName());
552 void setCurrentlySelectedOrganization(String orgName) {
553 comboBoxOrgName.setSelectedItem(orgName == null ? CentralRepoDbUtil.getDefaultOrgName() : orgName);
557 "OptionalCasePropertiesPanel.errorDialog.emptyCaseNameMessage=No case name entered.",
558 "OptionalCasePropertiesPanel.errorDialog.invalidCaseNameMessage=Case names cannot include the following symbols: \\, /, :, *, ?, \", <, >, |",
559 "OptionalCasePropertiesPanel.errorDialog.noOpenCase.errMsg=Exception while getting open case."
561 void saveUpdatedCaseDetails() {
562 if (caseDisplayNameTextField.getText().trim().isEmpty()) {
563 MessageNotifyUtil.Message.error(Bundle.OptionalCasePropertiesPanel_errorDialog_emptyCaseNameMessage());
566 if (!Case.isValidName(caseDisplayNameTextField.getText())) {
567 MessageNotifyUtil.Message.error(Bundle.OptionalCasePropertiesPanel_errorDialog_invalidCaseNameMessage());
572 }
catch (NoCurrentCaseException ex) {
573 MessageNotifyUtil.Message.error(Bundle.OptionalCasePropertiesPanel_errorDialog_noOpenCase_errMsg());
576 updateCorrelationCase();
579 private void updateCaseDetails() throws NoCurrentCaseException {
580 if (caseDisplayNameTextField.isVisible()) {
582 Case.getCurrentCaseThrows().updateCaseDetails(
new CaseDetails(
583 caseDisplayNameTextField.getText(), caseNumberTextField.getText(),
584 examinerTextField.getText(), tfExaminerPhoneText.getText(),
585 tfExaminerEmailText.getText(), taNotesText.getText()));
586 }
catch (CaseActionException ex) {
587 logger.log(Level.WARNING,
"Error updating case details", ex);
596 private void updateCorrelationCase() {
597 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
598 if (CentralRepository.isEnabled()) {
600 CentralRepository dbManager = CentralRepository.getInstance();
601 CorrelationCase correlationCase = dbManager.getCase(Case.getCurrentCaseThrows());
602 if (caseDisplayNameTextField.isVisible()) {
603 correlationCase.setDisplayName(caseDisplayNameTextField.getText());
605 correlationCase.setOrg(selectedOrg);
606 correlationCase.setCaseNumber(caseNumberTextField.getText());
607 correlationCase.setExaminerName(examinerTextField.getText());
608 correlationCase.setExaminerEmail(tfExaminerEmailText.getText());
609 correlationCase.setExaminerPhone(tfExaminerPhoneText.getText());
610 correlationCase.setNotes(taNotesText.getText());
611 dbManager.updateCase(correlationCase);
612 }
catch (CentralRepoException ex) {
613 logger.log(Level.SEVERE,
"Error connecting to central repository database", ex);
614 }
catch (NoCurrentCaseException ex) {
615 logger.log(Level.SEVERE,
"Exception while getting open case.", ex);
617 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
622 private javax.swing.JButton bnNewOrganization;
623 private javax.swing.JLabel caseDisplayNameLabel;
624 private javax.swing.JTextField caseDisplayNameTextField;
625 private javax.swing.JScrollPane caseNotesScrollPane;
626 private javax.swing.JLabel caseNumberLabel;
627 private javax.swing.JTextField caseNumberTextField;
628 private javax.swing.JPanel casePanel;
629 private javax.swing.JComboBox<String> comboBoxOrgName;
630 private javax.swing.JLabel examinerLabel;
631 private javax.swing.JPanel examinerPanel;
632 private javax.swing.JTextField examinerTextField;
633 private javax.swing.JLabel lbExaminerEmailLabel;
634 private javax.swing.JLabel lbExaminerPhoneLabel;
635 private javax.swing.JLabel lbNotesLabel;
636 private javax.swing.JLabel lbOrganizationNameLabel;
637 private javax.swing.JLabel lbPointOfContactEmailLabel;
638 private javax.swing.JLabel lbPointOfContactEmailText;
639 private javax.swing.JLabel lbPointOfContactNameLabel;
640 private javax.swing.JLabel lbPointOfContactNameText;
641 private javax.swing.JLabel lbPointOfContactPhoneLabel;
642 private javax.swing.JLabel lbPointOfContactPhoneText;
643 private javax.swing.JPanel orgainizationPanel;
644 private javax.swing.JTextArea taNotesText;
645 private javax.swing.JTextField tfExaminerEmailText;
646 private javax.swing.JTextField tfExaminerPhoneText;