From 1d4208483b61a47d6e778b52e508c7e7413d080e Mon Sep 17 00:00:00 2001 From: Johannes Oehm Date: Wed, 25 Nov 2015 11:29:00 +0100 Subject: [PATCH] JavaDoc --- .../mi/projmi6/controller/FallController.java | 1 + .../mi/projmi6/controller/MainController.java | 105 ++++++++++++++++++--- .../mi/projmi6/controller/MessageController.java | 32 ++++++- 3 files changed, 122 insertions(+), 16 deletions(-) diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java index a819c45..e5f0beb 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java @@ -296,6 +296,7 @@ public class FallController { public void createNewFall() { clearFields(); this.state.set(State.CREATE); + mainController.lockForEdit(MainController.TabName.OVERVIEW); Patient patient = mainController.getPatientTablesController().getSelectedPatient(); diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/MainController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/MainController.java index 147456f..21e1a12 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/MainController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/MainController.java @@ -16,6 +16,9 @@ import java.util.List; public class MainController { + /** + * The subcontroller instances + */ private FallController fallController; private DiagnoseController diagnoseController; private PatientTablesController patientTablesController; @@ -26,6 +29,9 @@ public class MainController { private MessageController messageController; + /** + * The number of JavaFX tasks that is currently running. + */ private int parallelTaskCount = 0; @FXML @@ -49,10 +55,20 @@ public class MainController { @FXML private Tab tabFallOverview, tabFallUntersuchungen, tabFallDiagnose, tabFallStationsHistorie; + @FXML + private Label lvFallPlaceholder; + + private Task> loadFallTask = null; + + private Task loadCaseData = null; + private Stammdaten stammdaten = new Stammdaten(); + /** + * Controller factory for the FXMLLoader + */ private Callback, Object> controllerFactory = clazz -> { if (clazz.equals(MainController.class)) { return this; @@ -78,11 +94,14 @@ public class MainController { } }; + + + /** + * Remembers the cases to show after the cases are loaded. + * Set by the {@link #selectPatientAndFallId(Patient, int)} + */ private int fallIdToShow = -1; - @FXML - private Label lvFallPlaceholder; - private Task> loadFallTask = null; - private Task loadCaseData = null; + public MainController() { fallController = new FallController(this); @@ -95,42 +114,73 @@ public class MainController { messageController = new MessageController(this); } + /** + * Getter for the Stammdaten + */ public Stammdaten getStammdaten() { return stammdaten; } + /** + * Getter for the controller factory. + * The controller factory returns instances of the subcontroller that are created by this controller. + */ public Callback, Object> getControllerFactory() { return controllerFactory; } + /** + * Getter for the case controller + */ public FallController getFallController() { return fallController; } + /** + * Getter for the diagnosis controller + */ public DiagnoseController getDiagnoseController() { return diagnoseController; } + /** + * Getter for the patient tables controller + */ public PatientTablesController getPatientTablesController() { return patientTablesController; } + /** + * Getter for the settings controller + */ public SettingsController getSettingsController() { return settingsController; } + /** + * Getter for the examinations controller + */ public UntersuchungenController getUntersuchungenController() { return untersuchungenController; } + /** + * Getter for the hl7 message controller + */ public MessageController getMessageController() { return messageController; } + /** + * Getter for the HL7 message log controller + */ public LogController getLogController() { return logController; } + /** + * Increase the counter of tasks running. Makes the spinning progress view visible. + */ public void increaseParallelTaskCount() { parallelTaskCount++; if (parallelTaskCount > 0 && progressIndicator != null) { @@ -138,6 +188,9 @@ public class MainController { } } + /** + * Decreases the counter of tasks running. Makes the progress view invisible if none is running. + */ public void decreaseParallelTaskCount() { parallelTaskCount--; if (parallelTaskCount <= 0 && progressIndicator != null) { @@ -146,6 +199,11 @@ public class MainController { } } + /** + * Opens a patient and specific case in the window. + * @param patient The patient to be shown. + * @param fallId The case number of the patient. + */ public void selectPatientAndFallId(Patient patient, int fallId) { if (patientTablesController.getSelectedPatient() == patient && !loadFallTask.isRunning()) { @@ -157,6 +215,10 @@ public class MainController { patientTablesController.selectPatient(patient); } + /** + * Opens a specific case by id. + * @param id The case id + */ private void selectFallById(int id) { if (lvFall.getItems() == null) { return; @@ -168,10 +230,13 @@ public class MainController { return; } } - - } + /** + * Starts a task that loads all cases for the given patient and displays them + * Stops other running tasks if necessary. + * @param patient The patient whose cases will be loaded. + */ public void refreshCasesFromDb(Patient patient) { lvFall.setItems(null); //clear list @@ -229,6 +294,10 @@ public class MainController { thread.start(); } + + /** + * FXMLLoaders initialize()-method + */ @FXML private void initialize() { //Init user data. @@ -255,6 +324,7 @@ public class MainController { refreshCaseData(newValue); }); + //Custom cell factory to highlight the canceled cases. lvFall.setCellFactory(lv -> { return new ListCell() { @Override @@ -281,6 +351,11 @@ public class MainController { } + /** + * Loads all the data that belongs to a specific case (diagnosis, ward history, examinations) + * and sets the data in the correlating controllers. + * @param fall The case whose correlationg data will be loaded + */ private void refreshCaseData(Fall fall) { if (loadCaseData != null && loadCaseData.isRunning()) { loadCaseData.cancel(); @@ -359,24 +434,26 @@ public class MainController { } + /** + * Reloads the data to the case that is currently selected. + */ public void refreshCaseData() { refreshCaseData(lvFall.getSelectionModel().getSelectedItem()); } + /** + * EventHandler for the {@link #btnFallCreate} + */ @FXML private void clickedCreateFall() { -// tabFallDiagnose.setDisable(true); -// tabFallUntersuchungen.setDisable(true); -// tabFallStationsHistorie.setDisable(true); -// tabPaneFall.getSelectionModel().select(tabFallOverview); -// patientTablesController.getPatientOverviewTabPane().setDisable(true); -// -// fallController.createNewFall(); - lockForEdit(TabName.OVERVIEW); } + /** + * + * @return + */ public Fall getFall() { return lvFall.getSelectionModel().getSelectedItem(); } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/MessageController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/MessageController.java index 3a3b873..d9f925f 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/MessageController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/MessageController.java @@ -15,29 +15,54 @@ import javafx.stage.Stage; import java.io.IOException; /** + * This controller controlls the small message icon at the bottom of the application's main window. * Created by Johannes on 21/11/2015. */ public class MessageController { + /** + * The superior controller + */ final MainController mainController; + + /** + * The list of unread messages + */ private final SimpleListProperty messages = new SimpleListProperty(FXCollections.observableArrayList()); + + /** + * The view that is mantained by this controller + */ @FXML private MessageIcon messageIcon; - + /** + * Constructor + * @param mainController The controller that creates this instance + */ public MessageController(MainController mainController) { this.mainController = mainController; } + /** + * FXMLLoaders initialize()-method + */ @FXML private void initialize() { messageIcon.messageCountProperty().bind(messages.sizeProperty()); } + /** + * EventHandler for the {@link #messageIcon}. + */ @FXML private void onMessageIconClicked() { showMessageList(); } + /** + * Opens a window that shows all the unread messages. + * @see de.uniluebeck.mi.projmi6.controller.MessageListController + */ private void showMessageList() { FXMLLoader fxmlLoader = new FXMLLoader(); fxmlLoader.setLocation(getClass().getClassLoader().getResource("message_list.fxml")); @@ -63,7 +88,10 @@ public class MessageController { stage.show(); } - + /** + * Adds a message to the list of unread messages that is controlled by this controller + * @param message The message that will be added. + */ public void addMessage(HL7Message message) { messages.add(message); mainController.getLogController().refreshLogFromDb();