use of org.exist.client.DialogCompleteWithResponse in project exist by eXist-db.
the class UserManagerDialog method showEditUserDialog.
private void showEditUserDialog(final Account account) {
final UserManagerDialog that = this;
final DialogCompleteWithResponse<String> callback = response -> {
// get client to reconnect with edited users new password
try {
System.out.println("Detected logged-in user password change, reconnecting to server...");
that.userManagementService = reconnectClientAndUserManager(response);
System.out.println("Reconnected.");
} catch (final XMLDBException xmldbe) {
JOptionPane.showMessageDialog(that, "Could not edit user '" + getSelectedUsername() + "': " + xmldbe.getMessage(), "User Manager Error", JOptionPane.ERROR_MESSAGE);
}
};
final EditUserDialog userDialog = new EditUserDialog(userManagementService, account);
if (getSelectedUsername().equals(currentUser)) {
// register for password update event, if we are changing the password
// of the current user
userDialog.addDialogCompleteWithResponseCallback(callback);
}
userDialog.addWindowListener(new WindowAdapter() {
@Override
public void windowClosed(final WindowEvent e) {
refreshUsersTableModel();
}
});
userDialog.setVisible(true);
}
Aggregations