Compare commits

..

3 commits

7 changed files with 531 additions and 375 deletions

View file

@ -2,8 +2,9 @@ package de.hitec.nhplus.controller;
import de.hitec.nhplus.datastorage.DaoFactory; import de.hitec.nhplus.datastorage.DaoFactory;
import de.hitec.nhplus.datastorage.PatientDao; import de.hitec.nhplus.datastorage.PatientDao;
import de.hitec.nhplus.model.Patient;
import de.hitec.nhplus.utils.DateConverter;
import javafx.beans.value.ChangeListener; import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.fxml.FXML; import javafx.fxml.FXML;
@ -13,82 +14,58 @@ import javafx.scene.control.TableView;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.control.cell.TextFieldTableCell; import javafx.scene.control.cell.TextFieldTableCell;
import de.hitec.nhplus.model.Patient;
import de.hitec.nhplus.utils.DateConverter;
import java.sql.SQLException; import java.sql.SQLException;
import java.time.LocalDate; import java.time.LocalDate;
import static de.hitec.nhplus.utils.Validator.*;
/** public class AllPatientController
* The <code>AllPatientController</code> contains the entire logic of the patient view. It determines which data is displayed and how to react to events. {
*/
public class AllPatientController {
@FXML @FXML
private TableView<Patient> tableView; private TableView<Patient> tableView;
@FXML @FXML
private TableColumn<Patient, Integer> columnId; private TableColumn<Patient, Integer> columnId;
@FXML @FXML
private TableColumn<Patient, String> columnFirstName; private TableColumn<Patient, String> columnFirstName;
@FXML @FXML
private TableColumn<Patient, String> columnSurname; private TableColumn<Patient, String> columnSurname;
@FXML @FXML
private TableColumn<Patient, String> columnDateOfBirth; private TableColumn<Patient, String> columnDateOfBirth;
@FXML @FXML
private TableColumn<Patient, String> columnCareLevel; private TableColumn<Patient, String> columnCareLevel;
@FXML @FXML
private TableColumn<Patient, String> columnRoomNumber; private TableColumn<Patient, String> columnRoomNumber;
@FXML @FXML
private TableColumn<Patient, String> columnAssets; private TableColumn<Patient, String> columnAssets;
@FXML @FXML
private Button buttonDelete; private Button buttonDelete;
@FXML @FXML
private Button buttonAdd; private Button buttonAdd;
@FXML @FXML
private TextField textFieldSurname; private TextField textFieldSurname;
@FXML @FXML
private TextField textFieldFirstName; private TextField textFieldFirstName;
@FXML @FXML
private TextField textFieldDateOfBirth; private TextField textFieldDateOfBirth;
@FXML @FXML
private TextField textFieldCareLevel; private TextField textFieldCareLevel;
@FXML @FXML
private TextField textFieldRoomNumber; private TextField textFieldRoomNumber;
@FXML @FXML
private TextField textFieldAssets; private TextField textFieldAssets;
private final ObservableList<Patient> patients = FXCollections.observableArrayList(); private final ObservableList<Patient> patients = FXCollections.observableArrayList();
private PatientDao dao; private PatientDao dao;
/** public void initialize()
* When <code>initialize()</code> gets called, all fields are already initialized. For example from the FXMLLoader {
* after loading an FXML-File. At this point of the lifecycle of the Controller, the fields can be accessed and
* configured.
*/
public void initialize() {
this.readAllAndShowInTableView(); this.readAllAndShowInTableView();
this.columnId.setCellValueFactory(new PropertyValueFactory<>("pid")); this.columnId.setCellValueFactory(new PropertyValueFactory<>("pid"));
// CellValueFactory to show property values in TableView
this.columnFirstName.setCellValueFactory(new PropertyValueFactory<>("firstName")); this.columnFirstName.setCellValueFactory(new PropertyValueFactory<>("firstName"));
// CellFactory to write property values from with in the TableView
this.columnFirstName.setCellFactory(TextFieldTableCell.forTableColumn()); this.columnFirstName.setCellFactory(TextFieldTableCell.forTableColumn());
this.columnSurname.setCellValueFactory(new PropertyValueFactory<>("surname")); this.columnSurname.setCellValueFactory(new PropertyValueFactory<>("surname"));
@ -106,146 +83,166 @@ public class AllPatientController {
this.columnAssets.setCellValueFactory(new PropertyValueFactory<>("assets")); this.columnAssets.setCellValueFactory(new PropertyValueFactory<>("assets"));
this.columnAssets.setCellFactory(TextFieldTableCell.forTableColumn()); this.columnAssets.setCellFactory(TextFieldTableCell.forTableColumn());
//Anzeigen der Daten
this.tableView.setItems(this.patients); this.tableView.setItems(this.patients);
this.buttonDelete.setDisable(true); this.buttonDelete.setDisable(true);
this.tableView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Patient>() { this.tableView
@Override .getSelectionModel()
public void changed(ObservableValue<? extends Patient> observableValue, Patient oldPatient, Patient newPatient) {; .selectedItemProperty()
AllPatientController.this.buttonDelete.setDisable(newPatient == null); .addListener((observableValue, oldPatient, newPatient) ->
} {
}); AllPatientController.this.buttonDelete.setDisable(newPatient == null);
}
);
this.buttonAdd.setDisable(true); this.buttonAdd.setDisable(true);
ChangeListener<String> inputNewPatientListener = (observableValue, oldText, newText) -> ChangeListener<String> inputNewPatientValidationListener = (observableValue, oldText, newText) ->
AllPatientController.this.buttonAdd.setDisable(!AllPatientController.this.areInputDataValid()); {
this.textFieldSurname.textProperty().addListener(inputNewPatientListener); boolean isValid = isValidDate(this.textFieldDateOfBirth.getText())
this.textFieldFirstName.textProperty().addListener(inputNewPatientListener); && isValidFirstName(this.textFieldFirstName.getText())
this.textFieldDateOfBirth.textProperty().addListener(inputNewPatientListener); && isValidSurName(this.textFieldSurname.getText())
this.textFieldCareLevel.textProperty().addListener(inputNewPatientListener); && isValidDate(this.textFieldDateOfBirth.getText())
this.textFieldRoomNumber.textProperty().addListener(inputNewPatientListener); && isValidCareLevel(this.textFieldCareLevel.getText())
this.textFieldAssets.textProperty().addListener(inputNewPatientListener); && isValidRoomNumber(textFieldRoomNumber.getText())
&& !this.textFieldAssets.getText().isBlank();
AllPatientController.this.buttonAdd.setDisable(!isValid);
};
this.textFieldSurname.textProperty().addListener(inputNewPatientValidationListener);
this.textFieldFirstName.textProperty().addListener(inputNewPatientValidationListener);
this.textFieldDateOfBirth.textProperty().addListener(inputNewPatientValidationListener);
this.textFieldCareLevel.textProperty().addListener(inputNewPatientValidationListener);
this.textFieldRoomNumber.textProperty().addListener(inputNewPatientValidationListener);
this.textFieldAssets.textProperty().addListener(inputNewPatientValidationListener);
} }
/**
* When a cell of the column with first names was changed, this method will be called, to persist the change.
*
* @param event Event including the changed object and the change.
*/
@FXML @FXML
public void handleOnEditFirstname(TableColumn.CellEditEvent<Patient, String> event) { public void handleOnEditFirstname(TableColumn.CellEditEvent<Patient, String> event)
event.getRowValue().setFirstName(event.getNewValue()); {
String newFirstName = event.getNewValue();
if (!isValidFirstName(newFirstName))
{
showValidationError("First Name");
event.getTableView().refresh();
return;
}
event.getRowValue().setFirstName(newFirstName);
this.doUpdate(event); this.doUpdate(event);
} }
/**
* When a cell of the column with surnames was changed, this method will be called, to persist the change.
*
* @param event Event including the changed object and the change.
*/
@FXML @FXML
public void handleOnEditSurname(TableColumn.CellEditEvent<Patient, String> event) { public void handleOnEditSurname(TableColumn.CellEditEvent<Patient, String> event)
event.getRowValue().setSurname(event.getNewValue()); {
String newSurName = event.getNewValue();
if (!isValidSurName(newSurName))
{
showValidationError("Sur Name");
event.getTableView().refresh();
return;
}
event.getRowValue().setSurname(newSurName);
this.doUpdate(event); this.doUpdate(event);
} }
/**
* When a cell of the column with dates of birth was changed, this method will be called, to persist the change.
*
* @param event Event including the changed object and the change.
*/
@FXML @FXML
public void handleOnEditDateOfBirth(TableColumn.CellEditEvent<Patient, String> event) { public void handleOnEditDateOfBirth(TableColumn.CellEditEvent<Patient, String> event)
event.getRowValue().setDateOfBirth(event.getNewValue()); {
String newDateString = event.getNewValue();
if (!isValidDate(newDateString))
{
showValidationError("Date");
event.getTableView().refresh();
return;
}
event.getRowValue().setDateOfBirth(newDateString);
this.doUpdate(event); this.doUpdate(event);
} }
/**
* When a cell of the column with care levels was changed, this method will be called, to persist the change.
*
* @param event Event including the changed object and the change.
*/
@FXML @FXML
public void handleOnEditCareLevel(TableColumn.CellEditEvent<Patient, String> event) { public void handleOnEditCareLevel(TableColumn.CellEditEvent<Patient, String> event)
event.getRowValue().setCareLevel(event.getNewValue()); {
String newCareLevel = event.getNewValue();
if (!isValidCareLevel(newCareLevel))
{
showValidationError("Care Level");
event.getTableView().refresh();
return;
}
event.getRowValue().setCareLevel(newCareLevel);
this.doUpdate(event); this.doUpdate(event);
} }
/**
* When a cell of the column with room numbers was changed, this method will be called, to persist the change.
*
* @param event Event including the changed object and the change.
*/
@FXML @FXML
public void handleOnEditRoomNumber(TableColumn.CellEditEvent<Patient, String> event){ public void handleOnEditRoomNumber(TableColumn.CellEditEvent<Patient, String> event)
event.getRowValue().setRoomNumber(event.getNewValue()); {
String newRoomNumber = event.getNewValue();
if (!isValidRoomNumber(newRoomNumber))
{
showValidationError("Room Number");
event.getTableView().refresh();
return;
}
event.getRowValue().setRoomNumber(newRoomNumber);
this.doUpdate(event); this.doUpdate(event);
} }
/**
* When a cell of the column with assets was changed, this method will be called, to persist the change.
*
* @param event Event including the changed object and the change.
*/
@FXML @FXML
public void handleOnEditAssets(TableColumn.CellEditEvent<Patient, String> event){ public void handleOnEditAssets(TableColumn.CellEditEvent<Patient, String> event)
event.getRowValue().setAssets(event.getNewValue()); {
String newAssets = event.getNewValue();
if(newAssets.isBlank()){
event.getTableView().refresh();
return;
}
event.getRowValue().setAssets(newAssets);
this.doUpdate(event); this.doUpdate(event);
} }
/** private void doUpdate(TableColumn.CellEditEvent<Patient, String> event)
* Updates a patient by calling the method <code>update()</code> of {@link PatientDao}. {
* try
* @param event Event including the changed object and the change. {
*/
private void doUpdate(TableColumn.CellEditEvent<Patient, String> event) {
try {
this.dao.update(event.getRowValue()); this.dao.update(event.getRowValue());
} catch (SQLException exception) { } catch (SQLException exception)
{
exception.printStackTrace(); exception.printStackTrace();
} }
} }
/** private void readAllAndShowInTableView()
* Reloads all patients to the table by clearing the list of all patients and filling it again by all persisted {
* patients, delivered by {@link PatientDao}.
*/
private void readAllAndShowInTableView() {
this.patients.clear(); this.patients.clear();
this.dao = DaoFactory.getDaoFactory().createPatientDAO(); this.dao = DaoFactory.getDaoFactory().createPatientDAO();
try { try
{
this.patients.addAll(this.dao.readAll()); this.patients.addAll(this.dao.readAll());
} catch (SQLException exception) { } catch (SQLException exception)
{
exception.printStackTrace(); exception.printStackTrace();
} }
} }
/**
* This method handles events fired by the button to delete patients. It calls {@link PatientDao} to delete the
* patient from the database and removes the object from the list, which is the data source of the
* <code>TableView</code>.
*/
@FXML @FXML
public void handleDelete() { public void handleDelete()
{
Patient selectedItem = this.tableView.getSelectionModel().getSelectedItem(); Patient selectedItem = this.tableView.getSelectionModel().getSelectedItem();
if (selectedItem != null) { if (selectedItem != null)
try { {
try
{
DaoFactory.getDaoFactory().createPatientDAO().deleteById(selectedItem.getPid()); DaoFactory.getDaoFactory().createPatientDAO().deleteById(selectedItem.getPid());
this.tableView.getItems().remove(selectedItem); this.tableView.getItems().remove(selectedItem);
} catch (SQLException exception) { } catch (SQLException exception)
{
exception.printStackTrace(); exception.printStackTrace();
} }
} }
} }
/**
* This method handles the events fired by the button to add a patient. It collects the data from the
* <code>TextField</code>s, creates an object of class <code>Patient</code> of it and passes the object to
* {@link PatientDao} to persist the data.
*/
@FXML @FXML
public void handleAdd() { public void handleAdd()
{
String surname = this.textFieldSurname.getText(); String surname = this.textFieldSurname.getText();
String firstName = this.textFieldFirstName.getText(); String firstName = this.textFieldFirstName.getText();
String birthday = this.textFieldDateOfBirth.getText(); String birthday = this.textFieldDateOfBirth.getText();
@ -253,19 +250,19 @@ public class AllPatientController {
String careLevel = this.textFieldCareLevel.getText(); String careLevel = this.textFieldCareLevel.getText();
String roomNumber = this.textFieldRoomNumber.getText(); String roomNumber = this.textFieldRoomNumber.getText();
String assets = this.textFieldAssets.getText(); String assets = this.textFieldAssets.getText();
try { try
{
this.dao.create(new Patient(firstName, surname, date, careLevel, roomNumber, assets)); this.dao.create(new Patient(firstName, surname, date, careLevel, roomNumber, assets));
} catch (SQLException exception) { } catch (SQLException exception)
{
exception.printStackTrace(); exception.printStackTrace();
} }
readAllAndShowInTableView(); readAllAndShowInTableView();
clearTextfields(); clearTextfields();
} }
/** private void clearTextfields()
* Clears all contents from all <code>TextField</code>s. {
*/
private void clearTextfields() {
this.textFieldFirstName.clear(); this.textFieldFirstName.clear();
this.textFieldSurname.clear(); this.textFieldSurname.clear();
this.textFieldDateOfBirth.clear(); this.textFieldDateOfBirth.clear();
@ -273,18 +270,4 @@ public class AllPatientController {
this.textFieldRoomNumber.clear(); this.textFieldRoomNumber.clear();
this.textFieldAssets.clear(); this.textFieldAssets.clear();
} }
private boolean areInputDataValid() {
if (!this.textFieldDateOfBirth.getText().isBlank()) {
try {
DateConverter.convertStringToLocalDate(this.textFieldDateOfBirth.getText());
} catch (Exception exception) {
return false;
}
}
return !this.textFieldFirstName.getText().isBlank() && !this.textFieldSurname.getText().isBlank() &&
!this.textFieldDateOfBirth.getText().isBlank() && !this.textFieldCareLevel.getText().isBlank() &&
!this.textFieldRoomNumber.getText().isBlank() && !this.textFieldAssets.getText().isBlank();
}
} }

View file

@ -4,6 +4,8 @@ import de.hitec.nhplus.Main;
import de.hitec.nhplus.datastorage.DaoFactory; import de.hitec.nhplus.datastorage.DaoFactory;
import de.hitec.nhplus.datastorage.PatientDao; import de.hitec.nhplus.datastorage.PatientDao;
import de.hitec.nhplus.datastorage.TreatmentDao; import de.hitec.nhplus.datastorage.TreatmentDao;
import de.hitec.nhplus.model.Patient;
import de.hitec.nhplus.model.Treatment;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.fxml.FXML; import javafx.fxml.FXML;
@ -13,14 +15,13 @@ import javafx.scene.control.*;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage; import javafx.stage.Stage;
import de.hitec.nhplus.model.Patient;
import de.hitec.nhplus.model.Treatment;
import java.io.IOException; import java.io.IOException;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
public class AllTreatmentController { public class AllTreatmentController
{
@FXML @FXML
private TableView<Treatment> tableView; private TableView<Treatment> tableView;
@ -54,7 +55,8 @@ public class AllTreatmentController {
private final ObservableList<String> patientSelection = FXCollections.observableArrayList(); private final ObservableList<String> patientSelection = FXCollections.observableArrayList();
private ArrayList<Patient> patientList; private ArrayList<Patient> patientList;
public void initialize() { public void initialize()
{
readAllAndShowInTableView(); readAllAndShowInTableView();
comboBoxPatientSelection.setItems(patientSelection); comboBoxPatientSelection.setItems(patientSelection);
comboBoxPatientSelection.getSelectionModel().select(0); comboBoxPatientSelection.getSelectionModel().select(0);
@ -67,67 +69,88 @@ public class AllTreatmentController {
this.columnDescription.setCellValueFactory(new PropertyValueFactory<>("description")); this.columnDescription.setCellValueFactory(new PropertyValueFactory<>("description"));
this.tableView.setItems(this.treatments); this.tableView.setItems(this.treatments);
// Disabling the button to delete treatments as long, as no treatment was selected.
this.buttonDelete.setDisable(true); this.buttonDelete.setDisable(true);
this.tableView.getSelectionModel().selectedItemProperty().addListener( this.tableView
(observableValue, oldTreatment, newTreatment) -> .getSelectionModel()
AllTreatmentController.this.buttonDelete.setDisable(newTreatment == null)); .selectedItemProperty()
.addListener((observableValue, oldTreatment, newTreatment) ->
{
AllTreatmentController.this.buttonDelete.setDisable(newTreatment == null);
}
);
this.createComboBoxData(); this.createComboBoxData();
} }
public void readAllAndShowInTableView() { public void readAllAndShowInTableView()
{
this.treatments.clear(); this.treatments.clear();
comboBoxPatientSelection.getSelectionModel().select(0); comboBoxPatientSelection.getSelectionModel().select(0);
this.dao = DaoFactory.getDaoFactory().createTreatmentDao(); this.dao = DaoFactory.getDaoFactory().createTreatmentDao();
try { try
{
this.treatments.addAll(dao.readAll()); this.treatments.addAll(dao.readAll());
} catch (SQLException exception) { } catch (SQLException exception)
{
exception.printStackTrace(); exception.printStackTrace();
} }
} }
private void createComboBoxData() { private void createComboBoxData()
{
PatientDao dao = DaoFactory.getDaoFactory().createPatientDAO(); PatientDao dao = DaoFactory.getDaoFactory().createPatientDAO();
try { try
{
patientList = (ArrayList<Patient>) dao.readAll(); patientList = (ArrayList<Patient>) dao.readAll();
this.patientSelection.add("alle"); this.patientSelection.add("alle");
for (Patient patient: patientList) { for (Patient patient : patientList)
{
this.patientSelection.add(patient.getSurname()); this.patientSelection.add(patient.getSurname());
} }
} catch (SQLException exception) { } catch (SQLException exception)
{
exception.printStackTrace(); exception.printStackTrace();
} }
} }
@FXML @FXML
public void handleComboBox() { public void handleComboBox()
{
String selectedPatient = this.comboBoxPatientSelection.getSelectionModel().getSelectedItem(); String selectedPatient = this.comboBoxPatientSelection.getSelectionModel().getSelectedItem();
this.treatments.clear(); this.treatments.clear();
this.dao = DaoFactory.getDaoFactory().createTreatmentDao(); this.dao = DaoFactory.getDaoFactory().createTreatmentDao();
if (selectedPatient.equals("alle")) { if (selectedPatient.equals("alle"))
try { {
try
{
this.treatments.addAll(this.dao.readAll()); this.treatments.addAll(this.dao.readAll());
} catch (SQLException exception) { } catch (SQLException exception)
{
exception.printStackTrace(); exception.printStackTrace();
} }
} }
Patient patient = searchInList(selectedPatient); Patient patient = searchInList(selectedPatient);
if (patient !=null) { if (patient != null)
try { {
try
{
this.treatments.addAll(this.dao.readTreatmentsByPid(patient.getPid())); this.treatments.addAll(this.dao.readTreatmentsByPid(patient.getPid()));
} catch (SQLException exception) { } catch (SQLException exception)
{
exception.printStackTrace(); exception.printStackTrace();
} }
} }
} }
private Patient searchInList(String surname) { private Patient searchInList(String surname)
for (Patient patient : this.patientList) { {
if (patient.getSurname().equals(surname)) { for (Patient patient : this.patientList)
{
if (patient.getSurname().equals(surname))
{
return patient; return patient;
} }
} }
@ -135,24 +158,30 @@ public class AllTreatmentController {
} }
@FXML @FXML
public void handleDelete() { public void handleDelete()
{
int index = this.tableView.getSelectionModel().getSelectedIndex(); int index = this.tableView.getSelectionModel().getSelectedIndex();
Treatment t = this.treatments.remove(index); Treatment t = this.treatments.remove(index);
TreatmentDao dao = DaoFactory.getDaoFactory().createTreatmentDao(); TreatmentDao dao = DaoFactory.getDaoFactory().createTreatmentDao();
try { try
{
dao.deleteById(t.getTid()); dao.deleteById(t.getTid());
} catch (SQLException exception) { } catch (SQLException exception)
{
exception.printStackTrace(); exception.printStackTrace();
} }
} }
@FXML @FXML
public void handleNewTreatment() { public void handleNewTreatment()
try{ {
try
{
String selectedPatient = this.comboBoxPatientSelection.getSelectionModel().getSelectedItem(); String selectedPatient = this.comboBoxPatientSelection.getSelectionModel().getSelectedItem();
Patient patient = searchInList(selectedPatient); Patient patient = searchInList(selectedPatient);
newTreatmentWindow(patient); newTreatmentWindow(patient);
} catch (NullPointerException exception){ } catch (NullPointerException exception)
{
Alert alert = new Alert(Alert.AlertType.INFORMATION); Alert alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Information"); alert.setTitle("Information");
alert.setHeaderText("Patient für die Behandlung fehlt!"); alert.setHeaderText("Patient für die Behandlung fehlt!");
@ -162,9 +191,12 @@ public class AllTreatmentController {
} }
@FXML @FXML
public void handleMouseClick() { public void handleMouseClick()
tableView.setOnMouseClicked(event -> { {
if (event.getClickCount() == 2 && (tableView.getSelectionModel().getSelectedItem() != null)) { tableView.setOnMouseClicked(event ->
{
if (event.getClickCount() == 2 && (tableView.getSelectionModel().getSelectedItem() != null))
{
int index = this.tableView.getSelectionModel().getSelectedIndex(); int index = this.tableView.getSelectionModel().getSelectedIndex();
Treatment treatment = this.treatments.get(index); Treatment treatment = this.treatments.get(index);
treatmentWindow(treatment); treatmentWindow(treatment);
@ -172,8 +204,10 @@ public class AllTreatmentController {
}); });
} }
public void newTreatmentWindow(Patient patient) { public void newTreatmentWindow(Patient patient)
try { {
try
{
FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/NewTreatmentView.fxml")); FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/NewTreatmentView.fxml"));
AnchorPane pane = loader.load(); AnchorPane pane = loader.load();
Scene scene = new Scene(pane); Scene scene = new Scene(pane);
@ -187,13 +221,16 @@ public class AllTreatmentController {
stage.setScene(scene); stage.setScene(scene);
stage.setResizable(false); stage.setResizable(false);
stage.showAndWait(); stage.showAndWait();
} catch (IOException exception) { } catch (IOException exception)
{
exception.printStackTrace(); exception.printStackTrace();
} }
} }
public void treatmentWindow(Treatment treatment){ public void treatmentWindow(Treatment treatment)
try { {
try
{
FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/TreatmentView.fxml")); FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/TreatmentView.fxml"));
AnchorPane pane = loader.load(); AnchorPane pane = loader.load();
Scene scene = new Scene(pane); Scene scene = new Scene(pane);
@ -206,7 +243,8 @@ public class AllTreatmentController {
stage.setScene(scene); stage.setScene(scene);
stage.setResizable(false); stage.setResizable(false);
stage.showAndWait(); stage.showAndWait();
} catch (IOException exception) { } catch (IOException exception)
{
exception.printStackTrace(); exception.printStackTrace();
} }
} }

View file

@ -2,20 +2,23 @@ package de.hitec.nhplus.controller;
import de.hitec.nhplus.datastorage.DaoFactory; import de.hitec.nhplus.datastorage.DaoFactory;
import de.hitec.nhplus.datastorage.TreatmentDao; import de.hitec.nhplus.datastorage.TreatmentDao;
import de.hitec.nhplus.model.Patient;
import de.hitec.nhplus.model.Treatment;
import de.hitec.nhplus.utils.DateConverter;
import javafx.beans.value.ChangeListener; import javafx.beans.value.ChangeListener;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.*; import javafx.scene.control.*;
import javafx.stage.Stage; import javafx.stage.Stage;
import de.hitec.nhplus.model.Patient;
import de.hitec.nhplus.model.Treatment;
import de.hitec.nhplus.utils.DateConverter;
import javafx.util.StringConverter; import javafx.util.StringConverter;
import java.sql.SQLException; import java.sql.SQLException;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalTime; import java.time.LocalTime;
public class NewTreatmentController { import static de.hitec.nhplus.utils.Validator.*;
public class NewTreatmentController
{
@FXML @FXML
private Label labelFirstName; private Label labelFirstName;
@ -45,40 +48,66 @@ public class NewTreatmentController {
private Patient patient; private Patient patient;
private Stage stage; private Stage stage;
public void initialize(AllTreatmentController controller, Stage stage, Patient patient) { public void initialize(AllTreatmentController controller, Stage stage, Patient patient)
this.controller= controller; {
this.controller = controller;
this.patient = patient; this.patient = patient;
this.stage = stage; this.stage = stage;
this.buttonAdd.setDisable(true); this.buttonAdd.setDisable(true);
ChangeListener<String> inputNewPatientListener = (observableValue, oldText, newText) -> ChangeListener<String> inputNewTreatmentTextValidationListener = (observableValue, oldText, newText) ->
NewTreatmentController.this.buttonAdd.setDisable(NewTreatmentController.this.areInputDataInvalid()); {
this.textFieldBegin.textProperty().addListener(inputNewPatientListener); boolean isValid = isValidDate(this.datePicker.getValue())
this.textFieldEnd.textProperty().addListener(inputNewPatientListener); && isValidTimeRange(this.textFieldBegin.getText(), this.textFieldEnd.getText())
this.textFieldDescription.textProperty().addListener(inputNewPatientListener); && isValidDescription(this.textFieldDescription.getText());
this.textAreaRemarks.textProperty().addListener(inputNewPatientListener);
this.datePicker.valueProperty().addListener((observableValue, localDate, t1) -> NewTreatmentController.this.buttonAdd.setDisable(NewTreatmentController.this.areInputDataInvalid())); NewTreatmentController.this.buttonAdd.setDisable(!isValid);
this.datePicker.setConverter(new StringConverter<>() { };
ChangeListener<LocalDate> inputNewTreatmentDateValidationListener = (observableValue, localDate, t1) ->
{
boolean isValid = isValidDate(this.datePicker.getValue())
&& isValidTimeRange(this.textFieldBegin.getText(), this.textFieldEnd.getText())
&& isValidDescription(this.textFieldDescription.getText());
NewTreatmentController.this.buttonAdd.setDisable(!isValid);
};
this.textFieldBegin.textProperty().addListener(inputNewTreatmentTextValidationListener);
this.textFieldEnd.textProperty().addListener(inputNewTreatmentTextValidationListener);
this.textFieldDescription.textProperty().addListener(inputNewTreatmentTextValidationListener);
this.textAreaRemarks.textProperty().addListener(inputNewTreatmentTextValidationListener);
this.datePicker.valueProperty().addListener(inputNewTreatmentDateValidationListener);
this.datePicker.setConverter(new StringConverter<>()
{
@Override @Override
public String toString(LocalDate localDate) { public String toString(LocalDate localDate)
{
return (localDate == null) ? "" : DateConverter.convertLocalDateToString(localDate); return (localDate == null) ? "" : DateConverter.convertLocalDateToString(localDate);
} }
@Override @Override
public LocalDate fromString(String localDate) { public LocalDate fromString(String localDate)
{
if (!isValidDate(localDate))
{
return null;
}
return DateConverter.convertStringToLocalDate(localDate); return DateConverter.convertStringToLocalDate(localDate);
} }
}); });
this.showPatientData(); this.showPatientData();
} }
private void showPatientData(){ private void showPatientData()
{
this.labelFirstName.setText(patient.getFirstName()); this.labelFirstName.setText(patient.getFirstName());
this.labelSurname.setText(patient.getSurname()); this.labelSurname.setText(patient.getSurname());
} }
@FXML @FXML
public void handleAdd(){ public void handleAdd()
{
LocalDate date = this.datePicker.getValue(); LocalDate date = this.datePicker.getValue();
LocalTime begin = DateConverter.convertStringToLocalTime(textFieldBegin.getText()); LocalTime begin = DateConverter.convertStringToLocalTime(textFieldBegin.getText());
LocalTime end = DateConverter.convertStringToLocalTime(textFieldEnd.getText()); LocalTime end = DateConverter.convertStringToLocalTime(textFieldEnd.getText());
@ -90,33 +119,22 @@ public class NewTreatmentController {
stage.close(); stage.close();
} }
private void createTreatment(Treatment treatment) { private void createTreatment(Treatment treatment)
{
TreatmentDao dao = DaoFactory.getDaoFactory().createTreatmentDao(); TreatmentDao dao = DaoFactory.getDaoFactory().createTreatmentDao();
try { try
{
dao.create(treatment); dao.create(treatment);
} catch (SQLException exception) { } catch (SQLException exception)
{
exception.printStackTrace(); exception.printStackTrace();
} }
} }
@FXML @FXML
public void handleCancel(){ public void handleCancel()
{
stage.close(); stage.close();
} }
private boolean areInputDataInvalid() {
if (this.textFieldBegin.getText() == null || this.textFieldEnd.getText() == null) {
return true;
}
try {
LocalTime begin = DateConverter.convertStringToLocalTime(this.textFieldBegin.getText());
LocalTime end = DateConverter.convertStringToLocalTime(this.textFieldEnd.getText());
if (!end.isAfter(begin)) {
return true;
}
} catch (Exception exception) {
return true;
}
return this.textFieldDescription.getText().isBlank() || this.datePicker.getValue() == null;
}
} }

View file

@ -13,6 +13,8 @@ import de.hitec.nhplus.utils.DateConverter;
import java.sql.SQLException; import java.sql.SQLException;
import java.time.LocalDate; import java.time.LocalDate;
import static de.hitec.nhplus.utils.Validator.*;
public class TreatmentController { public class TreatmentController {
@FXML @FXML
@ -44,6 +46,7 @@ public class TreatmentController {
public void initializeController(AllTreatmentController controller, Stage stage, Treatment treatment) { public void initializeController(AllTreatmentController controller, Stage stage, Treatment treatment) {
this.stage = stage; this.stage = stage;
this.controller= controller; this.controller= controller;
PatientDao pDao = DaoFactory.getDaoFactory().createPatientDAO(); PatientDao pDao = DaoFactory.getDaoFactory().createPatientDAO();
try { try {
this.patient = pDao.read((int) treatment.getPid()); this.patient = pDao.read((int) treatment.getPid());
@ -67,11 +70,37 @@ public class TreatmentController {
@FXML @FXML
public void handleChange(){ public void handleChange(){
this.treatment.setDate(this.datePicker.getValue().toString()); LocalDate newDate = this.datePicker.getValue();
this.treatment.setBegin(textFieldBegin.getText()); if(!isValidDate(newDate)){
this.treatment.setEnd(textFieldEnd.getText()); showValidationError("Date");
this.treatment.setDescription(textFieldDescription.getText()); return;
this.treatment.setRemarks(textAreaRemarks.getText()); }
String newDescription = textFieldDescription.getText();
if(!isValidDescription(newDescription)){
showValidationError("Description");
return;
}
String newBegin = textFieldBegin.getText();
String newEnd = textFieldEnd.getText();
if(!isValidTimeRange(newBegin, newEnd)){
showValidationError("Time Range");
return;
}
String newRemarks = textAreaRemarks.getText();
if(!isValidDescription(newRemarks)){
showValidationError("Remarks");
return;
}
this.treatment.setDate(newDate.toString());
this.treatment.setDescription(newDescription);
this.treatment.setBegin(newBegin);
this.treatment.setEnd(newEnd);
this.treatment.setRemarks(newRemarks);
doUpdate(); doUpdate();
controller.readAllAndShowInTableView(); controller.readAllAndShowInTableView();
stage.close(); stage.close();

View file

@ -0,0 +1,79 @@
package de.hitec.nhplus.utils;
import javafx.scene.control.Alert;
import java.time.LocalDate;
import java.time.LocalTime;
public class Validator
{
public static void showValidationError(String type){
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Error");
alert.setHeaderText(null);
alert.setContentText("Invalid " + type + " !");
alert.showAndWait();
}
public static boolean isValidDate(String text) {
if(text.isBlank()){
return false;
}
try {
DateConverter.convertStringToLocalDate(text);
} catch (Exception exception) {
return false;
}
return true;
}
public static boolean isValidDate(LocalDate date) {
if(date == null){
return false;
}
try {
DateConverter.convertStringToLocalDate(date.toString());
} catch (Exception exception) {
return false;
}
return true;
}
public static boolean isValidTime(String text){
if(text.isBlank()){
return false;
}
try {
DateConverter.convertStringToLocalTime(text);
}catch (Exception exception){
return false;
}
return true;
}
public static boolean isValidTimeRange(String start, String end){
if(
!isValidTime(start) || !isValidTime(end)
){
return false;
}
LocalTime startTime = DateConverter.convertStringToLocalTime(start);
LocalTime endTime = DateConverter.convertStringToLocalTime(end);
return startTime.isBefore(endTime);
}
public static boolean isValidDescription(String text) {
return !text.isBlank();
}
public static boolean isValidFirstName(String text){
return !text.isBlank();
}
public static boolean isValidSurName(String text){
return !text.isBlank();
}
public static boolean isValidCareLevel(String text){
return !text.isBlank();
}
public static boolean isValidRoomNumber(String text){
return !text.isBlank();
}
}

View file

@ -3,77 +3,85 @@
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<?import javafx.scene.text.*?> <?import javafx.scene.text.*?>
<AnchorPane prefHeight="450.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/17.0.2-ea"
<AnchorPane prefHeight="450.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/17.0.2-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hitec.nhplus.controller.NewTreatmentController"> xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hitec.nhplus.controller.NewTreatmentController">
<children> <children>
<HBox alignment="TOP_CENTER" prefWidth="200.0" spacing="25.0" AnchorPane.leftAnchor="5.0" AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="5.0"> <HBox alignment="TOP_CENTER" prefWidth="200.0" spacing="25.0" AnchorPane.leftAnchor="5.0"
<children> AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="5.0">
<Label alignment="CENTER" contentDisplay="CENTER" minWidth="400.0" text="Neue Behandlung" textAlignment="CENTER"> <children>
<font> <Label alignment="CENTER" contentDisplay="CENTER" minWidth="400.0" text="Neue Behandlung"
<Font size="36.0" /> textAlignment="CENTER">
</font> <font>
</Label> <Font size="36.0"/>
</children> </font>
</HBox> </Label>
<GridPane hgap="10.0" layoutX="14.0" layoutY="14.0" AnchorPane.leftAnchor="50.0" AnchorPane.rightAnchor="50.0" AnchorPane.topAnchor="100.0"> </children>
<columnConstraints> </HBox>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <GridPane hgap="10.0" layoutX="14.0" layoutY="14.0" AnchorPane.leftAnchor="50.0" AnchorPane.rightAnchor="50.0"
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0" /> AnchorPane.topAnchor="100.0">
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0" /> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/>
</columnConstraints> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0"/>
<rowConstraints> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0"/>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0"/>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> </columnConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> <rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
</rowConstraints> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
<children> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
<Label text="Vorname:"> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
<font> </rowConstraints>
<Font name="System Bold" size="13.0" /> <children>
</font> <Label text="Vorname:">
</Label> <font>
<Label text="Nachname:" GridPane.columnIndex="2"> <Font name="System Bold" size="13.0"/>
<font> </font>
<Font name="System Bold" size="13.0" /> </Label>
</font> <Label text="Nachname:" GridPane.columnIndex="2">
</Label> <font>
<Label text="Datum:" GridPane.rowIndex="3"> <Font name="System Bold" size="13.0"/>
<font> </font>
<Font name="System Bold" size="13.0" /> </Label>
</font> <Label text="Datum:" GridPane.rowIndex="3">
</Label> <font>
<Label text="Beginn:" GridPane.columnIndex="2" GridPane.rowIndex="3"> <Font name="System Bold" size="13.0"/>
<font> </font>
<Font name="System Bold" size="13.0" /> </Label>
</font> <Label text="Beschreibung:" GridPane.columnIndex="2" GridPane.rowIndex="3">
</Label> <font>
<Label text="Ende" GridPane.rowIndex="4"> <Font name="System Bold" size="13.0"/>
<font> </font>
<Font name="System Bold" size="13.0" /> </Label>
</font> <Label text="Beginn:" GridPane.rowIndex="4">
</Label> <font>
<Label text="Beschreibung:" GridPane.columnIndex="2" GridPane.rowIndex="4"> <Font name="System Bold" size="13.0"/>
<font> </font>
<Font name="System Bold" size="13.0" /> </Label>
</font> <Label text="Ende" GridPane.columnIndex="2" GridPane.rowIndex="4">
</Label> <font>
<TextField fx:id="textFieldBegin" promptText="hh:mm" GridPane.columnIndex="3" GridPane.rowIndex="3" /> <Font name="System Bold" size="13.0"/>
<TextField fx:id="textFieldEnd" maxWidth="192.0" prefWidth="150.0" promptText="hh:mm" GridPane.columnIndex="1" GridPane.rowIndex="4" /> </font>
<TextField fx:id="textFieldDescription" GridPane.columnIndex="3" GridPane.rowIndex="4" /> </Label>
<DatePicker fx:id="datePicker" prefWidth="192.0" promptText="yyyy-mm-dd" GridPane.columnIndex="1" GridPane.rowIndex="3" /> <TextField fx:id="textFieldDescription" GridPane.columnIndex="3" GridPane.rowIndex="3"/>
<Label fx:id="labelFirstName" text="Vorname" GridPane.columnIndex="1" /> <TextField fx:id="textFieldBegin" promptText="hh:mm" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
<Label fx:id="labelSurname" text="Nachname" GridPane.columnIndex="3" /> <TextField fx:id="textFieldEnd" maxWidth="192.0" prefWidth="150.0" promptText="hh:mm"
</children> GridPane.columnIndex="3" GridPane.rowIndex="4"/>
</GridPane> <DatePicker fx:id="datePicker" prefWidth="192.0" promptText="yyyy-mm-dd" GridPane.columnIndex="1"
<HBox layoutX="298.0" layoutY="237.0" spacing="20.0" AnchorPane.bottomAnchor="20.0" AnchorPane.rightAnchor="50.0"> GridPane.rowIndex="3"/>
<children> <Label fx:id="labelFirstName" text="Vorname" GridPane.columnIndex="1"/>
<Button fx:id="buttonAdd" mnemonicParsing="false" onAction="#handleAdd" text="Anlegen" /> <Label fx:id="labelSurname" text="Nachname" GridPane.columnIndex="3"/>
<Button fx:id="buttonCancel" layoutX="298.0" layoutY="237.0" mnemonicParsing="false" onAction="#handleCancel" text="Abbruch" /> </children>
</children> </GridPane>
</HBox> <HBox layoutX="298.0" layoutY="237.0" spacing="20.0" AnchorPane.bottomAnchor="20.0"
<TextArea fx:id="textAreaRemarks" layoutX="50.0" layoutY="252.0" prefHeight="134.0" prefWidth="700.0" AnchorPane.topAnchor="265.0" /> AnchorPane.rightAnchor="50.0">
</children> <children>
<Button fx:id="buttonAdd" mnemonicParsing="false" onAction="#handleAdd" text="Anlegen"/>
<Button fx:id="buttonCancel" layoutX="298.0" layoutY="237.0" mnemonicParsing="false"
onAction="#handleCancel" text="Abbruch"/>
</children>
</HBox>
<TextArea fx:id="textAreaRemarks" layoutX="50.0" layoutY="252.0" prefHeight="134.0" prefWidth="700.0"
AnchorPane.topAnchor="265.0"/>
</children>
</AnchorPane> </AnchorPane>

View file

@ -1,87 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Button?> <?import javafx.scene.control.*?>
<?import javafx.scene.control.DatePicker?> <?import javafx.scene.layout.*?>
<?import javafx.scene.control.Label?> <?import javafx.scene.text.*?>
<?import javafx.scene.control.TextArea?> <AnchorPane prefHeight="450.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/11.0.1"
<?import javafx.scene.control.TextField?> xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hitec.nhplus.controller.TreatmentController">
<?import javafx.scene.layout.AnchorPane?> <children>
<?import javafx.scene.layout.ColumnConstraints?> <HBox alignment="TOP_CENTER" prefWidth="200.0" spacing="25.0" AnchorPane.leftAnchor="15.0"
<?import javafx.scene.layout.GridPane?> AnchorPane.rightAnchor="15.0" AnchorPane.topAnchor="5.0">
<?import javafx.scene.layout.HBox?> <children>
<?import javafx.scene.layout.RowConstraints?> <Label alignment="CENTER" contentDisplay="CENTER" minWidth="400.0" text="Behandlung"
<?import javafx.scene.text.Font?> textAlignment="CENTER">
<font>
<Font size="36.0"/>
</font>
</Label>
</children>
</HBox>
<GridPane hgap="10.0" layoutX="14.0" layoutY="14.0" AnchorPane.leftAnchor="50.0" AnchorPane.rightAnchor="50.0"
AnchorPane.topAnchor="100.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0"/>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0"/>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0"/>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0"/>
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
</rowConstraints>
<children>
<Label text="Patient:">
<font>
<Font name="System Bold" size="13.0"/>
</font>
</Label>
<Label text="Pflegestufe:" GridPane.columnIndex="2">
<font>
<Font name="System Bold" size="13.0"/>
</font>
</Label>
<Label text="Datum:" GridPane.rowIndex="3">
<font>
<Font name="System Bold" size="13.0"/>
</font>
</Label>
<Label text="Beschreibung:" GridPane.columnIndex="2" GridPane.rowIndex="3">
<font>
<Font name="System Bold" size="13.0"/>
</font>
</Label>
<Label text="Beginn:" GridPane.rowIndex="4">
<font>
<Font name="System Bold" size="13.0"/>
</font>
</Label>
<Label text="Ende" GridPane.columnIndex="2" GridPane.rowIndex="4">
<font>
<Font name="System Bold" size="13.0"/>
</font>
</Label>
<AnchorPane prefHeight="450.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/11.0.1" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.hitec.nhplus.controller.TreatmentController"> <TextField fx:id="textFieldDescription" GridPane.columnIndex="3" GridPane.rowIndex="3"/>
<children> <TextField fx:id="textFieldBegin" promptText="hh:mm" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
<HBox alignment="TOP_CENTER" prefWidth="200.0" spacing="25.0" AnchorPane.leftAnchor="15.0" AnchorPane.rightAnchor="15.0" AnchorPane.topAnchor="5.0"> <TextField fx:id="textFieldEnd" promptText="hh:mm" maxWidth="192.0" prefWidth="150.0"
<children> GridPane.columnIndex="3"
<Label alignment="CENTER" contentDisplay="CENTER" minWidth="400.0" text="Behandlung" textAlignment="CENTER"> GridPane.rowIndex="4"/>
<font> <DatePicker fx:id="datePicker" prefWidth="192.0" GridPane.columnIndex="1" GridPane.rowIndex="3"/>
<Font size="36.0" /> <Label fx:id="labelPatientName" text="Name" GridPane.columnIndex="1"/>
</font> <Label fx:id="labelCareLevel" text="Pflegestufe" GridPane.columnIndex="3"/>
</Label> </children>
</children> </GridPane>
</HBox> <HBox layoutX="298.0" layoutY="237.0" spacing="20.0" AnchorPane.bottomAnchor="20.0"
<GridPane hgap="10.0" layoutX="14.0" layoutY="14.0" AnchorPane.leftAnchor="50.0" AnchorPane.rightAnchor="50.0" AnchorPane.topAnchor="100.0"> AnchorPane.rightAnchor="50.0">
<columnConstraints> <children>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <Button fx:id="btnChange" mnemonicParsing="false" onAction="#handleChange" text="Ändern"/>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0" /> <Button fx:id="btnCancel" layoutX="298.0" layoutY="237.0" mnemonicParsing="false"
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0" /> onAction="#handleCancel" text="Abbruch"/>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="200.0" /> </children>
</columnConstraints> </HBox>
<rowConstraints> <TextArea fx:id="textAreaRemarks" layoutX="50.0" layoutY="252.0" prefHeight="134.0" prefWidth="700.0"
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> AnchorPane.topAnchor="265.0"/>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> </children>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label text="Patient:">
<font>
<Font name="System Bold" size="13.0" />
</font>
</Label>
<Label text="Pflegestufe:" GridPane.columnIndex="2">
<font>
<Font name="System Bold" size="13.0" />
</font>
</Label>
<Label text="Datum:" GridPane.rowIndex="3">
<font>
<Font name="System Bold" size="13.0" />
</font>
</Label>
<Label text="Beginn:" GridPane.columnIndex="2" GridPane.rowIndex="3">
<font>
<Font name="System Bold" size="13.0" />
</font>
</Label>
<Label text="Ende" GridPane.rowIndex="4">
<font>
<Font name="System Bold" size="13.0" />
</font>
</Label>
<Label text="Beschreibung:" GridPane.columnIndex="2" GridPane.rowIndex="4">
<font>
<Font name="System Bold" size="13.0" />
</font>
</Label>
<TextField fx:id="textFieldBegin" GridPane.columnIndex="3" GridPane.rowIndex="3" />
<TextField fx:id="textFieldEnd" maxWidth="192.0" prefWidth="150.0" GridPane.columnIndex="1" GridPane.rowIndex="4" />
<TextField fx:id="textFieldDescription" GridPane.columnIndex="3" GridPane.rowIndex="4" />
<DatePicker fx:id="datePicker" prefWidth="192.0" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<Label fx:id="labelPatientName" text="Name" GridPane.columnIndex="1" />
<Label fx:id="labelCareLevel" text="Pflegestufe" GridPane.columnIndex="3" />
</children>
</GridPane>
<HBox layoutX="298.0" layoutY="237.0" spacing="20.0" AnchorPane.bottomAnchor="20.0" AnchorPane.rightAnchor="50.0">
<children>
<Button fx:id="btnChange" mnemonicParsing="false" onAction="#handleChange" text="Ändern" />
<Button fx:id="btnCancel" layoutX="298.0" layoutY="237.0" mnemonicParsing="false" onAction="#handleCancel" text="Abbruch" />
</children>
</HBox>
<TextArea fx:id="textAreaRemarks" layoutX="50.0" layoutY="252.0" prefHeight="134.0" prefWidth="700.0" AnchorPane.topAnchor="265.0" />
</children>
</AnchorPane> </AnchorPane>