|
1 |
| -package create_flashcardset_use_case; |
2 |
| - |
3 |
| -import dataAccess.*; |
4 |
| -import entities.FlashcardSetFactory; |
5 |
| - |
6 |
| -import javax.swing.*; |
7 |
| -import java.awt.*; |
8 |
| -import java.io.IOException; |
9 |
| - |
10 |
| -public class MainCreateFlashcardSet { |
11 |
| - |
12 |
| - public static void main(String[] args) { |
13 |
| - |
14 |
| - // Build the main program window |
15 |
| - JFrame application = new JFrame("Create a Flashcard Set"); |
16 |
| - application.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); |
17 |
| - CardLayout cardLayout = new CardLayout(); |
18 |
| - JPanel screens = new JPanel(cardLayout); |
19 |
| - application.add(screens); |
20 |
| - |
21 |
| - // Create the parts to plug into the Use Case+Entities engine |
22 |
| - DBGateway dbGateway = dbGatewaySetup(); |
23 |
| - |
24 |
| - FlashcardSetOutputBoundary outputBoundary = new FlashcardSetPresenter(); |
25 |
| - FlashcardSetFactory flashcardSetFactory = new FlashcardSetFactory(); |
26 |
| - FlashcardSetInputBoundary interactor = new FlashcardSetInteractor(dbGateway, outputBoundary, |
27 |
| - flashcardSetFactory); |
28 |
| - FlashcardSetController flashcardSetController = new FlashcardSetController( |
29 |
| - interactor |
30 |
| - ); |
31 |
| - |
32 |
| - // Build the GUI, plugging in the parts |
33 |
| - CreationScreen creationScreen = new CreationScreen(flashcardSetController, application); |
34 |
| - screens.add(creationScreen, "welcome"); |
35 |
| - cardLayout.show(screens, "create flashcard set"); |
36 |
| - application.pack(); |
37 |
| - application.setVisible(true); |
38 |
| - } |
39 |
| - |
40 |
| - public static DBGateway dbGatewaySetup() { |
41 |
| - IFlashcardSetDataAccess flashcardSetRepo; |
42 |
| - IFlashcardDataAccess flashcardRepo; |
43 |
| - IUserDataAccess userRepo; |
44 |
| - try { |
45 |
| - flashcardSetRepo = new FlashcardSetDataAccess("src/data/FlashcardSets.csv"); |
46 |
| - flashcardRepo = new FlashcardDataAccess("src/data/Flashcards.csv"); |
47 |
| - userRepo = new CommonUserDataAccess("src/data/Users.csv"); |
48 |
| - } catch (IOException e) { |
49 |
| - throw new RuntimeException("Could not create file."); |
50 |
| - } |
51 |
| - |
52 |
| - return new DBGateway(flashcardRepo, flashcardSetRepo, userRepo); |
53 |
| - } |
54 |
| -} |
| 1 | +//package create_flashcardset_use_case; |
| 2 | +// |
| 3 | +//import dataAccess.*; |
| 4 | +//import entities.FlashcardSetFactory; |
| 5 | +// |
| 6 | +//import javax.swing.*; |
| 7 | +//import java.awt.*; |
| 8 | +//import java.io.IOException; |
| 9 | +// |
| 10 | +//public class MainCreateFlashcardSet { |
| 11 | +// |
| 12 | +// public static void main(String[] args) { |
| 13 | +// |
| 14 | +// // Build the main program window |
| 15 | +// JFrame application = new JFrame("Create a Flashcard Set"); |
| 16 | +// application.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); |
| 17 | +// CardLayout cardLayout = new CardLayout(); |
| 18 | +// JPanel screens = new JPanel(cardLayout); |
| 19 | +// application.add(screens); |
| 20 | +// |
| 21 | +// // Create the parts to plug into the Use Case+Entities engine |
| 22 | +// DBGateway dbGateway = dbGatewaySetup(); |
| 23 | +// |
| 24 | +// FlashcardSetOutputBoundary outputBoundary = new FlashcardSetPresenter(); |
| 25 | +// FlashcardSetFactory flashcardSetFactory = new FlashcardSetFactory(); |
| 26 | +// FlashcardSetInputBoundary interactor = new FlashcardSetInteractor(dbGateway, outputBoundary, |
| 27 | +// flashcardSetFactory); |
| 28 | +// FlashcardSetController flashcardSetController = new FlashcardSetController( |
| 29 | +// interactor |
| 30 | +// ); |
| 31 | +// |
| 32 | +// // Build the GUI, plugging in the parts |
| 33 | +// CreationScreen creationScreen = new CreationScreen(flashcardSetController); |
| 34 | +// screens.add(creationScreen, "welcome"); |
| 35 | +// cardLayout.show(screens, "create flashcard set"); |
| 36 | +// application.pack(); |
| 37 | +// application.setVisible(true); |
| 38 | +// } |
| 39 | +// |
| 40 | +// public static DBGateway dbGatewaySetup() { |
| 41 | +// IFlashcardSetDataAccess flashcardSetRepo; |
| 42 | +// IFlashcardDataAccess flashcardRepo; |
| 43 | +// IUserDataAccess userRepo; |
| 44 | +// try { |
| 45 | +// flashcardSetRepo = new FlashcardSetDataAccess("src/data/FlashcardSets.csv"); |
| 46 | +// flashcardRepo = new FlashcardDataAccess("src/data/Flashcards.csv"); |
| 47 | +// userRepo = new CommonUserDataAccess("src/data/Users.csv"); |
| 48 | +// } catch (IOException e) { |
| 49 | +// throw new RuntimeException("Could not create file."); |
| 50 | +// } |
| 51 | +// |
| 52 | +// return new DBGateway(flashcardRepo, flashcardSetRepo, userRepo); |
| 53 | +// } |
| 54 | +//} |
0 commit comments