diff --git a/build.gradle b/build.gradle
index be5e352042..c1770ccf91 100644
--- a/build.gradle
+++ b/build.gradle
@@ -32,7 +32,7 @@ javafx {
application {
// Change this to your main class.
- mainClassName = "spinbox.SpinBox"
+ mainClassName = "spinbox.gui.Launcher"
}
dependencies {
diff --git a/src/main/Resources/view/MainWindow.css b/src/main/Resources/view/MainWindow.css
index b7e849269e..5ea5be1c58 100644
--- a/src/main/Resources/view/MainWindow.css
+++ b/src/main/Resources/view/MainWindow.css
@@ -2,7 +2,7 @@
-fx-pref-width: 250
}
.tab-header-background {
- -fx-background-color:transparent
+ -fx-background-color:#25274D
}
.tab-pane > .tab-header-area > .headers-region > .tab > .tab-container > .tab-label {
diff --git a/src/main/Resources/view/MainWindow.fxml b/src/main/Resources/view/MainWindow.fxml
index e409c0a4f9..cd502d7baf 100644
--- a/src/main/Resources/view/MainWindow.fxml
+++ b/src/main/Resources/view/MainWindow.fxml
@@ -7,65 +7,80 @@
+
+
+
-
-
-
+
+
+
+
+
+
-
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
diff --git a/src/main/Resources/view/ModuleListBox/ModuleListBox.css b/src/main/Resources/view/ModuleListBox/ModuleListBox.css
new file mode 100644
index 0000000000..d68ca648cb
--- /dev/null
+++ b/src/main/Resources/view/ModuleListBox/ModuleListBox.css
@@ -0,0 +1,8 @@
+#vBox-pane {
+ -fx-background-color: #2E9CCA;
+}
+
+#vBox-pane:hover {
+ -fx-background-color: #29648A;
+ -fx-cursor: hand;
+}
\ No newline at end of file
diff --git a/src/main/Resources/view/ModuleListBox/ModuleListBox.fxml b/src/main/Resources/view/ModuleListBox/ModuleListBox.fxml
new file mode 100644
index 0000000000..538d4ae990
--- /dev/null
+++ b/src/main/Resources/view/ModuleListBox/ModuleListBox.fxml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/Resources/view/itemBoxes/FileBox.fxml b/src/main/Resources/view/itemBoxes/FileBox.fxml
new file mode 100644
index 0000000000..2df9cd69d5
--- /dev/null
+++ b/src/main/Resources/view/itemBoxes/FileBox.fxml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main/Resources/view/TaskBox.fxml b/src/main/Resources/view/itemBoxes/TaskBox.fxml
similarity index 100%
rename from src/main/Resources/view/TaskBox.fxml
rename to src/main/Resources/view/itemBoxes/TaskBox.fxml
diff --git a/src/main/java/spinbox/Main.java b/src/main/java/spinbox/Main.java
index 2d5d6ae910..33de8bf430 100644
--- a/src/main/java/spinbox/Main.java
+++ b/src/main/java/spinbox/Main.java
@@ -1,13 +1,11 @@
package spinbox;
-import spinbox.exceptions.DataReadWriteException;
-import spinbox.exceptions.FileCreationException;
-import spinbox.exceptions.InvalidIndexException;
+import javafx.scene.layout.GridPane;
+import spinbox.exceptions.SpinBoxException;
import spinbox.gui.MainWindow;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
-import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
import java.io.IOException;
@@ -15,26 +13,17 @@
* A GUI for SpinBox using FXML.
*/
public class Main extends Application {
-
- private SpinBox spinBox = new SpinBox();
-
@Override
public void start(Stage stage) {
try {
FXMLLoader fxmlLoader = new FXMLLoader(Main.class.getResource("/view/MainWindow.fxml"));
- AnchorPane ap = fxmlLoader.load();
- Scene scene = new Scene(ap);
+ GridPane gridPane = fxmlLoader.load();
+ Scene scene = new Scene(gridPane);
stage.setScene(scene);
- fxmlLoader.getController().setUpMain(spinBox);
+ fxmlLoader.getController().initializeGui();
stage.show();
- } catch (IOException e) {
- e.printStackTrace();
- } catch (DataReadWriteException e) {
- e.printStackTrace();
- } catch (FileCreationException e) {
- e.printStackTrace();
- } catch (InvalidIndexException e) {
+ } catch (SpinBoxException | IOException e) {
e.printStackTrace();
}
}
diff --git a/src/main/java/spinbox/commands/ViewCommand.java b/src/main/java/spinbox/commands/ViewCommand.java
index 28571c8794..60a2471d0d 100644
--- a/src/main/java/spinbox/commands/ViewCommand.java
+++ b/src/main/java/spinbox/commands/ViewCommand.java
@@ -180,6 +180,7 @@ public String execute(ModuleContainer moduleContainer, ArrayDeque pageTr
if (guiMode) {
outputList.set(0, newTrace.toString());
+ return outputList.get(0);
} else {
outputList.set(0, "Changed from page "
+ oldTrace.toString() + " to " + newTrace.toString());
diff --git a/src/main/java/spinbox/containers/ModuleContainer.java b/src/main/java/spinbox/containers/ModuleContainer.java
index 4d14e7ee7b..1282ea1364 100644
--- a/src/main/java/spinbox/containers/ModuleContainer.java
+++ b/src/main/java/spinbox/containers/ModuleContainer.java
@@ -67,6 +67,19 @@ public boolean checkModuleExists(String moduleCode) {
return this.getModules().containsKey(moduleCode);
}
+ /**
+ * Gets a specific module from within the container.
+ * @param moduleCode A string containing the module code to be used as the key.
+ * @return a Module object, or null if no such module exists.
+ */
+ public Module getModule(String moduleCode) {
+ if (this.checkModuleExists(moduleCode)) {
+ return this.getModules().get(moduleCode);
+ } else {
+ return null;
+ }
+ }
+
/**
* Loads data using the localStorage instance from the relevant .txt file.
* @throws DataReadWriteException I/O error.
diff --git a/src/main/java/spinbox/gui/MainWindow.java b/src/main/java/spinbox/gui/MainWindow.java
index 14f2243910..5854b5eb12 100644
--- a/src/main/java/spinbox/gui/MainWindow.java
+++ b/src/main/java/spinbox/gui/MainWindow.java
@@ -1,91 +1,133 @@
package spinbox.gui;
+import javafx.beans.value.ChangeListener;
+import javafx.beans.value.ObservableValue;
+import javafx.geometry.Insets;
+import javafx.scene.control.ScrollPane;
+import javafx.scene.control.TextField;
+import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TabPane;
import javafx.scene.layout.GridPane;
+import javafx.scene.paint.Color;
+import javafx.scene.text.Font;
+import javafx.scene.text.Text;
+import javafx.scene.text.TextAlignment;
+import javafx.scene.text.TextFlow;
import javafx.stage.Popup;
import javafx.stage.PopupWindow;
import javafx.stage.Window;
import javafx.fxml.FXML;
-import javafx.scene.control.Button;
-import javafx.scene.control.TextField;
-import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.VBox;
import spinbox.SpinBox;
import spinbox.containers.ModuleContainer;
+import spinbox.containers.lists.FileList;
+import spinbox.containers.lists.GradeList;
import spinbox.containers.lists.TaskList;
import spinbox.entities.Module;
+import spinbox.entities.items.File;
+import spinbox.entities.items.GradedComponent;
import spinbox.entities.items.tasks.Schedulable;
import spinbox.entities.items.tasks.Task;
import spinbox.entities.items.tasks.TaskType;
import spinbox.exceptions.DataReadWriteException;
import spinbox.exceptions.FileCreationException;
import spinbox.exceptions.InvalidIndexException;
+import spinbox.exceptions.SpinBoxException;
+import spinbox.gui.boxes.FileBox;
+import spinbox.gui.boxes.ModuleBox;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
/**
* Controller for MainWindow. Provides the layout for the other controls.
*/
-public class MainWindow extends AnchorPane {
+public class MainWindow extends GridPane {
+ private static final String WHITESPACE = " ";
+ private static final String TASKS = "Tasks";
+ private static final String FILES = "Files";
+ private static final String GRADES = "Grades";
+
@FXML
private TabPane tabPane;
@FXML
- private VBox urgentTasks;
+ private VBox overallTasksView;
@FXML
private TextField userInput;
@FXML
- private Button sendButton;
+ private Button submitButton;
+ @FXML
+ private GridPane modulesTabContainer;
private SpinBox spinBox;
- private ModuleContainer moduleContainer;
+ private String specificModuleCode;
+ private String subTab;
private Popup popup = new Popup();
- private ArrayList history = new ArrayList<>();
- private int count = 0;
+ private ArrayList commandHistory = new ArrayList<>();
+ private int commandCount = 0;
+ /**
+ * FXML method that is used as a post-constructor function to initialize variables and tabbed views.
+ */
@FXML
public void initialize() {
+ this.spinBox = new SpinBox();
+ this.specificModuleCode = null;
+ this.subTab = null;
+
+ tabPane.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener() {
+ @Override
+ public void changed(ObservableValue extends Number> observable, Number oldValue, Number newValue) {
+ switch (newValue.intValue()) {
+ case 0:
+ try {
+ updateMain();
+ } catch (SpinBoxException e) {
+ e.printStackTrace();
+ }
+ break;
+ case 1:
+ updateCalendar();
+ break;
+ default:
+ updateModules();
+ }
+ }
+ });
}
/**
- * Set up the required stuff for the main window.
- * @param spinbox SpinBox instance
- * @throws DataReadWriteException storage exception.
- * @throws FileCreationException file creation exception.
- * @throws InvalidIndexException invalid index exception.
+ * Uses a list of strings and a listener to cycle through user commands using the keyboard.
*/
- public void setUpMain(SpinBox spinbox) throws DataReadWriteException, FileCreationException, InvalidIndexException {
- spinBox = spinbox;
- update();
- setPopup(popup);
+ private void enableCommandHistory() {
userInput.setOnKeyPressed(event -> {
switch (event.getCode()) {
case UP:
- if (count < history.size()) {
- userInput.setText(history.get(count));
- count += 1;
+ if (commandCount < commandHistory.size()) {
+ userInput.setText(commandHistory.get(commandCount));
+ commandCount += 1;
}
userInput.end();
break;
case DOWN:
- count -= 1;
- if (count > 0) {
- count -= 1;
- userInput.setText(history.get(count));
+ commandCount -= 1;
+ if (commandCount > 0) {
+ commandCount -= 1;
+ userInput.setText(commandHistory.get(commandCount));
} else {
userInput.clear();
- count = 0;
+ commandCount = 0;
}
userInput.end();
break;
default:
break;
}
-
});
}
@@ -95,22 +137,41 @@ public void setUpMain(SpinBox spinbox) throws DataReadWriteException, FileCreati
*/
@FXML
private void handleUserInput() throws InvalidIndexException, DataReadWriteException, FileCreationException {
- history.add(0, userInput.getText());
- count = 0;
+ commandHistory.add(0, userInput.getText());
+ commandCount = 0;
String input = userInput.getText();
String response = spinBox.getResponse(input, true);
- switch (response) {
- case "/main":
+ String[] responseFragments = response.split("/");
+
+ String comparator;
+
+ if (responseFragments.length > 1) {
+ comparator = responseFragments[1];
+ } else {
+ comparator = response;
+ }
+
+ switch (comparator) {
+ case "main":
tabPane.getSelectionModel().select(0);
break;
- case "/calendar":
+ case "calendar":
tabPane.getSelectionModel().select(1);
break;
- case "/modules":
+ case "modules":
tabPane.getSelectionModel().select(2);
+
+ if (responseFragments.length == 4) {
+ this.specificModuleCode = responseFragments[2];
+ this.subTab = responseFragments[3].split(" ")[0];
+ } else {
+ this.specificModuleCode = null;
+ this.subTab = null;
+ }
+ updateModules();
break;
default:
- update();
+ updateAll();
getPopup(response);
break;
}
@@ -120,23 +181,44 @@ private void handleUserInput() throws InvalidIndexException, DataReadWriteExcept
}
}
- private void update() throws InvalidIndexException, DataReadWriteException, FileCreationException {
+ /**
+ * Initializes the contents of the Main tab, which is the default upon startup.
+ * @throws DataReadWriteException should be displayed.
+ * @throws FileCreationException should be displayed.
+ * @throws InvalidIndexException should be displayed.
+ */
+ public void initializeGui() throws DataReadWriteException, FileCreationException, InvalidIndexException {
+ this.updateMain();
+ this.setPopup(popup);
+ this.enableCommandHistory();
+ }
+
+ private void updateAll() throws DataReadWriteException, FileCreationException, InvalidIndexException {
updateMain();
updateCalendar();
updateModules();
}
-
private void updateMain() throws InvalidIndexException, DataReadWriteException, FileCreationException {
- updateUrgentTask();
+ updateOverallTasksView();
updateExams();
}
- private void updateUrgentTask() throws DataReadWriteException, InvalidIndexException, FileCreationException {
+ private void updateModules() {
+ modulesTabContainer.getChildren().clear();
+
+ if (this.specificModuleCode != null && this.subTab != null) {
+ updateSpecificModule(this.specificModuleCode, this.subTab);
+ } else {
+ updateModulesList();
+ }
+ }
+
+ private void updateOverallTasksView() throws DataReadWriteException, InvalidIndexException, FileCreationException {
TaskList allTasks = new TaskList("Main");
- urgentTasks.getChildren().clear();
- moduleContainer = spinBox.getModuleContainer();
+ overallTasksView.getChildren().clear();
+ ModuleContainer moduleContainer = spinBox.getModuleContainer();
HashMap modules = moduleContainer.getModules();
for (Map.Entry module : modules.entrySet()) {
String moduleCode = (String) module.getKey();
@@ -173,20 +255,208 @@ private void updateUrgentTask() throws DataReadWriteException, InvalidIndexExcep
}
}
String moduleCode = "";
- urgentTasks.getChildren().add(TaskBox.getTaskBox(description, moduleCode, dates));
+ overallTasksView.getChildren().add(TaskBox.getTaskBox(description, moduleCode, dates));
}
+ }
+
+ private void updateModulesList() {
+ ScrollPane scrollPane = new ScrollPane();
+ scrollPane.setFitToHeight(true);
+ scrollPane.setFitToWidth(true);
+ modulesTabContainer.add(scrollPane, 1, 0, 1, 2);
+ VBox modulesList = new VBox();
+ modulesList.setStyle("-fx-background-color: #25274D");
+
+ scrollPane.setContent(modulesList);
+
+ ModuleContainer moduleContainer = spinBox.getModuleContainer();
+ HashMap modules = moduleContainer.getModules();
+
+ for (Map.Entry module : modules.entrySet()) {
+ Module currentModule = (Module) module.getValue();
+ ModuleBox wrappedModule = ModuleBox.getModuleListBox(currentModule.getModuleCode(),
+ currentModule.getModuleName());
+
+ wrappedModule.setOnMouseClicked(event -> {
+ userInput.setText("view / modules " + currentModule.getModuleCode() + " tasks");
+ try {
+ handleUserInput();
+ } catch (SpinBoxException e) {
+ e.printStackTrace();
+ }
+ });
+ modulesList.getChildren().add(wrappedModule);
+ }
}
- private void updateExams() {
- assert true;
+ private void updateSpecificModule(String moduleCode, String subTab) {
+ ModuleContainer moduleContainer = spinBox.getModuleContainer();
+ Module currentModule = moduleContainer.getModule(moduleCode);
+
+ updateSpecificModuleHeader(currentModule, subTab);
+ updateSpecificModuleNotes(currentModule);
+ updateSpecificModuleList(currentModule, subTab);
}
- private void updateCalendar() {
+ private void updateSpecificModuleHeader(Module currentModule, String subTabName) {
+ TextFlow textFlow = new TextFlow();
+ textFlow.setPadding(new Insets(10, 10, 10, 10));
+ textFlow.setTextAlignment(TextAlignment.CENTER);
+ textFlow.setLineSpacing(5.0);
+ textFlow.setStyle("-fx-background-color: #464866");
+
+ Text modCode = new Text(currentModule.getModuleCode());
+ modCode.setFont(new Font("Roboto", 18.0));
+ modCode.setFill(Color.WHITE);
+ modCode.setStyle("-fx-font-weight: bold");
+ textFlow.getChildren().add(modCode);
+
+ textFlow.getChildren().add(new Text(WHITESPACE));
+
+ Text modName = new Text(currentModule.getModuleName());
+ modName.setFont(new Font("Roboto", 14.0));
+ modName.setFill(Color.WHITE);
+ textFlow.getChildren().add(modName);
+
+ textFlow.getChildren().add(new Text(System.lineSeparator()));
+
+ Text taskSubHeader = new Text((TASKS));
+ Text fileSubHeader = new Text((FILES));
+ Text gradeSubHeader = new Text((GRADES));
+
+ taskSubHeader.setFill(Color.WHITE);
+ fileSubHeader.setFill(Color.WHITE);
+ gradeSubHeader.setFill(Color.WHITE);
+
+ switch (subTabName) {
+ case "grades":
+ gradeSubHeader.setStyle("-fx-font-weight: bold");
+ gradeSubHeader.setFill(Color.AQUA);
+ break;
+
+ case "files":
+ fileSubHeader.setStyle("-fx-font-weight: bold");
+ fileSubHeader.setFill(Color.AQUA);
+ break;
+
+ case "tasks":
+ taskSubHeader.setStyle("-fx-font-weight: bold");
+ taskSubHeader.setFill(Color.AQUA);
+ break;
+
+ default:
+ break;
+ }
+
+ textFlow.getChildren().add(taskSubHeader);
+ textFlow.getChildren().add(new Text(WHITESPACE));
+ textFlow.getChildren().add(fileSubHeader);
+ textFlow.getChildren().add(new Text(WHITESPACE));
+ textFlow.getChildren().add(gradeSubHeader);
+
+ modulesTabContainer.add(textFlow, 0, 0, 2, 1);
+ }
+
+ private void updateSpecificModuleNotes(Module currentModule) {
+ TextFlow textFlow = new TextFlow();
+ textFlow.setStyle("-fx-background-color: #AAABB8");
+ textFlow.setPadding(new Insets(5, 5, 5, 5));
+ textFlow.setLineSpacing(5.0);
+ textFlow.setTextAlignment(TextAlignment.JUSTIFY);
+
+ List notes = currentModule.getNotepad().getNotes();
+ for (String note : notes) {
+ textFlow.getChildren().add(new Text(note));
+ textFlow.getChildren().add(new Text(System.lineSeparator()));
+ }
+
+ modulesTabContainer.add(textFlow, 0, 1, 1, 1);
+ }
+
+ private void updateSpecificModuleList(Module currentModule, String subTab) {
+ switch (subTab) {
+ case "files":
+ updateSpecificModuleFileList(currentModule);
+ break;
+
+ case "grades":
+ updateSpecificModuleGradeList(currentModule);
+ break;
+
+ default:
+ updateSpecificModuleTaskList(currentModule);
+ }
+ }
+
+ private void updateSpecificModuleGradeList(Module currModule) {
+ GradeList gradeList = currModule.getGrades();
+ List gradedComponents = gradeList.getList();
+
+ ScrollPane scrollPane = this.createScrollPane();
+ modulesTabContainer.add(scrollPane, 1, 1, 1, 1);
+
+ VBox gradesList = new VBox();
+ gradesList.setStyle("-fx-background-color: #25274D");
+
+ scrollPane.setContent(gradesList);
+ }
+
+ private void updateSpecificModuleTaskList(Module currModule) {
+ ScrollPane scrollPane = this.createScrollPane();
+ modulesTabContainer.add(scrollPane, 1, 1, 1, 1);
+
+ VBox tasksList = new VBox();
+ tasksList.setStyle("-fx-background-color: #25274D");
+
+ scrollPane.setContent(tasksList);
+
+ TaskList taskList = currModule.getTasks();
+ List tasks = taskList.getList();
+ for (Task task : tasks) {
+ String description = task.getTaskType().name();
+ description += ": " + task.getName();
+ String dates = "";
+ if (task.isSchedulable()) {
+ Schedulable schedulable = ((Schedulable) task);
+ dates += schedulable.getStartDate().toString();
+ if (TaskType.taskWithBothDates().contains(task.getTaskType())) {
+ dates += " " + schedulable.getEndDate().toString();
+ dates = "At: " + dates;
+ } else {
+ dates = "By: " + dates;
+ }
+ }
+
+ TaskBox wrappedTask = TaskBox.getTaskBox(description, "", dates);
+ if (!task.getDone()) {
+ tasksList.getChildren().add(wrappedTask);
+ }
+ }
+ }
+
+ private void updateSpecificModuleFileList(Module currModule) {
+ ScrollPane scrollPane = this.createScrollPane();
+ modulesTabContainer.add(scrollPane, 1, 1, 1, 1);
+
+ VBox filesList = new VBox();
+ filesList.setStyle("-fx-background-color: #25274D");
+
+ scrollPane.setContent(filesList);
+
+ FileList fileList = currModule.getFiles();
+ List files = fileList.getList();
+ for (File file : files) {
+ FileBox wrappedFile = FileBox.getFileBox(file);
+ filesList.getChildren().add(wrappedFile);
+ }
+ }
+
+ private void updateExams() {
assert true;
}
- private void updateModules() {
+ private void updateCalendar() {
assert true;
}
@@ -196,15 +466,14 @@ public void setPopup(Popup popup) {
}
/**
- * Set up popup style and add label
- * and show popup with string res.
- * @param res response string from spinbox.
+ * Retrieve a popup to display text in a styled manner.
+ * @param displayText the String to be displayed to the user.
*/
- public void getPopup(String res) {
+ private void getPopup(String displayText) {
popup.getContent().clear();
GridPane grid = new GridPane();
Label response = new Label();
- response.setText(res);
+ response.setText(displayText);
grid.setStyle("-fx-background-color:white;"
+ "-fx-border-color: black;"
+ "-fx-border-width:2;"
@@ -219,4 +488,10 @@ public void getPopup(String res) {
popup.show(window);
}
+ private ScrollPane createScrollPane() {
+ ScrollPane scrollPane = new ScrollPane();
+ scrollPane.setFitToHeight(true);
+ scrollPane.setFitToWidth(true);
+ return scrollPane;
+ }
}
diff --git a/src/main/java/spinbox/gui/TaskBox.java b/src/main/java/spinbox/gui/TaskBox.java
index 962075e30f..420f36de28 100644
--- a/src/main/java/spinbox/gui/TaskBox.java
+++ b/src/main/java/spinbox/gui/TaskBox.java
@@ -5,6 +5,7 @@
import javafx.geometry.Pos;
import javafx.scene.control.Label;
import javafx.scene.layout.AnchorPane;
+import javafx.scene.paint.Color;
import java.io.IOException;
@@ -18,7 +19,7 @@ public class TaskBox extends AnchorPane {
private TaskBox(String description, String module, String dates) {
try {
- FXMLLoader fxmlLoader = new FXMLLoader(MainWindow.class.getResource("/view/TaskBox.fxml"));
+ FXMLLoader fxmlLoader = new FXMLLoader(MainWindow.class.getResource("/view/itemBoxes/TaskBox.fxml"));
fxmlLoader.setController(this);
fxmlLoader.setRoot(this);
fxmlLoader.load();
@@ -26,6 +27,10 @@ private TaskBox(String description, String module, String dates) {
e.printStackTrace();
}
+ this.description.setTextFill(Color.WHITE);
+ this.module.setTextFill(Color.WHITE);
+ this.dates.setTextFill(Color.WHITE);
+
this.description.setText(description);
this.module.setText(module);
this.dates.setText(dates);
diff --git a/src/main/java/spinbox/gui/boxes/FileBox.java b/src/main/java/spinbox/gui/boxes/FileBox.java
new file mode 100644
index 0000000000..929004efea
--- /dev/null
+++ b/src/main/java/spinbox/gui/boxes/FileBox.java
@@ -0,0 +1,42 @@
+package spinbox.gui.boxes;
+
+import javafx.fxml.FXML;
+import javafx.fxml.FXMLLoader;
+import javafx.geometry.Insets;
+import javafx.scene.control.Label;
+import javafx.scene.layout.VBox;
+import javafx.scene.paint.Color;
+import spinbox.entities.items.File;
+import spinbox.gui.MainWindow;
+
+import java.io.IOException;
+
+public class FileBox extends VBox {
+ @FXML
+ private Label fileDetails;
+
+ private FileBox(File file) {
+ try {
+ FXMLLoader fxmlLoader = new FXMLLoader(MainWindow.class.getResource("/view/itemBoxes/FileBox.fxml"));
+ fxmlLoader.setController(this);
+ fxmlLoader.setRoot(this);
+ fxmlLoader.load();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ this.setStyle("-fx-border-color: #FFF");
+ this.setPadding(new Insets(10, 10, 10, 10));
+ this.setSpacing(10.0);
+ setMargin(this, new Insets(10, 10, 10, 10));
+ this.fileDetails.setStyle("-fx-font-weight: bold");
+ this.fileDetails.setTextFill(Color.WHITE);
+
+
+ this.fileDetails.setText(file.toString());
+ }
+
+ public static FileBox getFileBox(File file) {
+ return new FileBox(file);
+ }
+}
diff --git a/src/main/java/spinbox/gui/boxes/ModuleBox.java b/src/main/java/spinbox/gui/boxes/ModuleBox.java
new file mode 100644
index 0000000000..8ca48188f9
--- /dev/null
+++ b/src/main/java/spinbox/gui/boxes/ModuleBox.java
@@ -0,0 +1,45 @@
+package spinbox.gui.boxes;
+
+import javafx.fxml.FXML;
+import javafx.fxml.FXMLLoader;
+import javafx.geometry.Insets;
+import javafx.scene.control.Label;
+import javafx.scene.layout.VBox;
+import javafx.scene.paint.Color;
+import spinbox.gui.MainWindow;
+
+import java.io.IOException;
+
+public class ModuleBox extends VBox {
+ @FXML
+ private Label moduleNameLabel;
+ @FXML
+ private Label moduleCodeLabel;
+
+ private ModuleBox(String moduleCode, String moduleName) {
+ try {
+ FXMLLoader fxmlLoader = new FXMLLoader(MainWindow.class
+ .getResource("/view/ModuleListBox/ModuleListBox.fxml"));
+ fxmlLoader.setController(this);
+ fxmlLoader.setRoot(this);
+ fxmlLoader.load();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ this.setStyle("-fx-border-color: #FFF");
+ this.setPadding(new Insets(10, 10, 10, 10));
+ this.setSpacing(10.0);
+ setMargin(this, new Insets(10, 10, 10, 10));
+ this.moduleCodeLabel.setStyle("-fx-font-weight: bold");
+ this.moduleCodeLabel.setTextFill(Color.WHITE);
+
+
+ this.moduleCodeLabel.setText(moduleCode);
+ this.moduleNameLabel.setText(moduleName);
+ }
+
+ public static ModuleBox getModuleListBox(String moduleCode, String moduleName) {
+ return new ModuleBox(moduleCode, moduleName);
+ }
+}