19 package org.sleuthkit.autopsy.corecomponents;
21 import java.awt.Color;
22 import java.util.ArrayList;
23 import java.util.Collection;
24 import javax.swing.JTextField;
25 import javax.swing.event.DocumentEvent;
26 import javax.swing.event.DocumentListener;
27 import org.openide.util.NbBundle;
34 import java.awt.Cursor;
35 import java.beans.PropertyChangeEvent;
36 import java.io.IOException;
37 import java.util.EnumSet;
38 import java.util.logging.Level;
39 import javax.swing.ImageIcon;
40 import javax.swing.JOptionPane;
41 import javax.swing.SwingUtilities;
42 import org.openide.util.ImageUtilities;
43 import org.openide.util.Lookup;
44 import org.openide.util.NbBundle.Messages;
58 @SuppressWarnings(
"PMD.SingularField")
61 private static final String HOST_NAME_OR_IP_PROMPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbHostname.toolTipText");
62 private static final String PORT_PROMPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbPort.toolTipText");
63 private static final String USER_NAME_PROMPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbUsername.toolTipText");
64 private static final String PASSWORD_PROMPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbPassword.toolTipText");
65 private static final String USER_NAME_PROMPT_OPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbMsgUsername.toolTipText");
66 private static final String PASSWORD_PROMPT_OPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbMsgPassword.toolTipText");
67 private static final String INCOMPLETE_SETTINGS_MSG = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.validationErrMsg.incomplete");
68 private static final String INVALID_DB_PORT_MSG = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.validationErrMsg.invalidDatabasePort");
69 private static final String INVALID_MESSAGE_SERVICE_PORT_MSG = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.validationErrMsg.invalidMessageServicePort");
70 private static final String INVALID_INDEXING_SERVER_PORT_MSG = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.validationErrMsg.invalidIndexingServerPort");
71 private static final String INVALID_SOLR4_SERVER_PORT_MSG = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.validationErrMsg.invalidSolr4ServerPort");
72 private static final String SOLR_SERVER_NOT_CONFIGURED_MSG = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.validationErrMsg.solrNotConfigured");
73 private static final String INVALID_ZK_SERVER_HOST_MSG = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.validationErrMsg.invalidZkServerHostName");
74 private static final String INVALID_ZK_SERVER_PORT_MSG = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.validationErrMsg.invalidZkServerPort");
75 private static final String SOLR8_HOST_NAME_OR_IP_PROMPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbSolr8Hostname.toolTipText");
76 private static final String SOLR8_PORT_PROMPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbSolr8Port.toolTipText");
77 private static final String SOLR4_HOST_NAME_OR_IP_PROMPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbSolr4Hostname.toolTipText");
78 private static final String SOLR4_PORT_PROMPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbSolr4Port.toolTipText");
79 private static final String ZK_HOST_NAME_OR_IP_PROMPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbZkHostname.toolTipText");
80 private static final String ZK_PORT_PROMPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbZkPort.toolTipText");
82 private static final long serialVersionUID = 1L;
84 private final Collection<JTextField> textBoxes =
new ArrayList<>();
98 controller = theController;
104 Collection<TextPrompt> textPrompts =
new ArrayList<>();
105 textPrompts.add(
new TextPrompt(HOST_NAME_OR_IP_PROMPT, tbDbHostname));
106 textPrompts.add(
new TextPrompt(PORT_PROMPT, tbDbPort));
107 textPrompts.add(
new TextPrompt(USER_NAME_PROMPT, tbDbUsername));
108 textPrompts.add(
new TextPrompt(PASSWORD_PROMPT, tbDbPassword));
109 textPrompts.add(
new TextPrompt(HOST_NAME_OR_IP_PROMPT, tbMsgHostname));
110 textPrompts.add(
new TextPrompt(PORT_PROMPT, tbMsgPort));
111 textPrompts.add(
new TextPrompt(USER_NAME_PROMPT_OPT, tbMsgUsername));
112 textPrompts.add(
new TextPrompt(PASSWORD_PROMPT_OPT, tbMsgPassword));
113 textPrompts.add(
new TextPrompt(SOLR8_HOST_NAME_OR_IP_PROMPT, tbSolr8Hostname));
114 textPrompts.add(
new TextPrompt(SOLR8_PORT_PROMPT, tbSolr8Port));
115 textPrompts.add(
new TextPrompt(SOLR4_HOST_NAME_OR_IP_PROMPT, tbSolr4Hostname));
116 textPrompts.add(
new TextPrompt(SOLR4_PORT_PROMPT, tbSolr4Port));
117 textPrompts.add(
new TextPrompt(ZK_HOST_NAME_OR_IP_PROMPT, tbZkHostname));
118 textPrompts.add(
new TextPrompt(ZK_PORT_PROMPT, tbZkPort));
119 configureTextPrompts(textPrompts);
125 tbDbHostname.getDocument().putProperty(
"statusIcon", lbTestDatabase);
126 tbDbPort.getDocument().putProperty(
"statusIcon", lbTestDatabase);
127 tbDbUsername.getDocument().putProperty(
"statusIcon", lbTestDatabase);
128 tbDbPassword.getDocument().putProperty(
"statusIcon", lbTestDatabase);
130 tbSolr8Hostname.getDocument().putProperty(
"statusIcon", lbTestSolr8);
131 tbSolr8Port.getDocument().putProperty(
"statusIcon", lbTestSolr8);
132 tbSolr4Hostname.getDocument().putProperty(
"statusIcon", lbTestSolr4);
133 tbSolr4Port.getDocument().putProperty(
"statusIcon", lbTestSolr4);
134 tbZkHostname.getDocument().putProperty(
"statusIcon", lbTestZK);
135 tbZkPort.getDocument().putProperty(
"statusIcon", lbTestZK);
137 tbMsgHostname.getDocument().putProperty(
"statusIcon", lbTestMessageService);
138 tbMsgPort.getDocument().putProperty(
"statusIcon", lbTestMessageService);
139 tbMsgUsername.getDocument().putProperty(
"statusIcon", lbTestMessageService);
140 tbMsgPassword.getDocument().putProperty(
"statusIcon", lbTestMessageService);
143 textBoxChangedListener =
new TextBoxChangedListener();
144 textBoxes.add(tbDbHostname);
145 textBoxes.add(tbDbPort);
146 textBoxes.add(tbDbUsername);
147 textBoxes.add(tbDbPassword);
148 textBoxes.add(tbMsgHostname);
149 textBoxes.add(tbMsgPort);
150 textBoxes.add(tbMsgUsername);
151 textBoxes.add(tbMsgPassword);
152 textBoxes.add(tbSolr8Hostname);
153 textBoxes.add(tbSolr8Port);
154 textBoxes.add(tbSolr4Hostname);
155 textBoxes.add(tbSolr4Port);
156 textBoxes.add(tbZkHostname);
157 textBoxes.add(tbZkPort);
162 addDocumentListeners(textBoxes, textBoxChangedListener);
163 goodIcon =
new ImageIcon(ImageUtilities.loadImage(
"org/sleuthkit/autopsy/images/good.png",
false));
164 badIcon =
new ImageIcon(ImageUtilities.loadImage(
"org/sleuthkit/autopsy/images/bad.png",
false));
165 enableMultiUserComponents(textBoxes, cbEnableMultiUser.isSelected());
169 load(evt.getNewValue() != null);
182 textPrompt.setForeground(Color.LIGHT_GRAY);
183 textPrompt.changeAlpha(alpha);
194 for (JTextField textField : textFields) {
195 textField.getDocument().addDocumentListener(listener);
204 @SuppressWarnings(
"unchecked")
206 private
void initComponents() {
208 jScrollPane =
new javax.swing.JScrollPane();
209 pnOverallPanel =
new javax.swing.JPanel();
210 pnDatabaseSettings =
new javax.swing.JPanel();
211 tbDbHostname =
new javax.swing.JTextField();
212 tbDbPort =
new javax.swing.JTextField();
213 tbDbUsername =
new javax.swing.JTextField();
214 tbDbPassword =
new javax.swing.JPasswordField();
215 lbDatabaseSettings =
new javax.swing.JLabel();
216 bnTestDatabase =
new javax.swing.JButton();
217 lbTestDatabase =
new javax.swing.JLabel();
218 lbTestDbWarning =
new javax.swing.JLabel();
219 pnSolrSettings =
new javax.swing.JPanel();
220 lbSolr8Settings =
new javax.swing.JLabel();
221 tbSolr8Hostname =
new javax.swing.JTextField();
222 tbSolr8Port =
new javax.swing.JTextField();
223 bnTestSolr8 =
new javax.swing.JButton();
224 lbTestSolr8 =
new javax.swing.JLabel();
225 lbWarning =
new javax.swing.JLabel();
226 tbSolr4Hostname =
new javax.swing.JTextField();
227 tbSolr4Port =
new javax.swing.JTextField();
228 lbSolr4Settings =
new javax.swing.JLabel();
229 lbZkSettings =
new javax.swing.JLabel();
230 tbZkHostname =
new javax.swing.JTextField();
231 tbZkPort =
new javax.swing.JTextField();
232 lbSolrNote1 =
new javax.swing.JLabel();
233 lbSolrNote2 =
new javax.swing.JLabel();
234 bnTestSolr4 =
new javax.swing.JButton();
235 lbTestSolr4 =
new javax.swing.JLabel();
236 lbTestZK =
new javax.swing.JLabel();
237 bnTestZK =
new javax.swing.JButton();
238 pnMessagingSettings =
new javax.swing.JPanel();
239 lbMessageServiceSettings =
new javax.swing.JLabel();
240 tbMsgHostname =
new javax.swing.JTextField();
241 tbMsgUsername =
new javax.swing.JTextField();
242 tbMsgPort =
new javax.swing.JTextField();
243 tbMsgPassword =
new javax.swing.JPasswordField();
244 bnTestMessageService =
new javax.swing.JButton();
245 lbTestMessageService =
new javax.swing.JLabel();
246 lbTestMessageWarning =
new javax.swing.JLabel();
247 cbEnableMultiUser =
new javax.swing.JCheckBox();
248 tbOops =
new javax.swing.JTextField();
250 pnDatabaseSettings.setBorder(javax.swing.BorderFactory.createEtchedBorder());
252 tbDbHostname.setFont(tbDbHostname.getFont().deriveFont(tbDbHostname.getFont().getSize()+1f));
253 tbDbHostname.setText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbHostname.text"));
254 tbDbHostname.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbHostname.toolTipText"));
256 tbDbPort.setFont(tbDbPort.getFont().deriveFont(tbDbPort.getFont().getSize()+1f));
257 tbDbPort.setText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbPort.text"));
258 tbDbPort.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbPort.toolTipText"));
260 tbDbUsername.setFont(tbDbUsername.getFont().deriveFont(tbDbUsername.getFont().getSize()+1f));
261 tbDbUsername.setText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbUsername.text"));
262 tbDbUsername.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbUsername.toolTipText"));
264 tbDbPassword.setFont(tbDbPassword.getFont().deriveFont(tbDbPassword.getFont().getSize()+1f));
265 tbDbPassword.setText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbPassword.text"));
266 tbDbPassword.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbPassword.toolTipText"));
268 lbDatabaseSettings.setFont(lbDatabaseSettings.getFont().deriveFont(lbDatabaseSettings.getFont().getSize()+1f));
269 org.openide.awt.Mnemonics.setLocalizedText(lbDatabaseSettings,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbDatabaseSettings.text"));
270 lbDatabaseSettings.setVerticalAlignment(javax.swing.SwingConstants.TOP);
272 org.openide.awt.Mnemonics.setLocalizedText(bnTestDatabase,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.bnTestDatabase.text"));
273 bnTestDatabase.addActionListener(
new java.awt.event.ActionListener() {
274 public void actionPerformed(java.awt.event.ActionEvent evt) {
275 bnTestDatabaseActionPerformed(evt);
279 org.openide.awt.Mnemonics.setLocalizedText(lbTestDatabase,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbTestDatabase.text"));
280 lbTestDatabase.setAutoscrolls(
true);
282 lbTestDbWarning.setForeground(
new java.awt.Color(255, 0, 0));
283 org.openide.awt.Mnemonics.setLocalizedText(lbTestDbWarning,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbTestDbWarning.text"));
285 javax.swing.GroupLayout pnDatabaseSettingsLayout =
new javax.swing.GroupLayout(pnDatabaseSettings);
286 pnDatabaseSettings.setLayout(pnDatabaseSettingsLayout);
287 pnDatabaseSettingsLayout.setHorizontalGroup(
288 pnDatabaseSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
289 .addGroup(pnDatabaseSettingsLayout.createSequentialGroup()
291 .addGroup(pnDatabaseSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
292 .addComponent(tbDbHostname)
293 .addGroup(pnDatabaseSettingsLayout.createSequentialGroup()
294 .addComponent(lbDatabaseSettings)
295 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 231, Short.MAX_VALUE)
296 .addComponent(bnTestDatabase)
298 .addComponent(lbTestDatabase, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
299 .addComponent(tbDbPort)
300 .addComponent(tbDbUsername)
301 .addComponent(tbDbPassword)
302 .addGroup(pnDatabaseSettingsLayout.createSequentialGroup()
303 .addComponent(lbTestDbWarning)
304 .addGap(0, 0, Short.MAX_VALUE)))
307 pnDatabaseSettingsLayout.setVerticalGroup(
308 pnDatabaseSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
309 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnDatabaseSettingsLayout.createSequentialGroup()
311 .addGroup(pnDatabaseSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
312 .addComponent(bnTestDatabase)
313 .addComponent(lbTestDatabase, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
314 .addComponent(lbDatabaseSettings, javax.swing.GroupLayout.Alignment.TRAILING))
315 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
316 .addComponent(tbDbHostname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
317 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
318 .addComponent(tbDbPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
319 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
320 .addComponent(tbDbUsername, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
321 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
322 .addComponent(tbDbPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
323 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
324 .addComponent(lbTestDbWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
328 pnSolrSettings.setBorder(javax.swing.BorderFactory.createEtchedBorder());
330 lbSolr8Settings.setFont(lbSolr8Settings.getFont().deriveFont(lbSolr8Settings.getFont().getSize()+1f));
331 org.openide.awt.Mnemonics.setLocalizedText(lbSolr8Settings,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbSolr8Settings.text"));
333 tbSolr8Hostname.setFont(tbSolr8Hostname.getFont().deriveFont(tbSolr8Hostname.getFont().getSize()+1f));
334 tbSolr8Hostname.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbSolr8Hostname.toolTipText"));
336 tbSolr8Port.setFont(tbSolr8Port.getFont().deriveFont(tbSolr8Port.getFont().getSize()+1f));
337 tbSolr8Port.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbSolr8Port.toolTipText"));
339 org.openide.awt.Mnemonics.setLocalizedText(bnTestSolr8,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.bnTestSolr8.text"));
340 bnTestSolr8.addActionListener(
new java.awt.event.ActionListener() {
341 public void actionPerformed(java.awt.event.ActionEvent evt) {
342 bnTestSolr8ActionPerformed(evt);
346 org.openide.awt.Mnemonics.setLocalizedText(lbTestSolr8,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbTestSolr8.text"));
348 lbWarning.setForeground(
new java.awt.Color(255, 0, 0));
349 org.openide.awt.Mnemonics.setLocalizedText(lbWarning,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbWarning.text"));
351 tbSolr4Hostname.setFont(tbSolr4Hostname.getFont().deriveFont(tbSolr4Hostname.getFont().getSize()+1f));
352 tbSolr4Hostname.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbSolr4Hostname.toolTipText"));
354 tbSolr4Port.setFont(tbSolr4Port.getFont().deriveFont(tbSolr4Port.getFont().getSize()+1f));
355 tbSolr4Port.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbSolr4Port.toolTipText"));
357 lbSolr4Settings.setFont(lbSolr4Settings.getFont().deriveFont(lbSolr4Settings.getFont().getSize()+1f));
358 org.openide.awt.Mnemonics.setLocalizedText(lbSolr4Settings,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbSolr4Settings.text"));
360 lbZkSettings.setFont(lbZkSettings.getFont().deriveFont(lbZkSettings.getFont().getSize()+1f));
361 org.openide.awt.Mnemonics.setLocalizedText(lbZkSettings,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbZkSettings.text"));
363 tbZkHostname.setFont(tbZkHostname.getFont().deriveFont(tbZkHostname.getFont().getSize()+1f));
364 tbZkHostname.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbZkHostname.toolTipText"));
366 tbZkPort.setFont(tbZkPort.getFont().deriveFont(tbZkPort.getFont().getSize()+1f));
367 tbZkPort.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbZkPort.toolTipText"));
369 lbSolrNote1.setFont(lbSolrNote1.getFont().deriveFont(lbSolrNote1.getFont().getSize()+1f));
370 lbSolrNote1.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/corecomponents/warning16.png")));
371 org.openide.awt.Mnemonics.setLocalizedText(lbSolrNote1,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbSolrNote1.text"));
373 lbSolrNote2.setFont(lbSolrNote2.getFont().deriveFont(lbSolrNote2.getFont().getSize()+1f));
374 org.openide.awt.Mnemonics.setLocalizedText(lbSolrNote2,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbSolrNote2.text"));
376 org.openide.awt.Mnemonics.setLocalizedText(bnTestSolr4,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.bnTestSolr4.text"));
377 bnTestSolr4.addActionListener(
new java.awt.event.ActionListener() {
378 public void actionPerformed(java.awt.event.ActionEvent evt) {
379 bnTestSolr4ActionPerformed(evt);
383 org.openide.awt.Mnemonics.setLocalizedText(lbTestSolr4,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbTestSolr4.text"));
385 org.openide.awt.Mnemonics.setLocalizedText(lbTestZK,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbTestZK.text"));
387 org.openide.awt.Mnemonics.setLocalizedText(bnTestZK,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.bnTestZK.text"));
388 bnTestZK.addActionListener(
new java.awt.event.ActionListener() {
389 public void actionPerformed(java.awt.event.ActionEvent evt) {
390 bnTestZKActionPerformed(evt);
394 javax.swing.GroupLayout pnSolrSettingsLayout =
new javax.swing.GroupLayout(pnSolrSettings);
395 pnSolrSettings.setLayout(pnSolrSettingsLayout);
396 pnSolrSettingsLayout.setHorizontalGroup(
397 pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
398 .addGroup(pnSolrSettingsLayout.createSequentialGroup()
400 .addGroup(pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
401 .addGroup(pnSolrSettingsLayout.createSequentialGroup()
402 .addComponent(lbSolr4Settings)
403 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
404 .addComponent(bnTestSolr4)
406 .addComponent(lbTestSolr4, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
407 .addComponent(tbSolr8Hostname)
408 .addComponent(tbSolr8Port)
409 .addComponent(tbSolr4Hostname)
410 .addComponent(tbSolr4Port)
411 .addComponent(tbZkHostname)
412 .addComponent(tbZkPort)
413 .addGroup(pnSolrSettingsLayout.createSequentialGroup()
414 .addComponent(lbZkSettings)
415 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 164, Short.MAX_VALUE)
416 .addComponent(bnTestZK)
418 .addComponent(lbTestZK, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
419 .addGroup(pnSolrSettingsLayout.createSequentialGroup()
420 .addComponent(lbSolr8Settings)
421 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
422 .addComponent(bnTestSolr8)
424 .addComponent(lbTestSolr8, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
425 .addGroup(pnSolrSettingsLayout.createSequentialGroup()
426 .addGroup(pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
427 .addComponent(lbSolrNote1)
428 .addComponent(lbSolrNote2)
429 .addComponent(lbWarning))
430 .addGap(0, 0, Short.MAX_VALUE)))
433 pnSolrSettingsLayout.setVerticalGroup(
434 pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
435 .addGroup(pnSolrSettingsLayout.createSequentialGroup()
437 .addComponent(lbSolrNote1)
438 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
439 .addGroup(pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
440 .addGroup(pnSolrSettingsLayout.createSequentialGroup()
441 .addComponent(lbSolrNote2)
443 .addComponent(lbSolr8Settings))
444 .addGroup(pnSolrSettingsLayout.createSequentialGroup()
445 .addComponent(lbTestSolr8, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
447 .addComponent(bnTestSolr8))
449 .addComponent(tbSolr8Hostname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
450 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
451 .addComponent(tbSolr8Port, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
453 .addGroup(pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
454 .addGroup(pnSolrSettingsLayout.createSequentialGroup()
455 .addGroup(pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
456 .addComponent(lbSolr4Settings, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
457 .addComponent(bnTestSolr4))
458 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
459 .addComponent(tbSolr4Hostname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
460 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
461 .addComponent(tbSolr4Port, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
462 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
463 .addGroup(pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
464 .addGroup(pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
465 .addComponent(lbZkSettings)
466 .addComponent(bnTestZK))
467 .addComponent(lbTestZK, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
468 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
469 .addComponent(tbZkHostname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
470 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
471 .addComponent(tbZkPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
472 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
473 .addComponent(lbWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
474 .addGroup(pnSolrSettingsLayout.createSequentialGroup()
475 .addComponent(lbTestSolr4, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
476 .addGap(0, 0, Short.MAX_VALUE)))
480 tbSolr4Port.getAccessibleContext().setAccessibleDescription(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbSolr4Port.toolTipText"));
482 pnMessagingSettings.setBorder(javax.swing.BorderFactory.createEtchedBorder());
484 lbMessageServiceSettings.setFont(lbMessageServiceSettings.getFont().deriveFont((
float)12));
485 org.openide.awt.Mnemonics.setLocalizedText(lbMessageServiceSettings,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbMessageServiceSettings.text"));
487 tbMsgHostname.setFont(tbMsgHostname.getFont().deriveFont(tbMsgHostname.getFont().getSize()+1f));
488 tbMsgHostname.setText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbMsgHostname.text"));
489 tbMsgHostname.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbMsgHostname.toolTipText"));
491 tbMsgUsername.setFont(tbMsgUsername.getFont().deriveFont(tbMsgUsername.getFont().getSize()+1f));
492 tbMsgUsername.setText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbMsgUsername.text"));
493 tbMsgUsername.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbMsgUsername.toolTipText"));
495 tbMsgPort.setFont(tbMsgPort.getFont().deriveFont(tbMsgPort.getFont().getSize()+1f));
496 tbMsgPort.setText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbMsgPort.text"));
497 tbMsgPort.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbMsgPort.toolTipText"));
499 tbMsgPassword.setFont(tbMsgPassword.getFont().deriveFont(tbMsgPassword.getFont().getSize()+1f));
500 tbMsgPassword.setText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbMsgPassword.text"));
501 tbMsgPassword.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbMsgPassword.toolTipText"));
503 org.openide.awt.Mnemonics.setLocalizedText(bnTestMessageService,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.bnTestMessageService.text"));
504 bnTestMessageService.addActionListener(
new java.awt.event.ActionListener() {
505 public void actionPerformed(java.awt.event.ActionEvent evt) {
506 bnTestMessageServiceActionPerformed(evt);
510 org.openide.awt.Mnemonics.setLocalizedText(lbTestMessageService,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbTestMessageService.text"));
512 lbTestMessageWarning.setForeground(
new java.awt.Color(255, 0, 0));
513 org.openide.awt.Mnemonics.setLocalizedText(lbTestMessageWarning,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbTestMessageWarning.text"));
515 javax.swing.GroupLayout pnMessagingSettingsLayout =
new javax.swing.GroupLayout(pnMessagingSettings);
516 pnMessagingSettings.setLayout(pnMessagingSettingsLayout);
517 pnMessagingSettingsLayout.setHorizontalGroup(
518 pnMessagingSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
519 .addGroup(pnMessagingSettingsLayout.createSequentialGroup()
521 .addGroup(pnMessagingSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
522 .addComponent(tbMsgHostname)
523 .addGroup(pnMessagingSettingsLayout.createSequentialGroup()
524 .addComponent(lbMessageServiceSettings)
525 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
526 .addComponent(bnTestMessageService)
528 .addComponent(lbTestMessageService, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
529 .addComponent(tbMsgPort)
530 .addComponent(tbMsgUsername)
531 .addComponent(tbMsgPassword)
532 .addGroup(pnMessagingSettingsLayout.createSequentialGroup()
533 .addComponent(lbTestMessageWarning)
534 .addGap(0, 0, Short.MAX_VALUE)))
537 pnMessagingSettingsLayout.setVerticalGroup(
538 pnMessagingSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
539 .addGroup(pnMessagingSettingsLayout.createSequentialGroup()
541 .addGroup(pnMessagingSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
542 .addGroup(pnMessagingSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
543 .addComponent(bnTestMessageService)
544 .addComponent(lbMessageServiceSettings))
545 .addComponent(lbTestMessageService, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
546 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
547 .addComponent(tbMsgHostname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
548 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
549 .addComponent(tbMsgPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
550 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
551 .addComponent(tbMsgUsername, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
552 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
553 .addComponent(tbMsgPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
554 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
555 .addComponent(lbTestMessageWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
556 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
559 org.openide.awt.Mnemonics.setLocalizedText(cbEnableMultiUser,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.cbEnableMultiUser.text"));
560 cbEnableMultiUser.addItemListener(
new java.awt.event.ItemListener() {
561 public void itemStateChanged(java.awt.event.ItemEvent evt) {
562 cbEnableMultiUserItemStateChanged(evt);
566 tbOops.setEditable(
false);
567 tbOops.setFont(tbOops.getFont().deriveFont(tbOops.getFont().getStyle() | java.awt.Font.BOLD, tbOops.getFont().getSize()+1));
568 tbOops.setForeground(
new java.awt.Color(255, 0, 0));
569 tbOops.setText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbOops.text"));
570 tbOops.setBorder(null);
572 javax.swing.GroupLayout pnOverallPanelLayout =
new javax.swing.GroupLayout(pnOverallPanel);
573 pnOverallPanel.setLayout(pnOverallPanelLayout);
574 pnOverallPanelLayout.setHorizontalGroup(
575 pnOverallPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
576 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnOverallPanelLayout.createSequentialGroup()
578 .addGroup(pnOverallPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
579 .addGroup(pnOverallPanelLayout.createSequentialGroup()
580 .addComponent(cbEnableMultiUser)
581 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
582 .addComponent(tbOops))
583 .addComponent(pnDatabaseSettings, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
584 .addComponent(pnMessagingSettings, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
585 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
586 .addComponent(pnSolrSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
589 pnOverallPanelLayout.setVerticalGroup(
590 pnOverallPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
591 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnOverallPanelLayout.createSequentialGroup()
592 .addGroup(pnOverallPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
593 .addComponent(tbOops, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
594 .addComponent(cbEnableMultiUser))
595 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
596 .addGroup(pnOverallPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
597 .addGroup(pnOverallPanelLayout.createSequentialGroup()
598 .addComponent(pnDatabaseSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
600 .addComponent(pnMessagingSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
601 .addComponent(pnSolrSettings, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
602 .addContainerGap(234, Short.MAX_VALUE))
605 jScrollPane.setViewportView(pnOverallPanel);
607 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
608 this.setLayout(layout);
609 layout.setHorizontalGroup(
610 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
611 .addComponent(jScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1250, Short.MAX_VALUE)
613 layout.setVerticalGroup(
614 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
615 .addGroup(layout.createSequentialGroup()
617 .addComponent(jScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 695, Short.MAX_VALUE)
629 for (JTextField textField : textFields) {
630 textField.setEnabled(enabled);
635 if (!cbEnableMultiUser.isSelected()) {
637 bnTestDatabase.setEnabled(
false);
638 lbTestDatabase.setIcon(null);
639 bnTestSolr8.setEnabled(
false);
640 lbTestSolr8.setIcon(null);
641 bnTestSolr4.setEnabled(
false);
642 lbTestSolr4.setIcon(null);
643 bnTestZK.setEnabled(
false);
644 lbTestZK.setIcon(null);
645 bnTestMessageService.setEnabled(
false);
646 lbTestMessageService.setIcon(null);
647 lbTestDbWarning.setText(
"");
648 lbWarning.setText(
"");
649 lbTestMessageWarning.setText(
"");
651 enableMultiUserComponents(textBoxes, cbEnableMultiUser.isSelected());
656 lbTestDatabase.setIcon(null);
657 lbTestDatabase.paintImmediately(lbTestDatabase.getVisibleRect());
658 lbTestDbWarning.setText(
"");
659 lbTestDbWarning.paintImmediately(lbTestDbWarning.getVisibleRect());
660 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
662 CaseDbConnectionInfo info =
new CaseDbConnectionInfo(
663 this.tbDbHostname.getText().trim(),
664 this.tbDbPort.getText().trim(),
665 this.tbDbUsername.getText().trim(),
666 new String(this.tbDbPassword.getPassword()),
669 SleuthkitCase.tryConnect(info);
670 lbTestDatabase.setIcon(goodIcon);
671 lbTestDbWarning.setText(
"");
672 }
catch (TskCoreException ex) {
673 lbTestDatabase.setIcon(badIcon);
674 lbTestDbWarning.setText(ex.getMessage());
676 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
681 lbTestMessageService.setIcon(null);
682 lbTestMessageService.paintImmediately(lbTestMessageService.getVisibleRect());
683 lbTestMessageWarning.setText(
"");
684 lbTestMessageWarning.paintImmediately(lbTestMessageWarning.getVisibleRect());
685 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
689 port = Integer.parseInt(this.tbMsgPort.getText().trim());
690 }
catch (NumberFormatException ex) {
691 lbTestMessageService.setIcon(badIcon);
692 lbTestMessageWarning.setText(NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.InvalidPortNumber"));
697 this.tbMsgHostname.getText().trim(),
699 this.tbMsgUsername.getText().trim(),
700 new String(this.tbMsgPassword.getPassword()));
703 lbTestMessageService.setIcon(goodIcon);
704 lbTestMessageWarning.setText(
"");
706 lbTestMessageService.setIcon(badIcon);
707 lbTestMessageWarning.setText(ex.getMessage());
709 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
714 lbTestSolr8.setIcon(null);
715 lbTestSolr8.paintImmediately(lbTestSolr8.getVisibleRect());
716 lbWarning.setText(
"");
717 lbWarning.paintImmediately(lbWarning.getVisibleRect());
718 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
722 if (kwsService != null) {
724 if (tbSolr8Port.getText().trim().isEmpty() || tbSolr8Hostname.getText().trim().isEmpty()) {
725 lbTestSolr8.setIcon(badIcon);
726 lbWarning.setText(NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.Solr8ConnectionInfoMissing.error"));
729 int port = Integer.parseInt(tbSolr8Port.getText().trim());
730 kwsService.
tryConnect(tbSolr8Hostname.getText().trim(), port);
731 lbTestSolr8.setIcon(goodIcon);
732 lbWarning.setText(
"");
734 lbTestSolr8.setIcon(badIcon);
735 lbWarning.setText(NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.KeywordSearchNull"));
737 }
catch (NumberFormatException ex) {
738 lbTestSolr8.setIcon(badIcon);
739 lbWarning.setText(NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.InvalidPortNumber"));
741 lbTestSolr8.setIcon(badIcon);
742 lbWarning.setText(ex.getMessage());
744 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
749 lbTestSolr4.setIcon(null);
750 lbTestSolr4.paintImmediately(lbTestSolr4.getVisibleRect());
751 lbWarning.setText(
"");
752 lbWarning.paintImmediately(lbWarning.getVisibleRect());
753 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
757 if (kwsService != null) {
759 if (tbSolr4Port.getText().trim().isEmpty() || tbSolr4Hostname.getText().trim().isEmpty()) {
760 lbTestSolr4.setIcon(badIcon);
761 lbWarning.setText(NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.Solr4ConnectionInfoMissing.error"));
764 int port = Integer.parseInt(tbSolr4Port.getText().trim());
765 kwsService.
tryConnect(tbSolr4Hostname.getText().trim(), port);
766 lbTestSolr4.setIcon(goodIcon);
767 lbWarning.setText(
"");
769 lbTestSolr4.setIcon(badIcon);
770 lbWarning.setText(NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.KeywordSearchNull"));
772 }
catch (NumberFormatException ex) {
773 lbTestSolr4.setIcon(badIcon);
774 lbWarning.setText(NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.InvalidPortNumber"));
776 lbTestSolr4.setIcon(badIcon);
777 lbWarning.setText(ex.getMessage());
779 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
784 lbTestZK.setIcon(null);
785 lbTestZK.paintImmediately(lbTestZK.getVisibleRect());
786 lbWarning.setText(
"");
787 lbWarning.paintImmediately(lbWarning.getVisibleRect());
788 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
792 if (tbZkPort.getText().trim().isEmpty() || tbZkHostname.getText().trim().isEmpty()) {
793 lbTestZK.setIcon(badIcon);
794 lbWarning.setText(NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.UnableToConnectToZK"));
799 lbTestZK.setIcon(badIcon);
800 lbWarning.setText(NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.UnableToConnectToZK"));
804 lbTestZK.setIcon(goodIcon);
805 lbWarning.setText(
"");
806 }
catch (NumberFormatException ex) {
807 lbTestZK.setIcon(badIcon);
808 lbWarning.setText(NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.InvalidPortNumber"));
809 }
catch (InterruptedException | IOException ex) {
811 lbTestZK.setIcon(badIcon);
812 lbWarning.setText(ex.getMessage());
814 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
819 "MultiUserSettingsPanel_Close_Case_To_Modify=Close case to modfy settings"
822 void load(
boolean caseOpen) {
823 lbTestDatabase.setIcon(null);
824 lbTestSolr8.setIcon(null);
825 lbTestSolr4.setIcon(null);
826 lbTestZK.setIcon(null);
827 lbTestMessageService.setIcon(null);
828 lbTestDbWarning.setText(
"");
829 lbWarning.setText(
"");
830 lbTestMessageWarning.setText(
"");
833 CaseDbConnectionInfo dbInfo = UserPreferences.getDatabaseConnectionInfo();
834 tbDbHostname.setText(dbInfo.getHost().trim());
835 tbDbPort.setText(dbInfo.getPort().trim());
836 tbDbUsername.setText(dbInfo.getUserName().trim());
837 tbDbPassword.setText(dbInfo.getPassword());
838 }
catch (UserPreferencesException ex) {
839 logger.log(Level.SEVERE,
"Error accessing case database connection info", ex);
843 MessageServiceConnectionInfo msgServiceInfo = UserPreferences.getMessageServiceConnectionInfo();
844 tbMsgHostname.setText(msgServiceInfo.getHost().trim());
845 tbMsgPort.setText(Integer.toString(msgServiceInfo.getPort()));
846 tbMsgUsername.setText(msgServiceInfo.getUserName().trim());
847 tbMsgPassword.setText(msgServiceInfo.getPassword());
848 }
catch (UserPreferencesException ex) {
849 logger.log(Level.SEVERE,
"Error accessing case database connection info", ex);
852 populateSolrAndZkSettings();
854 bnTestDatabase.setEnabled(
false);
855 bnTestSolr8.setEnabled(
false);
856 bnTestSolr4.setEnabled(
false);
857 bnTestZK.setEnabled(
false);
858 bnTestMessageService.setEnabled(
false);
860 cbEnableMultiUser.setSelected(UserPreferences.getIsMultiUserModeEnabled());
864 cbEnableMultiUser.setEnabled(UserPreferences.isMultiUserSupported() && !caseOpen);
865 enableMultiUserComponents(textBoxes, cbEnableMultiUser.isSelected() && !caseOpen);
867 this.valid(caseOpen);
873 if (!indexingServerHost.isEmpty()) {
874 tbSolr8Hostname.setText(indexingServerHost);
877 if (portNumberIsValid(indexingServerPort)) {
878 tbSolr8Port.setText(indexingServerPort);
882 if (!solr4ServerHost.isEmpty()) {
883 tbSolr4Hostname.setText(solr4ServerHost);
886 if (portNumberIsValid(solr4ServerPort)) {
887 tbSolr4Port.setText(solr4ServerPort);
892 if (portNumberIsValid(zkServerPort)) {
893 tbZkPort.setText(zkServerPort);
896 if (!zkServerHost.isEmpty()) {
897 tbZkHostname.setText(zkServerHost);
903 if (solr4ServerHost.isEmpty() && !indexingServerHost.isEmpty()) {
904 tbZkHostname.setText(indexingServerHost);
905 tbZkPort.setText(zkServerPort);
911 if (!solr4ServerHost.isEmpty() && indexingServerHost.isEmpty()) {
912 tbZkHostname.setText(solr4ServerHost);
913 tbZkPort.setText(zkServerPort);
925 return !tbDbHostname.getText().trim().isEmpty()
926 && !tbDbPort.getText().trim().isEmpty()
927 && !tbDbUsername.getText().trim().isEmpty()
928 && tbDbPassword.getPassword().length != 0;
940 if (!tbSolr4Hostname.getText().trim().isEmpty()
941 && !tbSolr4Port.getText().trim().isEmpty()) {
957 if (!tbSolr8Hostname.getText().trim().isEmpty()
958 && !tbSolr8Port.getText().trim().isEmpty()) {
973 return (!tbZkHostname.getText().trim().isEmpty()
974 && !tbZkPort.getText().trim().isEmpty());
985 if ((tbMsgHostname.getText().trim().isEmpty())
986 || (tbMsgPort.getText().trim().isEmpty())) {
991 boolean isUserSet = (tbMsgUsername.getText().trim().isEmpty() ==
false);
992 boolean isPwSet = (tbMsgPassword.getPassword().length != 0);
993 return (isUserSet == isPwSet);
998 CaseDbConnectionInfo prevConn = null;
1001 }
catch (UserPreferencesException ex) {
1002 logger.log(Level.SEVERE,
"There was an error while fetching previous connection settings while trying to save", ex);
1005 boolean multiUserCasesEnabled = cbEnableMultiUser.isSelected();
1006 UserPreferences.setIsMultiUserModeEnabled(multiUserCasesEnabled);
1008 CaseDbConnectionInfo info = null;
1010 if (multiUserCasesEnabled ==
true) {
1013 boolean needsRestart =
false;
1015 if (prevSelected ==
true) {
1016 needsRestart = isRestartRequired();
1023 DbType dbType = DbType.POSTGRESQL;
1024 info =
new CaseDbConnectionInfo(
1025 tbDbHostname.getText().trim(),
1026 tbDbPort.getText().trim(),
1027 tbDbUsername.getText().trim(),
1028 new String(tbDbPassword.getPassword()),
1031 UserPreferences.setDatabaseConnectionInfo(info);
1032 }
catch (UserPreferencesException ex) {
1033 logger.log(Level.SEVERE,
"Error saving case database connection info", ex);
1036 int msgServicePort = 0;
1038 msgServicePort = Integer.parseInt(this.tbMsgPort.getText().trim());
1039 }
catch (NumberFormatException ex) {
1040 logger.log(Level.SEVERE,
"Could not parse messaging service port setting", ex);
1043 MessageServiceConnectionInfo msgServiceInfo =
new MessageServiceConnectionInfo(
1044 tbMsgHostname.getText().trim(),
1046 tbMsgUsername.getText().trim(),
1047 new String(tbMsgPassword.getPassword()));
1050 UserPreferences.setMessageServiceConnectionInfo(msgServiceInfo);
1051 }
catch (UserPreferencesException ex) {
1052 logger.log(Level.SEVERE,
"Error saving messaging service connection info", ex);
1055 UserPreferences.setIndexingServerHost(tbSolr8Hostname.getText().trim());
1056 String solr8port = tbSolr8Port.getText().trim();
1057 if (!solr8port.isEmpty()) {
1058 UserPreferences.setIndexingServerPort(Integer.parseInt(solr8port));
1060 UserPreferences.setSolr4ServerHost(tbSolr4Hostname.getText().trim());
1061 UserPreferences.setSolr4ServerPort(tbSolr4Port.getText().trim());
1062 UserPreferences.setZkServerHost(tbZkHostname.getText().trim());
1063 UserPreferences.setZkServerPort(tbZkPort.getText().trim());
1066 SwingUtilities.invokeLater(() -> {
1067 JOptionPane.showMessageDialog(
this,
1068 NbBundle.getMessage(MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.MustRestart"),
1069 NbBundle.getMessage(MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.restartRequiredLabel.text"),
1070 JOptionPane.WARNING_MESSAGE);
1076 if (prevSelected != multiUserCasesEnabled || !areCaseDbConnectionEqual(prevConn, info)) {
1077 GlobalSettingsPanel.onMultiUserChange(
this, prevSelected, multiUserCasesEnabled);
1094 if (a == null || b == null) {
1095 return (a == null && b == null);
1102 if (a == null || b == null) {
1103 return (a == null && b == null);
1106 return arePropsEqual(a.getDbType(), b.getDbType())
1107 && arePropsEqual(a.getHost(), b.getHost())
1108 && arePropsEqual(a.getPassword(), b.getPassword())
1109 && arePropsEqual(a.getPort(), b.getPort())
1110 && arePropsEqual(a.getUserName(), b.getUserName());
1118 boolean valid(
boolean caseOpen) {
1120 tbOops.setText(Bundle.MultiUserSettingsPanel_Close_Case_To_Modify());
1125 if (cbEnableMultiUser.isSelected()) {
1126 return checkFieldsAndEnableButtons(caseOpen)
1127 && databaseSettingsAreValid()
1128 && indexingServerSettingsAreValid()
1129 && messageServiceSettingsAreValid();
1141 boolean checkFieldsAndEnableButtons(
boolean caseOpen) {
1142 boolean result =
true;
1144 boolean dbPopulated = databaseFieldsArePopulated();
1145 boolean solr4Populated = solr4FieldsArePopulated();
1146 boolean solr8Populated = solr8FieldsArePopulated();
1147 boolean zkPopulated = ZooKeeperFieldsArePopulated();
1148 boolean messageServicePopulated = messageServiceFieldsArePopulated();
1151 bnTestDatabase.setEnabled(dbPopulated && !caseOpen);
1154 bnTestSolr8.setEnabled(solr8Populated && !caseOpen);
1155 bnTestSolr4.setEnabled(solr4Populated && !caseOpen);
1156 bnTestZK.setEnabled(zkPopulated && !caseOpen);
1159 bnTestMessageService.setEnabled(messageServicePopulated && !caseOpen);
1161 if (dbPopulated && messageServicePopulated && zkPopulated && (solr8Populated || solr4Populated)) {
1166 tbOops.setText(INCOMPLETE_SETTINGS_MSG);
1176 boolean databaseSettingsAreValid() {
1177 if (portNumberIsValid(tbDbPort.getText().trim())) {
1180 tbOops.setText(INVALID_DB_PORT_MSG);
1190 boolean messageServiceSettingsAreValid() {
1191 if (!portNumberIsValid(tbMsgPort.getText().trim())) {
1192 tbOops.setText(INVALID_MESSAGE_SERVICE_PORT_MSG);
1204 boolean indexingServerSettingsAreValid() {
1206 String solr8Port = tbSolr8Port.getText().trim();
1207 if (!solr8Port.isEmpty() && !portNumberIsValid(solr8Port)) {
1209 tbOops.setText(INVALID_INDEXING_SERVER_PORT_MSG);
1213 String solr4Port = tbSolr4Port.getText().trim();
1214 if (!solr4Port.isEmpty() && !portNumberIsValid(solr4Port)) {
1216 tbOops.setText(INVALID_SOLR4_SERVER_PORT_MSG);
1221 boolean solrConfigured =
false;
1224 if (!tbSolr8Hostname.getText().trim().isEmpty()
1225 && !tbSolr8Port.getText().trim().isEmpty()) {
1226 solrConfigured =
true;
1230 if (!tbSolr4Hostname.getText().trim().isEmpty()
1231 && !tbSolr4Port.getText().trim().isEmpty()) {
1232 solrConfigured =
true;
1235 if (!solrConfigured) {
1236 tbOops.setText(SOLR_SERVER_NOT_CONFIGURED_MSG);
1241 if (tbZkHostname.getText().trim().isEmpty()) {
1242 tbOops.setText(INVALID_ZK_SERVER_HOST_MSG);
1247 String zkPort = tbZkPort.getText().trim();
1248 if (zkPort.isEmpty() || !portNumberIsValid(zkPort)) {
1250 tbOops.setText(INVALID_ZK_SERVER_PORT_MSG);
1267 int value = Integer.parseInt(portNumber);
1268 if (value < 0 || value > 65535) {
1271 }
catch (NumberFormatException detailsNotImportant) {
1325 class TextBoxChangedListener
implements DocumentListener {
1328 public void changedUpdate(DocumentEvent e) {
1329 Object statusIcon = e.getDocument().getProperty(
"statusIcon");
1330 if (statusIcon != null) {
1331 ((javax.swing.JLabel) statusIcon).setIcon(null);
1337 public void insertUpdate(DocumentEvent e) {
1338 Object statusIcon = e.getDocument().getProperty(
"statusIcon");
1339 if (statusIcon != null) {
1340 ((javax.swing.JLabel) statusIcon).setIcon(null);
1346 public void removeUpdate(DocumentEvent e) {
1347 Object statusIcon = e.getDocument().getProperty(
"statusIcon");
1348 if (statusIcon != null) {
1349 ((javax.swing.JLabel) statusIcon).setIcon(null);
1359 tbZkHostname.setText(tbSolr8Hostname.getText().trim());
1364 tbZkHostname.setText(tbSolr8Hostname.getText().trim());
1369 tbZkHostname.setText(tbSolr8Hostname.getText().trim());
void cbEnableMultiUserItemStateChanged(java.awt.event.ItemEvent evt)
static void configureTextPrompts(Collection< TextPrompt > textPrompts)
javax.swing.JLabel lbTestSolr8
javax.swing.JPanel pnSolrSettings
javax.swing.JLabel lbSolr8Settings
javax.swing.JLabel lbTestDatabase
javax.swing.JPanel pnMessagingSettings
javax.swing.JPanel pnDatabaseSettings
javax.swing.JTextField tbDbUsername
void bnTestSolr8ActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JButton bnTestSolr4
static boolean arePropsEqual(Object a, Object b)
static String getSolr4ServerPort()
javax.swing.JButton bnTestZK
boolean isRestartRequired()
void tryConnect(String host, int port)
static String getIndexingServerPort()
javax.swing.JLabel lbTestDbWarning
static String getZkServerPort()
javax.swing.JLabel lbDatabaseSettings
boolean solr4FieldsArePopulated()
void changedUpdate(DocumentEvent e)
final TextBoxChangedListener textBoxChangedListener
javax.swing.JTextField tbSolr4Port
javax.swing.JPanel pnOverallPanel
javax.swing.JTextField tbMsgHostname
javax.swing.JLabel lbSolrNote2
javax.swing.JLabel lbWarning
javax.swing.JTextField tbZkPort
javax.swing.JLabel lbSolr4Settings
javax.swing.JCheckBox cbEnableMultiUser
void bnTestDatabaseActionPerformed(java.awt.event.ActionEvent evt)
static boolean areCaseDbConnectionEqual(CaseDbConnectionInfo a, CaseDbConnectionInfo b)
static boolean getIsMultiUserModeEnabled()
javax.swing.JLabel lbTestZK
static CaseDbConnectionInfo getDatabaseConnectionInfo()
static String getZkServerHost()
void removeUpdate(DocumentEvent e)
javax.swing.JTextField tbOops
MultiUserSettingsPanel(MultiUserSettingsPanelController theController)
javax.swing.JLabel lbZkSettings
javax.swing.JTextField tbDbPort
javax.swing.JButton bnTestSolr8
void bnTestSolr4ActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JLabel lbTestMessageWarning
javax.swing.JTextField tbMsgPort
static boolean portNumberIsValid(String portNumber)
javax.swing.JTextField tbSolr8Hostname
javax.swing.JLabel lbTestMessageService
javax.swing.JLabel lbTestSolr4
boolean messageServiceFieldsArePopulated()
void bnTestZKActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JTextField tbZkHostname
javax.swing.JTextField tbDbHostname
boolean databaseFieldsArePopulated()
static String getSolr4ServerHost()
void populateSolrAndZkSettings()
final MultiUserSettingsPanelController controller
javax.swing.JTextField tbMsgUsername
javax.swing.JTextField tbSolr4Hostname
synchronized static Logger getLogger(String name)
static boolean isZooKeeperAccessible(String hostName, String port)
static void addEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)
static void enableMultiUserComponents(Collection< JTextField > textFields, boolean enabled)
javax.swing.JButton bnTestMessageService
void bnTestMessageServiceActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JPasswordField tbDbPassword
javax.swing.JLabel lbSolrNote1
javax.swing.JPasswordField tbMsgPassword
javax.swing.JLabel lbMessageServiceSettings
void insertUpdate(DocumentEvent e)
boolean solr8FieldsArePopulated()
boolean ZooKeeperFieldsArePopulated()
static String getIndexingServerHost()
javax.swing.JScrollPane jScrollPane
javax.swing.JButton bnTestDatabase
static void addDocumentListeners(Collection< JTextField > textFields, TextBoxChangedListener listener)
javax.swing.JTextField tbSolr8Port