From 73e389339c899ac94b2310dff00c8f2499303dd8 Mon Sep 17 00:00:00 2001 From: h7x4 Date: Wed, 17 Feb 2021 21:36:12 +0100 Subject: [PATCH] Modularize all components --- src/main/java/app/MainController.java | 30 ++++++++--- .../app/controllers/FileTreeController.java | 8 --- .../app/controllers/FiletreeController.java | 34 +++++++++++++ .../app/controllers/MenubarController.java | 31 ++++++++++++ .../app/controllers/ModelineController.java | 31 ++++++++++++ src/main/resources/fxml/Main.fxml | 50 +++---------------- .../resources/fxml/components/Editor.fxml | 1 + .../resources/fxml/components/FileTree.fxml | 9 ---- .../resources/fxml/components/Filetree.fxml | 16 ++++++ .../resources/fxml/components/Menubar.fxml | 29 +++++++++++ .../resources/fxml/components/Modeline.fxml | 12 +++++ 11 files changed, 186 insertions(+), 65 deletions(-) delete mode 100644 src/main/java/app/controllers/FileTreeController.java create mode 100644 src/main/java/app/controllers/FiletreeController.java create mode 100644 src/main/java/app/controllers/MenubarController.java create mode 100644 src/main/java/app/controllers/ModelineController.java delete mode 100644 src/main/resources/fxml/components/FileTree.fxml create mode 100644 src/main/resources/fxml/components/Filetree.fxml create mode 100644 src/main/resources/fxml/components/Menubar.fxml create mode 100644 src/main/resources/fxml/components/Modeline.fxml diff --git a/src/main/java/app/MainController.java b/src/main/java/app/MainController.java index e677c75..78cef22 100644 --- a/src/main/java/app/MainController.java +++ b/src/main/java/app/MainController.java @@ -1,10 +1,28 @@ package app; -/** - * MainController - * Might not be needed. Not sure yet. - */ -public class MainController { +import java.net.URL; +import java.util.ResourceBundle; - +import app.model.Model; +import javafx.fxml.Initializable; + +public class MainController implements Initializable { + + private Model model; + + /** + * Links the controller to the global model + * @param model The model to be linked + */ + public void setModel(Model model) { + this.model = model; + } + + /** + * Initializes and customizes the properties of the javafx objects. + */ + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + // + } } \ No newline at end of file diff --git a/src/main/java/app/controllers/FileTreeController.java b/src/main/java/app/controllers/FileTreeController.java deleted file mode 100644 index 4e182c3..0000000 --- a/src/main/java/app/controllers/FileTreeController.java +++ /dev/null @@ -1,8 +0,0 @@ -package app.controllers; - -import javafx.fxml.FXML; -import javafx.scene.control.TreeView; - -public class FileTreeController { - -} diff --git a/src/main/java/app/controllers/FiletreeController.java b/src/main/java/app/controllers/FiletreeController.java new file mode 100644 index 0000000..159f3ee --- /dev/null +++ b/src/main/java/app/controllers/FiletreeController.java @@ -0,0 +1,34 @@ +package app.controllers; + +import javafx.fxml.FXML; +import javafx.scene.control.TreeView; + +import java.net.URL; +import java.util.ResourceBundle; + +import app.model.Model; +import javafx.fxml.Initializable; + +public class FiletreeController implements Initializable { + + // TODO: Add component references, and event handlers + + private Model model; + + /** + * Links the controller to the global model + * @param model The model to be linked + */ + public void setModel(Model model) { + this.model = model; + } + + /** + * Initializes and customizes the properties of the javafx objects. + */ + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + // TODO: implement + } + +} diff --git a/src/main/java/app/controllers/MenubarController.java b/src/main/java/app/controllers/MenubarController.java new file mode 100644 index 0000000..5c8e14d --- /dev/null +++ b/src/main/java/app/controllers/MenubarController.java @@ -0,0 +1,31 @@ +package app.controllers; + +import java.net.URL; +import java.util.ResourceBundle; + +import app.model.Model; +import javafx.fxml.Initializable; + +public class MenubarController implements Initializable { + + // TODO: Add component references, and event handlers + + private Model model; + + /** + * Links the controller to the global model + * @param model The model to be linked + */ + public void setModel(Model model) { + this.model = model; + } + + /** + * Initializes and customizes the properties of the javafx objects. + */ + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + // TODO: implement + } + +} diff --git a/src/main/java/app/controllers/ModelineController.java b/src/main/java/app/controllers/ModelineController.java new file mode 100644 index 0000000..6bf11b7 --- /dev/null +++ b/src/main/java/app/controllers/ModelineController.java @@ -0,0 +1,31 @@ +package app.controllers; + +import java.net.URL; +import java.util.ResourceBundle; + +import app.model.Model; +import javafx.fxml.Initializable; + +public class ModelineController implements Initializable { + + // TODO: Add component references, and event handlers + + private Model model; + + /** + * Links the controller to the global model + * @param model The model to be linked + */ + public void setModel(Model model) { + this.model = model; + } + + /** + * Initializes and customizes the properties of the javafx objects. + */ + @Override + public void initialize(URL url, ResourceBundle resourceBundle) { + // TODO: implement + } + +} diff --git a/src/main/resources/fxml/Main.fxml b/src/main/resources/fxml/Main.fxml index e707144..91da24f 100644 --- a/src/main/resources/fxml/Main.fxml +++ b/src/main/resources/fxml/Main.fxml @@ -1,16 +1,6 @@ - - - - - - - - - - @@ -18,28 +8,12 @@ prefWidth="600" prefHeight="400" xmlns="http://javafx.com/javafx/8.0.65" - xmlns:fx="http://javafx.com/fxml/1"> + xmlns:fx="http://javafx.com/fxml/1" + fx:controller="app.MainController"> - - - - - - - - - - - - - - - - - - - + +
@@ -49,26 +23,18 @@ - - - - - + - +
- - + + diff --git a/src/main/resources/fxml/components/Editor.fxml b/src/main/resources/fxml/components/Editor.fxml index 93b7811..4774175 100644 --- a/src/main/resources/fxml/components/Editor.fxml +++ b/src/main/resources/fxml/components/Editor.fxml @@ -1,5 +1,6 @@ + diff --git a/src/main/resources/fxml/components/FileTree.fxml b/src/main/resources/fxml/components/FileTree.fxml deleted file mode 100644 index 8c6bb3d..0000000 --- a/src/main/resources/fxml/components/FileTree.fxml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/main/resources/fxml/components/Filetree.fxml b/src/main/resources/fxml/components/Filetree.fxml new file mode 100644 index 0000000..5847a77 --- /dev/null +++ b/src/main/resources/fxml/components/Filetree.fxml @@ -0,0 +1,16 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/fxml/components/Menubar.fxml b/src/main/resources/fxml/components/Menubar.fxml new file mode 100644 index 0000000..a79fc91 --- /dev/null +++ b/src/main/resources/fxml/components/Menubar.fxml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/fxml/components/Modeline.fxml b/src/main/resources/fxml/components/Modeline.fxml new file mode 100644 index 0000000..eef610c --- /dev/null +++ b/src/main/resources/fxml/components/Modeline.fxml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file