|
1 | 1 | package screens.login_screen;
|
2 |
| -import use_cases.user_login_use_cases.UserLoginPresenter; |
3 |
| -import use_cases.user_registration_use_cases.UserVerificationOutputBoundary; |
| 2 | +import data_access.Database; |
| 3 | +import data_access.UserDatabase; |
| 4 | +import interface_adapters.login_interface_adapters.UserChatsPresenter; |
| 5 | +import interface_adapters.login_interface_adapters.UserLoginViewI; |
| 6 | +import use_cases.user_login_use_cases.UserLoginInputBoundary; |
| 7 | +import interface_adapters.login_interface_adapters.UserLoginPresenter; |
| 8 | +import use_cases.user_login_use_cases.UserLoginInteractor2; |
| 9 | +import interface_adapters.user_registration_interface_adapters.UserVerificationOutputView; |
4 | 10 |
|
5 | 11 | import javax.swing.*;
|
6 | 12 | import java.awt.event.ActionEvent;
|
7 | 13 | import java.awt.event.ActionListener;
|
| 14 | +import java.io.File; |
8 | 15 |
|
9 | 16 | /** This is the screen on which the user enters his credentials in order to login **/
|
10 |
| -public class UserLoginUI implements ActionListener, UserVerificationOutputBoundary { |
| 17 | +public class UserLoginUI implements ActionListener, UserVerificationOutputView { |
11 | 18 |
|
12 |
| - private final UserLoginPresenter loginInteractor; |
| 19 | + private final UserLoginPresenter loginPresenter; |
13 | 20 | JTextField credentialText;
|
14 | 21 | JPasswordField passwordText;
|
15 | 22 |
|
16 |
| - public UserLoginUI(UserLoginPresenter loginInteractor){ |
17 |
| - this.loginInteractor = loginInteractor; |
| 23 | + public UserLoginUI(UserLoginPresenter loginPresenter){ |
| 24 | + UserLoginViewI loginViewI = new AppScreenCreator(); |
| 25 | + this.loginPresenter = loginPresenter; |
| 26 | + this.loginPresenter.setLoginView(loginViewI); |
| 27 | + } |
| 28 | + //For Testing Purposes |
| 29 | + public static void main(String[] args){ |
| 30 | + Database userDB = new UserDatabase(new File("new")); |
| 31 | + UserLoginInputBoundary inputBoundary = new UserLoginInteractor2(userDB, new UserChatsPresenter()); |
| 32 | + UserLoginPresenter loginPresenter1 = new UserLoginPresenter(userDB, inputBoundary); |
| 33 | + UserLoginUI loginUI = new UserLoginUI(loginPresenter1); |
| 34 | + loginUI.getLoginCredentials(); |
18 | 35 | }
|
19 | 36 | @Override
|
20 | 37 | public void getLoginCredentials(){
|
@@ -69,7 +86,7 @@ public void cannotVerify() {
|
69 | 86 | public void actionPerformed(ActionEvent e) {
|
70 | 87 | String username = credentialText.getText();
|
71 | 88 | String password = passwordText.getText();
|
72 |
| - loginInteractor.setLoginCredentials(username, password); |
73 |
| - loginInteractor.tryLogin(); |
| 89 | + loginPresenter.setLoginCredentials(username, password); |
| 90 | + loginPresenter.tryLogin(); |
74 | 91 | }
|
75 | 92 | }
|
0 commit comments