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

add enums to combo boxes, remove 'setComboBox'-Method in MainController...

add enums to combo boxes, remove 'setComboBox'-Method in MainController because it works only with Strings and again some renaming of old 'degreeModification' to 'coursesOfStudyModification'
parent fc4cb45b
No related branches found
No related tags found
1 merge request!3jpa+gui+logic
package de.thdeg.grademanager.gui;
import de.thdeg.grademanager.model.enumeration.BachelorSemester;
import de.thdeg.grademanager.model.enumeration.CourseType;
import de.thdeg.grademanager.model.enumeration.ExamType;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
......@@ -18,37 +21,35 @@ import java.util.Optional;
public class CourseModificationController {
@FXML
protected ComboBox<String> bachelorSemesterComboBox;
protected ComboBox<BachelorSemester> bachelorSemesterComboBox;
@FXML
protected ComboBox<String> courseTypeComboBox;
protected ComboBox<CourseType> courseTypeComboBox;
@FXML
protected ComboBox<String> examTypeComboBox;
ObservableList<String> bachelorSemesterList = FXCollections.observableArrayList("1", "2", "3", "4", "5", "6", "7", "8",
"9");
ObservableList<String> courseTypeList = FXCollections.observableArrayList("Pflichtveranstaltung", "AWP", "FWP",
"PLV");
ObservableList<String> examTypeList = FXCollections.observableArrayList("schriftlich", "mündlich", "Teilnahme");
protected ComboBox<ExamType> examTypeComboBox;
ObservableList<BachelorSemester> bachelorSemesterList = FXCollections.observableArrayList(BachelorSemester.values());
ObservableList<CourseType> courseTypeList = FXCollections.observableArrayList(CourseType.values());
ObservableList<ExamType> examTypeList = FXCollections.observableArrayList(ExamType.values());
@FXML
protected void initialize() {
MainController.setComboBox(bachelorSemesterComboBox, bachelorSemesterList);
MainController.setComboBox(courseTypeComboBox, courseTypeList);
MainController.setComboBox(examTypeComboBox, examTypeList);
bachelorSemesterComboBox.setItems(bachelorSemesterList);
courseTypeComboBox.setItems(courseTypeList);
examTypeComboBox.setItems(examTypeList);
}
@FXML
protected TextField name;
@FXML
protected String bachelorSemester;
protected BachelorSemester bachelorSemester;
@FXML
protected String courseType;
protected CourseType courseType;
@FXML
protected TextField sws;
@FXML
protected TextField ects;
@FXML
protected String examType;
protected ExamType examType;
@FXML
protected TextField warning;
......@@ -63,8 +64,8 @@ public class CourseModificationController {
courseType = courseTypeComboBox.getValue();
examType = examTypeComboBox.getValue();
MainController.degreeList.add(name.getText());
switchToDegreeModification(event);
switchToCoursesOfStudyModification(event);
}
else
{
......@@ -82,7 +83,7 @@ public class CourseModificationController {
private FXMLLoader root;
@FXML
protected void switchToDegreeModification(ActionEvent event) throws IOException {
protected void switchToCoursesOfStudyModification(ActionEvent event) throws IOException {
root = new FXMLLoader(Main.class.getResource("courses-of-study-modification.fxml"));
stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
scene = new Scene(root.load(), 960, 540);
......
package de.thdeg.grademanager.gui;
import de.thdeg.grademanager.model.enumeration.BachelorDegree;
import de.thdeg.grademanager.model.enumeration.BachelorSemester;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
......@@ -15,27 +17,26 @@ import java.util.Optional;
public class CoursesOfStudyModificationController {
@FXML
protected ComboBox<String> bachelorDegreeComboBox;
protected ComboBox<BachelorDegree> bachelorDegreeComboBox;
@FXML
protected ComboBox<String> durationComboBox;
protected ComboBox<BachelorSemester> durationComboBox;
ObservableList<String> bachelorDegreeList = FXCollections.observableArrayList("B. A.", "B. Eng.", "B. Sc.");
ObservableList<String> durationList = FXCollections.observableArrayList("7 Semester", "8 Semester",
"9 Semester");
ObservableList<BachelorDegree> bachelorDegreeList = FXCollections.observableArrayList(BachelorDegree.values());
ObservableList<BachelorSemester> durationList = FXCollections.observableArrayList(BachelorSemester.values());
@FXML
protected void initialize() {
MainController.setComboBox(bachelorDegreeComboBox, bachelorDegreeList);
MainController.setComboBox(durationComboBox, durationList);
bachelorDegreeComboBox.setItems(bachelorDegreeList);
durationComboBox.setItems(durationList);
}
@FXML
protected TextField name;
@FXML
protected String bachelorDegree;
protected BachelorDegree bachelorDegree;
@FXML
protected String duration;
protected BachelorSemester duration;
@FXML
protected int fees;
@FXML
......@@ -55,7 +56,7 @@ public class CoursesOfStudyModificationController {
duration = durationComboBox.getValue();
fees = 62;
MainController.degreeList.add(name.getText());
//MainController.degreeList.add(name.getText());
switchToMain(event);
}
else
......
package de.thdeg.grademanager.gui;
import de.thdeg.grademanager.model.Student;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
......@@ -15,25 +16,22 @@ import java.io.IOException;
public class MainController {
@FXML
protected ComboBox<String> degreeComboBox;
protected ComboBox<CoursesOfStudy> coursesOfStudyComboBox;
@FXML
protected ComboBox<String> studentComboBox;
static public ObservableList<String> degreeList = FXCollections.observableArrayList();
static public ObservableList<String> studentList = FXCollections.observableArrayList();
protected ComboBox<Student> studentComboBox;
static public ObservableList<CoursesOfStudy> coursesOfStudyList = FXCollections.observableArrayList();
static public ObservableList<Student> studentList = FXCollections.observableArrayList();
static public void setComboBox(ComboBox<String> comboBox, ObservableList<String> list) {
comboBox.setItems(list);
}
@FXML
protected void initialize() {
if(!degreeList.isEmpty())
if(!coursesOfStudyList.isEmpty())
{
setComboBox(degreeComboBox, degreeList);
coursesOfStudyComboBox.setItems(coursesOfStudyList);
}
if(!studentList.isEmpty())
{
setComboBox(studentComboBox, studentList);
studentComboBox.setItems(studentList);
}
}
......@@ -83,7 +81,7 @@ public class MainController {
}
@FXML
protected void switchToDegreeModification(ActionEvent event) throws IOException {
protected void switchToCoursesOfStudyModification(ActionEvent event) throws IOException {
root = new FXMLLoader(Main.class.getResource("courses-of-study-modification.fxml"));
stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
scene = new Scene(root.load(), 960, 540);
......
package de.thdeg.grademanager.gui;
import de.thdeg.grademanager.model.Student;
import de.thdeg.grademanager.model.enumeration.BachelorSemester;
import de.thdeg.grademanager.model.enumeration.Gender;
import de.thdeg.grademanager.model.enumeration.Status;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
......@@ -17,26 +21,24 @@ import static de.thdeg.grademanager.gui.MainController.*;
public class StudentModificationController {
@FXML
protected ComboBox<String> genderComboBox;
protected ComboBox<Gender> genderComboBox;
@FXML
protected ComboBox<String> bachelorSemesterComboBox;
protected ComboBox<BachelorSemester> bachelorSemesterComboBox;
@FXML
protected ComboBox<String> statusComboBox;
ObservableList<String> genderList = FXCollections.observableArrayList("männlich", "weiblich", "divers");
ObservableList<String> bachelorSemesterList = FXCollections.observableArrayList("1", "2", "3", "4", "5", "6",
"7", "8", "9", "10", "11",
"12", "13");
ObservableList<String> statusList = FXCollections.observableArrayList("immatrikuliert", "exmatrikuliert");
protected ComboBox<Status> statusComboBox;
ObservableList<Gender> genderList = FXCollections.observableArrayList(Gender.values());
ObservableList<BachelorSemester> bachelorSemesterList = FXCollections.observableArrayList(BachelorSemester.values());
ObservableList<Status> statusList = FXCollections.observableArrayList(Status.values());
@FXML
protected void initialize() {
setComboBox(genderComboBox, genderList);
setComboBox(bachelorSemesterComboBox, bachelorSemesterList);
setComboBox(statusComboBox, statusList);
genderComboBox.setItems(genderList);
bachelorSemesterComboBox.setItems(bachelorSemesterList);
statusComboBox.setItems(statusList);
}
@FXML
protected String gender;
protected Gender gender;
@FXML
protected TextField firstName;
@FXML
......@@ -52,11 +54,11 @@ public class StudentModificationController {
@FXML
protected TextField personalCourses;
@FXML
protected String status;
protected Status status;
@FXML
protected boolean paidFees;
@FXML
protected String bachelorSemester;
protected BachelorSemester bachelorSemester;
@FXML
protected TextField grades;
@FXML
......@@ -84,7 +86,20 @@ public class StudentModificationController {
status = statusComboBox.getValue();
bachelorSemester = bachelorSemesterComboBox.getValue();
studentList.add(lastName.getText() + " " + firstName.getText());
studentList.add(new Student(
studentList.size(),
gender,
firstName.getText(),
lastName.getText(),
placeOfResidence.getText(),
birthPlace.getText(),
officialEmail.getText(),
privateEmail.getText(),
null,
status,
bachelorSemester
));
switchToMain(event);
}
else
......
......@@ -19,7 +19,7 @@
<children>
<ButtonBar buttonMinWidth="30.0" prefHeight="40.0" prefWidth="200.0">
<buttons>
<Button alignment="CENTER" minWidth="22.0" mnemonicParsing="false" onAction="#switchToDegreeModification" prefHeight="26.0" text="←" />
<Button alignment="CENTER" minWidth="22.0" mnemonicParsing="false" onAction="#switchToCoursesOfStudyModification" prefHeight="26.0" text="←" />
<Button alignment="CENTER" disable="true" layoutX="31.0" layoutY="17.0" minWidth="22.0" mnemonicParsing="false" prefHeight="26.0" text="→" />
<Region prefHeight="200.0" prefWidth="200.0" />
</buttons>
......
......@@ -58,7 +58,7 @@
<HBox alignment="TOP_CENTER" layoutX="10.0" layoutY="10.0" prefHeight="100.0" prefWidth="200.0">
<children>
<Region prefHeight="94.0" prefWidth="24.0" />
<Button defaultButton="true" onAction="#switchToDegreeModification" prefHeight="26.0" prefWidth="129.0" text="Studiengang anlegen">
<Button defaultButton="true" onAction="#switchToCoursesOfStudyModification" prefHeight="26.0" prefWidth="129.0" text="Studiengang anlegen">
<HBox.margin>
<Insets />
</HBox.margin></Button>
......
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