Refaktoring #21
11 changed files with 332 additions and 467 deletions
|
@ -7,7 +7,6 @@ import javafx.application.Platform;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.TabPane;
|
import javafx.scene.control.TabPane;
|
||||||
import javafx.scene.layout.BorderPane;
|
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
|
@ -11,7 +11,7 @@ import javafx.fxml.FXMLLoader;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.control.*;
|
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.BorderPane;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -176,19 +176,24 @@ public class AllTreatmentController {
|
||||||
public void newTreatmentWindow(Patient patient) {
|
public void newTreatmentWindow(Patient patient) {
|
||||||
try {
|
try {
|
||||||
FXMLLoader loader = new FXMLLoader(
|
FXMLLoader loader = new FXMLLoader(
|
||||||
Main.class.getResource("/de/hitec/nhplus/treatment/NewTreatmentView.fxml")
|
Main.class.getResource("/de/hitec/nhplus/treatment/TreatmentModal.fxml")
|
||||||
);
|
);
|
||||||
AnchorPane pane = loader.load();
|
BorderPane pane = loader.load();
|
||||||
Scene scene = new Scene(pane);
|
Scene scene = new Scene(pane);
|
||||||
|
|
||||||
// the primary stage should stay in the background
|
|
||||||
Stage stage = new Stage();
|
Stage stage = new Stage();
|
||||||
|
|
||||||
NewTreatmentController controller = loader.getController();
|
TreatmentModalController controller = loader.getController();
|
||||||
controller.initialize(this, stage, patient);
|
controller.initialize(
|
||||||
|
this,
|
||||||
|
stage,
|
||||||
|
null,
|
||||||
|
patient
|
||||||
|
);
|
||||||
|
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.setResizable(false);
|
stage.setTitle("NHPlus - Neue Behandlung");
|
||||||
|
stage.setResizable(true);
|
||||||
|
stage.setAlwaysOnTop(true);
|
||||||
stage.showAndWait();
|
stage.showAndWait();
|
||||||
} catch (IOException exception) {
|
} catch (IOException exception) {
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
|
@ -197,19 +202,46 @@ public class AllTreatmentController {
|
||||||
|
|
||||||
public void treatmentWindow(Treatment treatment) {
|
public void treatmentWindow(Treatment treatment) {
|
||||||
try {
|
try {
|
||||||
FXMLLoader loader = new FXMLLoader(Main.class.getResource("/de/hitec/nhplus/treatment/TreatmentView.fxml"));
|
FXMLLoader loader = new FXMLLoader(
|
||||||
AnchorPane pane = loader.load();
|
Main.class.getResource("/de/hitec/nhplus/treatment/TreatmentModal.fxml")
|
||||||
|
);
|
||||||
|
BorderPane pane = loader.load();
|
||||||
Scene scene = new Scene(pane);
|
Scene scene = new Scene(pane);
|
||||||
|
|
||||||
// the primary stage should stay in the background
|
|
||||||
Stage stage = new Stage();
|
Stage stage = new Stage();
|
||||||
TreatmentController controller = loader.getController();
|
|
||||||
controller.initializeController(this, stage, treatment);
|
TreatmentModalController controller = loader.getController();
|
||||||
|
PatientDao pDao = DaoFactory.getDaoFactory().createPatientDAO();
|
||||||
|
controller.initialize(
|
||||||
|
this,
|
||||||
|
stage,
|
||||||
|
treatment,
|
||||||
|
pDao.read(treatment.getPatientId())
|
||||||
|
);
|
||||||
|
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.setResizable(false);
|
stage.setTitle("NHPlus - Behandlung");
|
||||||
|
stage.setResizable(true);
|
||||||
|
stage.setAlwaysOnTop(true);
|
||||||
stage.showAndWait();
|
stage.showAndWait();
|
||||||
} catch (IOException exception) {
|
} catch (IOException | SQLException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void createTreatment(Treatment treatment) {
|
||||||
|
TreatmentDao dao = DaoFactory.getDaoFactory().createTreatmentDao();
|
||||||
|
try {
|
||||||
|
dao.create(treatment);
|
||||||
|
} catch (SQLException exception) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateTreatment(Treatment treatment) {
|
||||||
|
TreatmentDao dao = DaoFactory.getDaoFactory().createTreatmentDao();
|
||||||
|
try {
|
||||||
|
dao.update(treatment);
|
||||||
|
} catch (SQLException exception) {
|
||||||
exception.printStackTrace();
|
exception.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,138 +0,0 @@
|
||||||
package de.hitec.nhplus.treatment;
|
|
||||||
|
|
||||||
import de.hitec.nhplus.datastorage.DaoFactory;
|
|
||||||
import de.hitec.nhplus.patient.Patient;
|
|
||||||
import de.hitec.nhplus.utils.DateConverter;
|
|
||||||
import javafx.beans.value.ChangeListener;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import javafx.util.StringConverter;
|
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalTime;
|
|
||||||
|
|
||||||
import static de.hitec.nhplus.utils.Validator.*;
|
|
||||||
|
|
||||||
public class NewTreatmentController
|
|
||||||
{
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private Label labelFirstName;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private Label labelSurname;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private TextField textFieldBegin;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private TextField textFieldEnd;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private TextField textFieldDescription;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private TextArea textAreaRemarks;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private DatePicker datePicker;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private Button buttonAdd;
|
|
||||||
|
|
||||||
private AllTreatmentController controller;
|
|
||||||
private Patient patient;
|
|
||||||
private Stage stage;
|
|
||||||
|
|
||||||
public void initialize(AllTreatmentController controller, Stage stage, Patient patient)
|
|
||||||
{
|
|
||||||
this.controller = controller;
|
|
||||||
this.patient = patient;
|
|
||||||
this.stage = stage;
|
|
||||||
|
|
||||||
this.buttonAdd.setDisable(true);
|
|
||||||
ChangeListener<String> inputNewTreatmentTextValidationListener = (observableValue, oldText, newText) ->
|
|
||||||
{
|
|
||||||
boolean isValid = isValidDate(this.datePicker.getValue())
|
|
||||||
&& isValidTimeRange(this.textFieldBegin.getText(), this.textFieldEnd.getText())
|
|
||||||
&& isValidDescription(this.textFieldDescription.getText());
|
|
||||||
|
|
||||||
NewTreatmentController.this.buttonAdd.setDisable(!isValid);
|
|
||||||
};
|
|
||||||
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
|
|
||||||
public String toString(LocalDate localDate)
|
|
||||||
{
|
|
||||||
return (localDate == null) ? "" : DateConverter.convertLocalDateToString(localDate);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LocalDate fromString(String localDate)
|
|
||||||
{
|
|
||||||
if (!isValidDate(localDate))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return DateConverter.convertStringToLocalDate(localDate);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.showPatientData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showPatientData()
|
|
||||||
{
|
|
||||||
this.labelFirstName.setText(patient.getFirstName());
|
|
||||||
this.labelSurname.setText(patient.getSurname());
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
public void handleAdd()
|
|
||||||
{
|
|
||||||
LocalDate date = this.datePicker.getValue();
|
|
||||||
LocalTime begin = DateConverter.convertStringToLocalTime(textFieldBegin.getText());
|
|
||||||
LocalTime end = DateConverter.convertStringToLocalTime(textFieldEnd.getText());
|
|
||||||
String description = textFieldDescription.getText();
|
|
||||||
String remarks = textAreaRemarks.getText();
|
|
||||||
Treatment treatment = new Treatment(patient.getId(), date, begin, end, description, remarks);
|
|
||||||
createTreatment(treatment);
|
|
||||||
controller.readAllAndShowInTableView();
|
|
||||||
stage.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void createTreatment(Treatment treatment)
|
|
||||||
{
|
|
||||||
TreatmentDao dao = DaoFactory.getDaoFactory().createTreatmentDao();
|
|
||||||
try
|
|
||||||
{
|
|
||||||
dao.create(treatment);
|
|
||||||
} catch (SQLException exception)
|
|
||||||
{
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
public void handleCancel()
|
|
||||||
{
|
|
||||||
stage.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -59,12 +59,12 @@ public class Treatment {
|
||||||
this.date = DateConverter.convertStringToLocalDate(date);
|
this.date = DateConverter.convertStringToLocalDate(date);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setBegin(String begin) {
|
public void setBegin(LocalTime begin) {
|
||||||
this.begin = DateConverter.convertStringToLocalTime(begin);
|
this.begin = begin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setEnd(String end) {
|
public void setEnd(LocalTime end) {
|
||||||
this.end = DateConverter.convertStringToLocalTime(end);
|
this.end = end;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
|
|
|
@ -1,120 +0,0 @@
|
||||||
package de.hitec.nhplus.treatment;
|
|
||||||
|
|
||||||
import de.hitec.nhplus.datastorage.DaoFactory;
|
|
||||||
import de.hitec.nhplus.patient.PatientDao;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.scene.control.*;
|
|
||||||
import javafx.stage.Stage;
|
|
||||||
import de.hitec.nhplus.patient.Patient;
|
|
||||||
import de.hitec.nhplus.utils.DateConverter;
|
|
||||||
|
|
||||||
import java.sql.SQLException;
|
|
||||||
import java.time.LocalDate;
|
|
||||||
|
|
||||||
import static de.hitec.nhplus.utils.Validator.*;
|
|
||||||
|
|
||||||
public class TreatmentController {
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private Label labelPatientName;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private Label labelCareLevel;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private TextField textFieldBegin;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private TextField textFieldEnd;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private TextField textFieldDescription;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private TextArea textAreaRemarks;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private DatePicker datePicker;
|
|
||||||
|
|
||||||
private AllTreatmentController controller;
|
|
||||||
private Stage stage;
|
|
||||||
private Patient patient;
|
|
||||||
private Treatment treatment;
|
|
||||||
|
|
||||||
public void initializeController(AllTreatmentController controller, Stage stage, Treatment treatment) {
|
|
||||||
this.stage = stage;
|
|
||||||
this.controller= controller;
|
|
||||||
|
|
||||||
PatientDao pDao = DaoFactory.getDaoFactory().createPatientDAO();
|
|
||||||
try {
|
|
||||||
this.patient = pDao.read(treatment.getPatientId());
|
|
||||||
this.treatment = treatment;
|
|
||||||
showData();
|
|
||||||
} catch (SQLException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void showData(){
|
|
||||||
this.labelPatientName.setText(patient.getSurname()+", "+patient.getFirstName());
|
|
||||||
this.labelCareLevel.setText(patient.getCareLevel());
|
|
||||||
LocalDate date = DateConverter.convertStringToLocalDate(treatment.getDate());
|
|
||||||
this.datePicker.setValue(date);
|
|
||||||
this.textFieldBegin.setText(this.treatment.getBegin());
|
|
||||||
this.textFieldEnd.setText(this.treatment.getEnd());
|
|
||||||
this.textFieldDescription.setText(this.treatment.getDescription());
|
|
||||||
this.textAreaRemarks.setText(this.treatment.getRemarks());
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
public void handleChange(){
|
|
||||||
LocalDate newDate = this.datePicker.getValue();
|
|
||||||
if(!isValidDate(newDate)){
|
|
||||||
showValidationError("Date");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
controller.readAllAndShowInTableView();
|
|
||||||
stage.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doUpdate(){
|
|
||||||
TreatmentDao dao = DaoFactory.getDaoFactory().createTreatmentDao();
|
|
||||||
try {
|
|
||||||
dao.update(treatment);
|
|
||||||
} catch (SQLException exception) {
|
|
||||||
exception.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
public void handleCancel(){
|
|
||||||
stage.close();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,143 @@
|
||||||
|
package de.hitec.nhplus.treatment;
|
||||||
|
|
||||||
|
import de.hitec.nhplus.patient.Patient;
|
||||||
|
import de.hitec.nhplus.utils.DateConverter;
|
||||||
|
import javafx.beans.value.ChangeListener;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.*;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import javafx.util.StringConverter;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalTime;
|
||||||
|
|
||||||
|
import static de.hitec.nhplus.utils.Validator.*;
|
||||||
|
|
||||||
|
public class TreatmentModalController {
|
||||||
|
@FXML
|
||||||
|
private Label labelFirstName;
|
||||||
|
@FXML
|
||||||
|
private Label labelSurname;
|
||||||
|
@FXML
|
||||||
|
private TextField textFieldBegin;
|
||||||
|
@FXML
|
||||||
|
private TextField textFieldEnd;
|
||||||
|
@FXML
|
||||||
|
private TextField textFieldDescription;
|
||||||
|
@FXML
|
||||||
|
private TextArea textAreaRemarks;
|
||||||
|
@FXML
|
||||||
|
private DatePicker datePicker;
|
||||||
|
@FXML
|
||||||
|
private Button buttonSave;
|
||||||
|
private AllTreatmentController controller;
|
||||||
|
private Stage stage;
|
||||||
|
private Patient patient;
|
||||||
|
private Treatment treatment;
|
||||||
|
private boolean isNewTreatment = false;
|
||||||
|
|
||||||
|
public void initialize(AllTreatmentController controller, Stage stage, Treatment treatment, Patient patient) {
|
||||||
|
this.controller = controller;
|
||||||
|
this.stage = stage;
|
||||||
|
this.patient = patient;
|
||||||
|
if (treatment == null) {
|
||||||
|
isNewTreatment = true;
|
||||||
|
LocalTime currentTime = LocalTime.now();
|
||||||
|
this.treatment = new Treatment(
|
||||||
|
patient.getId(),
|
||||||
|
LocalDate.now(),
|
||||||
|
LocalTime.of(currentTime.getHour(), currentTime.getMinute()),
|
||||||
|
LocalTime.of(currentTime.getHour(), currentTime.getMinute()),
|
||||||
|
"",
|
||||||
|
""
|
||||||
|
);
|
||||||
|
this.buttonSave.setDisable(true);
|
||||||
|
} else {
|
||||||
|
this.treatment = treatment;
|
||||||
|
}
|
||||||
|
showData();
|
||||||
|
|
||||||
|
ChangeListener<String> inputNewTreatmentTextValidationListener = (observableValue, oldText, newText) ->
|
||||||
|
{
|
||||||
|
boolean isValid = isValidDate(this.datePicker.getValue())
|
||||||
|
&& isValidTimeRange(this.textFieldBegin.getText(), this.textFieldEnd.getText())
|
||||||
|
&& isValidDescription(this.textFieldDescription.getText());
|
||||||
|
|
||||||
|
this.buttonSave.setDisable(!isValid);
|
||||||
|
};
|
||||||
|
ChangeListener<LocalDate> inputNewTreatmentDateValidationListener = (observableValue, localDate, t1) ->
|
||||||
|
{
|
||||||
|
boolean isValid = isValidDate(this.datePicker.getValue())
|
||||||
|
&& isValidTimeRange(this.textFieldBegin.getText(), this.textFieldEnd.getText())
|
||||||
|
&& isValidDescription(this.textFieldDescription.getText());
|
||||||
|
|
||||||
|
this.buttonSave.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
|
||||||
|
public String toString(LocalDate localDate) {
|
||||||
|
return (localDate == null) ? "" : DateConverter.convertLocalDateToString(localDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LocalDate fromString(String localDate) {
|
||||||
|
if (!isValidDate(localDate)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return DateConverter.convertStringToLocalDate(localDate);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showData() {
|
||||||
|
this.labelFirstName.setText(patient.getFirstName());
|
||||||
|
this.labelSurname.setText(patient.getSurname());
|
||||||
|
LocalDate date = DateConverter.convertStringToLocalDate(treatment.getDate());
|
||||||
|
this.datePicker.setValue(date);
|
||||||
|
this.textFieldBegin.setText(this.treatment.getBegin());
|
||||||
|
this.textFieldEnd.setText(this.treatment.getEnd());
|
||||||
|
this.textFieldDescription.setText(this.treatment.getDescription());
|
||||||
|
this.textAreaRemarks.setText(this.treatment.getRemarks());
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void handleSave() {
|
||||||
|
LocalDate newDate = this.datePicker.getValue();
|
||||||
|
LocalTime newBegin = DateConverter.convertStringToLocalTime(textFieldBegin.getText());
|
||||||
|
LocalTime newEnd = DateConverter.convertStringToLocalTime(textFieldEnd.getText());
|
||||||
|
String newDescription = textFieldDescription.getText();
|
||||||
|
String newRemarks = textAreaRemarks.getText();
|
||||||
|
|
||||||
|
this.treatment.setDate(newDate.toString());
|
||||||
|
this.treatment.setDescription(newDescription);
|
||||||
|
this.treatment.setBegin(newBegin);
|
||||||
|
this.treatment.setEnd(newEnd);
|
||||||
|
this.treatment.setRemarks(newRemarks);
|
||||||
|
|
||||||
|
if (isNewTreatment) {
|
||||||
|
controller.createTreatment(treatment);
|
||||||
|
} else {
|
||||||
|
controller.updateTreatment(treatment);
|
||||||
|
}
|
||||||
|
|
||||||
|
controller.readAllAndShowInTableView();
|
||||||
|
stage.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void handleCancel() {
|
||||||
|
stage.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Treatment getTreatment() {
|
||||||
|
return treatment;
|
||||||
|
}
|
||||||
|
}
|
|
@ -67,12 +67,12 @@
|
||||||
<center>
|
<center>
|
||||||
<GridPane hgap="8.0" vgap="8.0">
|
<GridPane hgap="8.0" vgap="8.0">
|
||||||
<padding>
|
<padding>
|
||||||
<Insets right="48.0"/>
|
<Insets right="8.0"/>
|
||||||
</padding>
|
</padding>
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" prefWidth="200.0"/>
|
<ColumnConstraints halignment="LEFT" hgrow="ALWAYS"/>
|
||||||
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" minWidth="200.0" prefWidth="200.0"/>
|
<ColumnConstraints halignment="LEFT" hgrow="ALWAYS" />
|
||||||
<ColumnConstraints halignment="LEFT" hgrow="SOMETIMES" minWidth="10.0" prefWidth="160.0"/>
|
<ColumnConstraints halignment="LEFT" hgrow="ALWAYS"/>
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<rowConstraints>
|
<rowConstraints>
|
||||||
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES"/>
|
||||||
|
@ -97,7 +97,6 @@
|
||||||
fx:id="textFieldDateOfBirth"
|
fx:id="textFieldDateOfBirth"
|
||||||
minWidth="160.0"
|
minWidth="160.0"
|
||||||
prefWidth="160.0"
|
prefWidth="160.0"
|
||||||
|
|
||||||
promptText="Geburtstag"
|
promptText="Geburtstag"
|
||||||
GridPane.columnIndex="2"
|
GridPane.columnIndex="2"
|
||||||
/>
|
/>
|
||||||
|
@ -105,7 +104,6 @@
|
||||||
fx:id="textFieldCareLevel"
|
fx:id="textFieldCareLevel"
|
||||||
prefHeight="26.0"
|
prefHeight="26.0"
|
||||||
prefWidth="200.0"
|
prefWidth="200.0"
|
||||||
|
|
||||||
promptText="Pflegegrad"
|
promptText="Pflegegrad"
|
||||||
GridPane.rowIndex="1"
|
GridPane.rowIndex="1"
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -63,20 +63,19 @@
|
||||||
</BorderPane.margin>
|
</BorderPane.margin>
|
||||||
<center>
|
<center>
|
||||||
<HBox spacing="8.0">
|
<HBox spacing="8.0">
|
||||||
|
<ComboBox
|
||||||
|
fx:id="comboBoxPatientSelection"
|
||||||
|
minWidth="160.0"
|
||||||
|
onAction="#handleComboBox"
|
||||||
|
prefWidth="200.0"
|
||||||
|
/>
|
||||||
<Button
|
<Button
|
||||||
fx:id="buttonNewTreament"
|
|
||||||
mnemonicParsing="false"
|
mnemonicParsing="false"
|
||||||
onAction="#handleNewTreatment"
|
onAction="#handleNewTreatment"
|
||||||
prefWidth="200.0"
|
prefWidth="200.0"
|
||||||
text="neue Behandlung anlegen"
|
text="neue Behandlung anlegen"
|
||||||
GridPane.columnIndex="1"
|
GridPane.columnIndex="1"
|
||||||
/>
|
/>
|
||||||
<ComboBox
|
|
||||||
fx:id="comboBoxPatientSelection"
|
|
||||||
minWidth="160.0"
|
|
||||||
onAction="#handleComboBox"
|
|
||||||
prefWidth="200.0"/>
|
|
||||||
|
|
||||||
</HBox>
|
</HBox>
|
||||||
</center>
|
</center>
|
||||||
<right>
|
<right>
|
||||||
|
|
|
@ -1,87 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.*?>
|
|
||||||
<?import javafx.scene.layout.*?>
|
|
||||||
<?import javafx.scene.text.*?>
|
|
||||||
<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.treatment.NewTreatmentController">
|
|
||||||
<children>
|
|
||||||
<HBox alignment="TOP_CENTER" prefWidth="200.0" spacing="25.0" AnchorPane.leftAnchor="5.0"
|
|
||||||
AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="5.0">
|
|
||||||
<children>
|
|
||||||
<Label alignment="CENTER" contentDisplay="CENTER" minWidth="400.0" text="Neue Behandlung"
|
|
||||||
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="Vorname:">
|
|
||||||
<font>
|
|
||||||
<Font name="System Bold" size="13.0"/>
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
<Label text="Nachname:" 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>
|
|
||||||
<TextField fx:id="textFieldDescription" GridPane.columnIndex="3" GridPane.rowIndex="3"/>
|
|
||||||
<TextField fx:id="textFieldBegin" promptText="hh:mm" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
|
|
||||||
<TextField fx:id="textFieldEnd" maxWidth="192.0" prefWidth="150.0" promptText="hh:mm"
|
|
||||||
GridPane.columnIndex="3" GridPane.rowIndex="4"/>
|
|
||||||
<DatePicker fx:id="datePicker" prefWidth="192.0" promptText="yyyy-mm-dd" GridPane.columnIndex="1"
|
|
||||||
GridPane.rowIndex="3"/>
|
|
||||||
<Label fx:id="labelFirstName" text="Vorname" GridPane.columnIndex="1"/>
|
|
||||||
<Label fx:id="labelSurname" text="Nachname" 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="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>
|
|
127
src/main/resources/de/hitec/nhplus/treatment/TreatmentModal.fxml
Normal file
127
src/main/resources/de/hitec/nhplus/treatment/TreatmentModal.fxml
Normal file
|
@ -0,0 +1,127 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import javafx.geometry.Insets?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<BorderPane
|
||||||
|
xmlns="http://javafx.com/javafx/17.0.2-ea"
|
||||||
|
xmlns:fx="http://javafx.com/fxml/1"
|
||||||
|
fx:controller="de.hitec.nhplus.treatment.TreatmentModalController"
|
||||||
|
>
|
||||||
|
<padding>
|
||||||
|
<Insets top="8" left="8" bottom="8" right="8"/>
|
||||||
|
</padding>
|
||||||
|
<top>
|
||||||
|
<GridPane hgap="8.0">
|
||||||
|
<columnConstraints>
|
||||||
|
<ColumnConstraints hgrow="NEVER"/>
|
||||||
|
<ColumnConstraints hgrow="NEVER"/>
|
||||||
|
<ColumnConstraints hgrow="ALWAYS"/>
|
||||||
|
<ColumnConstraints hgrow="NEVER"/>
|
||||||
|
<ColumnConstraints hgrow="NEVER"/>
|
||||||
|
</columnConstraints>
|
||||||
|
<rowConstraints>
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="NEVER"/>
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="NEVER"/>
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="NEVER"/>
|
||||||
|
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="NEVER"/>
|
||||||
|
</rowConstraints>
|
||||||
|
<!-- Row 0-->
|
||||||
|
<Label
|
||||||
|
GridPane.rowIndex="0"
|
||||||
|
GridPane.columnIndex="0"
|
||||||
|
text="Vorname:"
|
||||||
|
/>
|
||||||
|
<Label
|
||||||
|
GridPane.rowIndex="0"
|
||||||
|
GridPane.columnIndex="1"
|
||||||
|
prefWidth="200"
|
||||||
|
fx:id="labelFirstName" text="Vorname"
|
||||||
|
/>
|
||||||
|
<Label
|
||||||
|
GridPane.rowIndex="0"
|
||||||
|
GridPane.columnIndex="3"
|
||||||
|
text="Nachname:"
|
||||||
|
/>
|
||||||
|
<Label
|
||||||
|
GridPane.rowIndex="0"
|
||||||
|
GridPane.columnIndex="4"
|
||||||
|
prefWidth="200"
|
||||||
|
fx:id="labelSurname"
|
||||||
|
text="Nachname"
|
||||||
|
/>
|
||||||
|
<!-- Row 2 -->
|
||||||
|
<Label
|
||||||
|
GridPane.rowIndex="2"
|
||||||
|
GridPane.columnIndex="0"
|
||||||
|
text="Datum:"
|
||||||
|
/>
|
||||||
|
<DatePicker
|
||||||
|
GridPane.rowIndex="2"
|
||||||
|
GridPane.columnIndex="1"
|
||||||
|
prefWidth="200"
|
||||||
|
fx:id="datePicker"
|
||||||
|
promptText="yyyy-mm-dd"
|
||||||
|
/>
|
||||||
|
<Label
|
||||||
|
GridPane.rowIndex="2"
|
||||||
|
GridPane.columnIndex="3"
|
||||||
|
text="Beschreibung:"
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
GridPane.rowIndex="2"
|
||||||
|
GridPane.columnIndex="4"
|
||||||
|
fx:id="textFieldDescription"
|
||||||
|
/>
|
||||||
|
<!-- Row 3 -->
|
||||||
|
<Label
|
||||||
|
GridPane.rowIndex="3"
|
||||||
|
GridPane.columnIndex="0"
|
||||||
|
text="Beginn:"
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
GridPane.rowIndex="3"
|
||||||
|
GridPane.columnIndex="1"
|
||||||
|
fx:id="textFieldBegin"
|
||||||
|
promptText="hh:mm"
|
||||||
|
/>
|
||||||
|
<Label
|
||||||
|
GridPane.rowIndex="3"
|
||||||
|
GridPane.columnIndex="3"
|
||||||
|
text="Ende"
|
||||||
|
/>
|
||||||
|
<TextField
|
||||||
|
GridPane.rowIndex="3"
|
||||||
|
GridPane.columnIndex="4"
|
||||||
|
fx:id="textFieldEnd"
|
||||||
|
promptText="hh:mm"
|
||||||
|
/>
|
||||||
|
</GridPane>
|
||||||
|
</top>
|
||||||
|
<center>
|
||||||
|
<HBox spacing="8.0">
|
||||||
|
<BorderPane.margin>
|
||||||
|
<Insets top="8.0"/>
|
||||||
|
</BorderPane.margin>
|
||||||
|
<TextArea
|
||||||
|
fx:id="textAreaRemarks"
|
||||||
|
HBox.hgrow="ALWAYS"
|
||||||
|
/>
|
||||||
|
<VBox>
|
||||||
|
<Button
|
||||||
|
fx:id="buttonSave"
|
||||||
|
prefWidth="90"
|
||||||
|
mnemonicParsing="false"
|
||||||
|
onAction="#handleSave"
|
||||||
|
text="Speichern"
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
prefWidth="90"
|
||||||
|
mnemonicParsing="false"
|
||||||
|
onAction="#handleCancel"
|
||||||
|
text="Abbrechen"
|
||||||
|
/>
|
||||||
|
</VBox>
|
||||||
|
</HBox>
|
||||||
|
</center>
|
||||||
|
</BorderPane>
|
|
@ -1,88 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.*?>
|
|
||||||
<?import javafx.scene.layout.*?>
|
|
||||||
<?import javafx.scene.text.*?>
|
|
||||||
<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.treatment.TreatmentController">
|
|
||||||
<children>
|
|
||||||
<HBox alignment="TOP_CENTER" prefWidth="200.0" spacing="25.0" AnchorPane.leftAnchor="15.0"
|
|
||||||
AnchorPane.rightAnchor="15.0" AnchorPane.topAnchor="5.0">
|
|
||||||
<children>
|
|
||||||
<Label alignment="CENTER" contentDisplay="CENTER" minWidth="400.0" text="Behandlung"
|
|
||||||
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>
|
|
||||||
|
|
||||||
<TextField fx:id="textFieldDescription" GridPane.columnIndex="3" GridPane.rowIndex="3"/>
|
|
||||||
<TextField fx:id="textFieldBegin" promptText="hh:mm" GridPane.columnIndex="1" GridPane.rowIndex="4"/>
|
|
||||||
<TextField fx:id="textFieldEnd" promptText="hh:mm" maxWidth="192.0" prefWidth="150.0"
|
|
||||||
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>
|
|
Loading…
Reference in a new issue