Add EditorController
This commit is contained in:
parent
3f591b07e0
commit
0b9791ee0c
46
src/main/java/app/components/editor/EditorController.java
Normal file
46
src/main/java/app/components/editor/EditorController.java
Normal 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) {
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user