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.Exceptions;
25 import org.openide.util.NbBundle.Messages;
39 @SuppressWarnings(
"PMD.SingularField")
40 final class OptionalCasePropertiesPanel extends javax.swing.JPanel {
42 private final static Logger logger = Logger.getLogger(OptionalCasePropertiesPanel.class.getName());
43 private static final long serialVersionUID = 1L;
44 private EamOrganization selectedOrg = null;
45 private java.util.List<EamOrganization> orgs = null;
50 OptionalCasePropertiesPanel() {
52 caseDisplayNameLabel.setVisible(
false);
53 caseDisplayNameTextField.setVisible(
false);
54 lbPointOfContactNameLabel.setVisible(
false);
55 lbPointOfContactNameText.setVisible(
false);
56 lbPointOfContactPhoneLabel.setVisible(
false);
57 lbPointOfContactPhoneText.setVisible(
false);
58 lbPointOfContactEmailLabel.setVisible(
false);
59 lbPointOfContactEmailText.setVisible(
false);
60 setUpCaseDetailsFields();
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 (EamDb.isEnabled()) {
98 Case currentCase = Case.getCurrentCaseThrows();
99 if (currentCase != null) {
100 EamDb dbManager = EamDb.getInstance();
101 selectedOrg = dbManager.getCase(currentCase).getOrg();
103 }
catch (EamDbException 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(EamDbUtil.getDefaultOrgName());
118 void setUpCaseDetailsFields() {
119 boolean cREnabled = EamDb.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 EamDb dbManager = EamDb.getInstance();
143 orgs = dbManager.getOrganizations();
144 orgs.forEach((
org) -> {
145 comboBoxOrgName.addItem(
org.getName());
147 comboBoxOrgName.setSelectedItem(selectedBeforeLoad);
148 }
catch (EamDbException 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 EamDbUtil.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() {
232 casePanel =
new javax.swing.JPanel();
233 caseNumberLabel =
new javax.swing.JLabel();
234 caseNumberTextField =
new javax.swing.JTextField();
235 caseDisplayNameLabel =
new javax.swing.JLabel();
236 caseDisplayNameTextField =
new javax.swing.JTextField();
237 examinerPanel =
new javax.swing.JPanel();
238 tfExaminerPhoneText =
new javax.swing.JTextField();
239 lbExaminerPhoneLabel =
new javax.swing.JLabel();
240 caseNotesScrollPane =
new javax.swing.JScrollPane();
241 taNotesText =
new javax.swing.JTextArea();
242 tfExaminerEmailText =
new javax.swing.JTextField();
243 examinerTextField =
new javax.swing.JTextField();
244 lbExaminerEmailLabel =
new javax.swing.JLabel();
245 examinerLabel =
new javax.swing.JLabel();
246 lbNotesLabel =
new javax.swing.JLabel();
247 orgainizationPanel =
new javax.swing.JPanel();
248 lbPointOfContactPhoneLabel =
new javax.swing.JLabel();
249 comboBoxOrgName =
new javax.swing.JComboBox<>();
250 lbPointOfContactNameLabel =
new javax.swing.JLabel();
251 bnNewOrganization =
new javax.swing.JButton();
252 lbPointOfContactEmailText =
new javax.swing.JLabel();
253 lbPointOfContactNameText =
new javax.swing.JLabel();
254 lbOrganizationNameLabel =
new javax.swing.JLabel();
255 lbPointOfContactEmailLabel =
new javax.swing.JLabel();
256 lbPointOfContactPhoneText =
new javax.swing.JLabel();
258 casePanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.casePanel.border.title")));
260 caseNumberLabel.setFont(caseNumberLabel.getFont().deriveFont(caseNumberLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
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 caseNumberTextField.setFont(caseNumberTextField.getFont().deriveFont(caseNumberTextField.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
268 caseDisplayNameLabel.setFont(caseDisplayNameLabel.getFont().deriveFont(caseDisplayNameLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
269 org.openide.awt.Mnemonics.setLocalizedText(caseDisplayNameLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.caseDisplayNameLabel.text"));
270 caseDisplayNameLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
271 caseDisplayNameLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
272 caseDisplayNameLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
273 caseDisplayNameLabel.setVerifyInputWhenFocusTarget(
false);
275 caseDisplayNameTextField.setFont(caseDisplayNameTextField.getFont().deriveFont(caseDisplayNameTextField.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
277 javax.swing.GroupLayout casePanelLayout =
new javax.swing.GroupLayout(casePanel);
278 casePanel.setLayout(casePanelLayout);
279 casePanelLayout.setHorizontalGroup(
280 casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
281 .addGroup(casePanelLayout.createSequentialGroup()
283 .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
284 .addComponent(caseNumberLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
285 .addComponent(caseDisplayNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
286 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
287 .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
288 .addComponent(caseNumberTextField)
289 .addComponent(caseDisplayNameTextField))
292 casePanelLayout.setVerticalGroup(
293 casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
294 .addGroup(casePanelLayout.createSequentialGroup()
296 .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
297 .addComponent(caseDisplayNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
298 .addComponent(caseDisplayNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
299 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
300 .addGroup(casePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
301 .addComponent(caseNumberLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
302 .addComponent(caseNumberTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
306 examinerPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.examinerPanel.border.title")));
308 org.openide.awt.Mnemonics.setLocalizedText(lbExaminerPhoneLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbExaminerPhoneLabel.text"));
309 lbExaminerPhoneLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
310 lbExaminerPhoneLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
311 lbExaminerPhoneLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
313 caseNotesScrollPane.setBorder(javax.swing.BorderFactory.createEtchedBorder());
315 taNotesText.setColumns(20);
316 taNotesText.setFont(
new java.awt.Font(
"Tahoma", 0, 11));
317 taNotesText.setLineWrap(
true);
318 taNotesText.setRows(2);
319 taNotesText.setWrapStyleWord(
true);
320 taNotesText.setBorder(null);
321 caseNotesScrollPane.setViewportView(taNotesText);
323 examinerTextField.setFont(examinerTextField.getFont().deriveFont(examinerTextField.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
325 org.openide.awt.Mnemonics.setLocalizedText(lbExaminerEmailLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbExaminerEmailLabel.text"));
326 lbExaminerEmailLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
327 lbExaminerEmailLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
328 lbExaminerEmailLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
330 examinerLabel.setFont(examinerLabel.getFont().deriveFont(examinerLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
331 org.openide.awt.Mnemonics.setLocalizedText(examinerLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.examinerLabel.text"));
332 examinerLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
333 examinerLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
334 examinerLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
336 org.openide.awt.Mnemonics.setLocalizedText(lbNotesLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbNotesLabel.text"));
337 lbNotesLabel.setMaximumSize(
new java.awt.Dimension(41, 14));
338 lbNotesLabel.setMinimumSize(
new java.awt.Dimension(41, 14));
339 lbNotesLabel.setPreferredSize(
new java.awt.Dimension(41, 14));
341 javax.swing.GroupLayout examinerPanelLayout =
new javax.swing.GroupLayout(examinerPanel);
342 examinerPanel.setLayout(examinerPanelLayout);
343 examinerPanelLayout.setHorizontalGroup(
344 examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
345 .addGroup(examinerPanelLayout.createSequentialGroup()
347 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
348 .addGroup(examinerPanelLayout.createSequentialGroup()
349 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
350 .addComponent(lbNotesLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
351 .addComponent(lbExaminerPhoneLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
352 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
353 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
354 .addComponent(caseNotesScrollPane)
355 .addComponent(tfExaminerPhoneText)))
356 .addGroup(examinerPanelLayout.createSequentialGroup()
357 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
358 .addComponent(lbExaminerEmailLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
359 .addComponent(examinerLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
360 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
361 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
362 .addComponent(examinerTextField)
363 .addComponent(tfExaminerEmailText))))
367 examinerPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {examinerLabel, lbExaminerEmailLabel, lbExaminerPhoneLabel, lbNotesLabel});
369 examinerPanelLayout.setVerticalGroup(
370 examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
371 .addGroup(examinerPanelLayout.createSequentialGroup()
373 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
374 .addComponent(examinerLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
375 .addComponent(examinerTextField, 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.BASELINE)
378 .addComponent(tfExaminerPhoneText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
379 .addComponent(lbExaminerPhoneLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
380 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
381 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
382 .addComponent(tfExaminerEmailText, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
383 .addComponent(lbExaminerEmailLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
384 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
385 .addGroup(examinerPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
386 .addComponent(lbNotesLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
387 .addComponent(caseNotesScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
391 orgainizationPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.orgainizationPanel.border.title")));
393 org.openide.awt.Mnemonics.setLocalizedText(lbPointOfContactPhoneLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbPointOfContactPhoneLabel.text"));
394 lbPointOfContactPhoneLabel.setMaximumSize(
new java.awt.Dimension(82, 14));
395 lbPointOfContactPhoneLabel.setMinimumSize(
new java.awt.Dimension(82, 14));
396 lbPointOfContactPhoneLabel.setPreferredSize(
new java.awt.Dimension(82, 14));
398 comboBoxOrgName.addActionListener(
new java.awt.event.ActionListener() {
399 public void actionPerformed(java.awt.event.ActionEvent evt) {
400 comboBoxOrgNameActionPerformed(evt);
404 org.openide.awt.Mnemonics.setLocalizedText(lbPointOfContactNameLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbPointOfContactNameLabel.text"));
405 lbPointOfContactNameLabel.setMaximumSize(
new java.awt.Dimension(82, 14));
406 lbPointOfContactNameLabel.setMinimumSize(
new java.awt.Dimension(82, 14));
407 lbPointOfContactNameLabel.setPreferredSize(
new java.awt.Dimension(82, 14));
409 org.openide.awt.Mnemonics.setLocalizedText(bnNewOrganization,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.bnNewOrganization.text"));
410 bnNewOrganization.setMargin(
new java.awt.Insets(2, 6, 2, 6));
411 bnNewOrganization.setMaximumSize(
new java.awt.Dimension(123, 23));
412 bnNewOrganization.setMinimumSize(
new java.awt.Dimension(123, 23));
413 bnNewOrganization.setPreferredSize(
new java.awt.Dimension(123, 23));
414 bnNewOrganization.addActionListener(
new java.awt.event.ActionListener() {
415 public void actionPerformed(java.awt.event.ActionEvent evt) {
416 bnNewOrganizationActionPerformed(evt);
420 org.openide.awt.Mnemonics.setLocalizedText(lbOrganizationNameLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbOrganizationNameLabel.text"));
421 lbOrganizationNameLabel.setMaximumSize(
new java.awt.Dimension(189, 14));
422 lbOrganizationNameLabel.setMinimumSize(
new java.awt.Dimension(189, 14));
423 lbOrganizationNameLabel.setPreferredSize(
new java.awt.Dimension(189, 14));
425 org.openide.awt.Mnemonics.setLocalizedText(lbPointOfContactEmailLabel,
org.openide.util.NbBundle.getMessage(OptionalCasePropertiesPanel.class,
"OptionalCasePropertiesPanel.lbPointOfContactEmailLabel.text"));
426 lbPointOfContactEmailLabel.setMaximumSize(
new java.awt.Dimension(82, 14));
427 lbPointOfContactEmailLabel.setMinimumSize(
new java.awt.Dimension(82, 14));
428 lbPointOfContactEmailLabel.setPreferredSize(
new java.awt.Dimension(82, 14));
430 javax.swing.GroupLayout orgainizationPanelLayout =
new javax.swing.GroupLayout(orgainizationPanel);
431 orgainizationPanel.setLayout(orgainizationPanelLayout);
432 orgainizationPanelLayout.setHorizontalGroup(
433 orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
434 .addGroup(orgainizationPanelLayout.createSequentialGroup()
435 .addGroup(orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
436 .addGroup(orgainizationPanelLayout.createSequentialGroup()
437 .addGap(106, 106, 106)
438 .addGroup(orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
439 .addComponent(lbPointOfContactPhoneLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
440 .addComponent(lbPointOfContactEmailLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
441 .addComponent(lbPointOfContactNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE))
442 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
443 .addGroup(orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
444 .addComponent(lbPointOfContactPhoneText, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
445 .addComponent(lbPointOfContactNameText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
446 .addComponent(lbPointOfContactEmailText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
447 .addGroup(orgainizationPanelLayout.createSequentialGroup()
449 .addComponent(lbOrganizationNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 206, Short.MAX_VALUE)
451 .addComponent(comboBoxOrgName, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE)
452 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
453 .addComponent(bnNewOrganization, javax.swing.GroupLayout.PREFERRED_SIZE, 147, javax.swing.GroupLayout.PREFERRED_SIZE)))
457 orgainizationPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {lbPointOfContactEmailLabel, lbPointOfContactNameLabel, lbPointOfContactPhoneLabel});
459 orgainizationPanelLayout.setVerticalGroup(
460 orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
461 .addGroup(orgainizationPanelLayout.createSequentialGroup()
463 .addGroup(orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
464 .addComponent(lbOrganizationNameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
465 .addComponent(comboBoxOrgName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
466 .addComponent(bnNewOrganization, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
467 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
468 .addGroup(orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
469 .addComponent(lbPointOfContactNameText, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
470 .addComponent(lbPointOfContactNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
471 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
472 .addGroup(orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
473 .addComponent(lbPointOfContactPhoneLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
474 .addComponent(lbPointOfContactPhoneText, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
475 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
476 .addGroup(orgainizationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
477 .addComponent(lbPointOfContactEmailLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
478 .addComponent(lbPointOfContactEmailText, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
482 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
483 this.setLayout(layout);
484 layout.setHorizontalGroup(
485 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
486 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
488 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
489 .addComponent(casePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
490 .addComponent(examinerPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
491 .addComponent(orgainizationPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
494 layout.setVerticalGroup(
495 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
496 .addGroup(layout.createSequentialGroup()
498 .addComponent(casePanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
500 .addComponent(examinerPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
502 .addComponent(orgainizationPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
507 private void comboBoxOrgNameActionPerformed(java.awt.event.ActionEvent evt) {
508 @SuppressWarnings(
"unchecked")
509 JComboBox<String> cb = (JComboBox<String>) evt.getSource();
510 String orgName = (String) cb.getSelectedItem();
511 if (null == orgName) {
514 if (
"".equals(orgName)) {
518 for (EamOrganization
org : orgs) {
519 if (
org.getName().equals(orgName)) {
521 lbPointOfContactNameText.setText(selectedOrg.getPocName());
522 lbPointOfContactEmailText.setText(selectedOrg.getPocEmail());
523 lbPointOfContactPhoneText.setText(selectedOrg.getPocPhone());
529 private void bnNewOrganizationActionPerformed(java.awt.event.ActionEvent evt) {
530 ManageOrganizationsDialog dialog =
new ManageOrganizationsDialog();
532 loadOrganizationData();
533 if (dialog.isChanged()) {
534 selectedOrg = dialog.getNewOrg();
535 setCurrentlySelectedOrganization(dialog.getNewOrg().getName());
541 void setCurrentlySelectedOrganization(String orgName) {
542 comboBoxOrgName.setSelectedItem(orgName == null ? EamDbUtil.getDefaultOrgName() : orgName);
546 "OptionalCasePropertiesPanel.errorDialog.emptyCaseNameMessage=No case name entered.",
547 "OptionalCasePropertiesPanel.errorDialog.invalidCaseNameMessage=Case names cannot include the following symbols: \\, /, :, *, ?, \", <, >, |",
548 "OptionalCasePropertiesPanel.errorDialog.noOpenCase.errMsg=Exception while getting open case."
550 void saveUpdatedCaseDetails() {
551 if (caseDisplayNameTextField.getText().trim().isEmpty()) {
552 MessageNotifyUtil.Message.error(Bundle.OptionalCasePropertiesPanel_errorDialog_emptyCaseNameMessage());
555 if (!Case.isValidName(caseDisplayNameTextField.getText())) {
556 MessageNotifyUtil.Message.error(Bundle.OptionalCasePropertiesPanel_errorDialog_invalidCaseNameMessage());
561 }
catch (NoCurrentCaseException ex) {
562 MessageNotifyUtil.Message.error(Bundle.OptionalCasePropertiesPanel_errorDialog_noOpenCase_errMsg());
565 updateCorrelationCase();
568 private void updateCaseDetails() throws NoCurrentCaseException {
569 if (caseDisplayNameTextField.isVisible()) {
571 Case.getCurrentCaseThrows().updateCaseDetails(
new CaseDetails(
572 caseDisplayNameTextField.getText(), caseNumberTextField.getText(),
573 examinerTextField.getText(), tfExaminerPhoneText.getText(),
574 tfExaminerEmailText.getText(), taNotesText.getText()));
575 }
catch (CaseActionException ex) {
576 Exceptions.printStackTrace(ex);
585 private void updateCorrelationCase() {
586 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
587 if (EamDb.isEnabled()) {
589 EamDb dbManager = EamDb.getInstance();
590 CorrelationCase correlationCase = dbManager.getCase(Case.getCurrentCaseThrows());
591 if (caseDisplayNameTextField.isVisible()) {
592 correlationCase.setDisplayName(caseDisplayNameTextField.getText());
594 correlationCase.setOrg(selectedOrg);
595 correlationCase.setCaseNumber(caseNumberTextField.getText());
596 correlationCase.setExaminerName(examinerTextField.getText());
597 correlationCase.setExaminerEmail(tfExaminerEmailText.getText());
598 correlationCase.setExaminerPhone(tfExaminerPhoneText.getText());
599 correlationCase.setNotes(taNotesText.getText());
600 dbManager.updateCase(correlationCase);
601 }
catch (EamDbException ex) {
602 logger.log(Level.SEVERE,
"Error connecting to central repository database", ex);
603 }
catch (NoCurrentCaseException ex) {
604 logger.log(Level.SEVERE,
"Exception while getting open case.", ex);
606 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
611 private javax.swing.JButton bnNewOrganization;
612 private javax.swing.JLabel caseDisplayNameLabel;
613 private javax.swing.JTextField caseDisplayNameTextField;
614 private javax.swing.JScrollPane caseNotesScrollPane;
615 private javax.swing.JLabel caseNumberLabel;
616 private javax.swing.JTextField caseNumberTextField;
617 private javax.swing.JPanel casePanel;
618 private javax.swing.JComboBox<String> comboBoxOrgName;
619 private javax.swing.JLabel examinerLabel;
620 private javax.swing.JPanel examinerPanel;
621 private javax.swing.JTextField examinerTextField;
622 private javax.swing.JLabel lbExaminerEmailLabel;
623 private javax.swing.JLabel lbExaminerPhoneLabel;
624 private javax.swing.JLabel lbNotesLabel;
625 private javax.swing.JLabel lbOrganizationNameLabel;
626 private javax.swing.JLabel lbPointOfContactEmailLabel;
627 private javax.swing.JLabel lbPointOfContactEmailText;
628 private javax.swing.JLabel lbPointOfContactNameLabel;
629 private javax.swing.JLabel lbPointOfContactNameText;
630 private javax.swing.JLabel lbPointOfContactPhoneLabel;
631 private javax.swing.JLabel lbPointOfContactPhoneText;
632 private javax.swing.JPanel orgainizationPanel;
633 private javax.swing.JTextArea taNotesText;
634 private javax.swing.JTextField tfExaminerEmailText;
635 private javax.swing.JTextField tfExaminerPhoneText;