w/e #17
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@ -8,7 +8,7 @@
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_X" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" default="true" project-jdk-name="21" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
@ -250,6 +250,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){
|
||||
|
||||
JsonObject json = gson.fromJson(credentials, JsonObject.class);
|
||||
@ -284,6 +290,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){
|
||||
|
||||
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.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();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user