Add EditorController

This commit is contained in:
Oystein Kristoffer Tveit 2021-02-17 16:23:57 +01:00
parent 3f591b07e0
commit 0b9791ee0c

View File

@ -0,0 +1,46 @@
package app.components.editor;
import java.net.URL;
import java.util.ResourceBundle;
import org.fxmisc.richtext.CodeArea;
import org.fxmisc.richtext.LineNumberFactory;
import app.model.Model;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
public class EditorController implements Initializable {
@FXML
private CodeArea editor;
private Model model;
/**
* Links the controller to the global model
* @param model The model to be linked
*/
public EditorController(Model model) {
this.model = model;
}
/**
* Initializes and customizes the properties of the javafx objects.
*/
@Override
public void initialize(URL url, ResourceBundle resourceBundle) {
editor.setParagraphGraphicFactory(LineNumberFactory.get(editor));
}
/**
* Handles events from the editor, and reflects them in the model
* @param event The object containing metadata of the event
*/
@FXML
public void editorChanged(ActionEvent event) {
//
}
}