Modularize all components

This commit is contained in:
Oystein Kristoffer Tveit 2021-02-17 21:36:12 +01:00
parent c8d37c2754
commit 73e389339c
11 changed files with 186 additions and 65 deletions

View File

@ -1,10 +1,28 @@
package app; package app;
import java.net.URL;
import java.util.ResourceBundle;
import app.model.Model;
import javafx.fxml.Initializable;
public class MainController implements Initializable {
private Model model;
/** /**
* MainController * Links the controller to the global model
* Might not be needed. Not sure yet. * @param model The model to be linked
*/ */
public class MainController { 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) {
//
}
} }

View File

@ -1,8 +0,0 @@
package app.controllers;
import javafx.fxml.FXML;
import javafx.scene.control.TreeView;
public class FileTreeController {
}

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -1,16 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.SplitPane?> <?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.ToolBar?>
<?import javafx.scene.control.TreeView?>
<?import javafx.scene.control.TreeItem?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.BorderPane?> <?import javafx.scene.layout.BorderPane?>
<?import javafx.scene.text.TextFlow?> <?import javafx.scene.text.TextFlow?>
@ -18,28 +8,12 @@
prefWidth="600" prefWidth="600"
prefHeight="400" prefHeight="400"
xmlns="http://javafx.com/javafx/8.0.65" 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">
<top> <top>
<MenuBar prefHeight="25.0"> <!-- Menubar -->
<menus> <fx:include source="components/Menubar.fxml" fx:id="MenubarRoot"/>
<Menu mnemonicParsing="false" text="File">
<items>
<MenuItem mnemonicParsing="false" text="Close" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Edit">
<items>
<MenuItem mnemonicParsing="false" text="Delete" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Help">
<items>
<MenuItem mnemonicParsing="false" text="About" />
</items>
</Menu>
</menus>
</MenuBar>
</top> </top>
<center> <center>
@ -49,26 +23,18 @@
<items> <items>
<!-- File tree --> <!-- File tree -->
<ScrollPane> <fx:include source="components/Filetree.fxml" fx:id="FiletreeRoot"/>
<content>
<TreeView
fx:id="filetree"
prefHeight="${filetree.parent.height}"
prefWidth="${filetree.parent.width}"/>
</content>
</ScrollPane>
<!-- Editor --> <!-- Editor -->
<fx:include source="components/Editor.fxml" fx:id="editorRoot"/> <fx:include source="components/Editor.fxml" fx:id="EditorRoot"/>
</items> </items>
</SplitPane> </SplitPane>
</center> </center>
<bottom> <bottom>
<HBox fx:id="modeline" prefHeight="25.0"> <!-- Modeline -->
<Label text="Modeline :)"/> <fx:include source="components/Modeline.fxml" fx:id="ModelineRoot"/>
</HBox>
</bottom> </bottom>
</BorderPane> </BorderPane>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.ToolBar?>
<?import org.fxmisc.flowless.VirtualizedScrollPane?> <?import org.fxmisc.flowless.VirtualizedScrollPane?>
<?import org.fxmisc.richtext.CodeArea?> <?import org.fxmisc.richtext.CodeArea?>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.TreeView?>
<ScrollPane>
<content>
<TreeView layoutY="28.0" prefHeight="329.0" prefWidth="132.0" />
</content>
</ScrollPane>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.control.TreeView?>
<ScrollPane
xmlns="http://javafx.com/javafx/8.0.65"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="app.controllers.FiletreeController">
<content>
<TreeView
fx:id="filetree"
prefHeight="${filetree.parent.height}"
prefWidth="${filetree.parent.width}"/>
</content>
</ScrollPane>

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>
<MenuBar
prefHeight="25.0"
xmlns="http://javafx.com/javafx/8.0.65"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="app.controllers.MenubarController">
<menus>
<Menu mnemonicParsing="false" text="File">
<items>
<MenuItem mnemonicParsing="false" text="Close" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Edit">
<items>
<MenuItem mnemonicParsing="false" text="Delete" />
</items>
</Menu>
<Menu mnemonicParsing="false" text="Help">
<items>
<MenuItem mnemonicParsing="false" text="About" />
</items>
</Menu>
</menus>
</MenuBar>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.layout.HBox?>
<HBox
prefHeight="25.0"
xmlns="http://javafx.com/javafx/8.0.65"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="app.controllers.ModelineController">
<Label text="Modeline :)"/>
</HBox>