Browse Source

Javadoc

master
Johannes Oehm 10 years ago
parent
commit
cb5bc0fee1
1 changed files with 63 additions and 24 deletions
  1. +63
    -24
      src/main/java/de/uniluebeck/mi/projmi6/controller/DiagnoseController.java

+ 63
- 24
src/main/java/de/uniluebeck/mi/projmi6/controller/DiagnoseController.java View File

@@ -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> state = new SimpleObjectProperty<>(State.VIEW);
@FXML
Button btnDiagAbort, btnDiagEdit;
private MainController mainController;
private SimpleObjectProperty<ObservableList<Diagnose>> diagnosen = new SimpleObjectProperty<>();

private final SimpleObjectProperty<State> state = new SimpleObjectProperty<>(State.VIEW);

@FXML
private Button btnDiagAbort, btnDiagEdit, btnDiagSave,btnDiagCreate, btnDiagCancel;

@FXML
private final MainController mainController;

@FXML
private ListView<Diagnose> diagnoseList;
@FXML
@@ -33,52 +41,68 @@ public class DiagnoseController {
@FXML
private ComboBox<Mitarbeiter> 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<DiagArt> diagDiagnoseArt;
@FXML
private Label diagChanger;
@FXML
private ComboBox<Icd10Code> 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<Diagnose> getDiagnosen() {
return diagnosen.get();
}

/**
* Setter for the {@link #diagnosenProperty()}.
* @param diagnosen A observable list of diagnosis to be set.
*/
public void setDiagnosen(ObservableList<Diagnose> diagnosen) {
this.diagnosen.set(diagnosen);
}

/**
* The diagnosis in this controller.
* @return A simple object property.
*/
public SimpleObjectProperty<ObservableList<Diagnose>> 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<State> stateProperty() {
return state;
}

/**
* FXMLLoaders initialize()-method.
* See <a href="https://docs.oracle.com/javase/8/javafx/api/javafx/fxml/doc-files/introduction_to_fxml.html#controllers">Oracle FXML Introduction</a>
*/
@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();


Loading…
Cancel
Save