Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company.client.gui.login;
- import com.company.StageController;
- import com.company.client.gui.lobby.LobbyModel;
- import com.company.client.gui.lobby.LobbyView;
- import com.company.client.gui.lobby.gameLobby.GameLobbyModel;
- import com.company.client.gui.login.ForgottenPassword.PasswordView;
- import com.company.client.gui.registration.RegistrationView;
- import com.company.client.network.ClientActionDistributor;
- import com.company.services.AlertService;
- import com.company.shared.action.ActionLogin;
- import javafx.event.ActionEvent;
- import javafx.fxml.FXML;
- import javafx.fxml.Initializable;
- import javafx.scene.Scene;
- import javafx.scene.control.Alert;
- import javafx.scene.control.Label;
- import javafx.scene.control.TextField;
- import javafx.stage.Stage;
- import javax.inject.Inject;
- //import com.company.client.gui.registration.RegistrationView;
- /**
- *
- * Diese Klasse regelt die Anzeige auf dem LoginVIew und leitet Eingaben weiter
- * @author Tom Albrecht
- * @version 1.0.0
- *
- */
- public class LoginPresenter {
- @Inject
- AlertService alertService;
- @FXML
- private TextField passwordFiel;
- @FXML
- private TextField usernameField;
- @FXML
- private Label errorString;
- public void onAnmelden(ActionEvent gedrueckt) {
- if(usernameField.getText().equals("Falsch")){
- onFailedLogin("Der Benutzername ist Falsch");
- }else{
- System.out.println("Angemeldet mit: " +
- usernameField.getText() +
- " und dem Passwort: " +
- passwordFiel.getText());
- onSuccessfullLogin();
- }
- }
- public void onSuccessfullLogin(){
- Stage window = StageController.getWindow();
- LobbyView appView = new LobbyView();
- Scene scene = new Scene(appView.getView());
- window.setScene(scene);
- }
- public void onFailedLogin(String Fehler){
- alertService.showAlert(Alert.AlertType.ERROR, "Fehler", null, Fehler);
- }
- public void onPassword(ActionEvent gedrueckt) {
- Stage window = StageController.getWindow();
- PasswordView appView = new PasswordView();
- Scene scene = new Scene(appView.getView());
- window.setScene((scene));
- }
- public void onRegistrieren(ActionEvent gedrueckt) {
- Stage window = StageController.getWindow();
- RegistrationView appView = new RegistrationView();
- Scene scene = new Scene(appView.getView());
- window.setScene(scene);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement