w/e
This commit is contained in:
@@ -6,6 +6,7 @@ import RestAPISchnittstelle.RestApiClient;
|
||||
import javafx.beans.value.ChangeListener;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.geometry.Pos;
|
||||
@@ -32,14 +33,6 @@ import static java.time.LocalTime.now;
|
||||
|
||||
public class EssensverwaltungMitarbeiterView {
|
||||
|
||||
public Label g1Name;
|
||||
public Label g2Name;
|
||||
public Label g3Name;
|
||||
public Label g4Name;
|
||||
public Label g1Beschreibung;
|
||||
public Label g2Beschreibung;
|
||||
public Label g3Beschreibung;
|
||||
public Label g4Beschreibung;
|
||||
public Label dateLabel;
|
||||
@FXML
|
||||
private GridPane tagesplan;
|
||||
@@ -79,29 +72,11 @@ public class EssensverwaltungMitarbeiterView {
|
||||
|
||||
dateLabel.setText(String.format("%s.%s.%s", day, month, year));
|
||||
|
||||
|
||||
initGrid();
|
||||
initGerichte();
|
||||
|
||||
for (int i = 0; i < tagesplan.getColumnCount(); i++) {
|
||||
ColumnConstraints cc = new ColumnConstraints();
|
||||
cc.setHgrow(Priority.ALWAYS);
|
||||
cc.setFillWidth(true);
|
||||
tagesplan.getColumnConstraints().add(cc);
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
VerwaltungApplication.responsiveBreiteGrid(tagesplan);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void onAbmelden(ActionEvent actionEvent) {
|
||||
VerwaltungApplication.sceneWechseln("login-view.fxml");
|
||||
}
|
||||
@@ -128,6 +103,10 @@ public class EssensverwaltungMitarbeiterView {
|
||||
VerwaltungApplication.sceneWechseln("hauptmenue_mitarbeiter-view.fxml");
|
||||
}
|
||||
|
||||
/**
|
||||
* Methode bei Klick auf Pfeil links, ändert das Datum und gibt neue Gerichte auf die GUI aus.
|
||||
* @param actionEvent
|
||||
*/
|
||||
public void pfeilLinks(ActionEvent actionEvent) {
|
||||
|
||||
tagesplan.getChildren().clear();
|
||||
@@ -141,6 +120,10 @@ public class EssensverwaltungMitarbeiterView {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Methode bei Klick auf Pfeil rechts, ändert das Datum und gibt neue Gerichte auf die GUI aus.
|
||||
* @param actionEvent
|
||||
*/
|
||||
public void pfeilRechts(ActionEvent actionEvent) {
|
||||
|
||||
tagesplan.getChildren().clear();
|
||||
@@ -154,6 +137,9 @@ public class EssensverwaltungMitarbeiterView {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialisiert alle Gerichte des aktuellen Datums auf der Seite
|
||||
*/
|
||||
private void initGerichte(){
|
||||
|
||||
tagesplan.getStyleClass().clear();
|
||||
@@ -167,8 +153,9 @@ public class EssensverwaltungMitarbeiterView {
|
||||
Label beschreibung = new Label();
|
||||
beschreibung.setWrapText(true);
|
||||
tagesplan.add(beschreibung, i, 1);
|
||||
//Button loeschen = new Button("Löschen");
|
||||
//tagesplan.add(loeschen, i ,2);
|
||||
Button loeschen = new Button("Löschen");
|
||||
tagesplan.add(loeschen, i ,2);
|
||||
loeschen.setOnAction(this::loeschenButtonKlick);
|
||||
|
||||
name.setText(t.getGerichte().get(i).getName());
|
||||
beschreibung.setText(t.getGerichte().get(i).getBeschreibung());
|
||||
@@ -181,13 +168,50 @@ public class EssensverwaltungMitarbeiterView {
|
||||
tagesplan.add(label, 0, 0);
|
||||
}
|
||||
|
||||
for (Node n : tagesplan.getChildren()) {
|
||||
if (n instanceof Control) {
|
||||
((Control) n).setPrefWidth(tagesplan.getWidth() / tagesplan.getColumnCount());
|
||||
}
|
||||
}
|
||||
|
||||
for (Node n : tagesplan.getChildren()){
|
||||
if(n instanceof Control && GridPane.getRowIndex(n) == 1){
|
||||
((Control) n).setPrefHeight(tagesplan.getHeight());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
tagesplan.getStyleClass().add("essensuebersicht_gridlines");
|
||||
}
|
||||
|
||||
public void initGrid(){
|
||||
for (int i = 0; i < tagesplan.getColumnCount(); i++) {
|
||||
ColumnConstraints cc = new ColumnConstraints();
|
||||
cc.setHgrow(Priority.ALWAYS);
|
||||
cc.setFillWidth(true);
|
||||
tagesplan.getColumnConstraints().add(cc);
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
VerwaltungApplication.responsiveBreiteGrid(tagesplan);
|
||||
}
|
||||
|
||||
private void loeschenButtonKlick(ActionEvent a){
|
||||
Button btn = (Button) a.getSource();
|
||||
int col = GridPane.getColumnIndex(btn);
|
||||
t.getGerichte().remove(col);
|
||||
initGerichte();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user