Extract editor from main fxml and add linenumbers

This commit is contained in:
Oystein Kristoffer Tveit 2021-02-17 21:06:09 +01:00
parent fbcd6d3a87
commit 2d6fdd018f
6 changed files with 19 additions and 8 deletions

View File

@ -1,4 +1,4 @@
package app.components.editor; package app.controllers;
import java.net.URL; import java.net.URL;
import java.util.ResourceBundle; import java.util.ResourceBundle;
@ -22,7 +22,7 @@ public class EditorController implements Initializable {
* Links the controller to the global model * Links the controller to the global model
* @param model The model to be linked * @param model The model to be linked
*/ */
public EditorController(Model model) { public void setModel(Model model) {
this.model = model; this.model = model;
} }

View File

@ -1,4 +1,4 @@
package app.components.fileTree; package app.controllers.fileTree;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.TreeView; import javafx.scene.control.TreeView;

View File

@ -5,5 +5,7 @@ module app {
requires javafx.graphics; requires javafx.graphics;
requires org.fxmisc.richtext; requires org.fxmisc.richtext;
opens app.controllers to javafx.fxml;
exports app; exports app;
} }

View File

@ -61,11 +61,7 @@
</ScrollPane> </ScrollPane>
<!-- Editor --> <!-- Editor -->
<VirtualizedScrollPane> <fx:include source="components/Editor.fxml" fx:id="editorRoot"/>
<content>
<CodeArea fx:id="editor"/>
</content>
</VirtualizedScrollPane>
</items> </items>
</SplitPane> </SplitPane>

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import org.fxmisc.flowless.VirtualizedScrollPane?>
<?import org.fxmisc.richtext.CodeArea?>
<VirtualizedScrollPane
xmlns="http://javafx.com/javafx/8.0.65"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="app.controllers.EditorController">
<content>
<CodeArea fx:id="editor"/>
</content>
</VirtualizedScrollPane>