From e112ee3d4c5452a2558867927ea88a522acaa26d Mon Sep 17 00:00:00 2001 From: Johannes Oehm Date: Wed, 25 Nov 2015 11:35:55 +0100 Subject: [PATCH] JavaDoc LogController --- .../mi/projmi6/controller/LogController.java | 47 +++++++++++++++++----- 1 file changed, 36 insertions(+), 11 deletions(-) diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/LogController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/LogController.java index 962f325..e22aa24 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/LogController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/LogController.java @@ -14,46 +14,65 @@ import java.util.List; /** - * Created by 631806 on 19.11.15. + * Controller for the HL7 Log Tab. + * + * The log data is stored in the MySQL DB. The controller handles loading and showing of the data. + * + * Created by Johannes on 19.11.15. + * @author Johannes */ public class LogController { + /** + * The superior controller + */ final MainController mainController; @FXML - TableView tblLog; + private TableView tblLog; @FXML - TableColumn colLogIp, colLogMessage; + private TableColumn colLogIp, colLogMessage; @FXML - TableColumn colLogTime; + private TableColumn colLogTime; @FXML - TableColumn colLogDirection; - + private TableColumn colLogDirection; @FXML - Button btnRefresh; + private Button btnRefresh; + private Task> loadLogEntryTask = null; + /** + * Constructor. Instance is created by the main controller. + * @param mainController The main controller instance that creates this controller instance + */ public LogController(MainController mainController) { this.mainController = mainController; } + /** + * FXMLLoaders initialize()-method + */ @FXML private void initialize() { initColumns(); refreshLogFromDb(); } + /** + * Init cell value factories for the table columns + */ private void initColumns() { colLogDirection.setCellValueFactory(new PropertyValueFactory("direction")); colLogIp.setCellValueFactory(new PropertyValueFactory("source")); colLogTime.setCellValueFactory(new PropertyValueFactory("timestamp")); colLogMessage.setCellValueFactory(new PropertyValueFactory("message")); - colLogMessage.setCellFactory(column -> { - return new TableCell() { + //Change cell factory cuz we need scrollable fields + colLogMessage.setCellFactory(column -> + new TableCell() { private TextArea textArea = new TextArea(); { @@ -73,10 +92,13 @@ public class LogController { textArea.setWrapText(true); this.setGraphic(textArea); } - }; - }); + }); + } + /** + * Starts reloading the log data from db. + */ public void refreshLogFromDb() { if (this.loadLogEntryTask != null && this.loadLogEntryTask.isRunning()) { return; @@ -122,6 +144,9 @@ public class LogController { } + /** + * EventHandler for {@link #btnRefresh} + */ @FXML private void clickedRefresh() { refreshLogFromDb();