Compare commits

..

3 commits

Author SHA1 Message Date
Dorian Nemec
6893ee6f53 #24 Implement logic
All checks were successful
Quality Check / Linting Check (push) Successful in 17s
Quality Check / Linting Check (pull_request) Successful in 21s
Quality Check / Javadoc Check (push) Successful in 35s
Quality Check / Javadoc Check (pull_request) Successful in 32s
2024-05-20 08:21:23 +02:00
Dorian Nemec
eee25fab39 #24 Update UI 2024-05-20 08:21:08 +02:00
Dorian Nemec
17a5d30f7f #24 Update model 2024-05-20 08:15:50 +02:00
13 changed files with 30 additions and 606 deletions

View file

@ -67,6 +67,7 @@ public class MedicationFixture implements Fixture<Medication> {
Ingredient warfarinnatrium = new Ingredient("Warfarinnatrium"); Ingredient warfarinnatrium = new Ingredient("Warfarinnatrium");
medications.add(new Medication( medications.add(new Medication(
1,
"Metformin", "Metformin",
"AstraZeneca", "AstraZeneca",
List.of( List.of(
@ -80,6 +81,7 @@ public class MedicationFixture implements Fixture<Medication> {
100 100
)); ));
medications.add(new Medication( medications.add(new Medication(
2,
"Lisinopril", "Lisinopril",
"Teva Pharmaceuticals", "Teva Pharmaceuticals",
List.of( List.of(
@ -93,6 +95,7 @@ public class MedicationFixture implements Fixture<Medication> {
150 150
)); ));
medications.add(new Medication( medications.add(new Medication(
3,
"Simvastatin", "Simvastatin",
"Mylan", "Mylan",
List.of( List.of(
@ -106,6 +109,7 @@ public class MedicationFixture implements Fixture<Medication> {
80 80
)); ));
medications.add(new Medication( medications.add(new Medication(
4,
"Enoxaparin", "Enoxaparin",
"Sanofi", "Sanofi",
List.of( List.of(
@ -118,6 +122,7 @@ public class MedicationFixture implements Fixture<Medication> {
120 120
)); ));
medications.add(new Medication( medications.add(new Medication(
5,
"Levothyroxin", "Levothyroxin",
"Sandoz", "Sandoz",
List.of( List.of(
@ -131,6 +136,7 @@ public class MedicationFixture implements Fixture<Medication> {
90 90
)); ));
medications.add(new Medication( medications.add(new Medication(
6,
"Warfarin", "Warfarin",
"Apotex Inc.", "Apotex Inc.",
List.of( List.of(

View file

@ -1,35 +1,22 @@
package de.hitec.nhplus.medication; package de.hitec.nhplus.medication;
import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import java.util.stream.Collectors;
import de.hitec.nhplus.Main;
import de.hitec.nhplus.datastorage.DaoFactory; import de.hitec.nhplus.datastorage.DaoFactory;
import de.hitec.nhplus.medication.database.MedicationDao; import de.hitec.nhplus.medication.database.MedicationDao;
import de.hitec.nhplus.nurse.Nurse;
import de.hitec.nhplus.patient.Patient;
import de.hitec.nhplus.treatment.Treatment;
import de.hitec.nhplus.treatment.TreatmentModalController;
import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections; import javafx.collections.FXCollections;
import javafx.collections.ObservableList; import javafx.collections.ObservableList;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.control.SelectionModel;
import javafx.scene.control.TableColumn; import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView; import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.layout.BorderPane;
import javafx.stage.Stage; import java.sql.SQLException;
import java.util.stream.Collectors;
/** /**
* The controller for viewing all {@link Medication}s. * The controller for viewing all {@link Medication}s.
* *
* @author Dominik Säume * @author Dominik Säume
* @author Ole Kück
*/ */
public class AllMedicationController { public class AllMedicationController {
@FXML @FXML
@ -63,20 +50,14 @@ public class AllMedicationController {
this.columnName.setCellValueFactory(new PropertyValueFactory<>("name")); this.columnName.setCellValueFactory(new PropertyValueFactory<>("name"));
this.columnManufacturer.setCellValueFactory(new PropertyValueFactory<>("manufacturer")); this.columnManufacturer.setCellValueFactory(new PropertyValueFactory<>("manufacturer"));
this.columnIngredient.setCellValueFactory( this.columnIngredient.setCellValueFactory(
cellData -> { cellData -> new SimpleStringProperty(
Medication medication = cellData.getValue(); cellData
List<Ingredient> ingredients = medication.getIngredients(); .getValue()
if (ingredients.isEmpty()) { .getIngredients()
return new SimpleStringProperty(""); .stream()
} .map(ingredient -> ingredient.getName())
.collect(Collectors.joining("\n"))
return new SimpleStringProperty( ));
ingredients
.stream()
.map(ingredient -> ingredient.getName())
.collect(Collectors.joining("\n"))
);
});
this.columnPossibleSideEffects.setCellValueFactory(new PropertyValueFactory<>("possibleSideEffects")); this.columnPossibleSideEffects.setCellValueFactory(new PropertyValueFactory<>("possibleSideEffects"));
this.columnAdministrationMethod.setCellValueFactory(new PropertyValueFactory<>("administrationMethod")); this.columnAdministrationMethod.setCellValueFactory(new PropertyValueFactory<>("administrationMethod"));
this.columnCurrentStock.setCellValueFactory(new PropertyValueFactory<>("currentStock")); this.columnCurrentStock.setCellValueFactory(new PropertyValueFactory<>("currentStock"));
@ -95,73 +76,4 @@ public class AllMedicationController {
exception.printStackTrace(); exception.printStackTrace();
} }
} }
/**
* Method to save the changes to a {@link Medication}.
*/
public void updateMedication(Medication medication) {
dao = DaoFactory.getInstance().createMedicationDAO();
try {
dao.update(medication);
} catch (SQLException exception) {
exception.printStackTrace();
}
}
/**
* Method to create a new {@link Medication}.
*/
public void createMedication(Medication medication) {
dao = DaoFactory.getInstance().createMedicationDAO();
try {
dao.create(medication);
} catch (SQLException exception) {
exception.printStackTrace();
}
}
/**
* Internal method to create a {@link MedicationModalController MedicationModal}.
*
* @param medication The {@link Medication} which should be edited. Set null to create a new one.
* @param title The Title of the created modal.
*/
public void medicationWindow(Medication medication, String title) {
try {
FXMLLoader loader = new FXMLLoader(
Main.class.getResource("/de/hitec/nhplus/medication/MedicationModal.fxml")
);
BorderPane pane = loader.load();
Scene scene = new Scene(pane);
Stage stage = new Stage();
MedicationModalController controller = loader.getController();
controller.initialize(stage, this, medication);
stage.setScene(scene);
stage.setTitle(title);
stage.setResizable(true);
stage.setAlwaysOnTop(true);
stage.showAndWait();
} catch (IOException exception) {
exception.printStackTrace();
}
}
@FXML
public void handleNewMedication() {
medicationWindow(null, "NHPlus - Neues Medikament");
}
@FXML
public void handleMouseClick() {
tableView.setOnMouseClicked(event -> {
SelectionModel<Medication> selectionModel = tableView.getSelectionModel();
if (event.getClickCount() == 2 && (selectionModel.getSelectedItem() != null)) {
int index = selectionModel.getSelectedIndex();
Medication medication = this.medications.get(index);
medicationWindow(medication, "NHPlus - Medikament");
}
});
}
} }

View file

@ -17,7 +17,7 @@ public class Ingredient {
} }
public String getName() { public String getName() {
return name.getValue(); return name.get();
} }
public SimpleStringProperty nameProperty() { public SimpleStringProperty nameProperty() {

View file

@ -1,104 +0,0 @@
package de.hitec.nhplus.medication;
import javafx.beans.value.ObservableValue;
import javafx.geometry.Insets;
import javafx.scene.control.Button;
import javafx.scene.control.ListCell;
import javafx.scene.control.ListView;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javafx.scene.text.Text;
/**
* A custom implementation of the {@link ListCell} for {@link Ingredient}s.
* This implementation contains an automatic resizing of the parent {@link ListView}.
*
* @author Dominik Säume
*/
public class IngredientListCell extends ListCell<Ingredient> {
private final TextField textField;
private final Button deleteButton;
private static final double BUILTIN_BORDER_WIDTH = 1;
private static final double CELL_SPACING = 4;
private static final double CELL_PADDING = 4;
private static final double BUTTON_PADDING_X = 8;
private static final double BUTTON_PADDING_Y = 4;
private final double totalSpacing;
public IngredientListCell() {
this.setPadding(new Insets(CELL_PADDING));
textField = new TextField();
textField.setPromptText("Inhaltsstoff");
textField.textProperty().addListener(this::onTextFieldUpdate);
deleteButton = new Button("-");
deleteButton.setPadding(new Insets(
BUTTON_PADDING_Y,
BUTTON_PADDING_X,
BUTTON_PADDING_Y,
BUTTON_PADDING_X
));
deleteButton.setOnAction(event -> getListView().getItems().remove(getItem()));
// Calculate Delete Button Width
Text textNode = new Text(deleteButton.getText());
textNode.setFont(deleteButton.getFont());
double calculatedDeleteButtonWidth = textNode.getLayoutBounds().getWidth() + BUTTON_PADDING_X * 2;
totalSpacing = BUILTIN_BORDER_WIDTH * 2 // List View
+ CELL_PADDING * 2
+ CELL_SPACING
+ calculatedDeleteButtonWidth;
}
@Override
protected void updateItem(Ingredient item, boolean empty) {
super.updateItem(item, empty);
if (empty || item == null) {
setGraphic(null);
} else {
String oldText = textField.getText();
String newText = oldText != null && !oldText.isEmpty() ? oldText : item.getName();
textField.setText(newText);
BorderPane cellPane = new BorderPane();
cellPane.setCenter(textField);
cellPane.setRight(deleteButton);
BorderPane.setMargin(deleteButton, new Insets(0, 0, 0, CELL_SPACING));
setGraphic(cellPane);
}
}
/**
* A Callback for use as a Listener for the {@link IngredientListCell#textField}.
*/
private void onTextFieldUpdate(ObservableValue<? extends String> observable, String oldValue, String newValue) {
getItem().setName(textField.getText());
textField.setMinWidth(getTextFieldRequiredWidth(textField));
ListView<Ingredient> listView = getListView();
double max = listView.lookupAll("*")
.stream()
.filter(node -> node instanceof IngredientListCell)
.mapToDouble(node -> getTextFieldRequiredWidth(((IngredientListCell) node).textField))
.max()
.orElse(0);
getListView().setMinWidth(max + totalSpacing);
}
/**
* Internal method to calculate the required width of the {@link IngredientListCell#textField}.
*/
private double getTextFieldRequiredWidth(TextField textField) {
Text textNode = new Text(textField.getText());
textNode.setFont(textField.getFont());
return textNode.getLayoutBounds().getWidth()
+ textField.getPadding().getLeft()
+ textField.getPadding().getRight()
+ BUILTIN_BORDER_WIDTH * 2;
}
}

View file

@ -1,141 +0,0 @@
package de.hitec.nhplus.medication;
import de.hitec.nhplus.treatment.Treatment;
import javafx.beans.value.ChangeListener;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.ListView;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.stage.Stage;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Predicate;
import static de.hitec.nhplus.utils.Validator.*;
/**
* The controller for creating and editing a specific {@link Medication}.
*
* @author Ole Kück
*/
public class MedicationModalController {
@FXML
public ListView<Ingredient> listViewIngredients;
@FXML
public TextField textFieldName;
@FXML
public TextField textFieldManufacturer;
@FXML
public TextField textFieldAdministrationMethod;
@FXML
public TextField textFieldCurrentStock;
@FXML
public TextArea textAreaPossibleSideEffects;
@FXML
public Button buttonSave;
private Stage stage;
private Medication medication;
private final ObservableList<Ingredient> ingredients = FXCollections.observableArrayList();
private AllMedicationController controller;
private boolean isNewMedication = false;
/**
* Initialization method that is called after the binding of all the fields.
*/
@FXML
public void initialize(
Stage stage,
AllMedicationController controller,
Medication medication
) {
this.stage = stage;
this.controller = controller;
if (medication != null) {
this.medication = medication;
} else {
isNewMedication = true;
this.medication = new Medication(
"",
"",
new ArrayList<>(),
"",
"",
0
);
this.buttonSave.setDisable(true);
}
listViewIngredients.setCellFactory(cellData -> new IngredientListCell());
listViewIngredients.setItems(ingredients);
showData();
ChangeListener<String> inputMedicationValidationListener = (observableValue, oldText, newText) -> {
boolean isValid = isValidMedicationName(textFieldName.getText())
&& isValidMedicationManufacturer(textFieldManufacturer.getText())
&& isValidMedicationAdministrationMethod(textFieldAdministrationMethod.getText())
&& isValidStock(textFieldCurrentStock.getText());
this.buttonSave.setDisable(!isValid);
};
this.textFieldName.textProperty().addListener(inputMedicationValidationListener);
this.textFieldManufacturer.textProperty().addListener(inputMedicationValidationListener);
this.textFieldAdministrationMethod.textProperty().addListener(inputMedicationValidationListener);
this.textFieldCurrentStock.textProperty().addListener(inputMedicationValidationListener);
}
/**
* Internal method to show the data in the view.
*/
private void showData() {
ingredients.setAll(medication.getIngredients());
textFieldName.setText(medication.getName());
textFieldManufacturer.setText(medication.getManufacturer());
textFieldAdministrationMethod.setText(medication.getAdministrationMethod());
textFieldCurrentStock.setText(String.valueOf(medication.getCurrentStock()));
textAreaPossibleSideEffects.setText(medication.getPossibleSideEffects());
}
@FXML
public void handleSave() {
this.medication.setName(textFieldName.getText());
this.medication.setManufacturer(textFieldManufacturer.getText());
this.medication.setAdministrationMethod(textFieldAdministrationMethod.getText());
this.medication.setCurrentStock(Integer.parseInt(textFieldCurrentStock.getText()));
this.medication.setPossibleSideEffects(textAreaPossibleSideEffects.getText());
this.medication.setIngredients(ingredients
.stream()
.map(Ingredient::getName)
.distinct()
.filter(Predicate.not(String::isEmpty))
.map(Ingredient::new)
.toList()
);
if (isNewMedication) {
controller.createMedication(medication);
} else {
controller.updateMedication(medication);
}
controller.readAllAndShowInTableView();
stage.close();
}
@FXML
public void handleCancel() {
stage.close();
}
@FXML
public void handleAddIngredient() {
ingredients.add(new Ingredient(""));
}
}

View file

@ -29,7 +29,6 @@ public class MedicationDao implements Dao<Medication> {
@Override @Override
public void create(Medication medication) throws SQLException { public void create(Medication medication) throws SQLException {
connection.setAutoCommit(false); //Switch to Manual Commit, to do an SQL Transaction
final String medicationSQL = """ final String medicationSQL = """
INSERT INTO medication INSERT INTO medication
(name, manufacturer, possibleSideEffects, administrationMethod, currentStock) (name, manufacturer, possibleSideEffects, administrationMethod, currentStock)
@ -43,15 +42,6 @@ public class MedicationDao implements Dao<Medication> {
medicationStatement.setInt(5, medication.getCurrentStock()); medicationStatement.setInt(5, medication.getCurrentStock());
medicationStatement.execute(); medicationStatement.execute();
ResultSet generatedKeys = connection.createStatement().executeQuery("SELECT last_insert_rowid()");
connection.commit(); //Finish SQL Transaction
connection.setAutoCommit(true); //Switch back Mode
if (!generatedKeys.next()) {
return;
}
int newId = generatedKeys.getInt(1);
final String ingredientSQL = """ final String ingredientSQL = """
INSERT INTO medication_ingredient INSERT INTO medication_ingredient
(id, name) (id, name)
@ -59,7 +49,7 @@ public class MedicationDao implements Dao<Medication> {
"""; """;
for (Ingredient ingredient : medication.getIngredients()) { for (Ingredient ingredient : medication.getIngredients()) {
PreparedStatement ingredientStatement = this.connection.prepareStatement(ingredientSQL); PreparedStatement ingredientStatement = this.connection.prepareStatement(ingredientSQL);
ingredientStatement.setInt(1, newId); ingredientStatement.setInt(1, medication.getId());
ingredientStatement.setString(2, ingredient.getName()); ingredientStatement.setString(2, ingredient.getName());
ingredientStatement.execute(); ingredientStatement.execute();
} }
@ -100,26 +90,20 @@ public class MedicationDao implements Dao<Medication> {
result.getInt(1), result.getInt(1),
result.getString(2), result.getString(2),
result.getString(3), result.getString(3),
new ArrayList<>(), List.of(),
result.getString(4), result.getString(4),
result.getString(5), result.getString(5),
result.getInt(6) result.getInt(6)
); );
medications.add(medication); medications.add(medication);
} lastMedicationId = currentMedicationId;
List<Ingredient> ingredients = ingredientMap.computeIfAbsent(currentMedicationId, k -> new ArrayList<>());
String ingredientName = result.getString(7);
if(ingredientName == null){
continue; continue;
} }
ingredients.add(new Ingredient(ingredientName)); List<Ingredient> ingredients = ingredientMap.computeIfAbsent(currentMedicationId, k -> new ArrayList<>());
ingredients.add(new Ingredient(result.getString(7)));
lastMedicationId = currentMedicationId; lastMedicationId = currentMedicationId;
} }
for (Medication medication : medications) { for (Medication medication : medications) {
List<Ingredient> ingredients = ingredientMap.get(medication.getId());
if(ingredients.isEmpty()){
continue;
}
medication.setIngredients(ingredientMap.get(medication.getId())); medication.setIngredients(ingredientMap.get(medication.getId()));
} }

View file

@ -108,17 +108,6 @@ public class AllNurseController {
this.textFieldPhoneNumber.clear(); this.textFieldPhoneNumber.clear();
} }
/**
* Internal method that stores the changes in the database.
*/
private void doUpdate(TableColumn.CellEditEvent<Nurse, String> event) {
try {
this.dao.update(event.getRowValue());
} catch (SQLException exception) {
exception.printStackTrace();
}
}
@FXML @FXML
public void handleAdd(){ public void handleAdd(){
String surname=this.textFieldSurName.getText(); String surname=this.textFieldSurName.getText();
@ -150,39 +139,4 @@ public class AllNurseController {
readAllAndShowInTableView(); readAllAndShowInTableView();
} }
@FXML
public void handleOnEditSurname(TableColumn.CellEditEvent<Nurse, String> event) {
String newSurName = event.getNewValue();
if (!isValidSurName(newSurName)) {
showValidationError("Nachname");
event.getTableView().refresh();
return;
}
event.getRowValue().setSurName(newSurName);
this.doUpdate(event);
}
@FXML
public void handleOnEditFirstname(TableColumn.CellEditEvent<Nurse, String> event) {
String newFirstName = event.getNewValue();
if (!isValidFirstName(newFirstName)) {
showValidationError("Vorname");
event.getTableView().refresh();
return;
}
event.getRowValue().setFirstName(newFirstName);
this.doUpdate(event);
}
@FXML
public void handleOnEditPhoneNumber(TableColumn.CellEditEvent<Nurse, String> event) {
String newPhoneNumber = event.getNewValue();
if (!isValidPhoneNumber(newPhoneNumber)) {
showValidationError("Telefonnummer");
event.getTableView().refresh();
return;
}
event.getRowValue().setPhoneNumber(newPhoneNumber);
this.doUpdate(event);
}
} }

View file

@ -154,7 +154,7 @@ public class AllPatientController {
public void handleOnEditFirstname(TableColumn.CellEditEvent<Patient, String> event) { public void handleOnEditFirstname(TableColumn.CellEditEvent<Patient, String> event) {
String newFirstName = event.getNewValue(); String newFirstName = event.getNewValue();
if (!isValidFirstName(newFirstName)) { if (!isValidFirstName(newFirstName)) {
showValidationError("Vorname"); showValidationError("First Name");
event.getTableView().refresh(); event.getTableView().refresh();
return; return;
} }
@ -166,7 +166,7 @@ public class AllPatientController {
public void handleOnEditSurname(TableColumn.CellEditEvent<Patient, String> event) { public void handleOnEditSurname(TableColumn.CellEditEvent<Patient, String> event) {
String newSurName = event.getNewValue(); String newSurName = event.getNewValue();
if (!isValidSurName(newSurName)) { if (!isValidSurName(newSurName)) {
showValidationError("Nachname"); showValidationError("Sur Name");
event.getTableView().refresh(); event.getTableView().refresh();
return; return;
} }
@ -178,7 +178,7 @@ public class AllPatientController {
public void handleOnEditDateOfBirth(TableColumn.CellEditEvent<Patient, String> event) { public void handleOnEditDateOfBirth(TableColumn.CellEditEvent<Patient, String> event) {
String newDateString = event.getNewValue(); String newDateString = event.getNewValue();
if (!isValidDate(newDateString)) { if (!isValidDate(newDateString)) {
showValidationError("Geburtstag"); showValidationError("Date");
event.getTableView().refresh(); event.getTableView().refresh();
return; return;
} }
@ -190,7 +190,7 @@ public class AllPatientController {
public void handleOnEditCareLevel(TableColumn.CellEditEvent<Patient, String> event) { public void handleOnEditCareLevel(TableColumn.CellEditEvent<Patient, String> event) {
String newCareLevel = event.getNewValue(); String newCareLevel = event.getNewValue();
if (!isValidCareLevel(newCareLevel)) { if (!isValidCareLevel(newCareLevel)) {
showValidationError("Pflegegrad"); showValidationError("Care Level");
event.getTableView().refresh(); event.getTableView().refresh();
return; return;
} }
@ -202,7 +202,7 @@ public class AllPatientController {
public void handleOnEditRoomNumber(TableColumn.CellEditEvent<Patient, String> event) { public void handleOnEditRoomNumber(TableColumn.CellEditEvent<Patient, String> event) {
String newRoomNumber = event.getNewValue(); String newRoomNumber = event.getNewValue();
if (!isValidRoomNumber(newRoomNumber)) { if (!isValidRoomNumber(newRoomNumber)) {
showValidationError("Raum"); showValidationError("Room Number");
event.getTableView().refresh(); event.getTableView().refresh();
return; return;
} }

View file

@ -148,46 +148,4 @@ public class Validator {
public static boolean isValidRoomNumber(String text) { public static boolean isValidRoomNumber(String text) {
return !text.isBlank(); return !text.isBlank();
} }
/**
* Validate that a {@link String} is a valid {@link de.hitec.nhplus.medication.Medication#name Medication name}.
* @param text The {@link String} to validate.
*/
public static boolean isValidMedicationName(String text) {
return !text.isBlank();
}
/**
* Validate that a {@link String} is a valid
* {@link de.hitec.nhplus.medication.Medication#manufacturer Medication manufacturer}.
* @param text The {@link String} to validate.
*/
public static boolean isValidMedicationManufacturer(String text) {
return !text.isBlank();
}
/**
* Validate that a {@link String} is a valid
* {@link de.hitec.nhplus.medication.Medication#administrationMethod Medication administration method}.
* @param text The {@link String} to validate.
*/
public static boolean isValidMedicationAdministrationMethod(String text) {
return !text.isBlank();
}
/**
* Validate that a {@link String} is a valid stock count.
* @param text The {@link String} to validate.
*/
public static boolean isValidStock(String text) {
if (text.isBlank()) {
return false;
}
try {
int stock = Integer.parseInt(text);
return stock >= 0;
} catch (Exception exception) {
return false;
}
}
} }

View file

@ -12,7 +12,7 @@
<Insets top="8" left="8" right="8" bottom="8"/> <Insets top="8" left="8" right="8" bottom="8"/>
</padding> </padding>
<center> <center>
<TableView fx:id="tableView" onMouseClicked="#handleMouseClick"> <TableView fx:id="tableView">
<columns> <columns>
<TableColumn <TableColumn
fx:id="columnId" fx:id="columnId"
@ -66,7 +66,6 @@
fx:id="buttonAdd" fx:id="buttonAdd"
mnemonicParsing="false" mnemonicParsing="false"
prefWidth="90.0" prefWidth="90.0"
onAction="#handleNewMedication"
text="Hinzufügen" text="Hinzufügen"
/> />
<Button <Button

View file

@ -1,141 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.geometry.*?>
<?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.medication.MedicationModalController"
>
<padding>
<Insets top="8" left="8" bottom="8" right="8"/>
</padding>
<top>
<GridPane hgap="8.0">
<columnConstraints>
<ColumnConstraints hgrow="NEVER"/>
<ColumnConstraints hgrow="ALWAYS"/>
<ColumnConstraints hgrow="NEVER"/>
<ColumnConstraints hgrow="NEVER"/>
<ColumnConstraints hgrow="ALWAYS"/>
</columnConstraints>
<rowConstraints>
<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="Name:"
/>
<TextField
fx:id="textFieldName"
GridPane.rowIndex="0"
GridPane.columnIndex="1"
/>
<Label
GridPane.rowIndex="0"
GridPane.columnIndex="3"
text="Hersteller:"
/>
<TextField
fx:id="textFieldManufacturer"
GridPane.rowIndex="0"
GridPane.columnIndex="4"
/>
<!-- Row 1 -->
<Label
GridPane.rowIndex="1"
GridPane.columnIndex="0"
text="Verabreichungsmethode:"
/>
<TextField
fx:id="textFieldAdministrationMethod"
GridPane.rowIndex="1"
GridPane.columnIndex="1"
/>
<Label
GridPane.rowIndex="1"
GridPane.columnIndex="3"
text="Lagerbestand:"
/>
<TextField
fx:id="textFieldCurrentStock"
GridPane.rowIndex="1"
GridPane.columnIndex="4"
/>
</GridPane>
</top>
<center>
<BorderPane>
<padding>
<Insets top="8" bottom="8"/>
</padding>
<left>
<BorderPane>
<BorderPane.margin>
<Insets right="8"/>
</BorderPane.margin>
<top>
<Label text="Inhaltsstoffe:"/>
</top>
<center>
<ListView fx:id="listViewIngredients" minWidth="200">
<BorderPane.margin>
<Insets top="8"/>
</BorderPane.margin>
</ListView>
</center>
<bottom>
<AnchorPane>
<BorderPane.margin>
<Insets top="8"/>
</BorderPane.margin>
<Button
onAction="#handleAddIngredient"
text="+"
AnchorPane.leftAnchor="0"
AnchorPane.rightAnchor="0"
/>
</AnchorPane>
</bottom>
</BorderPane>
</left>
<center>
<BorderPane>
<top>
<Label text="Nebenwirkungen"/>
</top>
<center>
<TextArea fx:id="textAreaPossibleSideEffects"/>
</center>
</BorderPane>
</center>
</BorderPane>
</center>
<bottom>
<BorderPane>
<right>
<HBox spacing="8.0">
<Button
fx:id="buttonSave"
prefWidth="90"
mnemonicParsing="false"
onAction="#handleSave"
text="Speichern"
/>
<Button
prefWidth="90"
mnemonicParsing="false"
onAction="#handleCancel"
text="Abbrechen"
/>
</HBox>
</right>
</BorderPane>
</bottom>
</BorderPane>

View file

@ -22,19 +22,16 @@
<TableColumn <TableColumn
fx:id="columnSurName" fx:id="columnSurName"
minWidth="140.0" minWidth="140.0"
onEditCommit="#handleOnEditSurname"
text="Nachname" text="Nachname"
/> />
<TableColumn <TableColumn
fx:id="columnFirstName" fx:id="columnFirstName"
minWidth="140.0" minWidth="140.0"
onEditCommit="#handleOnEditFirstname"
text="Vorname" text="Vorname"
/> />
<TableColumn <TableColumn
fx:id="columnPhoneNumber" fx:id="columnPhoneNumber"
minWidth="140.0" minWidth="140.0"
onEditCommit="#handleOnEditPhoneNumber"
text="Telefonnummer" text="Telefonnummer"
/> />
</columns> </columns>

View file

@ -119,7 +119,7 @@
fx:id="textAreaRemarks" fx:id="textAreaRemarks"
HBox.hgrow="ALWAYS" HBox.hgrow="ALWAYS"
/> />
<VBox spacing="8.0"> <VBox>
<Button <Button
fx:id="buttonSave" fx:id="buttonSave"
prefWidth="90" prefWidth="90"