Compare commits
No commits in common. "feba2a14b2b9bc4886709677805e9a35e9bf4f03" and "f0d87b0e432d38977f6d6b594f544746fdfc34a1" have entirely different histories.
feba2a14b2
...
f0d87b0e43
@ -282,12 +282,6 @@ public class RestApiClient implements IRestAPI{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Startet einen guckt ob die mitgegebenen Anmeldedaten in der Kombination existieren.
|
|
||||||
*
|
|
||||||
* @param credentials Die Anmeldedaten in Json-String form
|
|
||||||
* @return True oder false, je nach Erfolg des Anmeldeversuchs
|
|
||||||
*/
|
|
||||||
public boolean anmeldeVersuch(String credentials){
|
public boolean anmeldeVersuch(String credentials){
|
||||||
|
|
||||||
JsonObject json = gson.fromJson(credentials, JsonObject.class);
|
JsonObject json = gson.fromJson(credentials, JsonObject.class);
|
||||||
@ -322,12 +316,6 @@ public class RestApiClient implements IRestAPI{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Holt alle Gerichte eines mitgegebenen Tages aus der Datenbank
|
|
||||||
*
|
|
||||||
* @param datum Das angeforderte Datum in String Form (YYYY-MM-DD)
|
|
||||||
* @return Ein Tagesplan Objekt mit allen Gerichten
|
|
||||||
*/
|
|
||||||
public Tagesplan getGerichteOnTag(String datum){
|
public Tagesplan getGerichteOnTag(String datum){
|
||||||
|
|
||||||
URI apiUri = URI.create(String.format("%s/Tagesplan/getGerichteOnTag?datum=%s", urlBase, datum));
|
URI apiUri = URI.create(String.format("%s/Tagesplan/getGerichteOnTag?datum=%s", urlBase, datum));
|
||||||
|
@ -6,7 +6,6 @@ import RestAPISchnittstelle.RestApiClient;
|
|||||||
import javafx.beans.value.ChangeListener;
|
import javafx.beans.value.ChangeListener;
|
||||||
import javafx.beans.value.ObservableValue;
|
import javafx.beans.value.ObservableValue;
|
||||||
import javafx.collections.FXCollections;
|
import javafx.collections.FXCollections;
|
||||||
import javafx.collections.ObservableList;
|
|
||||||
import javafx.event.ActionEvent;
|
import javafx.event.ActionEvent;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.geometry.Pos;
|
import javafx.geometry.Pos;
|
||||||
@ -33,6 +32,14 @@ import static java.time.LocalTime.now;
|
|||||||
|
|
||||||
public class EssensverwaltungMitarbeiterView {
|
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;
|
public Label dateLabel;
|
||||||
@FXML
|
@FXML
|
||||||
private GridPane tagesplan;
|
private GridPane tagesplan;
|
||||||
@ -72,11 +79,29 @@ public class EssensverwaltungMitarbeiterView {
|
|||||||
|
|
||||||
dateLabel.setText(String.format("%s.%s.%s", day, month, year));
|
dateLabel.setText(String.format("%s.%s.%s", day, month, year));
|
||||||
|
|
||||||
initGrid();
|
|
||||||
initGerichte();
|
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) {
|
public void onAbmelden(ActionEvent actionEvent) {
|
||||||
VerwaltungApplication.sceneWechseln("login-view.fxml");
|
VerwaltungApplication.sceneWechseln("login-view.fxml");
|
||||||
}
|
}
|
||||||
@ -103,10 +128,6 @@ public class EssensverwaltungMitarbeiterView {
|
|||||||
VerwaltungApplication.sceneWechseln("hauptmenue_mitarbeiter-view.fxml");
|
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) {
|
public void pfeilLinks(ActionEvent actionEvent) {
|
||||||
|
|
||||||
tagesplan.getChildren().clear();
|
tagesplan.getChildren().clear();
|
||||||
@ -120,10 +141,6 @@ 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) {
|
public void pfeilRechts(ActionEvent actionEvent) {
|
||||||
|
|
||||||
tagesplan.getChildren().clear();
|
tagesplan.getChildren().clear();
|
||||||
@ -137,9 +154,6 @@ public class EssensverwaltungMitarbeiterView {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialisiert alle Gerichte des aktuellen Datums auf der Seite
|
|
||||||
*/
|
|
||||||
private void initGerichte(){
|
private void initGerichte(){
|
||||||
|
|
||||||
tagesplan.getStyleClass().clear();
|
tagesplan.getStyleClass().clear();
|
||||||
@ -153,9 +167,8 @@ public class EssensverwaltungMitarbeiterView {
|
|||||||
Label beschreibung = new Label();
|
Label beschreibung = new Label();
|
||||||
beschreibung.setWrapText(true);
|
beschreibung.setWrapText(true);
|
||||||
tagesplan.add(beschreibung, i, 1);
|
tagesplan.add(beschreibung, i, 1);
|
||||||
Button loeschen = new Button("Löschen");
|
//Button loeschen = new Button("Löschen");
|
||||||
tagesplan.add(loeschen, i ,2);
|
//tagesplan.add(loeschen, i ,2);
|
||||||
loeschen.setOnAction(this::loeschenButtonKlick);
|
|
||||||
|
|
||||||
name.setText(t.getGerichte().get(i).getName());
|
name.setText(t.getGerichte().get(i).getName());
|
||||||
beschreibung.setText(t.getGerichte().get(i).getBeschreibung());
|
beschreibung.setText(t.getGerichte().get(i).getBeschreibung());
|
||||||
@ -173,45 +186,9 @@ public class EssensverwaltungMitarbeiterView {
|
|||||||
((Control) n).setPrefWidth(tagesplan.getWidth() / tagesplan.getColumnCount());
|
((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");
|
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user