Merge branch 'merge' into 1720-UI-User-anlegen
This commit is contained in:
@@ -3,10 +3,7 @@ package main;
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.CheckBox;
|
||||
import javafx.scene.control.ComboBox;
|
||||
import javafx.scene.control.DatePicker;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.stage.Stage;
|
||||
import res.DataController;
|
||||
import res.Event;
|
||||
@@ -29,39 +26,50 @@ public class CreateEventController {
|
||||
public CheckBox checkBoxIsFullDay;
|
||||
@FXML
|
||||
public CheckBox checkBoxIsPrivate;
|
||||
|
||||
|
||||
public CreateEventController(){}
|
||||
|
||||
@FXML
|
||||
public void initialize(){}
|
||||
public Label labelError;
|
||||
|
||||
|
||||
@FXML
|
||||
protected void createBtnClick(ActionEvent actionEvent){
|
||||
|
||||
Event event = new Event(
|
||||
textName.getText(),
|
||||
ComboBoxPriotity.getSelectionModel().getSelectedIndex(),
|
||||
checkBoxIsFullDay.isSelected(),
|
||||
checkBoxIsPrivate.isSelected(),
|
||||
textStart.getText(),
|
||||
textEnd.getText(),
|
||||
datePickerDate.getValue().atStartOfDay(),
|
||||
1
|
||||
);
|
||||
|
||||
System.out.println(event.getAsUrlParam());
|
||||
|
||||
DataController dataController = new DataController();
|
||||
dataController.createEvent(event);
|
||||
|
||||
Stage stage = (Stage) ((Node) actionEvent.getSource()).getScene().getWindow();
|
||||
stage.close();
|
||||
public CreateEventController() {
|
||||
}
|
||||
|
||||
@FXML
|
||||
protected void abortBtnClick(ActionEvent event){
|
||||
public void initialize() {
|
||||
}
|
||||
|
||||
|
||||
@FXML
|
||||
protected void createBtnClick(ActionEvent actionEvent) {
|
||||
try {
|
||||
if (datePickerDate.getValue() == null) {
|
||||
throw new IllegalArgumentException("Bitte w\u00e4hle ein Datum aus");
|
||||
}
|
||||
|
||||
Event event = new Event(
|
||||
textName.getText(),
|
||||
ComboBoxPriotity.getSelectionModel().getSelectedIndex(),
|
||||
checkBoxIsFullDay.isSelected(),
|
||||
checkBoxIsPrivate.isSelected(),
|
||||
textStart.getText(),
|
||||
textEnd.getText(),
|
||||
datePickerDate.getValue().atStartOfDay(),
|
||||
(int) DataController.USER_ID
|
||||
);
|
||||
|
||||
System.out.println(event.getAsUrlParam());
|
||||
|
||||
DataController dataController = new DataController();
|
||||
dataController.createEvent(event);
|
||||
|
||||
Stage stage = (Stage) ((Node) actionEvent.getSource()).getScene().getWindow();
|
||||
stage.close();
|
||||
} catch (RuntimeException e) {
|
||||
labelError.setText(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
protected void abortBtnClick(ActionEvent event) {
|
||||
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
||||
stage.close();
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
package main;
|
||||
|
||||
public class Launcher {
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
MainApplication.main(args);
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
import res.DataController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
@@ -14,19 +15,23 @@ public class MainApplication extends Application {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(MainApplication.class.getResource("main-view.fxml"));
|
||||
|
||||
Scene scene = new Scene(fxmlLoader.load(), 1200, 700);
|
||||
scene.getStylesheets().add(Objects.requireNonNull(MainApplication.class.getResource("main-view.css")).toExternalForm());
|
||||
scene.getStylesheets().add(Objects.requireNonNull(
|
||||
MainApplication.class.getResource("main-view.css")).toExternalForm());
|
||||
stage.setTitle("SharePlaner");
|
||||
stage.setScene(scene);
|
||||
stage.show();
|
||||
|
||||
FXMLLoader fxmlLoaderLogin = new FXMLLoader(MainApplication.class.getResource("../users/login.fxml"));
|
||||
Scene sceneLogin = new Scene(fxmlLoaderLogin.load(), 650, 500);
|
||||
sceneLogin.getStylesheets().add(Objects.requireNonNull(MainApplication.class.getResource("../users/login.css")).toExternalForm());
|
||||
sceneLogin.getStylesheets().add(Objects.requireNonNull(
|
||||
MainApplication.class.getResource("../users/login.css")).toExternalForm());
|
||||
Stage stageLogin = new Stage();
|
||||
stageLogin.setTitle("Anmelden");
|
||||
stageLogin.setScene(sceneLogin);
|
||||
stageLogin.show();
|
||||
stageLogin.showAndWait();
|
||||
|
||||
if (DataController.USER_ID >= 0) {
|
||||
stage.show();
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
@@ -65,12 +65,35 @@ public class MainController {
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
protected void onBackClick() {
|
||||
weekOffset--;
|
||||
setDates();
|
||||
updateEvents();
|
||||
}
|
||||
|
||||
@FXML
|
||||
protected void onTodayClick() {
|
||||
weekOffset = 0;
|
||||
setDates();
|
||||
updateEvents();
|
||||
}
|
||||
|
||||
@FXML
|
||||
protected void onNextClick() {
|
||||
weekOffset++;
|
||||
setDates();
|
||||
updateEvents();
|
||||
}
|
||||
|
||||
@FXML
|
||||
protected void onAddBtnClick() {
|
||||
try {
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(MainApplication.class.getResource("create-event.fxml"));
|
||||
Scene scene = new Scene(fxmlLoader.load(), 650, 500);
|
||||
scene.getStylesheets().add(Objects.requireNonNull(MainApplication.class.getResource("create-event.css")).toExternalForm());
|
||||
FXMLLoader fxmlLoader = new FXMLLoader(
|
||||
MainApplication.class.getResource("create-event.fxml"));
|
||||
Scene scene = new Scene(fxmlLoader.load(), 650, 650);
|
||||
scene.getStylesheets().add(Objects.requireNonNull(
|
||||
MainApplication.class.getResource("create-event.css")).toExternalForm());
|
||||
Stage stage = new Stage();
|
||||
stage.setTitle("Termin erstellen");
|
||||
stage.setScene(scene);
|
||||
@@ -161,7 +184,8 @@ public class MainController {
|
||||
|
||||
LocalDateTime eventDate = event.getDate();
|
||||
|
||||
int day = (int) Duration.between(weekStartDateTime.toLocalDate().atStartOfDay(), eventDate.toLocalDate().atStartOfDay()).toDays();
|
||||
int day = (int) Duration.between(
|
||||
weekStartDateTime.toLocalDate().atStartOfDay(), eventDate.toLocalDate().atStartOfDay()).toDays();
|
||||
|
||||
if (day >= 0 && day < 7) {
|
||||
dayVBoxes[day].getChildren().add(vBox);
|
||||
|
@@ -1,4 +0,0 @@
|
||||
package users;
|
||||
|
||||
public class LoginControler {
|
||||
}
|
50
client/app/src/main/java/users/LoginController.java
Normal file
50
client/app/src/main/java/users/LoginController.java
Normal file
@@ -0,0 +1,50 @@
|
||||
package users;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.Node;
|
||||
import javafx.scene.control.Label;
|
||||
import javafx.scene.control.TextField;
|
||||
import javafx.stage.Stage;
|
||||
import res.DataController;
|
||||
|
||||
public class LoginController {
|
||||
@FXML
|
||||
public TextField userField;
|
||||
@FXML
|
||||
public TextField passField;
|
||||
@FXML
|
||||
public Label userErrLabel;
|
||||
@FXML
|
||||
public Label passErrLabel;
|
||||
|
||||
@FXML
|
||||
protected void login(ActionEvent event) {
|
||||
if (userField.getText().trim().isEmpty()) {
|
||||
userErrLabel.setText("Bitte Usernamen eingeben!");
|
||||
passErrLabel.setText("");
|
||||
return;
|
||||
}
|
||||
if (passField.getText().trim().isEmpty()) {
|
||||
userErrLabel.setText("");
|
||||
passErrLabel.setText("Bitte Passwort eingeben!");
|
||||
return;
|
||||
}
|
||||
|
||||
DataController dataController = new DataController();
|
||||
if (!dataController.login(userField.getText(), passField.getText())) {
|
||||
userErrLabel.setText("Name und Passwort passen nicht zueinander!");
|
||||
passErrLabel.setText("Name und Passwort passen nicht zueinander!");
|
||||
return;
|
||||
}
|
||||
|
||||
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
||||
stage.close();
|
||||
}
|
||||
|
||||
@FXML
|
||||
protected void abortBtnClick(ActionEvent event) {
|
||||
Stage stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
|
||||
stage.close();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user