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.io.IOException;
36 import java.util.logging.Level;
37 import javax.swing.ImageIcon;
38 import javax.swing.JOptionPane;
39 import javax.swing.SwingUtilities;
40 import org.openide.util.ImageUtilities;
41 import org.openide.util.Lookup;
54 @SuppressWarnings(
"PMD.SingularField")
57 private static final String HOST_NAME_OR_IP_PROMPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbHostname.toolTipText");
58 private static final String PORT_PROMPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbPort.toolTipText");
59 private static final String USER_NAME_PROMPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbUsername.toolTipText");
60 private static final String PASSWORD_PROMPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbPassword.toolTipText");
61 private static final String USER_NAME_PROMPT_OPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbMsgUsername.toolTipText");
62 private static final String PASSWORD_PROMPT_OPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbMsgPassword.toolTipText");
63 private static final String INCOMPLETE_SETTINGS_MSG = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.validationErrMsg.incomplete");
64 private static final String INVALID_DB_PORT_MSG = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.validationErrMsg.invalidDatabasePort");
65 private static final String INVALID_MESSAGE_SERVICE_PORT_MSG = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.validationErrMsg.invalidMessageServicePort");
66 private static final String INVALID_INDEXING_SERVER_PORT_MSG = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.validationErrMsg.invalidIndexingServerPort");
67 private static final String INVALID_SOLR4_SERVER_PORT_MSG = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.validationErrMsg.invalidSolr4ServerPort");
68 private static final String SOLR_SERVER_NOT_CONFIGURED_MSG = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.validationErrMsg.solrNotConfigured");
69 private static final String INVALID_ZK_SERVER_HOST_MSG = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.validationErrMsg.invalidZkServerHostName");
70 private static final String INVALID_ZK_SERVER_PORT_MSG = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.validationErrMsg.invalidZkServerPort");
71 private static final String SOLR8_HOST_NAME_OR_IP_PROMPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbSolr8Hostname.toolTipText");
72 private static final String SOLR8_PORT_PROMPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbSolr8Port.toolTipText");
73 private static final String SOLR4_HOST_NAME_OR_IP_PROMPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbSolr4Hostname.toolTipText");
74 private static final String SOLR4_PORT_PROMPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbSolr4Port.toolTipText");
75 private static final String ZK_HOST_NAME_OR_IP_PROMPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbZkHostname.toolTipText");
76 private static final String ZK_PORT_PROMPT = NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbZkPort.toolTipText");
78 private static final long serialVersionUID = 1L;
80 private final Collection<JTextField> textBoxes =
new ArrayList<>();
94 controller = theController;
100 Collection<TextPrompt> textPrompts =
new ArrayList<>();
101 textPrompts.add(
new TextPrompt(HOST_NAME_OR_IP_PROMPT, tbDbHostname));
102 textPrompts.add(
new TextPrompt(PORT_PROMPT, tbDbPort));
103 textPrompts.add(
new TextPrompt(USER_NAME_PROMPT, tbDbUsername));
104 textPrompts.add(
new TextPrompt(PASSWORD_PROMPT, tbDbPassword));
105 textPrompts.add(
new TextPrompt(HOST_NAME_OR_IP_PROMPT, tbMsgHostname));
106 textPrompts.add(
new TextPrompt(PORT_PROMPT, tbMsgPort));
107 textPrompts.add(
new TextPrompt(USER_NAME_PROMPT_OPT, tbMsgUsername));
108 textPrompts.add(
new TextPrompt(PASSWORD_PROMPT_OPT, tbMsgPassword));
109 textPrompts.add(
new TextPrompt(SOLR8_HOST_NAME_OR_IP_PROMPT, tbSolr8Hostname));
110 textPrompts.add(
new TextPrompt(SOLR8_PORT_PROMPT, tbSolr8Port));
111 textPrompts.add(
new TextPrompt(SOLR4_HOST_NAME_OR_IP_PROMPT, tbSolr4Hostname));
112 textPrompts.add(
new TextPrompt(SOLR4_PORT_PROMPT, tbSolr4Port));
113 textPrompts.add(
new TextPrompt(ZK_HOST_NAME_OR_IP_PROMPT, tbZkHostname));
114 textPrompts.add(
new TextPrompt(ZK_PORT_PROMPT, tbZkPort));
115 configureTextPrompts(textPrompts);
121 tbDbHostname.getDocument().putProperty(
"statusIcon", lbTestDatabase);
122 tbDbPort.getDocument().putProperty(
"statusIcon", lbTestDatabase);
123 tbDbUsername.getDocument().putProperty(
"statusIcon", lbTestDatabase);
124 tbDbPassword.getDocument().putProperty(
"statusIcon", lbTestDatabase);
126 tbSolr8Hostname.getDocument().putProperty(
"statusIcon", lbTestSolr8);
127 tbSolr8Port.getDocument().putProperty(
"statusIcon", lbTestSolr8);
128 tbSolr4Hostname.getDocument().putProperty(
"statusIcon", lbTestSolr4);
129 tbSolr4Port.getDocument().putProperty(
"statusIcon", lbTestSolr4);
130 tbZkHostname.getDocument().putProperty(
"statusIcon", lbTestZK);
131 tbZkPort.getDocument().putProperty(
"statusIcon", lbTestZK);
133 tbMsgHostname.getDocument().putProperty(
"statusIcon", lbTestMessageService);
134 tbMsgPort.getDocument().putProperty(
"statusIcon", lbTestMessageService);
135 tbMsgUsername.getDocument().putProperty(
"statusIcon", lbTestMessageService);
136 tbMsgPassword.getDocument().putProperty(
"statusIcon", lbTestMessageService);
139 textBoxChangedListener =
new TextBoxChangedListener();
140 textBoxes.add(tbDbHostname);
141 textBoxes.add(tbDbPort);
142 textBoxes.add(tbDbUsername);
143 textBoxes.add(tbDbPassword);
144 textBoxes.add(tbMsgHostname);
145 textBoxes.add(tbMsgPort);
146 textBoxes.add(tbMsgUsername);
147 textBoxes.add(tbMsgPassword);
148 textBoxes.add(tbSolr8Hostname);
149 textBoxes.add(tbSolr8Port);
150 textBoxes.add(tbSolr4Hostname);
151 textBoxes.add(tbSolr4Port);
152 textBoxes.add(tbZkHostname);
153 textBoxes.add(tbZkPort);
158 addDocumentListeners(textBoxes, textBoxChangedListener);
159 goodIcon =
new ImageIcon(ImageUtilities.loadImage(
"org/sleuthkit/autopsy/images/good.png",
false));
160 badIcon =
new ImageIcon(ImageUtilities.loadImage(
"org/sleuthkit/autopsy/images/bad.png",
false));
161 enableMultiUserComponents(textBoxes, cbEnableMultiUser.isSelected());
173 textPrompt.setForeground(Color.LIGHT_GRAY);
174 textPrompt.changeAlpha(alpha);
185 for (JTextField textField : textFields) {
186 textField.getDocument().addDocumentListener(listener);
195 @SuppressWarnings(
"unchecked")
197 private
void initComponents() {
199 jScrollPane =
new javax.swing.JScrollPane();
200 pnOverallPanel =
new javax.swing.JPanel();
201 pnDatabaseSettings =
new javax.swing.JPanel();
202 tbDbHostname =
new javax.swing.JTextField();
203 tbDbPort =
new javax.swing.JTextField();
204 tbDbUsername =
new javax.swing.JTextField();
205 tbDbPassword =
new javax.swing.JPasswordField();
206 lbDatabaseSettings =
new javax.swing.JLabel();
207 bnTestDatabase =
new javax.swing.JButton();
208 lbTestDatabase =
new javax.swing.JLabel();
209 lbTestDbWarning =
new javax.swing.JLabel();
210 pnSolrSettings =
new javax.swing.JPanel();
211 lbSolr8Settings =
new javax.swing.JLabel();
212 tbSolr8Hostname =
new javax.swing.JTextField();
213 tbSolr8Port =
new javax.swing.JTextField();
214 bnTestSolr8 =
new javax.swing.JButton();
215 lbTestSolr8 =
new javax.swing.JLabel();
216 lbWarning =
new javax.swing.JLabel();
217 tbSolr4Hostname =
new javax.swing.JTextField();
218 tbSolr4Port =
new javax.swing.JTextField();
219 lbSolr4Settings =
new javax.swing.JLabel();
220 lbZkSettings =
new javax.swing.JLabel();
221 tbZkHostname =
new javax.swing.JTextField();
222 tbZkPort =
new javax.swing.JTextField();
223 lbSolrNote1 =
new javax.swing.JLabel();
224 lbSolrNote2 =
new javax.swing.JLabel();
225 bnTestSolr4 =
new javax.swing.JButton();
226 lbTestSolr4 =
new javax.swing.JLabel();
227 lbTestZK =
new javax.swing.JLabel();
228 bnTestZK =
new javax.swing.JButton();
229 pnMessagingSettings =
new javax.swing.JPanel();
230 lbMessageServiceSettings =
new javax.swing.JLabel();
231 tbMsgHostname =
new javax.swing.JTextField();
232 tbMsgUsername =
new javax.swing.JTextField();
233 tbMsgPort =
new javax.swing.JTextField();
234 tbMsgPassword =
new javax.swing.JPasswordField();
235 bnTestMessageService =
new javax.swing.JButton();
236 lbTestMessageService =
new javax.swing.JLabel();
237 lbTestMessageWarning =
new javax.swing.JLabel();
238 cbEnableMultiUser =
new javax.swing.JCheckBox();
239 tbOops =
new javax.swing.JTextField();
241 pnDatabaseSettings.setBorder(javax.swing.BorderFactory.createEtchedBorder());
243 tbDbHostname.setFont(tbDbHostname.getFont().deriveFont(tbDbHostname.getFont().getSize()+1f));
244 tbDbHostname.setText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbHostname.text"));
245 tbDbHostname.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbHostname.toolTipText"));
247 tbDbPort.setFont(tbDbPort.getFont().deriveFont(tbDbPort.getFont().getSize()+1f));
248 tbDbPort.setText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbPort.text"));
249 tbDbPort.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbPort.toolTipText"));
251 tbDbUsername.setFont(tbDbUsername.getFont().deriveFont(tbDbUsername.getFont().getSize()+1f));
252 tbDbUsername.setText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbUsername.text"));
253 tbDbUsername.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbUsername.toolTipText"));
255 tbDbPassword.setFont(tbDbPassword.getFont().deriveFont(tbDbPassword.getFont().getSize()+1f));
256 tbDbPassword.setText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbPassword.text"));
257 tbDbPassword.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbDbPassword.toolTipText"));
259 lbDatabaseSettings.setFont(lbDatabaseSettings.getFont().deriveFont(lbDatabaseSettings.getFont().getSize()+1f));
260 org.openide.awt.Mnemonics.setLocalizedText(lbDatabaseSettings,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbDatabaseSettings.text"));
261 lbDatabaseSettings.setVerticalAlignment(javax.swing.SwingConstants.TOP);
263 org.openide.awt.Mnemonics.setLocalizedText(bnTestDatabase,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.bnTestDatabase.text"));
264 bnTestDatabase.addActionListener(
new java.awt.event.ActionListener() {
265 public void actionPerformed(java.awt.event.ActionEvent evt) {
266 bnTestDatabaseActionPerformed(evt);
270 org.openide.awt.Mnemonics.setLocalizedText(lbTestDatabase,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbTestDatabase.text"));
271 lbTestDatabase.setAutoscrolls(
true);
273 lbTestDbWarning.setForeground(
new java.awt.Color(255, 0, 0));
274 org.openide.awt.Mnemonics.setLocalizedText(lbTestDbWarning,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbTestDbWarning.text"));
276 javax.swing.GroupLayout pnDatabaseSettingsLayout =
new javax.swing.GroupLayout(pnDatabaseSettings);
277 pnDatabaseSettings.setLayout(pnDatabaseSettingsLayout);
278 pnDatabaseSettingsLayout.setHorizontalGroup(
279 pnDatabaseSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
280 .addGroup(pnDatabaseSettingsLayout.createSequentialGroup()
282 .addGroup(pnDatabaseSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
283 .addComponent(tbDbHostname)
284 .addGroup(pnDatabaseSettingsLayout.createSequentialGroup()
285 .addComponent(lbDatabaseSettings)
286 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 231, Short.MAX_VALUE)
287 .addComponent(bnTestDatabase)
289 .addComponent(lbTestDatabase, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
290 .addComponent(tbDbPort)
291 .addComponent(tbDbUsername)
292 .addComponent(tbDbPassword)
293 .addGroup(pnDatabaseSettingsLayout.createSequentialGroup()
294 .addComponent(lbTestDbWarning)
295 .addGap(0, 0, Short.MAX_VALUE)))
298 pnDatabaseSettingsLayout.setVerticalGroup(
299 pnDatabaseSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
300 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnDatabaseSettingsLayout.createSequentialGroup()
302 .addGroup(pnDatabaseSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
303 .addComponent(bnTestDatabase)
304 .addComponent(lbTestDatabase, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
305 .addComponent(lbDatabaseSettings, javax.swing.GroupLayout.Alignment.TRAILING))
306 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
307 .addComponent(tbDbHostname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
308 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
309 .addComponent(tbDbPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
310 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
311 .addComponent(tbDbUsername, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
312 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
313 .addComponent(tbDbPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
314 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
315 .addComponent(lbTestDbWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
319 pnSolrSettings.setBorder(javax.swing.BorderFactory.createEtchedBorder());
321 lbSolr8Settings.setFont(lbSolr8Settings.getFont().deriveFont(lbSolr8Settings.getFont().getSize()+1f));
322 org.openide.awt.Mnemonics.setLocalizedText(lbSolr8Settings,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbSolr8Settings.text"));
324 tbSolr8Hostname.setFont(tbSolr8Hostname.getFont().deriveFont(tbSolr8Hostname.getFont().getSize()+1f));
325 tbSolr8Hostname.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbSolr8Hostname.toolTipText"));
327 tbSolr8Port.setFont(tbSolr8Port.getFont().deriveFont(tbSolr8Port.getFont().getSize()+1f));
328 tbSolr8Port.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbSolr8Port.toolTipText"));
330 org.openide.awt.Mnemonics.setLocalizedText(bnTestSolr8,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.bnTestSolr8.text"));
331 bnTestSolr8.addActionListener(
new java.awt.event.ActionListener() {
332 public void actionPerformed(java.awt.event.ActionEvent evt) {
333 bnTestSolr8ActionPerformed(evt);
337 org.openide.awt.Mnemonics.setLocalizedText(lbTestSolr8,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbTestSolr8.text"));
339 lbWarning.setForeground(
new java.awt.Color(255, 0, 0));
340 org.openide.awt.Mnemonics.setLocalizedText(lbWarning,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbWarning.text"));
342 tbSolr4Hostname.setFont(tbSolr4Hostname.getFont().deriveFont(tbSolr4Hostname.getFont().getSize()+1f));
343 tbSolr4Hostname.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbSolr4Hostname.toolTipText"));
345 tbSolr4Port.setFont(tbSolr4Port.getFont().deriveFont(tbSolr4Port.getFont().getSize()+1f));
346 tbSolr4Port.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbSolr4Port.toolTipText"));
348 lbSolr4Settings.setFont(lbSolr4Settings.getFont().deriveFont(lbSolr4Settings.getFont().getSize()+1f));
349 org.openide.awt.Mnemonics.setLocalizedText(lbSolr4Settings,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbSolr4Settings.text"));
351 lbZkSettings.setFont(lbZkSettings.getFont().deriveFont(lbZkSettings.getFont().getSize()+1f));
352 org.openide.awt.Mnemonics.setLocalizedText(lbZkSettings,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbZkSettings.text"));
354 tbZkHostname.setFont(tbZkHostname.getFont().deriveFont(tbZkHostname.getFont().getSize()+1f));
355 tbZkHostname.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbZkHostname.toolTipText"));
357 tbZkPort.setFont(tbZkPort.getFont().deriveFont(tbZkPort.getFont().getSize()+1f));
358 tbZkPort.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbZkPort.toolTipText"));
360 lbSolrNote1.setFont(lbSolrNote1.getFont().deriveFont(lbSolrNote1.getFont().getSize()+1f));
361 lbSolrNote1.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/corecomponents/warning16.png")));
362 org.openide.awt.Mnemonics.setLocalizedText(lbSolrNote1,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbSolrNote1.text"));
364 lbSolrNote2.setFont(lbSolrNote2.getFont().deriveFont(lbSolrNote2.getFont().getSize()+1f));
365 org.openide.awt.Mnemonics.setLocalizedText(lbSolrNote2,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbSolrNote2.text"));
367 org.openide.awt.Mnemonics.setLocalizedText(bnTestSolr4,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.bnTestSolr4.text"));
368 bnTestSolr4.addActionListener(
new java.awt.event.ActionListener() {
369 public void actionPerformed(java.awt.event.ActionEvent evt) {
370 bnTestSolr4ActionPerformed(evt);
374 org.openide.awt.Mnemonics.setLocalizedText(lbTestSolr4,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbTestSolr4.text"));
376 org.openide.awt.Mnemonics.setLocalizedText(lbTestZK,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbTestZK.text"));
378 org.openide.awt.Mnemonics.setLocalizedText(bnTestZK,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.bnTestZK.text"));
379 bnTestZK.addActionListener(
new java.awt.event.ActionListener() {
380 public void actionPerformed(java.awt.event.ActionEvent evt) {
381 bnTestZKActionPerformed(evt);
385 javax.swing.GroupLayout pnSolrSettingsLayout =
new javax.swing.GroupLayout(pnSolrSettings);
386 pnSolrSettings.setLayout(pnSolrSettingsLayout);
387 pnSolrSettingsLayout.setHorizontalGroup(
388 pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
389 .addGroup(pnSolrSettingsLayout.createSequentialGroup()
391 .addGroup(pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
392 .addGroup(pnSolrSettingsLayout.createSequentialGroup()
393 .addComponent(lbSolr4Settings)
394 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
395 .addComponent(bnTestSolr4)
397 .addComponent(lbTestSolr4, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
398 .addComponent(tbSolr8Hostname)
399 .addComponent(tbSolr8Port)
400 .addComponent(tbSolr4Hostname)
401 .addComponent(tbSolr4Port)
402 .addComponent(tbZkHostname)
403 .addComponent(tbZkPort)
404 .addGroup(pnSolrSettingsLayout.createSequentialGroup()
405 .addComponent(lbZkSettings)
406 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 164, Short.MAX_VALUE)
407 .addComponent(bnTestZK)
409 .addComponent(lbTestZK, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
410 .addGroup(pnSolrSettingsLayout.createSequentialGroup()
411 .addComponent(lbSolr8Settings)
412 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
413 .addComponent(bnTestSolr8)
415 .addComponent(lbTestSolr8, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
416 .addGroup(pnSolrSettingsLayout.createSequentialGroup()
417 .addGroup(pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
418 .addComponent(lbSolrNote1)
419 .addComponent(lbSolrNote2)
420 .addComponent(lbWarning))
421 .addGap(0, 0, Short.MAX_VALUE)))
424 pnSolrSettingsLayout.setVerticalGroup(
425 pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
426 .addGroup(pnSolrSettingsLayout.createSequentialGroup()
428 .addComponent(lbSolrNote1)
429 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
430 .addGroup(pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
431 .addGroup(pnSolrSettingsLayout.createSequentialGroup()
432 .addComponent(lbSolrNote2)
434 .addComponent(lbSolr8Settings))
435 .addGroup(pnSolrSettingsLayout.createSequentialGroup()
436 .addComponent(lbTestSolr8, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
438 .addComponent(bnTestSolr8))
440 .addComponent(tbSolr8Hostname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
441 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
442 .addComponent(tbSolr8Port, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
444 .addGroup(pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
445 .addGroup(pnSolrSettingsLayout.createSequentialGroup()
446 .addGroup(pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
447 .addComponent(lbSolr4Settings, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE)
448 .addComponent(bnTestSolr4))
449 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
450 .addComponent(tbSolr4Hostname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
451 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
452 .addComponent(tbSolr4Port, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
453 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
454 .addGroup(pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
455 .addGroup(pnSolrSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
456 .addComponent(lbZkSettings)
457 .addComponent(bnTestZK))
458 .addComponent(lbTestZK, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
459 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
460 .addComponent(tbZkHostname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
461 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
462 .addComponent(tbZkPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
463 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
464 .addComponent(lbWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
465 .addGroup(pnSolrSettingsLayout.createSequentialGroup()
466 .addComponent(lbTestSolr4, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
467 .addGap(0, 0, Short.MAX_VALUE)))
471 tbSolr4Port.getAccessibleContext().setAccessibleDescription(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbSolr4Port.toolTipText"));
473 pnMessagingSettings.setBorder(javax.swing.BorderFactory.createEtchedBorder());
475 lbMessageServiceSettings.setFont(lbMessageServiceSettings.getFont().deriveFont((
float)12));
476 org.openide.awt.Mnemonics.setLocalizedText(lbMessageServiceSettings,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbMessageServiceSettings.text"));
478 tbMsgHostname.setFont(tbMsgHostname.getFont().deriveFont(tbMsgHostname.getFont().getSize()+1f));
479 tbMsgHostname.setText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbMsgHostname.text"));
480 tbMsgHostname.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbMsgHostname.toolTipText"));
482 tbMsgUsername.setFont(tbMsgUsername.getFont().deriveFont(tbMsgUsername.getFont().getSize()+1f));
483 tbMsgUsername.setText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbMsgUsername.text"));
484 tbMsgUsername.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbMsgUsername.toolTipText"));
486 tbMsgPort.setFont(tbMsgPort.getFont().deriveFont(tbMsgPort.getFont().getSize()+1f));
487 tbMsgPort.setText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbMsgPort.text"));
488 tbMsgPort.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbMsgPort.toolTipText"));
490 tbMsgPassword.setFont(tbMsgPassword.getFont().deriveFont(tbMsgPassword.getFont().getSize()+1f));
491 tbMsgPassword.setText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbMsgPassword.text"));
492 tbMsgPassword.setToolTipText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbMsgPassword.toolTipText"));
494 org.openide.awt.Mnemonics.setLocalizedText(bnTestMessageService,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.bnTestMessageService.text"));
495 bnTestMessageService.addActionListener(
new java.awt.event.ActionListener() {
496 public void actionPerformed(java.awt.event.ActionEvent evt) {
497 bnTestMessageServiceActionPerformed(evt);
501 org.openide.awt.Mnemonics.setLocalizedText(lbTestMessageService,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbTestMessageService.text"));
503 lbTestMessageWarning.setForeground(
new java.awt.Color(255, 0, 0));
504 org.openide.awt.Mnemonics.setLocalizedText(lbTestMessageWarning,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.lbTestMessageWarning.text"));
506 javax.swing.GroupLayout pnMessagingSettingsLayout =
new javax.swing.GroupLayout(pnMessagingSettings);
507 pnMessagingSettings.setLayout(pnMessagingSettingsLayout);
508 pnMessagingSettingsLayout.setHorizontalGroup(
509 pnMessagingSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
510 .addGroup(pnMessagingSettingsLayout.createSequentialGroup()
512 .addGroup(pnMessagingSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
513 .addComponent(tbMsgHostname)
514 .addGroup(pnMessagingSettingsLayout.createSequentialGroup()
515 .addComponent(lbMessageServiceSettings)
516 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
517 .addComponent(bnTestMessageService)
519 .addComponent(lbTestMessageService, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE))
520 .addComponent(tbMsgPort)
521 .addComponent(tbMsgUsername)
522 .addComponent(tbMsgPassword)
523 .addGroup(pnMessagingSettingsLayout.createSequentialGroup()
524 .addComponent(lbTestMessageWarning)
525 .addGap(0, 0, Short.MAX_VALUE)))
528 pnMessagingSettingsLayout.setVerticalGroup(
529 pnMessagingSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
530 .addGroup(pnMessagingSettingsLayout.createSequentialGroup()
532 .addGroup(pnMessagingSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
533 .addGroup(pnMessagingSettingsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
534 .addComponent(bnTestMessageService)
535 .addComponent(lbMessageServiceSettings))
536 .addComponent(lbTestMessageService, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
537 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
538 .addComponent(tbMsgHostname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
539 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
540 .addComponent(tbMsgPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
541 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
542 .addComponent(tbMsgUsername, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
543 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
544 .addComponent(tbMsgPassword, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
545 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
546 .addComponent(lbTestMessageWarning, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
547 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
550 org.openide.awt.Mnemonics.setLocalizedText(cbEnableMultiUser,
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.cbEnableMultiUser.text"));
551 cbEnableMultiUser.addItemListener(
new java.awt.event.ItemListener() {
552 public void itemStateChanged(java.awt.event.ItemEvent evt) {
553 cbEnableMultiUserItemStateChanged(evt);
557 tbOops.setEditable(
false);
558 tbOops.setFont(tbOops.getFont().deriveFont(tbOops.getFont().getStyle() | java.awt.Font.BOLD, tbOops.getFont().getSize()+1));
559 tbOops.setForeground(
new java.awt.Color(255, 0, 0));
560 tbOops.setText(
org.openide.util.NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.tbOops.text"));
561 tbOops.setBorder(null);
563 javax.swing.GroupLayout pnOverallPanelLayout =
new javax.swing.GroupLayout(pnOverallPanel);
564 pnOverallPanel.setLayout(pnOverallPanelLayout);
565 pnOverallPanelLayout.setHorizontalGroup(
566 pnOverallPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
567 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnOverallPanelLayout.createSequentialGroup()
569 .addGroup(pnOverallPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
570 .addGroup(pnOverallPanelLayout.createSequentialGroup()
571 .addComponent(cbEnableMultiUser)
572 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
573 .addComponent(tbOops))
574 .addComponent(pnDatabaseSettings, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
575 .addComponent(pnMessagingSettings, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
576 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
577 .addComponent(pnSolrSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
580 pnOverallPanelLayout.setVerticalGroup(
581 pnOverallPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
582 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pnOverallPanelLayout.createSequentialGroup()
583 .addGroup(pnOverallPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
584 .addComponent(tbOops, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
585 .addComponent(cbEnableMultiUser))
586 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
587 .addGroup(pnOverallPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
588 .addGroup(pnOverallPanelLayout.createSequentialGroup()
589 .addComponent(pnDatabaseSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
591 .addComponent(pnMessagingSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
592 .addComponent(pnSolrSettings, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
593 .addContainerGap(234, Short.MAX_VALUE))
596 jScrollPane.setViewportView(pnOverallPanel);
598 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
599 this.setLayout(layout);
600 layout.setHorizontalGroup(
601 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
602 .addComponent(jScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 1250, Short.MAX_VALUE)
604 layout.setVerticalGroup(
605 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
606 .addGroup(layout.createSequentialGroup()
608 .addComponent(jScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 695, Short.MAX_VALUE)
620 for (JTextField textField : textFields) {
621 textField.setEnabled(enabled);
626 if (!cbEnableMultiUser.isSelected()) {
628 bnTestDatabase.setEnabled(
false);
629 lbTestDatabase.setIcon(null);
630 bnTestSolr8.setEnabled(
false);
631 lbTestSolr8.setIcon(null);
632 bnTestSolr4.setEnabled(
false);
633 lbTestSolr4.setIcon(null);
634 bnTestZK.setEnabled(
false);
635 lbTestZK.setIcon(null);
636 bnTestMessageService.setEnabled(
false);
637 lbTestMessageService.setIcon(null);
638 lbTestDbWarning.setText(
"");
639 lbWarning.setText(
"");
640 lbTestMessageWarning.setText(
"");
642 enableMultiUserComponents(textBoxes, cbEnableMultiUser.isSelected());
647 lbTestDatabase.setIcon(null);
648 lbTestDatabase.paintImmediately(lbTestDatabase.getVisibleRect());
649 lbTestDbWarning.setText(
"");
650 lbTestDbWarning.paintImmediately(lbTestDbWarning.getVisibleRect());
651 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
653 CaseDbConnectionInfo info =
new CaseDbConnectionInfo(
654 this.tbDbHostname.getText().trim(),
655 this.tbDbPort.getText().trim(),
656 this.tbDbUsername.getText().trim(),
657 new String(this.tbDbPassword.getPassword()),
660 SleuthkitCase.tryConnect(info);
661 lbTestDatabase.setIcon(goodIcon);
662 lbTestDbWarning.setText(
"");
663 }
catch (TskCoreException ex) {
664 lbTestDatabase.setIcon(badIcon);
665 lbTestDbWarning.setText(ex.getMessage());
667 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
672 lbTestMessageService.setIcon(null);
673 lbTestMessageService.paintImmediately(lbTestMessageService.getVisibleRect());
674 lbTestMessageWarning.setText(
"");
675 lbTestMessageWarning.paintImmediately(lbTestMessageWarning.getVisibleRect());
676 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
680 port = Integer.parseInt(this.tbMsgPort.getText().trim());
681 }
catch (NumberFormatException ex) {
682 lbTestMessageService.setIcon(badIcon);
683 lbTestMessageWarning.setText(NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.InvalidPortNumber"));
688 this.tbMsgHostname.getText().trim(),
690 this.tbMsgUsername.getText().trim(),
691 new String(this.tbMsgPassword.getPassword()));
694 lbTestMessageService.setIcon(goodIcon);
695 lbTestMessageWarning.setText(
"");
697 lbTestMessageService.setIcon(badIcon);
698 lbTestMessageWarning.setText(ex.getMessage());
700 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
705 lbTestSolr8.setIcon(null);
706 lbTestSolr8.paintImmediately(lbTestSolr8.getVisibleRect());
707 lbWarning.setText(
"");
708 lbWarning.paintImmediately(lbWarning.getVisibleRect());
709 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
713 if (kwsService != null) {
715 if (tbSolr8Port.getText().trim().isEmpty() || tbSolr8Hostname.getText().trim().isEmpty()) {
716 lbTestSolr8.setIcon(badIcon);
717 lbWarning.setText(NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.Solr8ConnectionInfoMissing.error"));
720 int port = Integer.parseInt(tbSolr8Port.getText().trim());
721 kwsService.
tryConnect(tbSolr8Hostname.getText().trim(), port);
722 lbTestSolr8.setIcon(goodIcon);
723 lbWarning.setText(
"");
725 lbTestSolr8.setIcon(badIcon);
726 lbWarning.setText(NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.KeywordSearchNull"));
728 }
catch (NumberFormatException ex) {
729 lbTestSolr8.setIcon(badIcon);
730 lbWarning.setText(NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.InvalidPortNumber"));
732 lbTestSolr8.setIcon(badIcon);
733 lbWarning.setText(ex.getMessage());
735 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
740 lbTestSolr4.setIcon(null);
741 lbTestSolr4.paintImmediately(lbTestSolr4.getVisibleRect());
742 lbWarning.setText(
"");
743 lbWarning.paintImmediately(lbWarning.getVisibleRect());
744 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
748 if (kwsService != null) {
750 if (tbSolr4Port.getText().trim().isEmpty() || tbSolr4Hostname.getText().trim().isEmpty()) {
751 lbTestSolr4.setIcon(badIcon);
752 lbWarning.setText(NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.Solr4ConnectionInfoMissing.error"));
755 int port = Integer.parseInt(tbSolr4Port.getText().trim());
756 kwsService.
tryConnect(tbSolr4Hostname.getText().trim(), port);
757 lbTestSolr4.setIcon(goodIcon);
758 lbWarning.setText(
"");
760 lbTestSolr4.setIcon(badIcon);
761 lbWarning.setText(NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.KeywordSearchNull"));
763 }
catch (NumberFormatException ex) {
764 lbTestSolr4.setIcon(badIcon);
765 lbWarning.setText(NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.InvalidPortNumber"));
767 lbTestSolr4.setIcon(badIcon);
768 lbWarning.setText(ex.getMessage());
770 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
775 lbTestZK.setIcon(null);
776 lbTestZK.paintImmediately(lbTestZK.getVisibleRect());
777 lbWarning.setText(
"");
778 lbWarning.paintImmediately(lbWarning.getVisibleRect());
779 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
783 if (tbZkPort.getText().trim().isEmpty() || tbZkHostname.getText().trim().isEmpty()) {
784 lbTestZK.setIcon(badIcon);
785 lbWarning.setText(NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.UnableToConnectToZK"));
790 lbTestZK.setIcon(badIcon);
791 lbWarning.setText(NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.UnableToConnectToZK"));
795 lbTestZK.setIcon(goodIcon);
796 lbWarning.setText(
"");
797 }
catch (NumberFormatException ex) {
798 lbTestZK.setIcon(badIcon);
799 lbWarning.setText(NbBundle.getMessage(
MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.InvalidPortNumber"));
800 }
catch (InterruptedException | IOException ex) {
802 lbTestZK.setIcon(badIcon);
803 lbWarning.setText(ex.getMessage());
805 setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
810 lbTestDatabase.setIcon(null);
811 lbTestSolr8.setIcon(null);
812 lbTestSolr4.setIcon(null);
813 lbTestZK.setIcon(null);
814 lbTestMessageService.setIcon(null);
815 lbTestDbWarning.setText(
"");
816 lbWarning.setText(
"");
817 lbTestMessageWarning.setText(
"");
821 tbDbHostname.setText(dbInfo.getHost().trim());
822 tbDbPort.setText(dbInfo.getPort().trim());
823 tbDbUsername.setText(dbInfo.getUserName().trim());
824 tbDbPassword.setText(dbInfo.getPassword());
825 }
catch (UserPreferencesException ex) {
826 logger.log(Level.SEVERE,
"Error accessing case database connection info", ex);
830 MessageServiceConnectionInfo msgServiceInfo = UserPreferences.getMessageServiceConnectionInfo();
831 tbMsgHostname.setText(msgServiceInfo.getHost().trim());
832 tbMsgPort.setText(Integer.toString(msgServiceInfo.getPort()));
833 tbMsgUsername.setText(msgServiceInfo.getUserName().trim());
834 tbMsgPassword.setText(msgServiceInfo.getPassword());
835 }
catch (UserPreferencesException ex) {
836 logger.log(Level.SEVERE,
"Error accessing case database connection info", ex);
839 populateSolrAndZkSettings();
841 bnTestDatabase.setEnabled(
false);
842 bnTestSolr8.setEnabled(
false);
843 bnTestSolr4.setEnabled(
false);
844 bnTestZK.setEnabled(
false);
845 bnTestMessageService.setEnabled(
false);
847 cbEnableMultiUser.setSelected(UserPreferences.getIsMultiUserModeEnabled());
854 if (!indexingServerHost.isEmpty()) {
855 tbSolr8Hostname.setText(indexingServerHost);
858 if (portNumberIsValid(indexingServerPort)) {
859 tbSolr8Port.setText(indexingServerPort);
863 if (!solr4ServerHost.isEmpty()) {
864 tbSolr4Hostname.setText(solr4ServerHost);
867 if (portNumberIsValid(solr4ServerPort)) {
868 tbSolr4Port.setText(solr4ServerPort);
873 if (portNumberIsValid(zkServerPort)) {
874 tbZkPort.setText(zkServerPort);
877 if (!zkServerHost.isEmpty()) {
878 tbZkHostname.setText(zkServerHost);
884 if (solr4ServerHost.isEmpty() && !indexingServerHost.isEmpty()) {
885 tbZkHostname.setText(indexingServerHost);
886 tbZkPort.setText(zkServerPort);
892 if (!solr4ServerHost.isEmpty() && indexingServerHost.isEmpty()) {
893 tbZkHostname.setText(solr4ServerHost);
894 tbZkPort.setText(zkServerPort);
906 return !tbDbHostname.getText().trim().isEmpty()
907 && !tbDbPort.getText().trim().isEmpty()
908 && !tbDbUsername.getText().trim().isEmpty()
909 && tbDbPassword.getPassword().length != 0;
921 if (!tbSolr4Hostname.getText().trim().isEmpty()
922 && !tbSolr4Port.getText().trim().isEmpty()) {
938 if (!tbSolr8Hostname.getText().trim().isEmpty()
939 && !tbSolr8Port.getText().trim().isEmpty()) {
954 return (!tbZkHostname.getText().trim().isEmpty()
955 && !tbZkPort.getText().trim().isEmpty());
966 if ((tbMsgHostname.getText().trim().isEmpty())
967 || (tbMsgPort.getText().trim().isEmpty())) {
972 boolean isUserSet = (tbMsgUsername.getText().trim().isEmpty() ==
false);
973 boolean isPwSet = (tbMsgPassword.getPassword().length != 0);
974 return (isUserSet == isPwSet);
979 CaseDbConnectionInfo prevConn = null;
982 }
catch (UserPreferencesException ex) {
983 logger.log(Level.SEVERE,
"There was an error while fetching previous connection settings while trying to save", ex);
986 boolean multiUserCasesEnabled = cbEnableMultiUser.isSelected();
987 UserPreferences.setIsMultiUserModeEnabled(multiUserCasesEnabled);
989 CaseDbConnectionInfo info = null;
991 if (multiUserCasesEnabled ==
true) {
994 boolean needsRestart =
false;
996 if (prevSelected ==
true) {
997 needsRestart = isRestartRequired();
1004 DbType dbType = DbType.POSTGRESQL;
1005 info =
new CaseDbConnectionInfo(
1006 tbDbHostname.getText().trim(),
1007 tbDbPort.getText().trim(),
1008 tbDbUsername.getText().trim(),
1009 new String(tbDbPassword.getPassword()),
1012 UserPreferences.setDatabaseConnectionInfo(info);
1013 }
catch (UserPreferencesException ex) {
1014 logger.log(Level.SEVERE,
"Error saving case database connection info", ex);
1017 int msgServicePort = 0;
1019 msgServicePort = Integer.parseInt(this.tbMsgPort.getText().trim());
1020 }
catch (NumberFormatException ex) {
1021 logger.log(Level.SEVERE,
"Could not parse messaging service port setting", ex);
1024 MessageServiceConnectionInfo msgServiceInfo =
new MessageServiceConnectionInfo(
1025 tbMsgHostname.getText().trim(),
1027 tbMsgUsername.getText().trim(),
1028 new String(tbMsgPassword.getPassword()));
1031 UserPreferences.setMessageServiceConnectionInfo(msgServiceInfo);
1032 }
catch (UserPreferencesException ex) {
1033 logger.log(Level.SEVERE,
"Error saving messaging service connection info", ex);
1036 UserPreferences.setIndexingServerHost(tbSolr8Hostname.getText().trim());
1037 String solr8port = tbSolr8Port.getText().trim();
1038 if (!solr8port.isEmpty()) {
1039 UserPreferences.setIndexingServerPort(Integer.parseInt(solr8port));
1041 UserPreferences.setSolr4ServerHost(tbSolr4Hostname.getText().trim());
1042 UserPreferences.setSolr4ServerPort(tbSolr4Port.getText().trim());
1043 UserPreferences.setZkServerHost(tbZkHostname.getText().trim());
1044 UserPreferences.setZkServerPort(tbZkPort.getText().trim());
1047 SwingUtilities.invokeLater(() -> {
1048 JOptionPane.showMessageDialog(
this,
1049 NbBundle.getMessage(MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.MustRestart"),
1050 NbBundle.getMessage(MultiUserSettingsPanel.class,
"MultiUserSettingsPanel.restartRequiredLabel.text"),
1051 JOptionPane.WARNING_MESSAGE);
1057 if (prevSelected != multiUserCasesEnabled || !areCaseDbConnectionEqual(prevConn, info)) {
1058 GlobalSettingsPanel.onMultiUserChange(
this, prevSelected, multiUserCasesEnabled);
1075 if (a == null || b == null) {
1076 return (a == null && b == null);
1083 if (a == null || b == null) {
1084 return (a == null && b == null);
1087 return arePropsEqual(a.getDbType(), b.getDbType())
1088 && arePropsEqual(a.getHost(), b.getHost())
1089 && arePropsEqual(a.getPassword(), b.getPassword())
1090 && arePropsEqual(a.getPort(), b.getPort())
1091 && arePropsEqual(a.getUserName(), b.getUserName());
1102 if (cbEnableMultiUser.isSelected()) {
1103 return checkFieldsAndEnableButtons()
1104 && databaseSettingsAreValid()
1105 && indexingServerSettingsAreValid()
1106 && messageServiceSettingsAreValid();
1118 boolean checkFieldsAndEnableButtons() {
1119 boolean result =
true;
1121 boolean dbPopulated = databaseFieldsArePopulated();
1122 boolean solr4Populated = solr4FieldsArePopulated();
1123 boolean solr8Populated = solr8FieldsArePopulated();
1124 boolean zkPopulated = ZooKeeperFieldsArePopulated();
1125 boolean messageServicePopulated = messageServiceFieldsArePopulated();
1128 bnTestDatabase.setEnabled(dbPopulated);
1131 bnTestSolr8.setEnabled(solr8Populated);
1132 bnTestSolr4.setEnabled(solr4Populated);
1133 bnTestZK.setEnabled(zkPopulated);
1136 bnTestMessageService.setEnabled(messageServicePopulated);
1138 if (dbPopulated && messageServicePopulated && zkPopulated && (solr8Populated || solr4Populated)) {
1143 tbOops.setText(INCOMPLETE_SETTINGS_MSG);
1153 boolean databaseSettingsAreValid() {
1154 if (portNumberIsValid(tbDbPort.getText().trim())) {
1157 tbOops.setText(INVALID_DB_PORT_MSG);
1167 boolean messageServiceSettingsAreValid() {
1168 if (!portNumberIsValid(tbMsgPort.getText().trim())) {
1169 tbOops.setText(INVALID_MESSAGE_SERVICE_PORT_MSG);
1181 boolean indexingServerSettingsAreValid() {
1183 String solr8Port = tbSolr8Port.getText().trim();
1184 if (!solr8Port.isEmpty() && !portNumberIsValid(solr8Port)) {
1186 tbOops.setText(INVALID_INDEXING_SERVER_PORT_MSG);
1190 String solr4Port = tbSolr4Port.getText().trim();
1191 if (!solr4Port.isEmpty() && !portNumberIsValid(solr4Port)) {
1193 tbOops.setText(INVALID_SOLR4_SERVER_PORT_MSG);
1198 boolean solrConfigured =
false;
1201 if (!tbSolr8Hostname.getText().trim().isEmpty()
1202 && !tbSolr8Port.getText().trim().isEmpty()) {
1203 solrConfigured =
true;
1207 if (!tbSolr4Hostname.getText().trim().isEmpty()
1208 && !tbSolr4Port.getText().trim().isEmpty()) {
1209 solrConfigured =
true;
1212 if (!solrConfigured) {
1213 tbOops.setText(SOLR_SERVER_NOT_CONFIGURED_MSG);
1218 if (tbZkHostname.getText().trim().isEmpty()) {
1219 tbOops.setText(INVALID_ZK_SERVER_HOST_MSG);
1224 String zkPort = tbZkPort.getText().trim();
1225 if (zkPort.isEmpty() || !portNumberIsValid(zkPort)) {
1227 tbOops.setText(INVALID_ZK_SERVER_PORT_MSG);
1244 int value = Integer.parseInt(portNumber);
1245 if (value < 0 || value > 65535) {
1248 }
catch (NumberFormatException detailsNotImportant) {
1302 class TextBoxChangedListener
implements DocumentListener {
1305 public void changedUpdate(DocumentEvent e) {
1306 Object statusIcon = e.getDocument().getProperty(
"statusIcon");
1307 if (statusIcon != null) {
1308 ((javax.swing.JLabel) statusIcon).setIcon(null);
1314 public void insertUpdate(DocumentEvent e) {
1315 Object statusIcon = e.getDocument().getProperty(
"statusIcon");
1316 if (statusIcon != null) {
1317 ((javax.swing.JLabel) statusIcon).setIcon(null);
1323 public void removeUpdate(DocumentEvent e) {
1324 Object statusIcon = e.getDocument().getProperty(
"statusIcon");
1325 if (statusIcon != null) {
1326 ((javax.swing.JLabel) statusIcon).setIcon(null);
1336 tbZkHostname.setText(tbSolr8Hostname.getText().trim());
1341 tbZkHostname.setText(tbSolr8Hostname.getText().trim());
1346 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 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