Advertisement
Guest User

Untitled

a guest
Nov 16th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.52 KB | None | 0 0
  1. package com.company.client.gui.login;
  2.  
  3. import com.company.StageController;
  4. import com.company.client.gui.lobby.LobbyModel;
  5. import com.company.client.gui.lobby.LobbyView;
  6. import com.company.client.gui.lobby.gameLobby.GameLobbyModel;
  7. import com.company.client.gui.login.ForgottenPassword.PasswordView;
  8. import com.company.client.gui.registration.RegistrationView;
  9. import com.company.client.network.ClientActionDistributor;
  10. import com.company.services.AlertService;
  11. import com.company.shared.action.ActionLogin;
  12. import javafx.event.ActionEvent;
  13. import javafx.fxml.FXML;
  14. import javafx.fxml.Initializable;
  15. import javafx.scene.Scene;
  16. import javafx.scene.control.Alert;
  17. import javafx.scene.control.Label;
  18. import javafx.scene.control.TextField;
  19. import javafx.stage.Stage;
  20.  
  21. import javax.inject.Inject;
  22.  
  23. //import com.company.client.gui.registration.RegistrationView;
  24.  
  25.  
  26.  
  27. /**
  28.  *
  29.  * Diese Klasse regelt die Anzeige auf dem LoginVIew und leitet Eingaben weiter
  30.  * @author Tom Albrecht
  31.  * @version 1.0.0
  32.  *
  33.  */
  34.  
  35. public class LoginPresenter {
  36.     @Inject
  37.     AlertService alertService;
  38.  
  39.     @FXML
  40.     private TextField passwordFiel;
  41.     @FXML
  42.     private TextField usernameField;
  43.     @FXML
  44.     private Label errorString;
  45.  
  46.  
  47.     public void onAnmelden(ActionEvent gedrueckt) {
  48.         if(usernameField.getText().equals("Falsch")){
  49.             onFailedLogin("Der Benutzername ist Falsch");
  50.         }else{
  51.             System.out.println("Angemeldet mit: " +
  52.                     usernameField.getText() +
  53.                     " und dem Passwort: " +
  54.                     passwordFiel.getText());
  55.             onSuccessfullLogin();
  56.         }
  57.     }
  58.  
  59.     public void onSuccessfullLogin(){
  60.         Stage window = StageController.getWindow();
  61.         LobbyView appView = new LobbyView();
  62.         Scene scene = new Scene(appView.getView());
  63.  
  64.         window.setScene(scene);
  65.     }
  66.  
  67.     public void onFailedLogin(String Fehler){
  68.         alertService.showAlert(Alert.AlertType.ERROR, "Fehler", null, Fehler);
  69.     }
  70.  
  71.     public void onPassword(ActionEvent gedrueckt) {
  72.         Stage window = StageController.getWindow();
  73.         PasswordView appView = new PasswordView();
  74.         Scene scene = new Scene(appView.getView());
  75.  
  76.         window.setScene((scene));
  77.     }
  78.  
  79.  
  80.     public void onRegistrieren(ActionEvent gedrueckt) {
  81.         Stage window = StageController.getWindow();
  82.         RegistrationView appView = new RegistrationView();
  83.         Scene scene = new Scene(appView.getView());
  84.  
  85.         window.setScene(scene);
  86.  
  87.     }
  88.  
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement