From cb5bc0fee1d73603faed8678096e47885c1ab3d7 Mon Sep 17 00:00:00 2001 From: Johannes Oehm Date: Sun, 22 Nov 2015 15:41:07 +0100 Subject: [PATCH] Javadoc --- .../mi/projmi6/controller/DiagnoseController.java | 87 ++++++++++++++++------ 1 file changed, 63 insertions(+), 24 deletions(-) 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 9d8d855..dc089d1 100644 --- a/src/main/java/de/uniluebeck/mi/projmi6/controller/DiagnoseController.java +++ b/src/main/java/de/uniluebeck/mi/projmi6/controller/DiagnoseController.java @@ -1,8 +1,5 @@ package de.uniluebeck.mi.projmi6.controller; -/** - * Created by 631806 on 12.11.15. - */ import de.uniluebeck.mi.projmi6.db.DBHandler; import de.uniluebeck.mi.projmi6.model.DiagArt; @@ -19,13 +16,24 @@ import javafx.fxml.FXML; import javafx.scene.control.*; import javafx.scene.layout.GridPane; +/** + * Controller that mantains the diagnosis assigned to a case in the UI. + * + * @author Johannes + * Created by 631806 on 12.11.15. + */ public class DiagnoseController { - SimpleObjectProperty state = new SimpleObjectProperty<>(State.VIEW); - @FXML - Button btnDiagAbort, btnDiagEdit; - private MainController mainController; private SimpleObjectProperty> diagnosen = new SimpleObjectProperty<>(); + + private final SimpleObjectProperty state = new SimpleObjectProperty<>(State.VIEW); + + @FXML + private Button btnDiagAbort, btnDiagEdit, btnDiagSave,btnDiagCreate, btnDiagCancel; + + @FXML + private final MainController mainController; + @FXML private ListView diagnoseList; @FXML @@ -33,52 +41,68 @@ public class DiagnoseController { @FXML private ComboBox diagDiagnoseArzt; @FXML - private Label diagCreator; - @FXML - private Button btnDiagCancel; + private Label diagCreator, diagCreateTime, diagChanger, diagChangeTime; @FXML private TextArea diagFreitext; @FXML - private Button btnDiagSave; - @FXML - private Label diagCreateTime; - @FXML private ComboBox diagDiagnoseArt; @FXML - private Label diagChanger; - @FXML private ComboBox diagDiagnose; - @FXML - private Label diagChangeTime; - @FXML - private Button btnDiagCreate; + /** + * Contructor. + * @param mainController The main controller that creates this instance. + */ public DiagnoseController(MainController mainController) { this.mainController = mainController; } + /** + * Getter for the {@link #diagnosenProperty()}. + * @return The list of diagnosis shown in the GUI. Might be null. + */ public ObservableList getDiagnosen() { return diagnosen.get(); } + /** + * Setter for the {@link #diagnosenProperty()}. + * @param diagnosen A observable list of diagnosis to be set. + */ public void setDiagnosen(ObservableList diagnosen) { this.diagnosen.set(diagnosen); } + /** + * The diagnosis in this controller. + * @return A simple object property. + */ public SimpleObjectProperty> diagnosenProperty() { return diagnosen; } + /** + * Getter for the state of this controller + * @return State.VIEW, State.EDIT or State.CREATE + */ public State getState() { return state.get(); } + /** + * A property for the controllers state. + * @return + */ public ReadOnlyObjectProperty stateProperty() { return state; } + /** + * FXMLLoaders initialize()-method. + * See Oracle FXML Introduction + */ @FXML - public void initialize() { + private void initialize() { diagDiagnose.itemsProperty().bind(mainController.getStammdaten().icd10CodesProperty()); @@ -105,6 +129,9 @@ public class DiagnoseController { } + /** + * Bind button visibility to application state. + */ private void initButtons() { btnDiagCreate.disableProperty().bind(mainController.fallProperty().isNull()); @@ -122,11 +149,17 @@ public class DiagnoseController { } + /** + * EventHandler for {@link #btnDiagEdit}. + */ @FXML private void clickedEdit() { state.set(State.EDIT); } + /** + * EventHandler for {@link #btnDiagAbort}. + */ @FXML private void clickedAbort() { state.set(State.VIEW); @@ -138,18 +171,24 @@ public class DiagnoseController { } } + /** + * EventHandler for the {@link #btnDiagCreate}. + */ @FXML - void clickedDiagCreate(ActionEvent event) { + void clickedDiagCreate() { this.state.set(State.CREATE); } + /** + * EventHandler for the {@link #btnDiagCancel}. + */ @FXML - void clickedDiagCancel(ActionEvent event) { + void clickedDiagCancel() { } @FXML - void clickedDiagSave(ActionEvent event) { + void clickedDiagSave() { if (state.get() == State.CREATE) { //Create new diagnosis Diagnose diagnose = new Diagnose();