Skip to content
Snippets Groups Projects
Commit ef7337c2 authored by Dennis Toth's avatar Dennis Toth
Browse files

added working ListView for courses in CoursesOfStudyDetailsController

parent 98efa33e
No related branches found
No related tags found
1 merge request!3jpa+gui+logic
...@@ -13,6 +13,8 @@ import javafx.scene.control.*; ...@@ -13,6 +13,8 @@ import javafx.scene.control.*;
import java.io.IOException; import java.io.IOException;
import java.util.Optional; import java.util.Optional;
import static de.thdeg.grademanager.gui.CoursesOfStudyDetailsController.courseList;
public class CourseModificationController { public class CourseModificationController {
@FXML @FXML
protected ComboBox<BachelorSemester> bachelorSemesterComboBox; protected ComboBox<BachelorSemester> bachelorSemesterComboBox;
...@@ -57,6 +59,14 @@ public class CourseModificationController { ...@@ -57,6 +59,14 @@ public class CourseModificationController {
courseType = courseTypeComboBox.getValue(); courseType = courseTypeComboBox.getValue();
examType = examTypeComboBox.getValue(); examType = examTypeComboBox.getValue();
CoursesOfStudyDetailsController.courseList.add(new Course(1,
name.getText(),
bachelorSemester,
courseType,
Integer.parseInt(sws.getText()),
Integer.parseInt(ects.getText()),
examType));
/*
Course k = new Course(1, Course k = new Course(1,
name.getText(), name.getText(),
bachelorSemester, bachelorSemester,
...@@ -64,6 +74,7 @@ public class CourseModificationController { ...@@ -64,6 +74,7 @@ public class CourseModificationController {
Integer.parseInt(sws.getText()), Integer.parseInt(sws.getText()),
Integer.parseInt(ects.getText()), Integer.parseInt(ects.getText()),
examType); examType);
*/
SwitchWindowHelper.switchTo("CoursesOfStudy Details", event); SwitchWindowHelper.switchTo("CoursesOfStudy Details", event);
} else { } else {
warning.setText("Bitte alle Felder ausfüllen."); warning.setText("Bitte alle Felder ausfüllen.");
......
package de.thdeg.grademanager.gui; package de.thdeg.grademanager.gui;
import de.thdeg.grademanager.model.Course;
import de.thdeg.grademanager.model.CoursesOfStudy;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent; import javafx.event.ActionEvent;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.scene.control.ListView;
import javafx.scene.control.TextField; import javafx.scene.control.TextField;
import java.io.IOException; import java.io.IOException;
...@@ -12,6 +17,18 @@ public class CoursesOfStudyDetailsController { ...@@ -12,6 +17,18 @@ public class CoursesOfStudyDetailsController {
@FXML @FXML
protected TextField courses; protected TextField courses;
@FXML
protected ListView<Course> courseListView;
static public ObservableList<Course> courseList = FXCollections.observableArrayList();
@FXML
protected void initialize() {
if (!courseList.isEmpty()) {
courseListView.setItems(courseList);
}
}
@FXML @FXML
protected void switchToMain(ActionEvent event) throws IOException { protected void switchToMain(ActionEvent event) throws IOException {
SwitchWindowHelper.switchTo("Main", event); SwitchWindowHelper.switchTo("Main", event);
......
...@@ -32,13 +32,6 @@ public class Course ...@@ -32,13 +32,6 @@ public class Course
@Override @Override
public String toString() { public String toString() {
return "\nCourse: " + return name;
"id=" + id +
", name='" + name + '\'' +
", bachelorSemester=" + bachelorSemester +
", courseType=" + courseType +
", sws=" + sws +
", ects=" + ects +
", examType=" + examType;
} }
} }
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<?import javafx.scene.text.Text?> <?import javafx.scene.text.Text?>
<BorderPane prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.thdeg.grademanager.gui.CoursesOfStudyDetailsController"> <BorderPane prefHeight="500.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/18" xmlns:fx="http://javafx.com/fxml/1" fx:controller="de.thdeg.grademanager.gui.CoursesOfStudyDetailsController">
<top> <top>
<VBox fillWidth="false" prefHeight="42.0" prefWidth="600.0" BorderPane.alignment="CENTER"> <VBox fillWidth="false" prefHeight="42.0" prefWidth="600.0" BorderPane.alignment="CENTER">
<children> <children>
...@@ -103,11 +103,11 @@ ...@@ -103,11 +103,11 @@
<Button layoutX="263.0" layoutY="16.0" mnemonicParsing="false" prefHeight="26.0" prefWidth="127.0" text="Statistiken anzeigen" /> <Button layoutX="263.0" layoutY="16.0" mnemonicParsing="false" prefHeight="26.0" prefWidth="127.0" text="Statistiken anzeigen" />
</children> </children>
</HBox> </HBox>
<HBox alignment="CENTER" prefHeight="46.0" prefWidth="600.0"> <HBox alignment="CENTER" prefHeight="133.0" prefWidth="600.0">
<children> <children>
<Text strokeType="OUTSIDE" strokeWidth="0.0" text="Angelegte Kurse:" /> <Text strokeType="OUTSIDE" strokeWidth="0.0" text="Angelegte Kurse:" />
<Region prefHeight="99.0" prefWidth="18.0" /> <Region prefHeight="99.0" prefWidth="18.0" />
<ListView disable="true" prefHeight="46.0" prefWidth="269.0" /> <ListView fx:id="courseListView" editable="true" prefHeight="133.0" prefWidth="270.0" />
</children> </children>
</HBox> </HBox>
</children> </children>
......
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