|
16 | 16 | public class HomePage extends JFrame {
|
17 | 17 |
|
18 | 18 | UserLoginResponseModel user;
|
| 19 | + DBGateway gateway; |
19 | 20 |
|
20 | 21 | public HomePage(UserLoginResponseModel user) throws IOException {
|
21 | 22 | super(user.getSignedInUsername() + "'s home page");
|
@@ -49,7 +50,8 @@ public HomePage(UserLoginResponseModel user) throws IOException {
|
49 | 50 | addFlashcardSetButton.addActionListener(e -> {
|
50 | 51 | FlashcardSetOutputBoundary presenter = new FlashcardSetPresenter();
|
51 | 52 | FlashcardSetFactory setFactory = new FlashcardSetFactory();
|
52 |
| - FlashcardSetInteractor interactor = new FlashcardSetInteractor(flashcardSetDataAccess, presenter, setFactory); |
| 53 | + FlashcardSetInteractor interactor = new FlashcardSetInteractor(flashcardSetDataAccess, presenter, |
| 54 | + setFactory); |
53 | 55 | FlashcardSetController controller = new FlashcardSetController(interactor);
|
54 | 56 | new CreationScreen(controller, this);
|
55 | 57 |
|
@@ -84,13 +86,32 @@ public HomePage(UserLoginResponseModel user) throws IOException {
|
84 | 86 | this.add(labelPanel);
|
85 | 87 | }
|
86 | 88 | else {
|
87 |
| - this.add(new ListOfFlashcardSetsDataPanel(idsToFlashcardSetData, gateway, true)); |
| 89 | + this.add(new ListOfFlashcardSetsDataPanel(idsToFlashcardSetData, gateway)); |
88 | 90 | }
|
89 | 91 | this.setSize(1000, 1000);
|
90 | 92 | this.setVisible(true);
|
91 | 93 | this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
92 | 94 | }
|
93 | 95 |
|
| 96 | + |
| 97 | + private void refresh() { |
| 98 | + 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(); |
| 110 | + new HomePage(user); |
| 111 | + } catch (Exception e) { |
| 112 | + JOptionPane.showMessageDialog(this, e.getMessage()); |
| 113 | + } |
| 114 | + } |
94 | 115 | public static void main(String[] args) throws IOException {
|
95 | 116 | Map<Integer, String[]> map = new HashMap<>();
|
96 | 117 | for (int i = 1; i < 4; i++) {
|
|
0 commit comments