aus main stuff kopiert
This commit is contained in:
parent
2814244d29
commit
f09d63dd21
@ -1,4 +1,3 @@
|
|||||||
/*Reshad Meher*/
|
|
||||||
package com.bib.essensbestellungsverwaltung;
|
package com.bib.essensbestellungsverwaltung;
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
@ -15,6 +14,7 @@ import java.util.HashMap;
|
|||||||
public class LoginController {
|
public class LoginController {
|
||||||
@FXML
|
@FXML
|
||||||
private TextField tfEmail;
|
private TextField tfEmail;
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private PasswordField pfPassword;
|
private PasswordField pfPassword;
|
||||||
|
|
||||||
@ -25,20 +25,18 @@ public class LoginController {
|
|||||||
String email = tfEmail.getText();
|
String email = tfEmail.getText();
|
||||||
String password = pfPassword.getText();
|
String password = pfPassword.getText();
|
||||||
if(benutzerMap.containsKey(email) && benutzerMap.containsValue(password)){
|
if(benutzerMap.containsKey(email) && benutzerMap.containsValue(password)){
|
||||||
FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.class.getResource("menue-view.fxml"));
|
// if user is worker: StartViewApplication.changeScene("workerMenu-view.fxml");
|
||||||
Scene scene = new Scene(fxmlLoader.load(), 950,480);
|
StartViewApplication.changeScene("parentMenu-view.fxml");
|
||||||
HelloApplication.primary.setScene(scene);
|
|
||||||
}else {
|
}else {
|
||||||
Alert alert = new Alert(Alert.AlertType.ERROR,"Email oder Passwort ist falsch");
|
Alert alert = new Alert(Alert.AlertType.ERROR,"Email oder Passwort ist falsch");
|
||||||
alert.showAndWait();
|
alert.showAndWait();
|
||||||
}
|
}
|
||||||
|
|
||||||
tfEmail.setText("");
|
tfEmail.setText("");
|
||||||
pfPassword.setText("");
|
pfPassword.setText("");
|
||||||
}
|
}
|
||||||
@FXML
|
@FXML
|
||||||
protected void changeToSignUp() throws IOException {
|
protected void changeToSignUp() throws IOException {
|
||||||
FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.class.getResource("signUp-view.fxml"));
|
StartViewApplication.changeScene("signUp-view.fxml");
|
||||||
Scene scene = new Scene(fxmlLoader.load(), 950,480);
|
|
||||||
HelloApplication.primary.setScene(scene);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ package com.bib.essensbestellungsverwaltung;
|
|||||||
|
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.Parent;
|
||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
@ -14,11 +15,12 @@ import java.io.IOException;
|
|||||||
|
|
||||||
public class StartViewApplication extends Application {
|
public class StartViewApplication extends Application {
|
||||||
public static Stage primary;
|
public static Stage primary;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage stage) throws IOException {
|
public void start(Stage stage) throws IOException {
|
||||||
FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.class.getResource("login-view.fxml"));
|
FXMLLoader fxmlLoader = new FXMLLoader(StartViewApplication.class.getResource("login-view.fxml"));
|
||||||
Scene scene = new Scene(fxmlLoader.load(), 950,480);
|
Scene scene = new Scene(fxmlLoader.load(), 1200, 750);
|
||||||
//stage = primary;
|
primary = stage;
|
||||||
stage.setTitle("Essen Bestellung im Kindergarten");
|
stage.setTitle("Essen Bestellung im Kindergarten");
|
||||||
stage.setScene(scene);
|
stage.setScene(scene);
|
||||||
stage.show();
|
stage.show();
|
||||||
@ -34,4 +36,9 @@ public class StartViewApplication extends Application {
|
|||||||
//Database.deleteSample();
|
//Database.deleteSample();
|
||||||
launch();
|
launch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void changeScene(String scene) throws IOException {
|
||||||
|
Parent p = FXMLLoader.load(StartViewApplication.class.getResource(scene));
|
||||||
|
primary.getScene().setRoot(p);
|
||||||
|
}
|
||||||
}
|
}
|
@ -0,0 +1,95 @@
|
|||||||
|
package com.bib.essensbestellungsverwaltung;
|
||||||
|
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.Parent;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.input.MouseEvent;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class WorkerMenuController {
|
||||||
|
@FXML
|
||||||
|
public BorderPane contentView;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
Button tagesbestellungButton;
|
||||||
|
@FXML
|
||||||
|
Button wochenplanButton;
|
||||||
|
@FXML
|
||||||
|
Button monatsabrechnungButton;
|
||||||
|
@FXML
|
||||||
|
Button mitarbeiterButton;
|
||||||
|
@FXML
|
||||||
|
Button mahlzeitButton;
|
||||||
|
@FXML
|
||||||
|
Button einstellungenButton;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void initialize() {
|
||||||
|
changePage("menue-view.fxml");
|
||||||
|
setButtonActive(tagesbestellungButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void onTagesbestellungenClick(MouseEvent mouseEvent) {
|
||||||
|
changePage("menue-view.fxml");
|
||||||
|
setButtonActive(tagesbestellungButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void onWochenplanClick(MouseEvent mouseEvent) {
|
||||||
|
changePage("createFoodplan-view.fxml");
|
||||||
|
setButtonActive(wochenplanButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void onMonatsabrechnungClick(MouseEvent mouseEvent) {
|
||||||
|
changePage("invoice-view.fxml");
|
||||||
|
setButtonActive(monatsabrechnungButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void onMitarbeiterClick(MouseEvent mouseEvent) {
|
||||||
|
changePage("createCoworker-view.fxml");
|
||||||
|
setButtonActive(mitarbeiterButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void onMahlzeitClick(MouseEvent mouseEvent) {
|
||||||
|
changePage("createFood-view.fxml");
|
||||||
|
setButtonActive(mahlzeitButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void onEinstellungenClick(MouseEvent mouseEvent) {
|
||||||
|
setButtonActive(einstellungenButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
public void onAusloggenClick(MouseEvent mouseEvent) throws IOException {
|
||||||
|
StartViewApplication.changeScene("parentMenu-view.fxml");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void changePage(String page) {
|
||||||
|
try {
|
||||||
|
Parent root = FXMLLoader.load(getClass().getResource(page));
|
||||||
|
contentView.setCenter(root);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setButtonActive(Button b) {
|
||||||
|
tagesbestellungButton.getStyleClass().remove("active");
|
||||||
|
monatsabrechnungButton.getStyleClass().remove("active");
|
||||||
|
wochenplanButton.getStyleClass().remove("active");
|
||||||
|
mahlzeitButton.getStyleClass().remove("active");
|
||||||
|
mitarbeiterButton.getStyleClass().remove("active");
|
||||||
|
einstellungenButton.getStyleClass().remove("active");
|
||||||
|
b.getStyleClass().add("active");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user