Merge pull request 'w/e' (#17) from samu_masken into master
Reviewed-on: #17
This commit is contained in:
commit
feba2a14b2
@ -282,6 +282,12 @@ 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);
|
||||||
@ -316,6 +322,12 @@ 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,6 +6,7 @@ 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;
|
||||||
@ -32,14 +33,6 @@ 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;
|
||||||
@ -58,7 +51,7 @@ public class EssensverwaltungMitarbeiterView {
|
|||||||
|
|
||||||
public void initialize(){
|
public void initialize(){
|
||||||
|
|
||||||
/*
|
/*
|
||||||
(obs,oldValue,newValue) -> {
|
(obs,oldValue,newValue) -> {
|
||||||
final int zeile = 1;
|
final int zeile = 1;
|
||||||
for (Node n : tagesplan.getChildren()){
|
for (Node n : tagesplan.getChildren()){
|
||||||
@ -79,29 +72,11 @@ 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");
|
||||||
}
|
}
|
||||||
@ -128,6 +103,10 @@ 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();
|
||||||
@ -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) {
|
public void pfeilRechts(ActionEvent actionEvent) {
|
||||||
|
|
||||||
tagesplan.getChildren().clear();
|
tagesplan.getChildren().clear();
|
||||||
@ -154,6 +137,9 @@ public class EssensverwaltungMitarbeiterView {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialisiert alle Gerichte des aktuellen Datums auf der Seite
|
||||||
|
*/
|
||||||
private void initGerichte(){
|
private void initGerichte(){
|
||||||
|
|
||||||
tagesplan.getStyleClass().clear();
|
tagesplan.getStyleClass().clear();
|
||||||
@ -167,8 +153,9 @@ 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());
|
||||||
@ -186,9 +173,45 @@ 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