/ portfolio2.md
portfolio2.md
1 # Graphical user interface with JavaFX 2 3 The functionality of the user interface is fundamentally tied 4 to the database. 5 The database is created and filled with activities based on 6 the class "Model" from @Rosendahl2025. 7 8 We have tried to keep a strict separation between Model, View and Controller. 9 The view class knows what is on screen, 10 but never how it is processed by the controller. 11 It knows what arguments to pass on to the controller 12 and in some cases what it can expect to receive. 13 14 The GUI itself is created based on a helper class GUI.java 15 consisting of a public enum containing a category name used for columns 16 and a number corresponding to the order the elements are shown in. 17 The start() function in Window.java, handling the view, 18 creates a List "columns" using the record ActivityColumn. 19 There is a lot of repetition in creating the layouts for the columns, 20 so the record allows us to cycle through columns based on the column and 21 label objects in the GUI class. 22 This cycle is where we assign functions to each button after creation. 23 24 <!--TODO: create E/R diagram--> 25 26 <!--TODO: make database with init_db.txt--> 27 28 The database is filled with the init_db.txt file 29 based on the commands in there. 30 A participation table is created to bridge courses to the student 31 to avoid many to many relationships<!-- TODO: create E/R diagram, 32 as shown in the E/R diagram-->. 33 34 getSumEcts() in Database.java returns the result of a query 35 constructed to return the sum of ECTS for a given program. 36 It does not currently work for elective activities, 37 as that would require a redesign of the database or a helper class 38 that would make the code "inconsistent". <!--maybe find better word--> 39 40 The backend was really created alongside the UI, 41 as we felt that was the most intuitive way to go about things. 42 43  44 45 <!--TODO: fix duplicate activities--> 46 47 <!--TODO: add label for subtotal ECTS--> 48 49 As the screenshot shows, 50 it is not possible to choose the same subject module in both boxes. 51 ECTS is calculated dynamically as new activities are added. 52 Fonts and styling is consistent across columns, 53 and new columns could in theory be added easily as the code 54 is modular and reusable. 55