feat/menus #7

Merged
PBS2H21AKA merged 6 commits from feat/menus into main 2023-01-31 10:31:15 +01:00
5 changed files with 26 additions and 18 deletions
Showing only changes of commit 1c85261c7b - Show all commits

View File

@ -26,12 +26,8 @@ public class LoginController {
String email = tfEmail.getText();
String password = pfPassword.getText();
if(benutzerMap.containsKey(email) && benutzerMap.containsValue(password)){
FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.class.getResource("menue-view.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 950,480);
Stage stage = new Stage();
stage.setTitle("Essen Bestellung im Kindergarten");
stage.setScene(scene);
stage.show();
// if user is worker: StartViewApplication.changeScene("workerMenu-view.fxml");
StartViewApplication.changeScene("parentMenu-view.fxml");
}else {
Alert alert = new Alert(Alert.AlertType.ERROR,"Email oder Passwort ist falsch");
alert.showAndWait();
@ -42,12 +38,6 @@ public class LoginController {
}
@FXML
protected void changeToSignUp() throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.class.getResource("signUp-view.fxml"));
Scene scene = new Scene(fxmlLoader.load(), 950,480);
Stage stage = new Stage();
stage.setTitle("Essen Bestellung im Kindergarten");
stage.setScene(scene);
stage.show();
StartViewApplication.changeScene("signUp-view.fxml");
}
}

View File

@ -55,8 +55,7 @@ public class ParentMenuController {
@FXML
public void onAusloggenClick(MouseEvent mouseEvent) throws IOException {
Parent p = FXMLLoader.load(StartViewApplication.class.getResource("workerMenu-view.fxml"));
StartViewApplication.primary.getScene().setRoot(p);
StartViewApplication.changeScene("workerMenu-view.fxml");
}
private void changePage(String page) {

View File

@ -0,0 +1,11 @@
package com.bib.essensbestellungsverwaltung;
import javafx.event.ActionEvent;
public class SingUpController {
public void onKontoErstellenBtClick(ActionEvent actionEvent) {
}
public void onAnmeldenBtClick(ActionEvent actionEvent) {
}
}

View File

@ -7,6 +7,7 @@ package com.bib.essensbestellungsverwaltung;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
@ -14,6 +15,7 @@ import java.io.IOException;
public class StartViewApplication extends Application {
public static Stage primary;
@Override
public void start(Stage stage) throws IOException {
FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.class.getResource("login-view.fxml"));
@ -34,4 +36,9 @@ public class StartViewApplication extends Application {
//Database.deleteSample();
launch();
}
public static void changeScene(String scene) throws IOException {
Parent p = FXMLLoader.load(StartViewApplication.class.getResource(scene));
primary.getScene().setRoot(p);
}
}

View File

@ -40,6 +40,7 @@ public class WorkerMenuController {
@FXML
public void onWochenplanClick(MouseEvent mouseEvent) {
changePage("createFoodplan-view.fxml");
setButtonActive(wochenplanButton);
}
@ -59,6 +60,7 @@ public class WorkerMenuController {
@FXML
public void onMahlzeitClick(MouseEvent mouseEvent) {
changePage("createFood-view.fxml");
setButtonActive(mahlzeitButton);
}
@ -69,8 +71,7 @@ public class WorkerMenuController {
@FXML
public void onAusloggenClick(MouseEvent mouseEvent) throws IOException {
Parent p = FXMLLoader.load(StartViewApplication.class.getResource("parentMenu-view.fxml"));
StartViewApplication.primary.getScene().setRoot(p);
StartViewApplication.changeScene("parentMenu-view.fxml");
}
private void changePage(String page) {