diff --git a/.idea/misc.xml b/.idea/misc.xml index a855768..fc45e5d 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -8,7 +8,7 @@ - + \ No newline at end of file diff --git a/src/main/java/de/subway_surfers/vpr_app/EssensverwaltungMitarbeiterView.java b/src/main/java/de/subway_surfers/vpr_app/EssensverwaltungMitarbeiterView.java new file mode 100644 index 0000000..386b8e6 --- /dev/null +++ b/src/main/java/de/subway_surfers/vpr_app/EssensverwaltungMitarbeiterView.java @@ -0,0 +1,50 @@ +package de.subway_surfers.vpr_app; + +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.geometry.Pos; +import javafx.scene.Node; +import javafx.scene.control.Control; +import javafx.scene.layout.ColumnConstraints; +import javafx.scene.layout.GridPane; +import javafx.scene.layout.Priority; +import javafx.scene.layout.RowConstraints; + + +public class EssensverwaltungMitarbeiterView { + @FXML + private GridPane tagesplan; + + public void initialize(){ + for (int i = 0; i < tagesplan.getColumnCount(); i++) { + ColumnConstraints cc = new ColumnConstraints(); + cc.setHgrow(Priority.ALWAYS); + cc.setFillWidth(true); + tagesplan.getColumnConstraints().add(cc); + } + VerwaltungApplication.responsiveBreiteGrid(tagesplan); + + tagesplan.heightProperty().addListener((obs,oldValue,newValue) -> { + final int zeile = 1; + for (Node n : tagesplan.getChildren()){ + if(n instanceof Control && GridPane.getRowIndex(n) == zeile){ + ((Control) n).setPrefHeight(newValue.floatValue()); + } + } + }); + + } + public void onAbmelden(ActionEvent actionEvent) { + VerwaltungApplication.sceneWechseln("login-view.fxml"); + } + + public void onFilter(ActionEvent actionEvent) { + } + + public void onHinzufuegen(ActionEvent actionEvent) { + } + + public void onZurueck(ActionEvent actionEvent) { + } + +} diff --git a/src/main/java/de/subway_surfers/vpr_app/VerwaltungApplication.java b/src/main/java/de/subway_surfers/vpr_app/VerwaltungApplication.java index 7ab829f..a50f92b 100644 --- a/src/main/java/de/subway_surfers/vpr_app/VerwaltungApplication.java +++ b/src/main/java/de/subway_surfers/vpr_app/VerwaltungApplication.java @@ -2,8 +2,11 @@ package de.subway_surfers.vpr_app; import javafx.application.Application; import javafx.fxml.FXMLLoader; +import javafx.scene.Node; import javafx.scene.Scene; import javafx.scene.control.Alert; +import javafx.scene.control.Control; +import javafx.scene.layout.GridPane; import javafx.stage.Stage; import java.io.IOException; @@ -14,7 +17,7 @@ public class VerwaltungApplication extends Application { @Override public void start(Stage stage) throws IOException { - FXMLLoader fxmlLoader = new FXMLLoader(VerwaltungApplication.class.getResource("login-view.fxml")); + FXMLLoader fxmlLoader = new FXMLLoader(VerwaltungApplication.class.getResource("essensverwaltung_mitarbeiter-view.fxml")); Scene scene = new Scene(fxmlLoader.load()); stage.setWidth(960); @@ -108,6 +111,24 @@ public class VerwaltungApplication extends Application { } + /** + * Methode zum automatischen vergrößern und verkleinern von Grids + * + * Geschrieben: Max Heer, Sven Alteköster + * Getestet + * + * @param grid das responsiv sein soll + */ + public static void responsiveBreiteGrid (GridPane grid) { + grid.widthProperty().addListener((obs, oldValue, newValue) -> { + for (Node n : grid.getChildren()) { + if (n instanceof Control) { + ((Control) n).setPrefWidth(newValue.floatValue() / grid.getColumnCount()); + } + } + }); + } + public static void main(String[] args) { launch(); } diff --git a/src/main/resources/de/subway_surfers/vpr_app/essensverwaltung_mitarbeiter-view.fxml b/src/main/resources/de/subway_surfers/vpr_app/essensverwaltung_mitarbeiter-view.fxml new file mode 100644 index 0000000..7b575b6 --- /dev/null +++ b/src/main/resources/de/subway_surfers/vpr_app/essensverwaltung_mitarbeiter-view.fxml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + +