|
3 | 3 | import create_flashcardset_use_case.*;
|
4 | 4 | import dataAccess.*;
|
5 | 5 | import entities.FlashcardSetFactory;
|
| 6 | +import loginAndSignupUseCase.UserLoginInputBoundary; |
| 7 | +import loginAndSignupUseCase.UserLoginInteractor; |
| 8 | +import loginAndSignupUseCase.UserLoginOutputBoundary; |
6 | 9 | import loginAndSignupUseCase.UserLoginResponseModel;
|
| 10 | +import loginAndSignupUseCase.loginAndSignupUseCaseScreens.UserLoginController; |
| 11 | +import loginAndSignupUseCase.loginAndSignupUseCaseScreens.UserLoginPresenter; |
7 | 12 | import loginAndSignupUseCase.loginAndSignupUseCaseScreens.WelcomeScreen;
|
8 | 13 | import search_use_case.*;
|
9 | 14 |
|
10 | 15 | import javax.swing.*;
|
11 | 16 | import java.awt.*;
|
12 | 17 | import java.io.IOException;
|
13 |
| -import java.util.HashMap; |
14 | 18 | import java.util.Map;
|
15 | 19 |
|
16 | 20 | public class HomePage extends JFrame {
|
@@ -94,30 +98,21 @@ public HomePage(UserLoginResponseModel user) throws IOException {
|
94 | 98 | }
|
95 | 99 |
|
96 | 100 |
|
97 |
| - private void refresh() { |
| 101 | + private void refresh(UserLoginResponseModel user) { |
98 | 102 | try {
|
99 |
| -// UserLoginOutputBoundary presenter = new UserLoginPresenter(); |
100 |
| -// UserLoginInputBoundary interactor = new UserLoginInteractor( |
101 |
| -// gateway, presenter); |
102 |
| -// UserLoginController userLoginController = new UserLoginController(interactor); |
103 |
| -// setVisible(false); |
104 |
| -// dispose(); |
105 |
| -// new LoginScreen(userLoginController).setVisible(true); |
106 |
| -// |
107 |
| -// UserLoginResponseModel user = userLoginController.create(user.getSignedInUsername(), |
108 |
| -// user.getPassword()); |
109 |
| -// this.dispose(); |
| 103 | + UserLoginOutputBoundary presenter = new UserLoginPresenter(); |
| 104 | + UserLoginInputBoundary interactor = new UserLoginInteractor( |
| 105 | + gateway, presenter); |
| 106 | + UserLoginController userLoginController = new UserLoginController(interactor); |
| 107 | + setVisible(false); |
| 108 | + dispose(); |
| 109 | + |
| 110 | + user = userLoginController.create(user.getSignedInUsername(), |
| 111 | + user.getPassword()); |
| 112 | + this.dispose(); |
110 | 113 | new HomePage(user);
|
111 | 114 | } catch (Exception e) {
|
112 | 115 | JOptionPane.showMessageDialog(this, e.getMessage());
|
113 | 116 | }
|
114 | 117 | }
|
115 |
| - public static void main(String[] args) throws IOException { |
116 |
| - Map<Integer, String[]> map = new HashMap<>(); |
117 |
| - for (int i = 1; i < 4; i++) { |
118 |
| - map.put(i, new String[]{"test set " + i, "test description " + i}); |
119 |
| - } |
120 |
| - UserLoginResponseModel user = new UserLoginResponseModel("Lucas", false, map); |
121 |
| - new HomePage(user); |
122 |
| - } |
123 | 118 | }
|
0 commit comments