#23: Create Medication Modal
All checks were successful
Quality Check / Linting Check (push) Successful in 12s
Quality Check / Javadoc Check (push) Successful in 20s

This commit is contained in:
Ole Kück 2024-05-08 16:58:00 +02:00
parent 9de598ef67
commit e96e10a7d6
4 changed files with 57 additions and 0 deletions

View file

@ -1,15 +1,22 @@
package de.hitec.nhplus.medication; package de.hitec.nhplus.medication;
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 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.event.ActionEvent;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
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.io.IOException;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -66,4 +73,27 @@ public class AllMedicationController {
exception.printStackTrace(); exception.printStackTrace();
} }
} }
@FXML
public void handleNewMedication() {
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.setScene(scene);
stage.setTitle("NHPlus - Neues Medikament");
stage.setResizable(true);
stage.setAlwaysOnTop(true);
stage.showAndWait();
} catch (IOException exception) {
exception.printStackTrace();
}
}
} }

View file

@ -0,0 +1,8 @@
package de.hitec.nhplus.medication;
public class MedicationModalController {
public void initialize(){
}
}

View file

@ -66,6 +66,7 @@
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

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.layout.*?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Label?>
<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>
<center>
<Label text="Test"/>
</center>
</BorderPane>