Skip to content
Snippets Groups Projects
Commit 6d576c75 authored by Kevin Thaller's avatar Kevin Thaller
Browse files

Delete unused classes + create Objects from User-Input instead of Strings

parent fa38a976
No related branches found
No related tags found
1 merge request!3jpa+gui+logic
package de.thdeg.grademanager.gui;
import de.thdeg.grademanager.model.Course;
import de.thdeg.grademanager.model.enumeration.BachelorSemester;
import de.thdeg.grademanager.model.enumeration.CourseType;
import de.thdeg.grademanager.model.enumeration.ExamType;
......@@ -56,19 +57,25 @@ public class CourseModificationController {
@FXML
protected void onSaveButtonClick(ActionEvent event) throws IOException {
if(!name.getText().isBlank() && bachelorSemesterComboBox.getValue() != null &&
if (!name.getText().isBlank() && bachelorSemesterComboBox.getValue() != null &&
courseTypeComboBox.getValue() != null && !sws.getText().isBlank() && !ects.getText().isBlank() &&
examTypeComboBox.getValue() != null)
{
examTypeComboBox.getValue() != null) {
bachelorSemester = bachelorSemesterComboBox.getValue();
courseType = courseTypeComboBox.getValue();
examType = examTypeComboBox.getValue();
Course k = new Course(1,
name.getText(),
bachelorSemester,
courseType,
Integer.parseInt(sws.getText()),
Integer.parseInt(ects.getText()),
examType);
switchToCoursesOfStudyModification(event);
}
else
{
} else {
warning.setText("Bitte alle Felder ausfüllen.");
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Fehler");
......
package de.thdeg.grademanager.gui;
//import enumeration.BachelorDegree;
//import enumeration.FieldOfStudy;
//import java.util.List;
import javafx.scene.control.TextField;
import javafx.scene.text.Text;
public class CoursesOfStudy
{
/*
private final int id;
private final String name;
private final BachelorDegree bachelorDegree;
private final int duration;
private final int fees;
private final List<Course> courses;
private FieldOfStudy fieldOfStudy;
public CoursesOfStudy(int id, String name, BachelorDegree bachelorDegree, int duration, int fees, List<Course> courses, FieldOfStudy fieldOfStudy)
{
this.id = id;
this.name = name;
this.bachelorDegree = bachelorDegree;
this.duration = duration;
this.fees = fees;
this.courses = courses;
this.fieldOfStudy = fieldOfStudy;
}
*/
private final TextField duration;
public CoursesOfStudy(TextField duration)
{
this.duration = duration;
}
}
package de.thdeg.grademanager.gui;
import de.thdeg.grademanager.model.CoursesOfStudy;
import de.thdeg.grademanager.model.enumeration.BachelorDegree;
import de.thdeg.grademanager.model.enumeration.BachelorSemester;
import de.thdeg.grademanager.model.enumeration.FieldOfStudy;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
......@@ -49,18 +51,21 @@ public class CoursesOfStudyModificationController {
@FXML
protected void onSaveButtonClick(ActionEvent event) throws IOException {
if(!name.getText().isBlank() && bachelorDegreeComboBox.getValue() != null &&
durationComboBox.getValue() != null && !fieldOfStudy.getText().isBlank())
{
if (!name.getText().isBlank() && bachelorDegreeComboBox.getValue() != null &&
durationComboBox.getValue() != null && !fieldOfStudy.getText().isBlank()) {
bachelorDegree = bachelorDegreeComboBox.getValue();
duration = durationComboBox.getValue();
fees = 62;
//MainController.degreeList.add(name.getText());
MainController.coursesOfStudyList.add(new CoursesOfStudy(
MainController.coursesOfStudyList.size(),
name.getText(),
bachelorDegree,
2,
fees,
null,
FieldOfStudy.EMBEDDED_SYSTEMS));
switchToMain(event);
}
else
{
} else {
warning.setText("Bitte alle Felder ausfüllen.");
Alert alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Fehler");
......@@ -73,6 +78,7 @@ public class CoursesOfStudyModificationController {
private Stage stage;
private Scene scene;
private FXMLLoader root;
@FXML
protected void switchToMain(ActionEvent event) throws IOException {
root = new FXMLLoader(Main.class.getResource("main.fxml"));
......@@ -95,7 +101,7 @@ public class CoursesOfStudyModificationController {
alert.getButtonTypes().setAll(buttonTypeOne, buttonTypeCancel);
Optional<ButtonType> result = alert.showAndWait();
if (result.get() == buttonTypeOne){
if (result.get() == buttonTypeOne) {
switchToMain(event);
}
}
......
package de.thdeg.grademanager.gui;
import de.thdeg.grademanager.model.CoursesOfStudy;
import de.thdeg.grademanager.model.Student;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
......@@ -25,12 +26,10 @@ public class MainController {
@FXML
protected void initialize() {
if(!coursesOfStudyList.isEmpty())
{
if (!coursesOfStudyList.isEmpty()) {
coursesOfStudyComboBox.setItems(coursesOfStudyList);
}
if(!studentList.isEmpty())
{
if (!studentList.isEmpty()) {
studentComboBox.setItems(studentList);
}
}
......
//package dto;
//import dto.enumeration.*;
/*
public class Main {
public static void main(String[] args) {
List<Course> kevCourses = new ArrayList<>();
Course a1 = new Course(1, "test1", BachelorSemester.FIFTH, CourseType.COMPULSORY, 5, 5.5, ExamType.ASSIGNMENT);
Course a2 = new Course(2, "test2", BachelorSemester.FIFTH, CourseType.COMPULSORY, 5, 5.5, ExamType.ASSIGNMENT);
Course a3 = new Course(3, "test3", BachelorSemester.FIFTH, CourseType.COMPULSORY, 5, 5.5, ExamType.ASSIGNMENT);
Course a4 = new Course(4, "test4", BachelorSemester.FIFTH, CourseType.COMPULSORY, 5, 5.5, ExamType.ASSIGNMENT);
Course a5 = new Course(4, "test4", BachelorSemester.FIFTH, CourseType.COMPULSORY, 5, 5.5, ExamType.ASSIGNMENT);
Course a6 = new Course(4, "test4", BachelorSemester.FIFTH, CourseType.COMPULSORY, 5, 5.5, ExamType.ASSIGNMENT);
Course a7 = new Course(4, "test4", BachelorSemester.FIFTH, CourseType.COMPULSORY, 5, 5.5, ExamType.ASSIGNMENT);
kevCourses.add(a1);
kevCourses.add(a2);
kevCourses.add(a3);
kevCourses.add(a4);
kevCourses.add(a5);
kevCourses.add(a6);
kevCourses.add(a7);
Student kev = new Student(1, Gender.MALE, "Kevin",
"Thaller", "Tittling", "Freyung", "kevin.thaller@stud.th-deg.de",
"123", kevCourses, Status.ENROLLED, BachelorSemester.FIFTH);
kev.setGrade(a1, Mark.VIER_NULL);
kev.setGrade(a2, Mark.FUENF_NULL);
kev.setGrade(a3, Mark.DREI_DREI);
kev.setGrade(a4, Mark.EINS_NULL);
kev.setGrade(a5, Mark.EINS_NULL);
kev.setGrade(a6, Mark.FUENF_NULL);
kev.setGrade(a7, Mark.FUENF_NULL);
System.out.println(kev.getGrades());
System.out.println(kev.calculateAverage());
System.out.println(kev.calculateMedian());
}
}
*/
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment