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);
63 OptionalCasePropertiesPanel(
boolean editCurrentCase) {
65 if (editCurrentCase) {
68 openCase = Case.getCurrentCaseThrows();
69 }
catch (NoCurrentCaseException ex) {
70 logger.log(Level.SEVERE,
"Exception while getting open case.", ex);
73 caseDisplayNameTextField.setText(openCase.getDisplayName());
74 caseNumberTextField.setText(openCase.getNumber());
75 examinerTextField.setText(openCase.getExaminer());
76 tfExaminerEmailText.setText(openCase.getExaminerEmail());
77 tfExaminerPhoneText.setText(openCase.getExaminerPhone());
78 taNotesText.setText(openCase.getCaseNotes());
79 setUpCaseDetailsFields();
80 setUpOrganizationData();
82 caseDisplayNameLabel.setVisible(
false);
83 caseDisplayNameTextField.setVisible(
false);
84 lbPointOfContactNameLabel.setVisible(
false);
85 lbPointOfContactNameText.setVisible(
false);
86 lbPointOfContactPhoneLabel.setVisible(
false);
87 lbPointOfContactPhoneText.setVisible(
false);
88 lbPointOfContactEmailLabel.setVisible(
false);
89 lbPointOfContactEmailText.setVisible(
false);
90 setUpCaseDetailsFields();
95 private void setUpOrganizationData() {
96 if (CentralRepository.isEnabled()) {
98 Case currentCase = Case.getCurrentCaseThrows();
99 if (currentCase != null) {
100 CentralRepository dbManager = CentralRepository.getInstance();
101 selectedOrg = dbManager.getCase(currentCase).getOrg();
103 }
catch (CentralRepoException ex) {
104 logger.log(Level.SEVERE,
"Unable to get Organization associated with the case from Central Repo", ex);
105 }
catch (NoCurrentCaseException ex) {
106 logger.log(Level.SEVERE,
"Exception while getting open case.", ex);
109 if (selectedOrg != null) {
110 setCurrentlySelectedOrganization(selectedOrg.getName());
113 setCurrentlySelectedOrganization(CentralRepoDbUtil.getDefaultOrgName());
118 void setUpCaseDetailsFields() {
119 boolean cREnabled = CentralRepository.isEnabled();
120 comboBoxOrgName.setEnabled(cREnabled);
121 bnNewOrganization.setEnabled(cREnabled);
122 lbPointOfContactNameText.setEnabled(cREnabled);
123 lbPointOfContactEmailText.setEnabled(cREnabled);
124 lbPointOfContactPhoneText.setEnabled(cREnabled);
125 lbOrganizationNameLabel.setEnabled(cREnabled);
126 lbPointOfContactNameLabel.setEnabled(cREnabled);
127 lbPointOfContactEmailLabel.setEnabled(cREnabled);
128 lbPointOfContactPhoneLabel.setEnabled(cREnabled);
129 orgainizationPanel.setEnabled(cREnabled);
133 loadOrganizationData();
138 private void loadOrganizationData() {
139 Object selectedBeforeLoad = comboBoxOrgName.getSelectedItem();
140 comboBoxOrgName.removeAllItems();
142 CentralRepository dbManager = CentralRepository.getInstance();
143 orgs = dbManager.getOrganizations();
144 orgs.forEach((
org) -> {
145 comboBoxOrgName.addItem(
org.getName());
147 comboBoxOrgName.setSelectedItem(selectedBeforeLoad);
148 }
catch (CentralRepoException ex) {
149 logger.log(Level.WARNING,
"Unable to populate list of Organizations from Central Repo", ex);
153 private void clearOrganization() {
155 lbPointOfContactNameText.setText(
"");
156 lbPointOfContactEmailText.setText(
"");
157 lbPointOfContactPhoneText.setText(
"");
160 String getCaseNumber() {
161 return caseNumberTextField.getText();
164 String getExaminerName() {
165 return examinerTextField.getText();
168 String getExaminerPhone() {
169 return tfExaminerPhoneText.getText();
172 String getExaminerEmail() {
173 return tfExaminerEmailText.getText();
176 String getCaseNotes() {
177 return taNotesText.getText();
180 String getOrganization() {
181 if (selectedOrg != null) {
182 return selectedOrg.getName();
184 return CentralRepoDbUtil.getDefaultOrgName();
188 void setCaseNumberField(String caseNumber) {
189 caseNumberTextField.setText(caseNumber == null ?
"" : caseNumber);
192 void setExaminerNameField(String examinerName) {
193 examinerTextField.setText(examinerName == null ?
"" : examinerName);
196 void setExaminerPhoneField(String examinerPhone) {
197 tfExaminerPhoneText.setText(examinerPhone == null ?
"" : examinerPhone);
200 void setExaminerEmailField(String examinerEmail) {
201 tfExaminerEmailText.setText(examinerEmail == null ?
"" : examinerEmail);
204 void setCaseNotesField(String caseNotes) {
205 taNotesText.setText(caseNotes == null ?
"" : caseNotes);
208 @Messages({
"OptionalCasePropertiesPanel.caseDisplayNameLabel.text=Name:",
209 "OptionalCasePropertiesPanel.lbPointOfContactEmailLabel.text=Email:",
210 "OptionalCasePropertiesPanel.lbOrganizationNameLabel.text=Organization analysis is being done for:",
211 "OptionalCasePropertiesPanel.bnNewOrganization.text=Manage Organizations",
212 "OptionalCasePropertiesPanel.lbPointOfContactNameLabel.text=Point of Contact:",
213 "OptionalCasePropertiesPanel.lbPointOfContactPhoneLabel.text=Phone:",
214 "OptionalCasePropertiesPanel.orgainizationPanel.border.title=Organization",
215 "OptionalCasePropertiesPanel.lbNotesLabel.text=Notes:",
216 "OptionalCasePropertiesPanel.examinerLabel.text=Name:",
217 "OptionalCasePropertiesPanel.lbExaminerEmailLabel.text=Email:",
218 "OptionalCasePropertiesPanel.lbExaminerPhoneLabel.text=Phone:",
219 "OptionalCasePropertiesPanel.examinerPanel.border.title=Examiner",
220 "OptionalCasePropertiesPanel.caseNumberLabel.text=Number:",
221 "OptionalCasePropertiesPanel.casePanel.border.title=Case"
228 @SuppressWarnings(
"unchecked")
230 private
void initComponents() {
231 java.awt.GridBagConstraints gridBagConstraints;
233 casePanel =
new javax.swing.JPanel();
234 caseNumberLabel =
new javax.swing.JLabel();
235 caseNumberTextField =
new javax.swing.JTextField();
236 caseDisplayNameLabel =
new javax.swing.JLabel();
237 caseDisplayNameTextField =
new javax.swing.JTextField();
238 examinerPanel =
new javax.swing.JPanel();
239 tfExaminerPhoneText =
new javax.swing.JTextField();
240 lbExaminerPhoneLabel =
new javax.swing.JLabel();
241 caseNotesScrollPane =
new javax.swing.JScrollPane();
242 taNotesText =
new javax.swing.JTextArea();
243 tfExaminerEmailText =
new javax.swing.JTextField();
244 examinerTextField =
new javax.swing.JTextField();
245 lbExaminerEmailLabel =
new javax.swing.JLabel();
246 examinerLabel =
new javax.swing.JLabel();
247 lbNotesLabel =
new javax.swing.JLabel();
248 orgainizationPanel =
new javax.swing.JPanel();
249 lbPointOfContactPhoneLabel =
new javax.swing.JLabel();
250 comboBoxOrgName =
new javax.swing.JComboBox<>();
251 lbPointOfContactNameLabel =
new javax.swing.JLabel();
252 bnNewOrganization =
new javax.swing.JButton();
253 lbPointOfContactEmailText =
new javax.swing.JLabel();
254 lbPointOfContactNameText =
new javax.swing.JLabel();
255 lbOrganizationNameLabel =
new javax.swing.JLabel();
256 lbPointOfContactEmailLabel =
new javax.swing.JLabel();
257 lbPointOfContactPhoneText =
new javax.swing.JLabel();
259 casePanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.casePanel.border.title")));
261 org.openide.awt.Mnemonics.setLocalizedText(caseNumberLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.caseNumberLabel.text"));
262 caseNumberLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
263 caseNumberLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
264 caseNumberLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
266 org.openide.awt.Mnemonics.setLocalizedText(caseDisplayNameLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.caseDisplayNameLabel.text"));
267 caseDisplayNameLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
268 caseDisplayNameLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
269 caseDisplayNameLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
270 caseDisplayNameLabel.setVerifyInputWhenFocusTarget(
false);
272 javax.swing.GroupLayout casePanelLayout =
new javax.swing.GroupLayout(casePanel);
273 casePanel.setLayout(casePanelLayout);
274 casePanelLayout.setHorizontalGroup(
275 casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
276 .addGroup(casePanelLayout.createSequentialGroup()
278 .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
279 .addComponent(caseNumberLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
280 .addComponent(caseDisplayNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
281 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
282 .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
283 .addComponent(caseNumberTextField)
284 .addComponent(caseDisplayNameTextField))
287 casePanelLayout.setVerticalGroup(
288 casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
289 .addGroup(casePanelLayout.createSequentialGroup()
291 .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
292 .addComponent(caseDisplayNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
293 .addComponent(caseDisplayNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
294 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
295 .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
296 .addComponent(caseNumberLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
297 .addComponent(caseNumberTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
301 examinerPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.examinerPanel.border.title")));
303 org.openide.awt.Mnemonics.setLocalizedText(lbExaminerPhoneLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbExaminerPhoneLabel.text"));
304 lbExaminerPhoneLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
305 lbExaminerPhoneLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
306 lbExaminerPhoneLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
308 caseNotesScrollPane.setBorder(javax.swing.BorderFactory.createEtchedBorder());
310 taNotesText.setColumns(20);
311 taNotesText.setLineWrap(
true);
312 taNotesText.setRows(2);
313 taNotesText.setWrapStyleWord(
true);
314 taNotesText.setBorder(null);
315 caseNotesScrollPane.setViewportView(taNotesText);
317 org.openide.awt.Mnemonics.setLocalizedText(lbExaminerEmailLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbExaminerEmailLabel.text"));
318 lbExaminerEmailLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
319 lbExaminerEmailLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
320 lbExaminerEmailLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
322 org.openide.awt.Mnemonics.setLocalizedText(examinerLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.examinerLabel.text"));
323 examinerLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
324 examinerLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
325 examinerLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
327 org.openide.awt.Mnemonics.setLocalizedText(lbNotesLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbNotesLabel.text"));
328 lbNotesLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
329 lbNotesLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
330 lbNotesLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
332 javax.swing.GroupLayout examinerPanelLayout =
new javax.swing.GroupLayout(examinerPanel);
333 examinerPanel.setLayout(examinerPanelLayout);
334 examinerPanelLayout.setHorizontalGroup(
335 examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
336 .addGroup(examinerPanelLayout.createSequentialGroup()
338 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
339 .addGroup(examinerPanelLayout.createSequentialGroup()
340 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
341 .addComponent(lbNotesLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
342 .addComponent(lbExaminerPhoneLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
343 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
344 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
345 .addComponent(caseNotesScrollPane)
346 .addComponent(tfExaminerPhoneText)))
347 .addGroup(examinerPanelLayout.createSequentialGroup()
348 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
349 .addComponent(lbExaminerEmailLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
350 .addComponent(examinerLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
351 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
352 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
353 .addComponent(examinerTextField)
354 .addComponent(tfExaminerEmailText))))
358 examinerPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {examinerLabel, lbExaminerEmailLabel, lbExaminerPhoneLabel, lbNotesLabel});
360 examinerPanelLayout.setVerticalGroup(
361 examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
362 .addGroup(examinerPanelLayout.createSequentialGroup()
364 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
365 .addComponent(examinerLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
366 .addComponent(examinerTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
367 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
368 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
369 .addComponent(tfExaminerPhoneText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
370 .addComponent(lbExaminerPhoneLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
371 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
372 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
373 .addComponent(tfExaminerEmailText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
374 .addComponent(lbExaminerEmailLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
375 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
376 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
377 .addComponent(lbNotesLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
378 .addComponent(caseNotesScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
382 orgainizationPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.orgainizationPanel.border.title")));
383 orgainizationPanel.setLayout(
new java.awt.GridBagLayout());
385 org.openide.awt.Mnemonics.setLocalizedText(lbPointOfContactPhoneLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbPointOfContactPhoneLabel.text"));
386 lbPointOfContactPhoneLabel.setMaximumSize(
new java.awt.Dimension(182, 14));
387 lbPointOfContactPhoneLabel.setMinimumSize(
new java.awt.Dimension(82, 14));
388 lbPointOfContactPhoneLabel.setPreferredSize(
new java.awt.Dimension(120, 14));
389 gridBagConstraints =
new java.awt.GridBagConstraints();
390 gridBagConstraints.gridx = 0;
391 gridBagConstraints.gridy = 2;
392 gridBagConstraints.gridwidth = 2;
393 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
394 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
395 gridBagConstraints.insets =
new java.awt.Insets(7, 12, 0, 0);
396 orgainizationPanel.add(lbPointOfContactPhoneLabel, gridBagConstraints);
398 comboBoxOrgName.addActionListener(
new java.awt.event.ActionListener() {
399 public void actionPerformed(java.awt.event.ActionEvent evt) {
400 comboBoxOrgNameActionPerformed(evt);
403 gridBagConstraints =
new java.awt.GridBagConstraints();
404 gridBagConstraints.gridx = 2;
405 gridBagConstraints.gridy = 0;
406 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
407 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
408 gridBagConstraints.insets =
new java.awt.Insets(8, 18, 0, 0);
409 orgainizationPanel.add(comboBoxOrgName, gridBagConstraints);
411 org.openide.awt.Mnemonics.setLocalizedText(lbPointOfContactNameLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbPointOfContactNameLabel.text"));
412 lbPointOfContactNameLabel.setMaximumSize(
new java.awt.Dimension(182, 14));
413 lbPointOfContactNameLabel.setMinimumSize(
new java.awt.Dimension(82, 14));
414 lbPointOfContactNameLabel.setPreferredSize(
new java.awt.Dimension(120, 14));
415 gridBagConstraints =
new java.awt.GridBagConstraints();
416 gridBagConstraints.gridx = 0;
417 gridBagConstraints.gridy = 1;
418 gridBagConstraints.gridwidth = 2;
419 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
420 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
421 gridBagConstraints.insets =
new java.awt.Insets(13, 12, 0, 5);
422 orgainizationPanel.add(lbPointOfContactNameLabel, gridBagConstraints);
424 org.openide.awt.Mnemonics.setLocalizedText(bnNewOrganization,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.bnNewOrganization.text"));
425 bnNewOrganization.setMargin(
new java.awt.Insets(2, 6, 2, 6));
426 bnNewOrganization.setMaximumSize(
new java.awt.Dimension(160, 23));
427 bnNewOrganization.setMinimumSize(
new java.awt.Dimension(123, 23));
428 bnNewOrganization.setPreferredSize(
new java.awt.Dimension(140, 23));
429 bnNewOrganization.addActionListener(
new java.awt.event.ActionListener() {
430 public void actionPerformed(java.awt.event.ActionEvent evt) {
431 bnNewOrganizationActionPerformed(evt);
434 gridBagConstraints =
new java.awt.GridBagConstraints();
435 gridBagConstraints.gridx = 3;
436 gridBagConstraints.gridy = 0;
437 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
438 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
439 gridBagConstraints.insets =
new java.awt.Insets(8, 12, 0, 18);
440 orgainizationPanel.add(bnNewOrganization, gridBagConstraints);
441 gridBagConstraints =
new java.awt.GridBagConstraints();
442 gridBagConstraints.gridx = 2;
443 gridBagConstraints.gridy = 3;
444 gridBagConstraints.gridwidth = 2;
445 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
446 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
447 gridBagConstraints.insets =
new java.awt.Insets(7, 4, 13, 18);
448 orgainizationPanel.add(lbPointOfContactEmailText, gridBagConstraints);
449 gridBagConstraints =
new java.awt.GridBagConstraints();
450 gridBagConstraints.gridx = 2;
451 gridBagConstraints.gridy = 1;
452 gridBagConstraints.gridwidth = 2;
453 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
454 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
455 gridBagConstraints.insets =
new java.awt.Insets(13, 4, 0, 18);
456 orgainizationPanel.add(lbPointOfContactNameText, gridBagConstraints);
458 org.openide.awt.Mnemonics.setLocalizedText(lbOrganizationNameLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbOrganizationNameLabel.text"));
459 lbOrganizationNameLabel.setMaximumSize(
new java.awt.Dimension(300, 14));
460 lbOrganizationNameLabel.setMinimumSize(
new java.awt.Dimension(189, 14));
461 lbOrganizationNameLabel.setPreferredSize(
new java.awt.Dimension(220, 14));
462 gridBagConstraints =
new java.awt.GridBagConstraints();
463 gridBagConstraints.gridx = 0;
464 gridBagConstraints.gridy = 0;
465 gridBagConstraints.gridwidth = 2;
466 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
467 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
468 gridBagConstraints.insets =
new java.awt.Insets(12, 0, 0, 0);
469 orgainizationPanel.add(lbOrganizationNameLabel, gridBagConstraints);
471 org.openide.awt.Mnemonics.setLocalizedText(lbPointOfContactEmailLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbPointOfContactEmailLabel.text"));
472 lbPointOfContactEmailLabel.setMaximumSize(
new java.awt.Dimension(182, 14));
473 lbPointOfContactEmailLabel.setMinimumSize(
new java.awt.Dimension(82, 14));
474 lbPointOfContactEmailLabel.setPreferredSize(
new java.awt.Dimension(120, 14));
475 gridBagConstraints =
new java.awt.GridBagConstraints();
476 gridBagConstraints.gridx = 0;
477 gridBagConstraints.gridy = 3;
478 gridBagConstraints.gridwidth = 2;
479 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
480 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
481 gridBagConstraints.insets =
new java.awt.Insets(7, 12, 13, 0);
482 orgainizationPanel.add(lbPointOfContactEmailLabel, gridBagConstraints);
483 gridBagConstraints =
new java.awt.GridBagConstraints();
484 gridBagConstraints.gridx = 2;
485 gridBagConstraints.gridy = 2;
486 gridBagConstraints.gridwidth = 2;
487 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
488 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
489 gridBagConstraints.insets =
new java.awt.Insets(7, 4, 0, 18);
490 orgainizationPanel.add(lbPointOfContactPhoneText, gridBagConstraints);
492 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
493 this.setLayout(layout);
494 layout.setHorizontalGroup(
495 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
496 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
498 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
499 .addComponent(casePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
500 .addComponent(examinerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
501 .addComponent(orgainizationPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
504 layout.setVerticalGroup(
505 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
506 .addGroup(layout.createSequentialGroup()
508 .addComponent(casePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
510 .addComponent(examinerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
512 .addComponent(orgainizationPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
517 private void comboBoxOrgNameActionPerformed(java.awt.event.ActionEvent evt) {
518 @SuppressWarnings(
"unchecked")
519 JComboBox<String> cb = (JComboBox<String>) evt.getSource();
520 String orgName = (String) cb.getSelectedItem();
521 if (null == orgName) {
524 if (
"".equals(orgName)) {
528 for (CentralRepoOrganization
org : orgs) {
529 if (
org.getName().equals(orgName)) {
531 lbPointOfContactNameText.setText(selectedOrg.getPocName());
532 lbPointOfContactEmailText.setText(selectedOrg.getPocEmail());
533 lbPointOfContactPhoneText.setText(selectedOrg.getPocPhone());
539 private void bnNewOrganizationActionPerformed(java.awt.event.ActionEvent evt) {
540 ManageOrganizationsDialog dialog =
new ManageOrganizationsDialog((Dialog) SwingUtilities.getWindowAncestor(
this));
542 loadOrganizationData();
543 if (dialog.isChanged()) {
544 selectedOrg = dialog.getNewOrg();
545 setCurrentlySelectedOrganization(dialog.getNewOrg().getName());
551 void setCurrentlySelectedOrganization(String orgName) {
552 comboBoxOrgName.setSelectedItem(orgName == null ? CentralRepoDbUtil.getDefaultOrgName() : orgName);
556 "OptionalCasePropertiesPanel.errorDialog.emptyCaseNameMessage=No case name entered.",
557 "OptionalCasePropertiesPanel.errorDialog.invalidCaseNameMessage=Case names cannot include the following symbols: \\, /, :, *, ?, \", <, >, |",
558 "OptionalCasePropertiesPanel.errorDialog.noOpenCase.errMsg=Exception while getting open case."
560 void saveUpdatedCaseDetails() {
561 if (caseDisplayNameTextField.getText().trim().isEmpty()) {
562 MessageNotifyUtil.Message.error(Bundle.OptionalCasePropertiesPanel_errorDialog_emptyCaseNameMessage());
565 if (!Case.isValidName(caseDisplayNameTextField.getText())) {
566 MessageNotifyUtil.Message.error(Bundle.OptionalCasePropertiesPanel_errorDialog_invalidCaseNameMessage());
571 }
catch (NoCurrentCaseException ex) {
572 MessageNotifyUtil.Message.error(Bundle.OptionalCasePropertiesPanel_errorDialog_noOpenCase_errMsg());
575 updateCorrelationCase();
578 private void updateCaseDetails() throws NoCurrentCaseException {
579 if (caseDisplayNameTextField.isVisible()) {
581 Case.getCurrentCaseThrows().updateCaseDetails(
new CaseDetails(
582 caseDisplayNameTextField.getText(), caseNumberTextField.getText(),
583 examinerTextField.getText(), tfExaminerPhoneText.getText(),
584 tfExaminerEmailText.getText(), taNotesText.getText()));
585 }
catch (CaseActionException ex) {
586 logger.log(Level.WARNING,
"Error updating case details", ex);
595 private void updateCorrelationCase() {
596 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
597 if (CentralRepository.isEnabled()) {
599 CentralRepository dbManager = CentralRepository.getInstance();
600 CorrelationCase correlationCase = dbManager.getCase(Case.getCurrentCaseThrows());
601 if (caseDisplayNameTextField.isVisible()) {
602 correlationCase.setDisplayName(caseDisplayNameTextField.getText());
604 correlationCase.setOrg(selectedOrg);
605 correlationCase.setCaseNumber(caseNumberTextField.getText());
606 correlationCase.setExaminerName(examinerTextField.getText());
607 correlationCase.setExaminerEmail(tfExaminerEmailText.getText());
608 correlationCase.setExaminerPhone(tfExaminerPhoneText.getText());
609 correlationCase.setNotes(taNotesText.getText());
610 dbManager.updateCase(correlationCase);
611 }
catch (CentralRepoException ex) {
612 logger.log(Level.SEVERE,
"Error connecting to central repository database", ex);
613 }
catch (NoCurrentCaseException ex) {
614 logger.log(Level.SEVERE,
"Exception while getting open case.", ex);
616 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
621 private javax.swing.JButton bnNewOrganization;
622 private javax.swing.JLabel caseDisplayNameLabel;
623 private javax.swing.JTextField caseDisplayNameTextField;
624 private javax.swing.JScrollPane caseNotesScrollPane;
625 private javax.swing.JLabel caseNumberLabel;
626 private javax.swing.JTextField caseNumberTextField;
627 private javax.swing.JPanel casePanel;
628 private javax.swing.JComboBox<String> comboBoxOrgName;
629 private javax.swing.JLabel examinerLabel;
630 private javax.swing.JPanel examinerPanel;
631 private javax.swing.JTextField examinerTextField;
632 private javax.swing.JLabel lbExaminerEmailLabel;
633 private javax.swing.JLabel lbExaminerPhoneLabel;
634 private javax.swing.JLabel lbNotesLabel;
635 private javax.swing.JLabel lbOrganizationNameLabel;
636 private javax.swing.JLabel lbPointOfContactEmailLabel;
637 private javax.swing.JLabel lbPointOfContactEmailText;
638 private javax.swing.JLabel lbPointOfContactNameLabel;
639 private javax.swing.JLabel lbPointOfContactNameText;
640 private javax.swing.JLabel lbPointOfContactPhoneLabel;
641 private javax.swing.JLabel lbPointOfContactPhoneText;
642 private javax.swing.JPanel orgainizationPanel;
643 private javax.swing.JTextArea taNotesText;
644 private javax.swing.JTextField tfExaminerEmailText;
645 private javax.swing.JTextField tfExaminerPhoneText;