diff --git a/src/main/java/de/uniluebeck/mi/projmi6/Main.java b/src/main/java/de/uniluebeck/mi/projmi6/Main.java index e688021..479ab65 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/Main.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/Main.java @@ -129,7 +129,7 @@ public class Main extends Application { loadingMessage.close(); primaryStage.setTitle("KIS Gruppe 06"); - primaryStage.setScene(new Scene(root, 1000, 800)); + primaryStage.setScene(new Scene(root, 1200, 800)); primaryStage.show(); }); diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/DiagnoseController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/DiagnoseController.java index 0dcc0bf..c7e4732 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/DiagnoseController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/DiagnoseController.java @@ -271,7 +271,7 @@ public class DiagnoseController { * Clear the fields in case no diagnosis is selcted, or * creating a new one is started. */ - private void clearFields() { + public void clearFields() { diagDiagnoseArzt.setValue(mainController.getCurrentMitarbeiter()); diagDiagnose.setValue(null); diagFreitext.setText(""); 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 b325626..d16032c 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/FallController.java @@ -21,6 +21,10 @@ import javafx.scene.layout.GridPane; import java.io.IOException; import java.sql.SQLException; +/** + * The controller that controls the detailed case data view. + * @author Johannes + */ public class FallController { /** @@ -300,7 +304,7 @@ public class FallController { /** * Clears the TextFields. */ - private void clearFields() { + public void clearFields() { if (state.get() == State.CREATE) { dtTmAufnahme.setToCurrentDateTime(); dtTmEntlassung.setToCurrentDateTime(); 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 21e1a12..593d712 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/MainController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/MainController.java @@ -14,6 +14,13 @@ import javafx.util.Callback; import java.util.List; + +/** + * The applications main window controller. Has several sub controllers and handles the list of cases to a single + * patient as well as the spinning progress indicator. + * + * @author Johannes + */ public class MainController { /** @@ -368,13 +375,20 @@ public class MainController { if (fall == null) { tabPaneFall.setDisable(true); - System.out.println("TODO: Clear tables cuz fall = null!"); + fallController.clearFields(); + stationsHistorieController.clearFields(); + diagnoseController.clearFields(); + untersuchungenController.clearFields(); + + stationsHistorieController.setStationsHistorie(null); + diagnoseController.setDiagnosen(null); + untersuchungenController.setUntersuchungen(null); //fallController.c return; } if (fall == null) { // If no patient is selected - //lvFallPlaceholder.setText("Kein Patient ausgew\u00e4hlt!"); + lvFallPlaceholder.setText("Kein Patient ausgew\u00e4hlt!"); return; } @@ -451,17 +465,24 @@ public class MainController { /** - * - * @return + * Getter for the case that is currently selected in the list */ public Fall getFall() { return lvFall.getSelectionModel().getSelectedItem(); } + /** + * Property for the case selected in the list. + */ public ReadOnlyObjectProperty fallProperty() { return lvFall.getSelectionModel().selectedItemProperty(); } + + /** + * Prevents the user from changing the patient/case and tab while editing case data. + * @param exclude The case data tab that should be excluded from disabling. + */ public void lockForEdit(TabName exclude) { tabFallDiagnose.setDisable(true); tabFallUntersuchungen.setDisable(true); @@ -491,6 +512,9 @@ public class MainController { } + /** + * Unlocks the GUI from locking by {@link #lockForEdit(TabName)} + */ public void unlockFromEdit() { tabFallDiagnose.setDisable(false); tabFallUntersuchungen.setDisable(false); @@ -503,14 +527,23 @@ public class MainController { } + /** + * The user / hospital employee that is currently "logged in" by choosing his name from the dropdown menu. + */ public Mitarbeiter getCurrentMitarbeiter() { return cmbUserChoose == null ? null : cmbUserChoose.getValue(); } + /** + * Property of the currently logged in user. + */ public ReadOnlyObjectProperty currentMitarbeiterProperty() { return cmbUserChoose.valueProperty(); } + /** + * TabName defintions for the {@link #lockForEdit(TabName)}-method + */ public enum TabName { OVERVIEW, DIAGNOSE, UNTERSUCHUNG, STATIONSHISTORIE } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/MessageListController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/MessageListController.java index 14e1fd3..c989ce6 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/MessageListController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/MessageListController.java @@ -1,8 +1,5 @@ package de.uniluebeck.mi.projmi6.controller; -/** - * Created by Johannes on 21/11/2015. - */ import de.uniluebeck.mi.projmi6.model.HL7Message; import javafx.beans.property.SimpleListProperty; @@ -12,7 +9,13 @@ import javafx.scene.control.Button; import javafx.scene.control.ListView; import javafx.stage.Modality; import javafx.stage.Stage; - +/** + * The Controller that manages the list of unseen HL7 messages. + * At the moment, the list is opened in its own window. + * + * Created by Johannes on 21/11/2015. + * @author Johannes + */ public class MessageListController { private final SimpleListProperty messages; @@ -24,26 +27,40 @@ public class MessageListController { @FXML private Button btnRemove; + /** + * Contstructor. + * @param messages The list of messages that will be shown in this window. Elements might become deleted. + * @param mainController The main controller. Necessary to switch the patient and case. + */ public MessageListController(SimpleListProperty messages, MainController mainController) { this.messages = messages; this.mainController = mainController; } + /** + * FXMLLoaders initialize()-method + */ @FXML private void initialize() { lvMessages.setItems(messages); + + //Disable buttons until a message in the list is selected btnShow.disableProperty().bind(lvMessages.getSelectionModel().selectedItemProperty().isNull()); btnRemove.disableProperty().bind(lvMessages.getSelectionModel().selectedItemProperty().isNull()); messages.sizeProperty().addListener((observable, oldValue, newValue) -> { + //If no messages are left in the window, close the window. if (messages.getSize() <= 0) { ((Stage) lvMessages.getScene().getWindow()).close(); } }); } + /** + * EventHandler for {@link #btnRemove} + */ @FXML - void clickedRemove() { + private void clickedRemove() { HL7Message message = lvMessages.getSelectionModel().getSelectedItem(); if (message == null) { return; @@ -51,8 +68,13 @@ public class MessageListController { messages.remove(message); } + /** + * EventHandler for {@link #btnShow}. + * Opens patient and case regarding the HL7 message, or shows a error text for the message. + * + */ @FXML - void clickedShow() { + private void clickedShow() { HL7Message message = lvMessages.getSelectionModel().getSelectedItem(); if (message == null) { return; @@ -60,6 +82,7 @@ public class MessageListController { messages.remove(message); if (message.isFailed()) { + //Show error messge. Alert alert = new Alert(Alert.AlertType.ERROR); alert.setTitle("Nachricht konnte nicht verarbeitet werden"); alert.setHeaderText("Die Nachricht konnte nicht verarbeitet werden"); @@ -69,6 +92,7 @@ public class MessageListController { alert.showAndWait(); } else { + //Select patient in the main window. mainController.selectPatientAndFallId(message.getPatient(), message.getFallId()); ((Stage) lvMessages.getScene().getWindow()).close(); } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientEditorController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientEditorController.java index a20a5e8..56c8b0b 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientEditorController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientEditorController.java @@ -207,7 +207,7 @@ public class PatientEditorController { } /** - * + * EventHandler for {@link #btnPatSave} */ @FXML private void clickedSave() { @@ -236,6 +236,10 @@ public class PatientEditorController { } } + + /** + * EventHandler for {@link #btnPatAbort} + */ @FXML private void clickedAbort() { ((Stage) patVorname.getScene().getWindow()).close(); //Close Window diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java index 163efc2..135d59c 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/PatientTablesController.java @@ -34,71 +34,56 @@ import java.util.List; */ public class PatientTablesController { + + private final MainController mainController; + /** + * The placeholder labels in case the TableViews are empty + */ @FXML - Button btnStatRefresh; - private MainController mainController; - @FXML - private Label lblTablePatientEmpty; - @FXML - private Label lblTableStationEmpty; - @FXML - private Button btnPatCreate; + private Label lblTablePatientEmpty, lblTableStationEmpty; @FXML - private Button btnPatEdit; + private Button btnPatCreate, btnPatEdit, btnPatRefresh; @FXML private TableView tblPatientOverview; @FXML - private TableColumn colPatPatId; - @FXML - private TableColumn colPatGeburtsname; - @FXML - private TableColumn colPatNachname; - @FXML - private TableColumn colPatVorname; + private TableColumn colPatPatId, colPatGeburtsname, colPatNachname, colPatVorname, colPatStrasse, + colPatPlz, colPatOrt, colPatCave; @FXML private TableColumn colPatGebDatum; - @FXML - private TableColumn colPatStrasse; - @FXML - private TableColumn colPatPlz; - @FXML - private TableColumn colPatOrt; - @FXML - private TableColumn colPatCave; + @FXML private ToggleButton btnEntlassenePatientenZeigen; + + @FXML + private Button btnStatRefresh; @FXML private ComboBox cmbStationenFilter; @FXML private TableView tblStationOverview; @FXML - private TableColumn colStatPatId; + private TableColumn colStatPatId, colStatAlter; @FXML private TableColumn colStatFullName; @FXML - private TableColumn colStatGebDatum; - @FXML - private TableColumn colStatAlter; - @FXML - private TableColumn colStatAufnahmedatum; - @FXML - private TableColumn colStatEntlassungsdatum; - @FXML - private Tab stationOverviewTab; - @FXML - private Tab patientOverviewTab; + private TableColumn colStatGebDatum, colStatAufnahmedatum, colStatEntlassungsdatum; + @FXML private TabPane patientOverviewTabPane; + @FXML + private Tab stationOverviewTab, patientOverviewTab; + private ObservableList stationsUebersicht = FXCollections.observableArrayList(); private FilteredList stationsUebersichtsItemFilteredList = new FilteredList(stationsUebersicht, item -> item.getStationEntlassung() == null || item.getStationEntlassung().isAfter(LocalDate.now())); private Task loadStationsHistorieTask = null; private Task loadPatientTask = null; - @FXML - private Button btnPatRefresh; private ObjectBinding patientObjectBinding = null; + /** + * Constructor. + * @param mainController The controller that creates this instance + */ public PatientTablesController(MainController mainController) { this.mainController = mainController; } @@ -107,8 +92,11 @@ public class PatientTablesController { return patientOverviewTabPane; } + /** + * FXMLLoaders initialize()-method. + */ @FXML - public void initialize() { + private void initialize() { btnPatEdit.disableProperty().bind(tblPatientOverview.getSelectionModel().selectedItemProperty().isNull()); tblPatientOverview.setRowFactory(tableView -> { TableRow tableRow = new TableRow<>(); @@ -149,6 +137,9 @@ public class PatientTablesController { updatePatientsFromDb(); } + /** + * Set up cell value factories for the patients table. + */ private void initColumnsPatient() { colPatPatId.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patIDProperty().asString()); colPatGeburtsname.setCellValueFactory(new PropertyValueFactory<>("geburtsname")); @@ -164,6 +155,9 @@ public class PatientTablesController { colPatCave.setCellValueFactory(new PropertyValueFactory<>("cave")); } + /** + * Set up cell value factories for the hospital ward overview. + */ private void initColumnsStation() { colStatPatId.setCellValueFactory(new PropertyValueFactory("patId")); colStatFullName.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().patNameProperty()); @@ -172,10 +166,12 @@ public class PatientTablesController { colStatAufnahmedatum.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().stationAufnahmeProperty()); colStatEntlassungsdatum.setCellValueFactory(cellDataFeatures -> cellDataFeatures.getValue().stationEntlassungProperty()); - + //Reload data if the user selects another ward. cmbStationenFilter.valueProperty().addListener((observableValue, oldValue, newValue) -> { updateStationsHistorieFromDb(); }); + + //Init filter tblStationOverview.itemsProperty().bind(Bindings.createObjectBinding(() -> { if (btnEntlassenePatientenZeigen.isSelected()) { return stationsUebersicht; @@ -185,16 +181,27 @@ public class PatientTablesController { }, btnEntlassenePatientenZeigen.selectedProperty())); } + + /** + * EventHandler for {@link #btnPatCreate} + */ @FXML private void clickedCreatePatient() { showEditWindow(null); } + /** + * EventHandler for {@link #btnPatEdit} + */ @FXML private void clickedEditPatient() { showEditWindow(tblPatientOverview.getSelectionModel().getSelectedItem()); } + /** + * Opens a window for editing the given patient. + * @param patient The patient that should be opened for editing. + */ private void showEditWindow(Patient patient) { FXMLLoader fxmlLoader = new FXMLLoader(); fxmlLoader.setLocation(getClass().getClassLoader().getResource("patient_edit.fxml")); @@ -219,14 +226,20 @@ public class PatientTablesController { stage.initModality(Modality.WINDOW_MODAL); stage.initOwner(btnPatEdit.getScene().getWindow()); patientEditorController.setPatient(patient); - stage.show(); + stage.showAndWait(); } + /** + * Highlight the given patient in the list, if patient was changed outside the controller. + */ public void selectPatient(Patient patient) { patientOverviewTabPane.getSelectionModel().select(0); // Select first tab tblPatientOverview.getSelectionModel().select(patient); } + /** + * Start the db request for loading every patient in the MySQL database. + */ public void updatePatientsFromDb() { if (this.loadPatientTask != null && this.loadPatientTask.isRunning()) { System.out.println("Patienten werden bereits geladen."); diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java index ba603ab..54fbedf 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/StationsHistorieController.java @@ -405,7 +405,7 @@ public class StationsHistorieController { /** * Clears TextFields in the view */ - private void clearFields() { + public void clearFields() { statHistCreateTime.setText(""); statHistCreator.setText(""); statHistEditTime.setText(""); diff --git a/src/main/java/de/uniluebeck/mi/projmi6/controller/UntersuchungenController.java b/src/main/java/de/uniluebeck/mi/projmi6/controller/UntersuchungenController.java index f26f9e8..fb40347 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/UntersuchungenController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/UntersuchungenController.java @@ -279,14 +279,14 @@ public class UntersuchungenController { /** * Clears the TextFields. */ - private void clearFields() { + public void clearFields() { untsCreateTime.setText(""); untsCreator.setText(""); untsChangeTime.setText(""); untsChanger.setText(""); untsOpsCode.setValue(null); - untsArzt.setValue(mainController.getCurrentMitarbeiter()); + untsArzt.setValue(null); dtTmUntersuchungszeitpunkt.setDateTime(null); } diff --git a/src/main/java/de/uniluebeck/mi/projmi6/view/DateTimePicker.java b/src/main/java/de/uniluebeck/mi/projmi6/view/DateTimePicker.java index c1fc152..3f46822 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/view/DateTimePicker.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/view/DateTimePicker.java @@ -85,8 +85,8 @@ public class DateTimePicker extends HBox { HBox timePicker = new HBox(hourText, colon, minuteText); timePicker.maxHeightProperty().bind(datePicker.heightProperty()); timePicker.getStyleClass().add("time-picker"); - timePicker.setMinWidth(55); - timePicker.setMaxWidth(70); + timePicker.setMinWidth(65); + timePicker.setMaxWidth(80); timePicker.getStyleClass().add("button"); //Set Now-Button action @@ -95,6 +95,9 @@ public class DateTimePicker extends HBox { btnNow.setMinWidth(50); btnNow.getStyleClass().add("now-button"); + btnNow.managedProperty().bind(this.disabledProperty().not()); + + //Add the subcomponents to the view. this.getChildren().addAll(datePicker, timePicker, btnNow); diff --git a/src/main/resources/diagnose.fxml b/src/main/resources/diagnose.fxml index a2f9626..ba35127 100644 --- a/src/main/resources/diagnose.fxml +++ b/src/main/resources/diagnose.fxml @@ -37,7 +37,7 @@