mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-19 19:14:55 +00:00
Complete multiuser settings panel additions for message service
This commit is contained in:
parent
7688a0791e
commit
d6d74a53de
@ -142,24 +142,20 @@ public final class UserPreferences {
|
|||||||
public static void setMessageServiceConnectionInfo(MessageServiceConnectionInfo info) {
|
public static void setMessageServiceConnectionInfo(MessageServiceConnectionInfo info) {
|
||||||
preferences.put(MESSAGE_SERVICE_USER, info.getUserName());
|
preferences.put(MESSAGE_SERVICE_USER, info.getUserName());
|
||||||
preferences.put(MESSAGE_SERVICE_PASSWORD, info.getPassword());
|
preferences.put(MESSAGE_SERVICE_PASSWORD, info.getPassword());
|
||||||
preferences.put(MESSAGE_SERVICE_HOST, info.getURI().getHost());
|
preferences.put(MESSAGE_SERVICE_HOST, info.getHost());
|
||||||
preferences.put(MESSAGE_SERVICE_PORT, Integer.toString(info.getURI().getPort()));
|
preferences.put(MESSAGE_SERVICE_PORT, info.getPort());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads persisted message service connection info.
|
* Reads persisted message service connection info.
|
||||||
*
|
*
|
||||||
* @return An object encapsulating the message service info.
|
* @return An object encapsulating the message service info.
|
||||||
* @throws NumberFormatException if the persisted port is not a valid
|
|
||||||
* integer.
|
|
||||||
* @throws URISyntaxException if the persisted connection info is not for a
|
|
||||||
* valid TCP URI.
|
|
||||||
*/
|
*/
|
||||||
public static MessageServiceConnectionInfo getMessageServiceConnectionInfo() throws NumberFormatException, URISyntaxException {
|
public static MessageServiceConnectionInfo getMessageServiceConnectionInfo() {
|
||||||
return new MessageServiceConnectionInfo(preferences.get(MESSAGE_SERVICE_USER, ""),
|
return new MessageServiceConnectionInfo(preferences.get(MESSAGE_SERVICE_USER, ""),
|
||||||
preferences.get(MESSAGE_SERVICE_PASSWORD, ""),
|
preferences.get(MESSAGE_SERVICE_PASSWORD, ""),
|
||||||
preferences.get(MESSAGE_SERVICE_HOST, ""),
|
preferences.get(MESSAGE_SERVICE_HOST, ""),
|
||||||
Integer.parseInt(preferences.get(MESSAGE_SERVICE_PORT, "")));
|
preferences.get(MESSAGE_SERVICE_PORT, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,10 +26,11 @@ import java.net.URISyntaxException;
|
|||||||
*/
|
*/
|
||||||
public final class MessageServiceConnectionInfo {
|
public final class MessageServiceConnectionInfo {
|
||||||
|
|
||||||
private static final String MESSAGE_SERVICE_URI = "tcp://%s:%d";
|
private static final String MESSAGE_SERVICE_URI = "tcp://%s:%s";
|
||||||
private final String userName;
|
private final String userName;
|
||||||
private final String password;
|
private final String password;
|
||||||
private final URI uri;
|
private final String host;
|
||||||
|
private final String port;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs an object containing the connection info for a Java Message
|
* Constructs an object containing the connection info for a Java Message
|
||||||
@ -40,12 +41,12 @@ public final class MessageServiceConnectionInfo {
|
|||||||
* @param host The host to use for a message service connection. May be a
|
* @param host The host to use for a message service connection. May be a
|
||||||
* host name or an IP address.
|
* host name or an IP address.
|
||||||
* @param port The port number to use for a message service connection.
|
* @param port The port number to use for a message service connection.
|
||||||
* @throws URISyntaxException if the host and port are not a valid TCP URI.
|
|
||||||
*/
|
*/
|
||||||
public MessageServiceConnectionInfo(String userName, String password, String host, int port) throws URISyntaxException {
|
public MessageServiceConnectionInfo(String userName, String password, String host, String port) {
|
||||||
this.userName = userName;
|
this.userName = userName;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
this.uri = new URI(String.format(MESSAGE_SERVICE_URI, host, port));
|
this.host = host;
|
||||||
|
this.port = port;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -65,14 +66,35 @@ public final class MessageServiceConnectionInfo {
|
|||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the host to use for a message service connection. May be a host name
|
||||||
|
* or an IP address.
|
||||||
|
*
|
||||||
|
* @return The host as a string.
|
||||||
|
*/
|
||||||
|
public String getHost() {
|
||||||
|
return host;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the port number to use for a message service connection.
|
||||||
|
*
|
||||||
|
* @return The port as a string.
|
||||||
|
*/
|
||||||
|
public String getPort() {
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the TCP URI to use for a message service connection.
|
* Gets the TCP URI to use for a message service connection.
|
||||||
*
|
*
|
||||||
* @return The URI.
|
* @return The URI.
|
||||||
|
* @throws URISyntaxException if the connection info is not for a valid TCP
|
||||||
|
* URI.
|
||||||
*/
|
*/
|
||||||
public URI getURI() {
|
URI getURI() throws URISyntaxException {
|
||||||
return uri;
|
return new URI(String.format(MESSAGE_SERVICE_URI, host, port));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -166,14 +166,11 @@ MultiUserSettingsPanel.validationErrMsg.incomplete=Fill in all values
|
|||||||
MultiUserSettingsPanel.validationErrMsg.invalidDatabasePort=Invalid database port number
|
MultiUserSettingsPanel.validationErrMsg.invalidDatabasePort=Invalid database port number
|
||||||
MultiUserSettingsPanel.validationErrMsg.invalidMessageServicePort=Invalid message service port number
|
MultiUserSettingsPanel.validationErrMsg.invalidMessageServicePort=Invalid message service port number
|
||||||
MultiUserSettingsPanel.validationErrMsg.invalidMessgeServiceURI=Message service host and/or port not valid
|
MultiUserSettingsPanel.validationErrMsg.invalidMessgeServiceURI=Message service host and/or port not valid
|
||||||
MultiUserSettingsPanel.validationErrMsg.invalidMessgeServicePassword=Message service password entries do not match
|
|
||||||
MultiUserSettingsPanel.msgHostTextField.text=
|
MultiUserSettingsPanel.msgHostTextField.text=
|
||||||
MultiUserSettingsPanel.msgHostTextField.toolTipText=Hostname or IP Address
|
MultiUserSettingsPanel.msgHostTextField.toolTipText=Hostname or IP Address
|
||||||
MultiUserSettingsPanel.msgUserNameTextField.toolTipText=Hostname or IP Address
|
MultiUserSettingsPanel.msgUserNameTextField.toolTipText=Hostname or IP Address
|
||||||
MultiUserSettingsPanel.msgUserNameTextField.text=
|
MultiUserSettingsPanel.msgUserNameTextField.text=
|
||||||
MultiUserSettingsPanel.msgPasswordField.toolTipText=Password
|
MultiUserSettingsPanel.msgPasswordField.toolTipText=Password
|
||||||
MultiUserSettingsPanel.msgPasswordField.text=
|
MultiUserSettingsPanel.msgPasswordField.text=
|
||||||
MultiUserSettingsPanel.msgRetypePasswordField.toolTipText=Retype Password
|
|
||||||
MultiUserSettingsPanel.msgRetypePasswordField.text=
|
|
||||||
MultiUserSettingsPanel.msgPortTextField.toolTipText=Hostname or IP Address
|
MultiUserSettingsPanel.msgPortTextField.toolTipText=Hostname or IP Address
|
||||||
MultiUserSettingsPanel.msgPortTextField.text=
|
MultiUserSettingsPanel.msgPortTextField.text=
|
||||||
|
@ -258,7 +258,6 @@
|
|||||||
<Component id="msgUserNameTextField" alignment="1" max="32767" attributes="0"/>
|
<Component id="msgUserNameTextField" alignment="1" max="32767" attributes="0"/>
|
||||||
<Component id="msgPortTextField" alignment="1" max="32767" attributes="0"/>
|
<Component id="msgPortTextField" alignment="1" max="32767" attributes="0"/>
|
||||||
<Component id="msgPasswordField" alignment="0" max="32767" attributes="0"/>
|
<Component id="msgPasswordField" alignment="0" max="32767" attributes="0"/>
|
||||||
<Component id="msgRetypePasswordField" alignment="0" max="32767" attributes="0"/>
|
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
@ -278,8 +277,6 @@
|
|||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="msgPasswordField" min="-2" max="-2" attributes="0"/>
|
<Component id="msgPasswordField" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="msgRetypePasswordField" min="-2" max="-2" attributes="0"/>
|
|
||||||
<EmptySpace max="32767" attributes="0"/>
|
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
@ -347,19 +344,6 @@
|
|||||||
</Property>
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JPasswordField" name="msgRetypePasswordField">
|
|
||||||
<Properties>
|
|
||||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
|
||||||
<Font name="Tahoma" size="12" style="0"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="MultiUserSettingsPanel.msgRetypePasswordField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="MultiUserSettingsPanel.msgRetypePasswordField.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
|
||||||
</Property>
|
|
||||||
</Properties>
|
|
||||||
</Component>
|
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
<Component class="javax.swing.JCheckBox" name="cbEnableMultiUser">
|
<Component class="javax.swing.JCheckBox" name="cbEnableMultiUser">
|
||||||
|
@ -26,12 +26,10 @@ public final class MultiUserSettingsPanel extends javax.swing.JPanel {
|
|||||||
private static final String PORT_PROMPT = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbPortNumber.toolTipText");
|
private static final String PORT_PROMPT = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbPortNumber.toolTipText");
|
||||||
private static final String USER_NAME_PROMPT = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbUsername.toolTipText");
|
private static final String USER_NAME_PROMPT = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbUsername.toolTipText");
|
||||||
private static final String PASSWORD_PROMPT = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbPassword.toolTipText");
|
private static final String PASSWORD_PROMPT = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.tbPassword.toolTipText");
|
||||||
private static final String RETYPE_PASSWORD_PROMPT = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.msgRetypePasswordField.toolTipText");
|
|
||||||
private static final String INCOMPLETE_SETTINGS_MSG = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.validationErrMsg.incomplete");
|
private static final String INCOMPLETE_SETTINGS_MSG = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.validationErrMsg.incomplete");
|
||||||
private static final String INVALID_DB_PORT_MSG = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.validationErrMsg.invalidDatabasePort");
|
private static final String INVALID_DB_PORT_MSG = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.validationErrMsg.invalidDatabasePort");
|
||||||
private static final String INVALID_MESSAGE_SERVICE_PORT_MSG = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.validationErrMsg.invalidMessageServicePort");
|
private static final String INVALID_MESSAGE_SERVICE_PORT_MSG = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.validationErrMsg.invalidMessageServicePort");
|
||||||
private static final String INVALID_MESSAGE_SERVICE_URI_MSG = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.validationErrMsg.invalidMessgeServiceURI");
|
private static final String INVALID_MESSAGE_SERVICE_URI_MSG = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.validationErrMsg.invalidMessgeServiceURI");
|
||||||
private static final String INVALID_MESSAGE_PASSWORD_MSG = NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.validationErrMsg.invalidMessgeServicePassword");
|
|
||||||
private final MultiUserSettingsPanelController controller;
|
private final MultiUserSettingsPanelController controller;
|
||||||
private final Collection<JTextField> textBoxes = new ArrayList<>();
|
private final Collection<JTextField> textBoxes = new ArrayList<>();
|
||||||
private final TextBoxChangedListener textBoxChangedListener;
|
private final TextBoxChangedListener textBoxChangedListener;
|
||||||
@ -56,7 +54,6 @@ public final class MultiUserSettingsPanel extends javax.swing.JPanel {
|
|||||||
textPrompts.add(new TextPrompt(PORT_PROMPT, msgPortTextField));
|
textPrompts.add(new TextPrompt(PORT_PROMPT, msgPortTextField));
|
||||||
textPrompts.add(new TextPrompt(USER_NAME_PROMPT, msgUserNameTextField));
|
textPrompts.add(new TextPrompt(USER_NAME_PROMPT, msgUserNameTextField));
|
||||||
textPrompts.add(new TextPrompt(PASSWORD_PROMPT, msgPasswordField));
|
textPrompts.add(new TextPrompt(PASSWORD_PROMPT, msgPasswordField));
|
||||||
textPrompts.add(new TextPrompt(RETYPE_PASSWORD_PROMPT, msgRetypePasswordField));
|
|
||||||
configureTextPrompts(textPrompts);
|
configureTextPrompts(textPrompts);
|
||||||
|
|
||||||
/// Register for notifications when the text boxes get updated.
|
/// Register for notifications when the text boxes get updated.
|
||||||
@ -69,7 +66,6 @@ public final class MultiUserSettingsPanel extends javax.swing.JPanel {
|
|||||||
textBoxes.add(msgPortTextField);
|
textBoxes.add(msgPortTextField);
|
||||||
textBoxes.add(msgUserNameTextField);
|
textBoxes.add(msgUserNameTextField);
|
||||||
textBoxes.add(msgPasswordField);
|
textBoxes.add(msgPasswordField);
|
||||||
textBoxes.add(msgRetypePasswordField);
|
|
||||||
addDocumentListeners(textBoxes, textBoxChangedListener);
|
addDocumentListeners(textBoxes, textBoxChangedListener);
|
||||||
|
|
||||||
enableMultiUserComponents(textBoxes, cbEnableMultiUser.isSelected());
|
enableMultiUserComponents(textBoxes, cbEnableMultiUser.isSelected());
|
||||||
@ -126,7 +122,6 @@ public final class MultiUserSettingsPanel extends javax.swing.JPanel {
|
|||||||
msgUserNameTextField = new javax.swing.JTextField();
|
msgUserNameTextField = new javax.swing.JTextField();
|
||||||
msgPortTextField = new javax.swing.JTextField();
|
msgPortTextField = new javax.swing.JTextField();
|
||||||
msgPasswordField = new javax.swing.JPasswordField();
|
msgPasswordField = new javax.swing.JPasswordField();
|
||||||
msgRetypePasswordField = new javax.swing.JPasswordField();
|
|
||||||
cbEnableMultiUser = new javax.swing.JCheckBox();
|
cbEnableMultiUser = new javax.swing.JCheckBox();
|
||||||
|
|
||||||
pnDatabaseSettings.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
pnDatabaseSettings.setBorder(javax.swing.BorderFactory.createEtchedBorder());
|
||||||
@ -231,10 +226,6 @@ public final class MultiUserSettingsPanel extends javax.swing.JPanel {
|
|||||||
msgPasswordField.setText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.msgPasswordField.text")); // NOI18N
|
msgPasswordField.setText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.msgPasswordField.text")); // NOI18N
|
||||||
msgPasswordField.setToolTipText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.msgPasswordField.toolTipText")); // NOI18N
|
msgPasswordField.setToolTipText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.msgPasswordField.toolTipText")); // NOI18N
|
||||||
|
|
||||||
msgRetypePasswordField.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N
|
|
||||||
msgRetypePasswordField.setText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.msgRetypePasswordField.text")); // NOI18N
|
|
||||||
msgRetypePasswordField.setToolTipText(org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.msgRetypePasswordField.toolTipText")); // NOI18N
|
|
||||||
|
|
||||||
javax.swing.GroupLayout pnMessagingSettingsLayout = new javax.swing.GroupLayout(pnMessagingSettings);
|
javax.swing.GroupLayout pnMessagingSettingsLayout = new javax.swing.GroupLayout(pnMessagingSettings);
|
||||||
pnMessagingSettings.setLayout(pnMessagingSettingsLayout);
|
pnMessagingSettings.setLayout(pnMessagingSettingsLayout);
|
||||||
pnMessagingSettingsLayout.setHorizontalGroup(
|
pnMessagingSettingsLayout.setHorizontalGroup(
|
||||||
@ -248,8 +239,7 @@ public final class MultiUserSettingsPanel extends javax.swing.JPanel {
|
|||||||
.addComponent(msgHostTextField, javax.swing.GroupLayout.Alignment.TRAILING)
|
.addComponent(msgHostTextField, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||||
.addComponent(msgUserNameTextField, javax.swing.GroupLayout.Alignment.TRAILING)
|
.addComponent(msgUserNameTextField, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||||
.addComponent(msgPortTextField, javax.swing.GroupLayout.Alignment.TRAILING)
|
.addComponent(msgPortTextField, javax.swing.GroupLayout.Alignment.TRAILING)
|
||||||
.addComponent(msgPasswordField)
|
.addComponent(msgPasswordField))
|
||||||
.addComponent(msgRetypePasswordField))
|
|
||||||
.addContainerGap())
|
.addContainerGap())
|
||||||
);
|
);
|
||||||
pnMessagingSettingsLayout.setVerticalGroup(
|
pnMessagingSettingsLayout.setVerticalGroup(
|
||||||
@ -265,9 +255,7 @@ public final class MultiUserSettingsPanel extends javax.swing.JPanel {
|
|||||||
.addComponent(msgUserNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(msgUserNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(msgPasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(msgPasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addContainerGap())
|
||||||
.addComponent(msgRetypePasswordField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
|
||||||
);
|
);
|
||||||
|
|
||||||
org.openide.awt.Mnemonics.setLocalizedText(cbEnableMultiUser, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.cbEnableMultiUser.text")); // NOI18N
|
org.openide.awt.Mnemonics.setLocalizedText(cbEnableMultiUser, org.openide.util.NbBundle.getMessage(MultiUserSettingsPanel.class, "MultiUserSettingsPanel.cbEnableMultiUser.text")); // NOI18N
|
||||||
@ -334,7 +322,7 @@ public final class MultiUserSettingsPanel extends javax.swing.JPanel {
|
|||||||
|
|
||||||
private void cbEnableMultiUserItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbEnableMultiUserItemStateChanged
|
private void cbEnableMultiUserItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cbEnableMultiUserItemStateChanged
|
||||||
if (!cbEnableMultiUser.isSelected()) {
|
if (!cbEnableMultiUser.isSelected()) {
|
||||||
lbOops.setText("");
|
lbOops.setText("");
|
||||||
}
|
}
|
||||||
enableMultiUserComponents(textBoxes, cbEnableMultiUser.isSelected());
|
enableMultiUserComponents(textBoxes, cbEnableMultiUser.isSelected());
|
||||||
controller.changed();
|
controller.changed();
|
||||||
@ -347,18 +335,11 @@ public final class MultiUserSettingsPanel extends javax.swing.JPanel {
|
|||||||
tbUsername.setText(dbInfo.getUserName());
|
tbUsername.setText(dbInfo.getUserName());
|
||||||
tbPassword.setText(dbInfo.getPassword());
|
tbPassword.setText(dbInfo.getPassword());
|
||||||
|
|
||||||
MessageServiceConnectionInfo msgServiceInfo = null;
|
MessageServiceConnectionInfo msgServiceInfo = UserPreferences.getMessageServiceConnectionInfo();
|
||||||
try {
|
msgHostTextField.setText(msgServiceInfo.getHost());
|
||||||
msgServiceInfo = UserPreferences.getMessageServiceConnectionInfo();
|
msgPortTextField.setText(msgServiceInfo.getPort());
|
||||||
msgHostTextField.setText(msgServiceInfo.getURI().getHost());
|
msgUserNameTextField.setText(msgServiceInfo.getUserName());
|
||||||
msgPortTextField.setText(Integer.toString(msgServiceInfo.getURI().getPort()));
|
msgPasswordField.setText(msgServiceInfo.getPassword());
|
||||||
msgUserNameTextField.setText(msgServiceInfo.getUserName());
|
|
||||||
msgPasswordField.setText(msgServiceInfo.getPassword());
|
|
||||||
msgRetypePasswordField.setText(msgServiceInfo.getPassword());
|
|
||||||
} catch (NumberFormatException | URISyntaxException ex) {
|
|
||||||
resetMessageServiceTextFields();
|
|
||||||
logger.log(Level.SEVERE, "Invalid message service settings read from user preferences, clearing settings components", ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dbInfo.getDbType() == DbType.UNKNOWN) {
|
if (dbInfo.getDbType() == DbType.UNKNOWN) {
|
||||||
cbEnableMultiUser.setSelected(false);
|
cbEnableMultiUser.setSelected(false);
|
||||||
@ -367,18 +348,6 @@ public final class MultiUserSettingsPanel extends javax.swing.JPanel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the text of the message service settings text fields to the empty
|
|
||||||
* string.
|
|
||||||
*/
|
|
||||||
private void resetMessageServiceTextFields() {
|
|
||||||
msgHostTextField.setText("");
|
|
||||||
msgPortTextField.setText("");
|
|
||||||
msgUserNameTextField.setText("");
|
|
||||||
msgPasswordField.setText("");
|
|
||||||
msgRetypePasswordField.setText("");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests whether or not values have been entered in all of the message
|
* Tests whether or not values have been entered in all of the message
|
||||||
* service settings text fields.
|
* service settings text fields.
|
||||||
@ -389,8 +358,7 @@ public final class MultiUserSettingsPanel extends javax.swing.JPanel {
|
|||||||
return !msgHostTextField.getText().isEmpty()
|
return !msgHostTextField.getText().isEmpty()
|
||||||
&& !msgPortTextField.getText().isEmpty()
|
&& !msgPortTextField.getText().isEmpty()
|
||||||
&& !msgUserNameTextField.getText().isEmpty()
|
&& !msgUserNameTextField.getText().isEmpty()
|
||||||
&& msgPasswordField.getPassword().length != 0
|
&& msgPasswordField.getPassword().length != 0;
|
||||||
&& msgRetypePasswordField.getPassword().length != 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void store() {
|
void store() {
|
||||||
@ -410,22 +378,12 @@ public final class MultiUserSettingsPanel extends javax.swing.JPanel {
|
|||||||
|
|
||||||
UserPreferences.setDatabaseConnectionInfo(info);
|
UserPreferences.setDatabaseConnectionInfo(info);
|
||||||
|
|
||||||
/**
|
MessageServiceConnectionInfo msgServiceInfo = new MessageServiceConnectionInfo(
|
||||||
* Add the message service settings to the persisted user preferences.
|
msgUserNameTextField.getText(),
|
||||||
* It is expected that this code is only executed after validation; if
|
new String(msgPasswordField.getPassword()),
|
||||||
* the settings are not valid the exception is caught and the invalid
|
msgHostTextField.getText(),
|
||||||
* settings are discarded.
|
msgPortTextField.getText());
|
||||||
*/
|
UserPreferences.setMessageServiceConnectionInfo(msgServiceInfo);
|
||||||
try {
|
|
||||||
MessageServiceConnectionInfo msgServiceInfo = new MessageServiceConnectionInfo(
|
|
||||||
msgUserNameTextField.getText(),
|
|
||||||
new String(msgPasswordField.getPassword()),
|
|
||||||
msgHostTextField.getText(),
|
|
||||||
Integer.parseInt(msgPortTextField.getText()));
|
|
||||||
UserPreferences.setMessageServiceConnectionInfo(msgServiceInfo);
|
|
||||||
} catch (NumberFormatException | URISyntaxException ex) {
|
|
||||||
logger.log(Level.SEVERE, "Attempt to store invalid message service settings", ex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -481,34 +439,11 @@ public final class MultiUserSettingsPanel extends javax.swing.JPanel {
|
|||||||
* @return True or false.
|
* @return True or false.
|
||||||
*/
|
*/
|
||||||
boolean messageServiceSettingsAreValid() {
|
boolean messageServiceSettingsAreValid() {
|
||||||
if (!messageServiceFieldsArePopulated()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!portNumberIsValid(msgPortTextField.getText())) {
|
if (!portNumberIsValid(msgPortTextField.getText())) {
|
||||||
lbOops.setText(INVALID_MESSAGE_SERVICE_PORT_MSG);
|
lbOops.setText(INVALID_MESSAGE_SERVICE_PORT_MSG);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
String password = new String(msgPasswordField.getPassword());
|
|
||||||
String retypedPassword = new String(msgRetypePasswordField.getPassword());
|
|
||||||
if (!password.contentEquals(retypedPassword)) {
|
|
||||||
lbOops.setText(INVALID_MESSAGE_PASSWORD_MSG);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageServiceConnectionInfo msgServiceInfo;
|
|
||||||
try {
|
|
||||||
msgServiceInfo = new MessageServiceConnectionInfo(
|
|
||||||
msgUserNameTextField.getText(),
|
|
||||||
new String(msgPasswordField.getPassword()),
|
|
||||||
msgHostTextField.getText(),
|
|
||||||
Integer.parseInt(msgPortTextField.getText()));
|
|
||||||
} catch (URISyntaxException detailsNotImportant) {
|
|
||||||
lbOops.setText(INVALID_MESSAGE_SERVICE_URI_MSG);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -540,7 +475,6 @@ public final class MultiUserSettingsPanel extends javax.swing.JPanel {
|
|||||||
private javax.swing.JTextField msgHostTextField;
|
private javax.swing.JTextField msgHostTextField;
|
||||||
private javax.swing.JPasswordField msgPasswordField;
|
private javax.swing.JPasswordField msgPasswordField;
|
||||||
private javax.swing.JTextField msgPortTextField;
|
private javax.swing.JTextField msgPortTextField;
|
||||||
private javax.swing.JPasswordField msgRetypePasswordField;
|
|
||||||
private javax.swing.JTextField msgUserNameTextField;
|
private javax.swing.JTextField msgUserNameTextField;
|
||||||
private javax.swing.JPanel pnDatabaseSettings;
|
private javax.swing.JPanel pnDatabaseSettings;
|
||||||
private javax.swing.JPanel pnMessagingSettings;
|
private javax.swing.JPanel pnMessagingSettings;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user