Implemented generics to reuse code, clean-ups
This commit is contained in:
10
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
10
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="DuplicatedCode" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
||||||
|
<Languages>
|
||||||
|
<language minSize="86" name="Java" />
|
||||||
|
</Languages>
|
||||||
|
</inspection_tool>
|
||||||
|
</profile>
|
||||||
|
</component>
|
||||||
@@ -7,11 +7,10 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Faculty implements Serializable {
|
public class Faculty implements Serializable {
|
||||||
|
|
||||||
private final List<Group> groups = new ArrayList<>();
|
|
||||||
private String name;
|
private String name;
|
||||||
private String abbreviation;
|
private String abbreviation;
|
||||||
private StudyField field;
|
private StudyField field;
|
||||||
|
private final List<Group> groups = new ArrayList<>();
|
||||||
public Faculty(String name, String abbreviation, StudyField field) {
|
public Faculty(String name, String abbreviation, StudyField field) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.abbreviation = abbreviation;
|
this.abbreviation = abbreviation;
|
||||||
|
|||||||
@@ -6,9 +6,9 @@ import java.util.List;
|
|||||||
|
|
||||||
public class Group implements Serializable {
|
public class Group implements Serializable {
|
||||||
|
|
||||||
private final List<Student> students = new ArrayList<>();
|
|
||||||
private String name;
|
private String name;
|
||||||
private Faculty faculty;
|
private Faculty faculty;
|
||||||
|
private final List<Student> students = new ArrayList<>();
|
||||||
|
|
||||||
public Group(String name) {
|
public Group(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|||||||
@@ -7,24 +7,16 @@ import java.util.List;
|
|||||||
|
|
||||||
public class Student implements Serializable {
|
public class Student implements Serializable {
|
||||||
|
|
||||||
private final List<Grade> grades = new ArrayList<>();
|
|
||||||
private boolean graduated = false;
|
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
private String surname;
|
private String surname;
|
||||||
|
|
||||||
private String fullname;
|
private String fullname;
|
||||||
|
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
private Date enrollmentDate;
|
private Date enrollmentDate;
|
||||||
|
|
||||||
private Date dateOfBirth;
|
private Date dateOfBirth;
|
||||||
|
|
||||||
private Faculty faculty;
|
private Faculty faculty;
|
||||||
|
|
||||||
private Group group;
|
private Group group;
|
||||||
|
private boolean graduated = false;
|
||||||
|
private final List<Grade> grades = new ArrayList<>();
|
||||||
|
|
||||||
public Student(String name, String surname, String email, Group group, Faculty faculty, Date birth, Date enrol) {
|
public Student(String name, String surname, String email, Group group, Faculty faculty, Date birth, Date enrol) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import org.lumijiez.gui.forms.group.ShowGroupForm;
|
|||||||
import org.lumijiez.gui.forms.student.*;
|
import org.lumijiez.gui.forms.student.*;
|
||||||
import org.lumijiez.gui.loader.BatchGraduater;
|
import org.lumijiez.gui.loader.BatchGraduater;
|
||||||
import org.lumijiez.gui.loader.BatchLoader;
|
import org.lumijiez.gui.loader.BatchLoader;
|
||||||
import org.lumijiez.gui.util.DisplayerManager;
|
import org.lumijiez.gui.util.DisplayHandler;
|
||||||
import org.lumijiez.managers.Supervisor;
|
import org.lumijiez.managers.Supervisor;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -20,34 +20,22 @@ import java.awt.event.WindowAdapter;
|
|||||||
import java.awt.event.WindowEvent;
|
import java.awt.event.WindowEvent;
|
||||||
|
|
||||||
public class StudentManagementGUI extends JFrame {
|
public class StudentManagementGUI extends JFrame {
|
||||||
private static final JTextArea mainTextLabel = new javax.swing.JTextArea();
|
|
||||||
private static Supervisor sv;
|
|
||||||
private final JMenuBar menuBar = new JMenuBar();
|
|
||||||
private final JMenu fileMenu = new JMenu();
|
private final JMenu fileMenu = new JMenu();
|
||||||
private final JMenu studentMenu = new JMenu();
|
private final JMenu studentMenu = new JMenu();
|
||||||
private final JMenu groupMenu = new JMenu();
|
private final JMenu groupMenu = new JMenu();
|
||||||
private final JMenu facultyMenu = new JMenu();
|
private final JMenu facultyMenu = new JMenu();
|
||||||
private final JScrollPane mainScrollPane = new javax.swing.JScrollPane();
|
private final JMenuBar menuBar = new JMenuBar();
|
||||||
|
private static final JTextArea mainTextLabel = new JTextArea();
|
||||||
|
private static Supervisor sv;
|
||||||
|
private final JScrollPane mainScrollPane = new JScrollPane();
|
||||||
|
|
||||||
public StudentManagementGUI() {
|
public StudentManagementGUI() {
|
||||||
sv = DataDeserializer.deserialize();
|
sv = (DataDeserializer.deserialize());
|
||||||
this.setSize(650, 720);
|
this.setSize(650, 720);
|
||||||
this.setTitle("Student Management System");
|
this.setTitle("Student Management System");
|
||||||
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
|
||||||
int x = (screenSize.width - this.getWidth()) / 2;
|
|
||||||
int y = (screenSize.height - this.getHeight()) / 2;
|
|
||||||
this.setLocation(x, y);
|
|
||||||
initComponents();
|
initComponents();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static JTextArea getMainLabel() {
|
|
||||||
return mainTextLabel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Supervisor getSv() {
|
|
||||||
return sv;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void initComponents() {
|
private void initComponents() {
|
||||||
|
|
||||||
JMenuItem loadBatchOption = new JMenuItem("Load as Batch", UIManager.getIcon("FileView.directoryIcon"));
|
JMenuItem loadBatchOption = new JMenuItem("Load as Batch", UIManager.getIcon("FileView.directoryIcon"));
|
||||||
@@ -108,11 +96,10 @@ public class StudentManagementGUI extends JFrame {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
loadBatchOption.addActionListener(this::loadBatchEvent);
|
||||||
loadBatchOption.addActionListener(this::loadBatchOptionActionPerformed);
|
graduateBatchOption.addActionListener(this::graduateBatchEvent);
|
||||||
graduateBatchOption.addActionListener(this::graduateBatchOptionActionPerformed);
|
saveAsOption.addActionListener(this::saveAsEvent);
|
||||||
saveAsOption.addActionListener(this::saveAsOptionActionPerformed);
|
saveAndExitOption.addActionListener(this::saveExitEvent);
|
||||||
saveAndExitOption.addActionListener(this::saveAndExitOptionActionPerformed);
|
|
||||||
|
|
||||||
fileMenu.add(loadBatchOption);
|
fileMenu.add(loadBatchOption);
|
||||||
fileMenu.add(graduateBatchOption);
|
fileMenu.add(graduateBatchOption);
|
||||||
@@ -122,15 +109,16 @@ public class StudentManagementGUI extends JFrame {
|
|||||||
|
|
||||||
menuBar.add(fileMenu);
|
menuBar.add(fileMenu);
|
||||||
|
|
||||||
showParticularStudentOption.addActionListener(this::showParticularStudentOptionActionPerformed);
|
showAllStudentsOption.addActionListener(this::showAllStudentsEvent);
|
||||||
showStudentGrade.addActionListener(this::showStudentGradeActionPerformed);
|
showParticularStudentOption.addActionListener(this::showStudentEvent);
|
||||||
gradeStudentOption.addActionListener(this::gradeStudentOptionActionPerformed);
|
showStudentGrade.addActionListener(this::showGradeEvent);
|
||||||
addStudentOption.addActionListener(this::addStudentOptionActionPerformed);
|
gradeStudentOption.addActionListener(this::gradeStudentEvent);
|
||||||
editStudentOption.addActionListener(this::editStudentOptionActionPerformed);
|
addStudentOption.addActionListener(this::addStudentEvent);
|
||||||
deleteStudentOption.addActionListener(this::deleteStudentOptionActionPerformed);
|
editStudentOption.addActionListener(this::editStudentEvent);
|
||||||
graduateStudent.addActionListener(this::graduateStudentOptionActionPerformed);
|
deleteStudentOption.addActionListener(this::deleteStudentEvent);
|
||||||
showEnrolled.addActionListener(this::showEnrolledOptionActionPerformed);
|
graduateStudent.addActionListener(this::graduateStudentEvent);
|
||||||
showGraduates.addActionListener(this::showGraduatesOptionActionPerformed);
|
showEnrolled.addActionListener(this::showEnrolledEvent);
|
||||||
|
showGraduates.addActionListener(this::showGraduatesEvent);
|
||||||
|
|
||||||
studentMenu.add(showAllStudentsOption);
|
studentMenu.add(showAllStudentsOption);
|
||||||
studentMenu.add(showParticularStudentOption);
|
studentMenu.add(showParticularStudentOption);
|
||||||
@@ -146,9 +134,11 @@ public class StudentManagementGUI extends JFrame {
|
|||||||
|
|
||||||
menuBar.add(studentMenu);
|
menuBar.add(studentMenu);
|
||||||
|
|
||||||
showParticularGroupOption.addActionListener(this::showParticularGroupOptionActionPerformed);
|
showAllGroupsOption.addActionListener(this::showAllGroupsEvent);
|
||||||
addGroupOption.addActionListener(this::addGroupOptionActionPerformed);
|
showParticularGroupOption.addActionListener(this::showGroupEvent);
|
||||||
editGroupOption.addActionListener(this::editGroupOptionActionPerformed);
|
addGroupOption.addActionListener(this::addGroupEvent);
|
||||||
|
editGroupOption.addActionListener(this::editGroupEvent);
|
||||||
|
deleteGroupOption.addActionListener(this::deleteGroupEvent);
|
||||||
|
|
||||||
groupMenu.add(showAllGroupsOption);
|
groupMenu.add(showAllGroupsOption);
|
||||||
groupMenu.add(showParticularGroupOption);
|
groupMenu.add(showParticularGroupOption);
|
||||||
@@ -159,15 +149,12 @@ public class StudentManagementGUI extends JFrame {
|
|||||||
|
|
||||||
menuBar.add(groupMenu);
|
menuBar.add(groupMenu);
|
||||||
|
|
||||||
showAllGroupsOption.addActionListener(this::showAllGroupsOptionActionPerformed);
|
showAllFacultiesOption.addActionListener(this::showAllFacultiesEvent);
|
||||||
showAllStudentsOption.addActionListener(this::showAllStudentsOptionActionPerformed);
|
showParticularFacultyOption.addActionListener(this::showFacultyEvent);
|
||||||
showAllFacultiesOption.addActionListener(this::showAllFacultiesOptionActionPerformed);
|
showFacultyBySpecialtyOption.addActionListener(this::showFacultySpecEvent);
|
||||||
showParticularFacultyOption.addActionListener(this::showParticularFacultyOptionActionPerformed);
|
addFacultyOption.addActionListener(this::addFacultyEvent);
|
||||||
showFacultyBySpecialtyOption.addActionListener(this::showFacultySpecialtyActionPerformed);
|
editFacultyOption.addActionListener(this::editFacultyEvent);
|
||||||
addFacultyOption.addActionListener(this::addFacultyOptionActionPerformed);
|
removeFacultyOption.addActionListener(this::deleteFacultyEvent);
|
||||||
editFacultyOption.addActionListener(this::editFacultyOptionActionPerformed);
|
|
||||||
deleteGroupOption.addActionListener(this::deleteGroupOptionActionPerformed);
|
|
||||||
removeFacultyOption.addActionListener(this::removeFacultyOptionActionPerformed);
|
|
||||||
|
|
||||||
facultyMenu.add(showAllFacultiesOption);
|
facultyMenu.add(showAllFacultiesOption);
|
||||||
facultyMenu.add(showParticularFacultyOption);
|
facultyMenu.add(showParticularFacultyOption);
|
||||||
@@ -181,73 +168,77 @@ public class StudentManagementGUI extends JFrame {
|
|||||||
|
|
||||||
setJMenuBar(menuBar);
|
setJMenuBar(menuBar);
|
||||||
|
|
||||||
DisplayerManager.displayStudents();
|
DisplayHandler.displayStudents();
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
GroupLayout layout = new GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(mainScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 650, Short.MAX_VALUE));
|
.addComponent(mainScrollPane, GroupLayout.DEFAULT_SIZE, 650, Short.MAX_VALUE));
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(mainScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 697, Short.MAX_VALUE));
|
.addComponent(mainScrollPane, GroupLayout.DEFAULT_SIZE, 697, Short.MAX_VALUE));
|
||||||
pack();
|
pack();
|
||||||
|
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
|
||||||
|
int x = (screenSize.width - this.getWidth()) / 2;
|
||||||
|
int y = (screenSize.height - this.getHeight()) / 2;
|
||||||
|
this.setLocation(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showFacultySpecialtyActionPerformed(ActionEvent actionEvent) {
|
private void showFacultySpecEvent(ActionEvent actionEvent) {
|
||||||
ShowSpecialtyFacultyForm form = new ShowSpecialtyFacultyForm(sv, mainTextLabel);
|
ShowSpecialtyFacultyForm form = new ShowSpecialtyFacultyForm(sv, mainTextLabel);
|
||||||
form.setVisible(true);
|
form.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void graduateBatchOptionActionPerformed(ActionEvent actionEvent) {
|
private void graduateBatchEvent(ActionEvent actionEvent) {
|
||||||
BatchGraduater picker = new BatchGraduater(sv);
|
BatchGraduater picker = new BatchGraduater(sv);
|
||||||
picker.setVisible(true);
|
picker.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showGraduatesOptionActionPerformed(ActionEvent actionEvent) {
|
private void showGraduatesEvent(ActionEvent actionEvent) {
|
||||||
if (checkStudent() && checkGroup() && checkFaculty()) {
|
if (checkStudent() && checkGroup() && checkFaculty()) {
|
||||||
DisplayerManager.displayGraduates();
|
DisplayHandler.displayGraduates();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showEnrolledOptionActionPerformed(ActionEvent actionEvent) {
|
private void showEnrolledEvent(ActionEvent actionEvent) {
|
||||||
if (checkStudent() && checkGroup() && checkFaculty()) {
|
if (checkStudent() && checkGroup() && checkFaculty()) {
|
||||||
DisplayerManager.displayEnrolled();
|
DisplayHandler.displayEnrolled();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void graduateStudentOptionActionPerformed(ActionEvent actionEvent) {
|
private void graduateStudentEvent(ActionEvent actionEvent) {
|
||||||
if (checkStudent() && checkGroup() && checkFaculty()) {
|
if (checkStudent() && checkGroup() && checkFaculty()) {
|
||||||
GraduateStudentForm form = new GraduateStudentForm(sv);
|
GraduateStudentForm form = new GraduateStudentForm(sv);
|
||||||
form.setVisible(true);
|
form.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showAllStudentsOptionActionPerformed(ActionEvent actionEvent) {
|
private void showAllStudentsEvent(ActionEvent actionEvent) {
|
||||||
if (checkStudent() && checkGroup() && checkFaculty()) {
|
if (checkStudent() && checkGroup() && checkFaculty()) {
|
||||||
DisplayerManager.displayStudents();
|
DisplayHandler.displayStudents();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showAllGroupsOptionActionPerformed(ActionEvent actionEvent) {
|
private void showAllGroupsEvent(ActionEvent actionEvent) {
|
||||||
if (checkGroup() && checkFaculty()) {
|
if (checkGroup() && checkFaculty()) {
|
||||||
DisplayerManager.displayGroups();
|
DisplayHandler.displayGroups();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteGroupOptionActionPerformed(ActionEvent actionEvent) {
|
private void deleteGroupEvent(ActionEvent actionEvent) {
|
||||||
if (checkGroup() && checkFaculty()) {
|
if (checkGroup() && checkFaculty()) {
|
||||||
DeleteGroupForm form = new DeleteGroupForm(sv);
|
DeleteGroupForm form = new DeleteGroupForm(sv);
|
||||||
form.setVisible(true);
|
form.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadBatchOptionActionPerformed(ActionEvent evt) {
|
private void loadBatchEvent(ActionEvent evt) {
|
||||||
BatchLoader picker = new BatchLoader(sv);
|
BatchLoader picker = new BatchLoader(sv);
|
||||||
picker.setVisible(true);
|
picker.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveAndExitOptionActionPerformed(ActionEvent evt) {
|
private void saveExitEvent(ActionEvent evt) {
|
||||||
int result = JOptionPane.showConfirmDialog(
|
int result = JOptionPane.showConfirmDialog(
|
||||||
StudentManagementGUI.this,
|
StudentManagementGUI.this,
|
||||||
"Are you sure you want to exit?",
|
"Are you sure you want to exit?",
|
||||||
@@ -262,99 +253,99 @@ public class StudentManagementGUI extends JFrame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showAllFacultiesOptionActionPerformed(ActionEvent evt) {
|
private void showAllFacultiesEvent(ActionEvent evt) {
|
||||||
if (checkFaculty()) {
|
if (checkFaculty()) {
|
||||||
DisplayerManager.displayFaculties();
|
DisplayHandler.displayFaculties();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveAsOptionActionPerformed(ActionEvent evt) {
|
private void saveAsEvent(ActionEvent evt) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showParticularGroupOptionActionPerformed(ActionEvent evt) {
|
private void showGroupEvent(ActionEvent evt) {
|
||||||
if (checkGroup() && checkFaculty()) {
|
if (checkGroup() && checkFaculty()) {
|
||||||
ShowGroupForm form = new ShowGroupForm(sv, mainTextLabel);
|
ShowGroupForm form = new ShowGroupForm(sv, mainTextLabel);
|
||||||
form.setVisible(true);
|
form.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addFacultyOptionActionPerformed(ActionEvent evt) {
|
private void addFacultyEvent(ActionEvent evt) {
|
||||||
AddFacultyForm form = new AddFacultyForm(sv);
|
AddFacultyForm form = new AddFacultyForm(sv);
|
||||||
form.setVisible(true);
|
form.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addStudentOptionActionPerformed(ActionEvent evt) {
|
private void addStudentEvent(ActionEvent evt) {
|
||||||
if (checkGroup() && checkFaculty()) {
|
if (checkGroup() && checkFaculty()) {
|
||||||
AddStudentForm form = new AddStudentForm(sv);
|
AddStudentForm form = new AddStudentForm(sv);
|
||||||
form.setVisible(true);
|
form.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void gradeStudentOptionActionPerformed(ActionEvent evt) {
|
private void gradeStudentEvent(ActionEvent evt) {
|
||||||
if (checkStudent() && checkGroup() && checkFaculty()) {
|
if (checkStudent() && checkGroup() && checkFaculty()) {
|
||||||
GradeStudentForm form = new GradeStudentForm(sv, mainTextLabel);
|
GradeStudentForm form = new GradeStudentForm(sv, mainTextLabel);
|
||||||
form.setVisible(true);
|
form.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editStudentOptionActionPerformed(ActionEvent evt) {
|
private void editStudentEvent(ActionEvent evt) {
|
||||||
if (checkStudent() && checkGroup() && checkFaculty()) {
|
if (checkStudent() && checkGroup() && checkFaculty()) {
|
||||||
EditStudentForm form = new EditStudentForm(sv);
|
EditStudentForm form = new EditStudentForm(sv);
|
||||||
form.setVisible(true);
|
form.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteStudentOptionActionPerformed(ActionEvent evt) {
|
private void deleteStudentEvent(ActionEvent evt) {
|
||||||
if (checkStudent() && checkGroup() && checkFaculty()) {
|
if (checkStudent() && checkGroup() && checkFaculty()) {
|
||||||
DeleteStudentForm form = new DeleteStudentForm(sv);
|
DeleteStudentForm form = new DeleteStudentForm(sv);
|
||||||
form.setVisible(true);
|
form.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showStudentGradeActionPerformed(ActionEvent evt) {
|
private void showGradeEvent(ActionEvent evt) {
|
||||||
if (checkStudent() && checkGroup() && checkFaculty()) {
|
if (checkStudent() && checkGroup() && checkFaculty()) {
|
||||||
ShowStudentGradesForm form = new ShowStudentGradesForm(sv, mainTextLabel);
|
ShowStudentGradesForm form = new ShowStudentGradesForm(sv, mainTextLabel);
|
||||||
form.setVisible(true);
|
form.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showParticularStudentOptionActionPerformed(ActionEvent evt) {
|
private void showStudentEvent(ActionEvent evt) {
|
||||||
if (checkStudent() && checkGroup() && checkFaculty()) {
|
if (checkStudent() && checkGroup() && checkFaculty()) {
|
||||||
ShowStudentForm form = new ShowStudentForm(sv, mainTextLabel);
|
ShowStudentForm form = new ShowStudentForm(sv, mainTextLabel);
|
||||||
form.setVisible(true);
|
form.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addGroupOptionActionPerformed(ActionEvent evt) {
|
private void addGroupEvent(ActionEvent evt) {
|
||||||
if (checkFaculty()) {
|
if (checkFaculty()) {
|
||||||
AddGroupForm form = new AddGroupForm(sv);
|
AddGroupForm form = new AddGroupForm(sv);
|
||||||
form.setVisible(true);
|
form.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editGroupOptionActionPerformed(ActionEvent evt) {
|
private void editGroupEvent(ActionEvent evt) {
|
||||||
if (checkGroup() && checkFaculty()) {
|
if (checkGroup() && checkFaculty()) {
|
||||||
EditGroupForm form = new EditGroupForm(sv);
|
EditGroupForm form = new EditGroupForm(sv);
|
||||||
form.setVisible(true);
|
form.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showParticularFacultyOptionActionPerformed(ActionEvent evt) {
|
private void showFacultyEvent(ActionEvent evt) {
|
||||||
if (checkFaculty()) {
|
if (checkFaculty()) {
|
||||||
ShowFacultyForm form = new ShowFacultyForm(sv, mainTextLabel);
|
ShowFacultyForm form = new ShowFacultyForm(sv, mainTextLabel);
|
||||||
form.setVisible(true);
|
form.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void editFacultyOptionActionPerformed(ActionEvent evt) {
|
private void editFacultyEvent(ActionEvent evt) {
|
||||||
if (checkFaculty()) {
|
if (checkFaculty()) {
|
||||||
EditFacultyForm form = new EditFacultyForm(sv);
|
EditFacultyForm form = new EditFacultyForm(sv);
|
||||||
form.setVisible(true);
|
form.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeFacultyOptionActionPerformed(ActionEvent evt) {
|
private void deleteFacultyEvent(ActionEvent evt) {
|
||||||
if (checkFaculty()) {
|
if (checkFaculty()) {
|
||||||
RemoveFacultyForm form = new RemoveFacultyForm(sv);
|
RemoveFacultyForm form = new RemoveFacultyForm(sv);
|
||||||
form.setVisible(true);
|
form.setVisible(true);
|
||||||
@@ -362,7 +353,7 @@ public class StudentManagementGUI extends JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkFaculty() {
|
private boolean checkFaculty() {
|
||||||
if (sv.getFm().getFaculties().isEmpty()) {
|
if (sv.facultyManager().getFaculties().isEmpty()) {
|
||||||
JOptionPane.showMessageDialog(null, "Configure a faculty!", "Warning!", JOptionPane.INFORMATION_MESSAGE, null);
|
JOptionPane.showMessageDialog(null, "Configure a faculty!", "Warning!", JOptionPane.INFORMATION_MESSAGE, null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -370,7 +361,7 @@ public class StudentManagementGUI extends JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkGroup() {
|
private boolean checkGroup() {
|
||||||
if (sv.getFm().getGm().getGroups().isEmpty()) {
|
if (sv.groupManager().getGroups().isEmpty()) {
|
||||||
JOptionPane.showMessageDialog(null, "Configure a group!", "Warning!", JOptionPane.INFORMATION_MESSAGE, null);
|
JOptionPane.showMessageDialog(null, "Configure a group!", "Warning!", JOptionPane.INFORMATION_MESSAGE, null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -378,10 +369,18 @@ public class StudentManagementGUI extends JFrame {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkStudent() {
|
private boolean checkStudent() {
|
||||||
if (sv.getFm().getGm().getSm().getStudents().isEmpty()) {
|
if (sv.studentManager().getStudents().isEmpty()) {
|
||||||
JOptionPane.showMessageDialog(null, "No students in database!", "Warning!", JOptionPane.INFORMATION_MESSAGE, null);
|
JOptionPane.showMessageDialog(null, "No students in database!", "Warning!", JOptionPane.INFORMATION_MESSAGE, null);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static JTextArea getMainLabel() {
|
||||||
|
return mainTextLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Supervisor getSv() {
|
||||||
|
return sv;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package org.lumijiez.gui.forms.faculty;
|
|||||||
|
|
||||||
import org.lumijiez.base.Faculty;
|
import org.lumijiez.base.Faculty;
|
||||||
import org.lumijiez.enums.StudyField;
|
import org.lumijiez.enums.StudyField;
|
||||||
import org.lumijiez.gui.util.ComboBoxRenderer;
|
import org.lumijiez.gui.util.ComboRenderer;
|
||||||
import org.lumijiez.gui.util.ComponentDecorator;
|
import org.lumijiez.gui.util.ComponentDecorator;
|
||||||
import org.lumijiez.gui.util.DisplayerManager;
|
import org.lumijiez.gui.util.DisplayHandler;
|
||||||
import org.lumijiez.managers.Supervisor;
|
import org.lumijiez.managers.Supervisor;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -13,16 +13,16 @@ import java.awt.event.ActionEvent;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class AddFacultyForm extends JFrame {
|
public class AddFacultyForm extends JFrame {
|
||||||
private final Supervisor sv;
|
|
||||||
private final JLabel titleLabel = new JLabel();
|
private final JLabel titleLabel = new JLabel();
|
||||||
private final JComboBox<StudyField> specialtyCombo = new JComboBox<>();
|
|
||||||
private final JTextField nameField = new JTextField();
|
|
||||||
private final JButton submitButton = new JButton();
|
|
||||||
private final JButton cancelButton = new JButton();
|
|
||||||
private final JLabel nameLabel = new JLabel();
|
private final JLabel nameLabel = new JLabel();
|
||||||
private final JTextField abbreviationField = new JTextField();
|
|
||||||
private final JLabel abbreviationLabel = new JLabel();
|
private final JLabel abbreviationLabel = new JLabel();
|
||||||
private final JLabel specialtyLabel = new JLabel();
|
private final JLabel specialtyLabel = new JLabel();
|
||||||
|
private final JButton submitButton = new JButton();
|
||||||
|
private final JButton cancelButton = new JButton();
|
||||||
|
private final JTextField nameField = new JTextField();
|
||||||
|
private final JTextField abbreviationField = new JTextField();
|
||||||
|
private final JComboBox<StudyField> specialtyCombo = new JComboBox<>();
|
||||||
|
private final Supervisor sv;
|
||||||
|
|
||||||
public AddFacultyForm(Supervisor sv) {
|
public AddFacultyForm(Supervisor sv) {
|
||||||
this.sv = sv;
|
this.sv = sv;
|
||||||
@@ -33,7 +33,7 @@ public class AddFacultyForm extends JFrame {
|
|||||||
|
|
||||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
titleLabel.setFont(new Font("sansserif", Font.PLAIN, 18));
|
||||||
setTitle("Add a Faculty");
|
setTitle("Add a Faculty");
|
||||||
|
|
||||||
titleLabel.setText("Add a new faculty");
|
titleLabel.setText("Add a new faculty");
|
||||||
@@ -45,14 +45,14 @@ public class AddFacultyForm extends JFrame {
|
|||||||
|
|
||||||
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
||||||
|
|
||||||
specialtyCombo.addActionListener(this::specialtyComboActionPerformed);
|
ComboRenderer.setRenderer(specialtyCombo, StudyField.getAllEnums().toArray(new StudyField[0]));
|
||||||
submitButton.addActionListener(this::submitButtonActionPerformed);
|
|
||||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
|
||||||
|
|
||||||
ComboBoxRenderer.setRenderer(specialtyCombo, StudyField.getAllEnums().toArray(new StudyField[0]));
|
|
||||||
|
|
||||||
abbreviationField.setText(StudyField.getAbbrevFromString(Objects.requireNonNull(specialtyCombo.getSelectedItem()).toString()));
|
abbreviationField.setText(StudyField.getAbbrevFromString(Objects.requireNonNull(specialtyCombo.getSelectedItem()).toString()));
|
||||||
|
|
||||||
|
specialtyCombo.addActionListener(this::specialtyComboEvent);
|
||||||
|
submitButton.addActionListener(this::submitEvent);
|
||||||
|
cancelButton.addActionListener(this::cancelEvent);
|
||||||
|
|
||||||
GroupLayout layout = new GroupLayout(getContentPane());
|
GroupLayout layout = new GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
@@ -109,25 +109,23 @@ public class AddFacultyForm extends JFrame {
|
|||||||
this.setLocation(x, y);
|
this.setLocation(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void submitButtonActionPerformed(ActionEvent evt) {
|
private void submitEvent(ActionEvent evt) {
|
||||||
String name = nameField.getText();
|
String name = nameField.getText();
|
||||||
String abbreviation = abbreviationField.getText();
|
String abbreviation = abbreviationField.getText();
|
||||||
StudyField specialty = StudyField.getEnum(Objects.requireNonNull(specialtyCombo.getSelectedItem()).toString());
|
StudyField specialty = StudyField.getEnum(Objects.requireNonNull(specialtyCombo.getSelectedItem()).toString());
|
||||||
if (!name.isEmpty()) {
|
if (!name.isEmpty()) {
|
||||||
Faculty newFaculty = new Faculty(name, abbreviation, specialty);
|
Faculty newFaculty = new Faculty(name, abbreviation, specialty);
|
||||||
sv.addFaculty(newFaculty);
|
sv.addFaculty(newFaculty);
|
||||||
DisplayerManager.displayFaculties();
|
DisplayHandler.displayFaculties();
|
||||||
this.dispose();
|
this.dispose();
|
||||||
} else {
|
} else JOptionPane.showMessageDialog(null, "Fill in all the fields!", "Warning!", JOptionPane.INFORMATION_MESSAGE, null);
|
||||||
JOptionPane.showMessageDialog(null, "Fill in all the fields!", "Warning!", JOptionPane.INFORMATION_MESSAGE, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void specialtyComboActionPerformed(ActionEvent evt) {
|
private void specialtyComboEvent(ActionEvent evt) {
|
||||||
abbreviationField.setText(StudyField.getAbbrevFromString(Objects.requireNonNull(specialtyCombo.getSelectedItem()).toString()));
|
abbreviationField.setText(StudyField.getAbbrevFromString(Objects.requireNonNull(specialtyCombo.getSelectedItem()).toString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelButtonActionPerformed(ActionEvent evt) {
|
private void cancelEvent(ActionEvent evt) {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package org.lumijiez.gui.forms.faculty;
|
|||||||
|
|
||||||
import org.lumijiez.base.Faculty;
|
import org.lumijiez.base.Faculty;
|
||||||
import org.lumijiez.enums.StudyField;
|
import org.lumijiez.enums.StudyField;
|
||||||
import org.lumijiez.gui.util.ComboBoxRenderer;
|
import org.lumijiez.gui.util.ComboRenderer;
|
||||||
import org.lumijiez.gui.util.ComponentDecorator;
|
import org.lumijiez.gui.util.ComponentDecorator;
|
||||||
import org.lumijiez.gui.util.DisplayerManager;
|
import org.lumijiez.gui.util.DisplayHandler;
|
||||||
import org.lumijiez.managers.Supervisor;
|
import org.lumijiez.managers.Supervisor;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -13,15 +13,15 @@ import java.awt.event.ActionEvent;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class EditFacultyForm extends JFrame {
|
public class EditFacultyForm extends JFrame {
|
||||||
private final JTextField abbreviationField = new JTextField();
|
|
||||||
private final JLabel abbreviationLabel = new JLabel();
|
private final JLabel abbreviationLabel = new JLabel();
|
||||||
private final JButton cancelButton = new JButton();
|
|
||||||
private final JLabel facultyLabel = new JLabel();
|
private final JLabel facultyLabel = new JLabel();
|
||||||
private final JTextField nameField = new JTextField();
|
|
||||||
private final JLabel nameLabel = new JLabel();
|
private final JLabel nameLabel = new JLabel();
|
||||||
private final JLabel specialtyLabel = new JLabel();
|
private final JLabel specialtyLabel = new JLabel();
|
||||||
private final JButton submitButton = new JButton();
|
|
||||||
private final JLabel titleLabel = new JLabel();
|
private final JLabel titleLabel = new JLabel();
|
||||||
|
private final JButton cancelButton = new JButton();
|
||||||
|
private final JButton submitButton = new JButton();
|
||||||
|
private final JTextField abbreviationField = new JTextField();
|
||||||
|
private final JTextField nameField = new JTextField();
|
||||||
private final JComboBox<Faculty> facultyCombo = new JComboBox<>();
|
private final JComboBox<Faculty> facultyCombo = new JComboBox<>();
|
||||||
private final JComboBox<StudyField> specialtyCombo = new JComboBox<>();
|
private final JComboBox<StudyField> specialtyCombo = new JComboBox<>();
|
||||||
private final Supervisor sv;
|
private final Supervisor sv;
|
||||||
@@ -35,7 +35,7 @@ public class EditFacultyForm extends JFrame {
|
|||||||
|
|
||||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
titleLabel.setFont(new Font("sansserif", Font.PLAIN, 18));
|
||||||
setTitle("Edit a Faculty");
|
setTitle("Edit a Faculty");
|
||||||
|
|
||||||
titleLabel.setText("Edit a faculty");
|
titleLabel.setText("Edit a faculty");
|
||||||
@@ -47,16 +47,16 @@ public class EditFacultyForm extends JFrame {
|
|||||||
|
|
||||||
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
||||||
|
|
||||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
cancelButton.addActionListener(this::cancelEvent);
|
||||||
submitButton.addActionListener(this::submitButtonActionPerformed);
|
submitButton.addActionListener(this::submitEvent);
|
||||||
specialtyCombo.addActionListener(this::specialtyComboActionPerformed);
|
specialtyCombo.addActionListener(this::specialtyComboEvent);
|
||||||
facultyCombo.addActionListener(this::facultyComboActionPerformed);
|
facultyCombo.addActionListener(this::facultyComboEvent);
|
||||||
|
|
||||||
|
ComboRenderer.setRenderer(facultyCombo, sv.facultyManager().getFaculties().toArray(new Faculty[0]));
|
||||||
|
ComboRenderer.setRenderer(specialtyCombo, StudyField.getAllEnums().toArray(new StudyField[0]));
|
||||||
|
|
||||||
specialtyCombo.setSelectedItem(((Faculty) Objects.requireNonNull(facultyCombo.getSelectedItem())).getField());
|
specialtyCombo.setSelectedItem(((Faculty) Objects.requireNonNull(facultyCombo.getSelectedItem())).getField());
|
||||||
|
|
||||||
ComboBoxRenderer.setRenderer(facultyCombo, sv.getFm().getFaculties().toArray(new Faculty[0]));
|
|
||||||
ComboBoxRenderer.setRenderer(specialtyCombo, StudyField.getAllEnums().toArray(new StudyField[0]));
|
|
||||||
|
|
||||||
GroupLayout layout = new GroupLayout(getContentPane());
|
GroupLayout layout = new GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
layout.setHorizontalGroup(
|
layout.setHorizontalGroup(
|
||||||
@@ -87,7 +87,6 @@ public class EditFacultyForm extends JFrame {
|
|||||||
.addComponent(submitButton)))
|
.addComponent(submitButton)))
|
||||||
.addComponent(nameLabel))))))
|
.addComponent(nameLabel))))))
|
||||||
.addContainerGap(24, Short.MAX_VALUE)));
|
.addContainerGap(24, Short.MAX_VALUE)));
|
||||||
|
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
@@ -121,24 +120,24 @@ public class EditFacultyForm extends JFrame {
|
|||||||
this.setLocation(x, y);
|
this.setLocation(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void facultyComboActionPerformed(ActionEvent actionEvent) {
|
private void facultyComboEvent(ActionEvent actionEvent) {
|
||||||
specialtyCombo.setSelectedItem(((Faculty) Objects.requireNonNull(facultyCombo.getSelectedItem())).getField());
|
specialtyCombo.setSelectedItem(((Faculty) Objects.requireNonNull(facultyCombo.getSelectedItem())).getField());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void specialtyComboActionPerformed(ActionEvent actionEvent) {
|
private void specialtyComboEvent(ActionEvent actionEvent) {
|
||||||
abbreviationField.setText(((StudyField) Objects.requireNonNull(specialtyCombo.getSelectedItem())).getAbbreviation());
|
abbreviationField.setText(((StudyField) Objects.requireNonNull(specialtyCombo.getSelectedItem())).getAbbreviation());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void submitButtonActionPerformed(ActionEvent evt) {
|
private void submitEvent(ActionEvent evt) {
|
||||||
((Faculty) Objects.requireNonNull(facultyCombo.getSelectedItem())).setName(nameField.getText());
|
((Faculty) Objects.requireNonNull(facultyCombo.getSelectedItem())).setName(nameField.getText());
|
||||||
((Faculty) Objects.requireNonNull(facultyCombo.getSelectedItem())).setAbbreviation(abbreviationField.getText());
|
((Faculty) Objects.requireNonNull(facultyCombo.getSelectedItem())).setAbbreviation(abbreviationField.getText());
|
||||||
((Faculty) Objects.requireNonNull(facultyCombo.getSelectedItem())).setField(((StudyField) Objects.requireNonNull(specialtyCombo.getSelectedItem())));
|
((Faculty) Objects.requireNonNull(facultyCombo.getSelectedItem())).setField(((StudyField) Objects.requireNonNull(specialtyCombo.getSelectedItem())));
|
||||||
DisplayerManager.displayFaculties();
|
DisplayHandler.displayFaculties();
|
||||||
sv.getLogger().logOperation("Faculty edited : " + ((Faculty) Objects.requireNonNull(facultyCombo.getSelectedItem())).getName());
|
sv.getLogger().logOperation("Faculty edited : " + ((Faculty) Objects.requireNonNull(facultyCombo.getSelectedItem())).getName());
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelButtonActionPerformed(ActionEvent evt) {
|
private void cancelEvent(ActionEvent evt) {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package org.lumijiez.gui.forms.faculty;
|
package org.lumijiez.gui.forms.faculty;
|
||||||
|
|
||||||
import org.lumijiez.base.Faculty;
|
import org.lumijiez.base.Faculty;
|
||||||
import org.lumijiez.gui.util.ComboBoxRenderer;
|
import org.lumijiez.gui.util.ComboRenderer;
|
||||||
import org.lumijiez.gui.util.ComponentDecorator;
|
import org.lumijiez.gui.util.ComponentDecorator;
|
||||||
import org.lumijiez.gui.util.DisplayerManager;
|
import org.lumijiez.gui.util.DisplayHandler;
|
||||||
import org.lumijiez.managers.Supervisor;
|
import org.lumijiez.managers.Supervisor;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -11,13 +11,12 @@ import java.awt.*;
|
|||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
|
||||||
public class RemoveFacultyForm extends JFrame {
|
public class RemoveFacultyForm extends JFrame {
|
||||||
|
|
||||||
private final Supervisor sv;
|
|
||||||
private final JButton cancelButton = new JButton();
|
|
||||||
private final JComboBox<Faculty> facultyCombo = new JComboBox<>();
|
|
||||||
private final JLabel facultyLabel = new JLabel();
|
private final JLabel facultyLabel = new JLabel();
|
||||||
private final JButton submitButton = new JButton();
|
|
||||||
private final JLabel titleLabel = new JLabel();
|
private final JLabel titleLabel = new JLabel();
|
||||||
|
private final JButton cancelButton = new JButton();
|
||||||
|
private final JButton submitButton = new JButton();
|
||||||
|
private final JComboBox<Faculty> facultyCombo = new JComboBox<>();
|
||||||
|
private final Supervisor sv;
|
||||||
|
|
||||||
public RemoveFacultyForm(Supervisor sv) {
|
public RemoveFacultyForm(Supervisor sv) {
|
||||||
this.sv = sv;
|
this.sv = sv;
|
||||||
@@ -28,7 +27,7 @@ public class RemoveFacultyForm extends JFrame {
|
|||||||
|
|
||||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
titleLabel.setFont(new Font("sansserif", Font.PLAIN, 18));
|
||||||
setTitle("Remove a Faculty");
|
setTitle("Remove a Faculty");
|
||||||
|
|
||||||
titleLabel.setText("Remove a faculty");
|
titleLabel.setText("Remove a faculty");
|
||||||
@@ -38,10 +37,10 @@ public class RemoveFacultyForm extends JFrame {
|
|||||||
|
|
||||||
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
||||||
|
|
||||||
submitButton.addActionListener(this::submitButtonActionPerformed);
|
submitButton.addActionListener(this::submitEvent);
|
||||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
cancelButton.addActionListener(this::cancelEvent);
|
||||||
|
|
||||||
ComboBoxRenderer.setRenderer(facultyCombo, sv.getFm().getFaculties().toArray(new Faculty[0]));
|
ComboRenderer.setRenderer(facultyCombo, sv.facultyManager().getFaculties().toArray(new Faculty[0]));
|
||||||
|
|
||||||
GroupLayout layout = new GroupLayout(getContentPane());
|
GroupLayout layout = new GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
@@ -83,13 +82,13 @@ public class RemoveFacultyForm extends JFrame {
|
|||||||
this.setLocation(x, y);
|
this.setLocation(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void submitButtonActionPerformed(ActionEvent evt) {
|
private void submitEvent(ActionEvent evt) {
|
||||||
sv.deleteFaculty(((Faculty) facultyCombo.getSelectedItem()));
|
sv.deleteFaculty(((Faculty) facultyCombo.getSelectedItem()));
|
||||||
DisplayerManager.displayFaculties();
|
DisplayHandler.displayFaculties();
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelButtonActionPerformed(ActionEvent evt) {
|
private void cancelEvent(ActionEvent evt) {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package org.lumijiez.gui.forms.faculty;
|
|||||||
|
|
||||||
import org.lumijiez.base.Faculty;
|
import org.lumijiez.base.Faculty;
|
||||||
import org.lumijiez.base.Group;
|
import org.lumijiez.base.Group;
|
||||||
import org.lumijiez.gui.util.ComboBoxRenderer;
|
import org.lumijiez.gui.util.ComboRenderer;
|
||||||
import org.lumijiez.gui.util.ComponentDecorator;
|
import org.lumijiez.gui.util.ComponentDecorator;
|
||||||
import org.lumijiez.managers.Supervisor;
|
import org.lumijiez.managers.Supervisor;
|
||||||
|
|
||||||
@@ -11,15 +11,13 @@ import java.awt.*;
|
|||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
|
||||||
public class ShowFacultyForm extends JFrame {
|
public class ShowFacultyForm extends JFrame {
|
||||||
|
|
||||||
private final JTextArea mainTextLabel;
|
|
||||||
private final JButton cancelButton = new JButton();
|
|
||||||
private final JComboBox<Faculty> facultyCombo = new JComboBox<>();
|
|
||||||
private final JLabel facultyLabel = new JLabel();
|
|
||||||
private final JButton submitButton = new JButton();
|
|
||||||
private final JLabel titleLabel = new JLabel();
|
private final JLabel titleLabel = new JLabel();
|
||||||
|
private final JLabel facultyLabel = new JLabel();
|
||||||
|
private final JButton cancelButton = new JButton();
|
||||||
|
private final JButton submitButton = new JButton();
|
||||||
|
private final JComboBox<Faculty> facultyCombo = new JComboBox<>();
|
||||||
private final Supervisor sv;
|
private final Supervisor sv;
|
||||||
|
private final JTextArea mainTextLabel;
|
||||||
|
|
||||||
public ShowFacultyForm(Supervisor sv, JTextArea mainTextLabel) {
|
public ShowFacultyForm(Supervisor sv, JTextArea mainTextLabel) {
|
||||||
this.sv = sv;
|
this.sv = sv;
|
||||||
@@ -31,7 +29,7 @@ public class ShowFacultyForm extends JFrame {
|
|||||||
|
|
||||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
titleLabel.setFont(new Font("sansserif", Font.PLAIN, 18));
|
||||||
setTitle("Show a Faculty");
|
setTitle("Show a Faculty");
|
||||||
|
|
||||||
titleLabel.setText("Show a faculty");
|
titleLabel.setText("Show a faculty");
|
||||||
@@ -41,10 +39,10 @@ public class ShowFacultyForm extends JFrame {
|
|||||||
|
|
||||||
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
||||||
|
|
||||||
submitButton.addActionListener(this::submitButtonActionPerformed);
|
submitButton.addActionListener(this::submitEvent);
|
||||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
cancelButton.addActionListener(this::cancelEvent);
|
||||||
|
|
||||||
ComboBoxRenderer.setRenderer(facultyCombo, sv.getFm().getFaculties().toArray(new Faculty[0]));
|
ComboRenderer.setRenderer(facultyCombo, sv.facultyManager().getFaculties().toArray(new Faculty[0]));
|
||||||
|
|
||||||
GroupLayout layout = new GroupLayout(getContentPane());
|
GroupLayout layout = new GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
@@ -66,7 +64,6 @@ public class ShowFacultyForm extends JFrame {
|
|||||||
.addComponent(submitButton))
|
.addComponent(submitButton))
|
||||||
.addComponent(facultyCombo, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 250, GroupLayout.PREFERRED_SIZE)))))
|
.addComponent(facultyCombo, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 250, GroupLayout.PREFERRED_SIZE)))))
|
||||||
.addContainerGap(27, Short.MAX_VALUE)));
|
.addContainerGap(27, Short.MAX_VALUE)));
|
||||||
|
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
@@ -88,7 +85,7 @@ public class ShowFacultyForm extends JFrame {
|
|||||||
this.setLocation(x, y);
|
this.setLocation(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void submitButtonActionPerformed(ActionEvent evt) {
|
private void submitEvent(ActionEvent evt) {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
Faculty fac = (Faculty) facultyCombo.getSelectedItem();
|
Faculty fac = (Faculty) facultyCombo.getSelectedItem();
|
||||||
assert fac != null;
|
assert fac != null;
|
||||||
@@ -104,7 +101,7 @@ public class ShowFacultyForm extends JFrame {
|
|||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelButtonActionPerformed(ActionEvent evt) {
|
private void cancelEvent(ActionEvent evt) {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package org.lumijiez.gui.forms.faculty;
|
|||||||
|
|
||||||
import org.lumijiez.base.Faculty;
|
import org.lumijiez.base.Faculty;
|
||||||
import org.lumijiez.enums.StudyField;
|
import org.lumijiez.enums.StudyField;
|
||||||
import org.lumijiez.gui.util.ComboBoxRenderer;
|
import org.lumijiez.gui.util.ComboRenderer;
|
||||||
import org.lumijiez.gui.util.ComponentDecorator;
|
import org.lumijiez.gui.util.ComponentDecorator;
|
||||||
import org.lumijiez.managers.Supervisor;
|
import org.lumijiez.managers.Supervisor;
|
||||||
|
|
||||||
@@ -11,15 +11,13 @@ import java.awt.*;
|
|||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
|
||||||
public class ShowSpecialtyFacultyForm extends JFrame {
|
public class ShowSpecialtyFacultyForm extends JFrame {
|
||||||
|
|
||||||
private final JTextArea mainTextLabel;
|
|
||||||
private final JButton cancelButton = new JButton();
|
|
||||||
private final JComboBox<StudyField> specialtyCombo = new JComboBox<>();
|
|
||||||
private final JLabel facultyLabel = new JLabel();
|
|
||||||
private final JButton submitButton = new JButton();
|
|
||||||
private final JLabel titleLabel = new JLabel();
|
private final JLabel titleLabel = new JLabel();
|
||||||
|
private final JLabel facultyLabel = new JLabel();
|
||||||
|
private final JButton cancelButton = new JButton();
|
||||||
|
private final JButton submitButton = new JButton();
|
||||||
|
private final JComboBox<StudyField> specialtyCombo = new JComboBox<>();
|
||||||
private final Supervisor sv;
|
private final Supervisor sv;
|
||||||
|
private final JTextArea mainTextLabel;
|
||||||
|
|
||||||
public ShowSpecialtyFacultyForm(Supervisor sv, JTextArea mainTextLabel) {
|
public ShowSpecialtyFacultyForm(Supervisor sv, JTextArea mainTextLabel) {
|
||||||
this.sv = sv;
|
this.sv = sv;
|
||||||
@@ -31,7 +29,7 @@ public class ShowSpecialtyFacultyForm extends JFrame {
|
|||||||
|
|
||||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
titleLabel.setFont(new Font("sansserif", Font.PLAIN, 18));
|
||||||
setTitle("Show a Faculty by Specialty");
|
setTitle("Show a Faculty by Specialty");
|
||||||
|
|
||||||
titleLabel.setText("Show a faculty");
|
titleLabel.setText("Show a faculty");
|
||||||
@@ -41,10 +39,10 @@ public class ShowSpecialtyFacultyForm extends JFrame {
|
|||||||
|
|
||||||
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
||||||
|
|
||||||
submitButton.addActionListener(this::submitButtonActionPerformed);
|
submitButton.addActionListener(this::submitEvent);
|
||||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
cancelButton.addActionListener(this::cancelEvent);
|
||||||
|
|
||||||
ComboBoxRenderer.setRenderer(specialtyCombo, StudyField.getAllEnums().toArray(new StudyField[0]));
|
ComboRenderer.setRenderer(specialtyCombo, StudyField.getAllEnums().toArray(new StudyField[0]));
|
||||||
|
|
||||||
GroupLayout layout = new GroupLayout(getContentPane());
|
GroupLayout layout = new GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
@@ -66,7 +64,6 @@ public class ShowSpecialtyFacultyForm extends JFrame {
|
|||||||
.addComponent(submitButton))
|
.addComponent(submitButton))
|
||||||
.addComponent(specialtyCombo, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 250, GroupLayout.PREFERRED_SIZE)))))
|
.addComponent(specialtyCombo, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 250, GroupLayout.PREFERRED_SIZE)))))
|
||||||
.addContainerGap(27, Short.MAX_VALUE)));
|
.addContainerGap(27, Short.MAX_VALUE)));
|
||||||
|
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
@@ -88,7 +85,7 @@ public class ShowSpecialtyFacultyForm extends JFrame {
|
|||||||
this.setLocation(x, y);
|
this.setLocation(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void submitButtonActionPerformed(ActionEvent evt) {
|
private void submitEvent(ActionEvent evt) {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
StudyField fac = (StudyField) specialtyCombo.getSelectedItem();
|
StudyField fac = (StudyField) specialtyCombo.getSelectedItem();
|
||||||
assert fac != null;
|
assert fac != null;
|
||||||
@@ -96,17 +93,15 @@ public class ShowSpecialtyFacultyForm extends JFrame {
|
|||||||
builder.append("Specialty: ").append(fac.getName()).append("\n");
|
builder.append("Specialty: ").append(fac.getName()).append("\n");
|
||||||
builder.append("==========\n");
|
builder.append("==========\n");
|
||||||
builder.append("Faculties: ").append("\n");
|
builder.append("Faculties: ").append("\n");
|
||||||
for (Faculty fc : sv.getFm().getFaculties()) {
|
for (Faculty fc : sv.facultyManager().getFaculties())
|
||||||
if (fc.getField().equals(fac)) {
|
if (fc.getField().equals(fac))
|
||||||
builder.append(fc.getName()).append("\n").append("==========\n");
|
builder.append(fc.getName()).append("\n").append("==========\n");
|
||||||
}
|
|
||||||
}
|
|
||||||
builder.append("============================================================");
|
builder.append("============================================================");
|
||||||
mainTextLabel.setText(builder.toString());
|
mainTextLabel.setText(builder.toString());
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelButtonActionPerformed(ActionEvent evt) {
|
private void cancelEvent(ActionEvent evt) {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package org.lumijiez.gui.forms.group;
|
|||||||
|
|
||||||
import org.lumijiez.base.Faculty;
|
import org.lumijiez.base.Faculty;
|
||||||
import org.lumijiez.base.Group;
|
import org.lumijiez.base.Group;
|
||||||
import org.lumijiez.gui.util.ComboBoxRenderer;
|
import org.lumijiez.gui.util.ComboRenderer;
|
||||||
import org.lumijiez.gui.util.ComponentDecorator;
|
import org.lumijiez.gui.util.ComponentDecorator;
|
||||||
import org.lumijiez.gui.util.DisplayerManager;
|
import org.lumijiez.gui.util.DisplayHandler;
|
||||||
import org.lumijiez.managers.Supervisor;
|
import org.lumijiez.managers.Supervisor;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -13,15 +13,14 @@ import java.awt.event.ActionEvent;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class AddGroupForm extends JFrame {
|
public class AddGroupForm extends JFrame {
|
||||||
|
|
||||||
private final Supervisor sv;
|
|
||||||
private final JLabel titleLabel = new JLabel();
|
private final JLabel titleLabel = new JLabel();
|
||||||
private final JTextField nameField = new JTextField();
|
private final JLabel nameLabel = new JLabel();
|
||||||
|
private final JLabel facultyLabel = new JLabel();
|
||||||
private final JButton submitButton = new JButton();
|
private final JButton submitButton = new JButton();
|
||||||
private final JButton cancelButton = new JButton();
|
private final JButton cancelButton = new JButton();
|
||||||
private final JLabel nameLabel = new JLabel();
|
private final JTextField nameField = new JTextField();
|
||||||
private final JComboBox<Faculty> facultyCombo = new JComboBox<>();
|
private final JComboBox<Faculty> facultyCombo = new JComboBox<>();
|
||||||
private final JLabel facultyLabel = new JLabel();
|
private final Supervisor sv;
|
||||||
|
|
||||||
public AddGroupForm(Supervisor sv) {
|
public AddGroupForm(Supervisor sv) {
|
||||||
this.sv = sv;
|
this.sv = sv;
|
||||||
@@ -32,7 +31,7 @@ public class AddGroupForm extends JFrame {
|
|||||||
|
|
||||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
titleLabel.setFont(new Font("sansserif", Font.PLAIN, 18));
|
||||||
setTitle("Add a Group");
|
setTitle("Add a Group");
|
||||||
|
|
||||||
titleLabel.setText("Add a new group");
|
titleLabel.setText("Add a new group");
|
||||||
@@ -43,10 +42,10 @@ public class AddGroupForm extends JFrame {
|
|||||||
|
|
||||||
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
||||||
|
|
||||||
submitButton.addActionListener(this::submitButtonActionPerformed);
|
submitButton.addActionListener(this::submitEvent);
|
||||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
cancelButton.addActionListener(this::cancelEvent);
|
||||||
|
|
||||||
ComboBoxRenderer.setRenderer(facultyCombo, sv.getFm().getFaculties().toArray(new Faculty[0]));
|
ComboRenderer.setRenderer(facultyCombo, sv.facultyManager().getFaculties().toArray(new Faculty[0]));
|
||||||
|
|
||||||
GroupLayout layout = new GroupLayout(getContentPane());
|
GroupLayout layout = new GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
@@ -71,7 +70,6 @@ public class AddGroupForm extends JFrame {
|
|||||||
.addGap(38, 38, 38)
|
.addGap(38, 38, 38)
|
||||||
.addComponent(titleLabel)))
|
.addComponent(titleLabel)))
|
||||||
.addContainerGap(29, Short.MAX_VALUE)));
|
.addContainerGap(29, Short.MAX_VALUE)));
|
||||||
|
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
@@ -97,19 +95,17 @@ public class AddGroupForm extends JFrame {
|
|||||||
this.setLocation(x, y);
|
this.setLocation(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void submitButtonActionPerformed(ActionEvent evt) {
|
private void submitEvent(ActionEvent evt) {
|
||||||
if (!nameField.getText().isEmpty()) {
|
if (!nameField.getText().isEmpty()) {
|
||||||
Group gr = new Group(nameField.getText());
|
Group gr = new Group(nameField.getText());
|
||||||
Faculty fac = ((Faculty) Objects.requireNonNull(facultyCombo.getSelectedItem()));
|
Faculty fac = ((Faculty) Objects.requireNonNull(facultyCombo.getSelectedItem()));
|
||||||
sv.addGroup(gr, fac);
|
sv.addGroup(gr, fac);
|
||||||
DisplayerManager.displayGroups();
|
DisplayHandler.displayGroups();
|
||||||
this.dispose();
|
this.dispose();
|
||||||
} else {
|
} else JOptionPane.showMessageDialog(null, "Fill in all the fields!", "Warning!", JOptionPane.INFORMATION_MESSAGE, null);
|
||||||
JOptionPane.showMessageDialog(null, "Fill in all the fields!", "Warning!", JOptionPane.INFORMATION_MESSAGE, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelButtonActionPerformed(ActionEvent evt) {
|
private void cancelEvent(ActionEvent evt) {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package org.lumijiez.gui.forms.group;
|
package org.lumijiez.gui.forms.group;
|
||||||
|
|
||||||
import org.lumijiez.base.Group;
|
import org.lumijiez.base.Group;
|
||||||
import org.lumijiez.gui.util.ComboBoxRenderer;
|
import org.lumijiez.gui.util.ComboRenderer;
|
||||||
import org.lumijiez.gui.util.ComponentDecorator;
|
import org.lumijiez.gui.util.ComponentDecorator;
|
||||||
import org.lumijiez.gui.util.DisplayerManager;
|
import org.lumijiez.gui.util.DisplayHandler;
|
||||||
import org.lumijiez.managers.Supervisor;
|
import org.lumijiez.managers.Supervisor;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -11,12 +11,12 @@ import java.awt.*;
|
|||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
|
|
||||||
public class DeleteGroupForm extends JFrame {
|
public class DeleteGroupForm extends JFrame {
|
||||||
private final Supervisor sv;
|
|
||||||
private final JButton cancelButton = new JButton();
|
|
||||||
private final JComboBox<Group> groupCombo = new JComboBox<>();
|
|
||||||
private final JLabel groupLabel = new JLabel();
|
private final JLabel groupLabel = new JLabel();
|
||||||
private final JButton submitButton = new JButton();
|
|
||||||
private final JLabel titleLabel = new JLabel();
|
private final JLabel titleLabel = new JLabel();
|
||||||
|
private final JButton cancelButton = new JButton();
|
||||||
|
private final JButton submitButton = new JButton();
|
||||||
|
private final JComboBox<Group> groupCombo = new JComboBox<>();
|
||||||
|
private final Supervisor sv;
|
||||||
|
|
||||||
public DeleteGroupForm(Supervisor sv) {
|
public DeleteGroupForm(Supervisor sv) {
|
||||||
this.sv = sv;
|
this.sv = sv;
|
||||||
@@ -27,7 +27,7 @@ public class DeleteGroupForm extends JFrame {
|
|||||||
|
|
||||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
titleLabel.setFont(new Font("sansserif", Font.PLAIN, 18));
|
||||||
setTitle("Delete a Group");
|
setTitle("Delete a Group");
|
||||||
|
|
||||||
titleLabel.setText("Delete a group");
|
titleLabel.setText("Delete a group");
|
||||||
@@ -37,10 +37,10 @@ public class DeleteGroupForm extends JFrame {
|
|||||||
|
|
||||||
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
||||||
|
|
||||||
submitButton.addActionListener(this::submitButtonActionPerformed);
|
submitButton.addActionListener(this::submitEvent);
|
||||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
cancelButton.addActionListener(this::cancelEvent);
|
||||||
|
|
||||||
ComboBoxRenderer.setRenderer(groupCombo, sv.getFm().getGm().getGroups().toArray(new Group[0]));
|
ComboRenderer.setRenderer(groupCombo, sv.groupManager().getGroups().toArray(new Group[0]));
|
||||||
|
|
||||||
GroupLayout layout = new GroupLayout(getContentPane());
|
GroupLayout layout = new GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
@@ -62,7 +62,6 @@ public class DeleteGroupForm extends JFrame {
|
|||||||
.addGap(54, 54, 54)
|
.addGap(54, 54, 54)
|
||||||
.addComponent(titleLabel)))
|
.addComponent(titleLabel)))
|
||||||
.addContainerGap(29, Short.MAX_VALUE)));
|
.addContainerGap(29, Short.MAX_VALUE)));
|
||||||
|
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
@@ -84,13 +83,13 @@ public class DeleteGroupForm extends JFrame {
|
|||||||
this.setLocation(x, y);
|
this.setLocation(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void submitButtonActionPerformed(ActionEvent evt) {
|
private void submitEvent(ActionEvent evt) {
|
||||||
sv.deleteGroup(((Group) groupCombo.getSelectedItem()));
|
sv.deleteGroup(((Group) groupCombo.getSelectedItem()));
|
||||||
DisplayerManager.displayGroups();
|
DisplayHandler.displayGroups();
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelButtonActionPerformed(ActionEvent evt) {
|
private void cancelEvent(ActionEvent evt) {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package org.lumijiez.gui.forms.group;
|
|||||||
|
|
||||||
import org.lumijiez.base.Faculty;
|
import org.lumijiez.base.Faculty;
|
||||||
import org.lumijiez.base.Group;
|
import org.lumijiez.base.Group;
|
||||||
import org.lumijiez.gui.util.ComboBoxRenderer;
|
import org.lumijiez.gui.util.ComboRenderer;
|
||||||
import org.lumijiez.gui.util.ComponentDecorator;
|
import org.lumijiez.gui.util.ComponentDecorator;
|
||||||
import org.lumijiez.gui.util.DisplayerManager;
|
import org.lumijiez.gui.util.DisplayHandler;
|
||||||
import org.lumijiez.managers.Supervisor;
|
import org.lumijiez.managers.Supervisor;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -13,17 +13,16 @@ import java.awt.event.ActionEvent;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class EditGroupForm extends JFrame {
|
public class EditGroupForm extends JFrame {
|
||||||
|
|
||||||
private final Supervisor sv;
|
|
||||||
private final JButton cancelButton = new JButton();
|
|
||||||
private final JComboBox<Faculty> facultyCombo = new JComboBox<>();
|
|
||||||
private final JLabel facultyLabel = new JLabel();
|
|
||||||
private final JComboBox<Group> groupCombo = new JComboBox<>();
|
|
||||||
private final JLabel groupLabel = new JLabel();
|
|
||||||
private final JTextField nameField = new JTextField();
|
|
||||||
private final JLabel nameLabel = new JLabel();
|
|
||||||
private final JButton submitButton = new JButton();
|
|
||||||
private final JLabel titleLabel = new JLabel();
|
private final JLabel titleLabel = new JLabel();
|
||||||
|
private final JLabel facultyLabel = new JLabel();
|
||||||
|
private final JLabel groupLabel = new JLabel();
|
||||||
|
private final JLabel nameLabel = new JLabel();
|
||||||
|
private final JButton cancelButton = new JButton();
|
||||||
|
private final JButton submitButton = new JButton();
|
||||||
|
private final JTextField nameField = new JTextField();
|
||||||
|
private final JComboBox<Faculty> facultyCombo = new JComboBox<>();
|
||||||
|
private final JComboBox<Group> groupCombo = new JComboBox<>();
|
||||||
|
private final Supervisor sv;
|
||||||
|
|
||||||
public EditGroupForm(Supervisor sv) {
|
public EditGroupForm(Supervisor sv) {
|
||||||
this.sv = sv;
|
this.sv = sv;
|
||||||
@@ -34,7 +33,7 @@ public class EditGroupForm extends JFrame {
|
|||||||
|
|
||||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
titleLabel.setFont(new Font("sansserif", Font.PLAIN, 18));
|
||||||
setTitle("Edit a Group");
|
setTitle("Edit a Group");
|
||||||
|
|
||||||
titleLabel.setText("Edit a group");
|
titleLabel.setText("Edit a group");
|
||||||
@@ -46,11 +45,11 @@ public class EditGroupForm extends JFrame {
|
|||||||
|
|
||||||
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
||||||
|
|
||||||
submitButton.addActionListener(this::submitButtonActionPerformed);
|
submitButton.addActionListener(this::submitEvent);
|
||||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
cancelButton.addActionListener(this::cancelEvent);
|
||||||
|
|
||||||
ComboBoxRenderer.setRenderer(facultyCombo, sv.getFm().getFaculties().toArray(new Faculty[0]));
|
ComboRenderer.setRenderer(facultyCombo, sv.facultyManager().getFaculties().toArray(new Faculty[0]));
|
||||||
ComboBoxRenderer.setRenderer(groupCombo, sv.getFm().getGm().getGroups().toArray(new Group[0]));
|
ComboRenderer.setRenderer(groupCombo, sv.groupManager().getGroups().toArray(new Group[0]));
|
||||||
|
|
||||||
GroupLayout layout = new GroupLayout(getContentPane());
|
GroupLayout layout = new GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
@@ -79,7 +78,6 @@ public class EditGroupForm extends JFrame {
|
|||||||
.addComponent(facultyCombo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
.addComponent(facultyCombo, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||||
.addComponent(submitButton))))
|
.addComponent(submitButton))))
|
||||||
.addContainerGap(34, Short.MAX_VALUE)));
|
.addContainerGap(34, Short.MAX_VALUE)));
|
||||||
|
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
@@ -111,15 +109,15 @@ public class EditGroupForm extends JFrame {
|
|||||||
this.setLocation(x, y);
|
this.setLocation(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void submitButtonActionPerformed(ActionEvent evt) {
|
private void submitEvent(ActionEvent evt) {
|
||||||
Faculty fac = ((Faculty) Objects.requireNonNull(facultyCombo.getSelectedItem()));
|
Faculty fac = ((Faculty) Objects.requireNonNull(facultyCombo.getSelectedItem()));
|
||||||
Group gr = (Group) Objects.requireNonNull(groupCombo.getSelectedItem());
|
Group gr = (Group) Objects.requireNonNull(groupCombo.getSelectedItem());
|
||||||
sv.editGroup(gr, nameField.getText(), fac);
|
sv.editGroup(gr, nameField.getText(), fac);
|
||||||
DisplayerManager.displayGroups();
|
DisplayHandler.displayGroups();
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelButtonActionPerformed(ActionEvent evt) {
|
private void cancelEvent(ActionEvent evt) {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package org.lumijiez.gui.forms.group;
|
|||||||
|
|
||||||
import org.lumijiez.base.Group;
|
import org.lumijiez.base.Group;
|
||||||
import org.lumijiez.base.Student;
|
import org.lumijiez.base.Student;
|
||||||
import org.lumijiez.gui.util.ComboBoxRenderer;
|
import org.lumijiez.gui.util.ComboRenderer;
|
||||||
import org.lumijiez.gui.util.ComponentDecorator;
|
import org.lumijiez.gui.util.ComponentDecorator;
|
||||||
import org.lumijiez.managers.Supervisor;
|
import org.lumijiez.managers.Supervisor;
|
||||||
|
|
||||||
@@ -13,14 +13,13 @@ import java.util.Objects;
|
|||||||
|
|
||||||
|
|
||||||
public class ShowGroupForm extends JFrame {
|
public class ShowGroupForm extends JFrame {
|
||||||
|
|
||||||
private final JTextArea mainTextLabel;
|
|
||||||
private final JButton cancelButton = new JButton();
|
|
||||||
private final JComboBox<Group> groupCombo = new JComboBox<>();
|
|
||||||
private final JLabel groupLabel = new JLabel();
|
|
||||||
private final JButton submitButton = new JButton();
|
|
||||||
private final JLabel titleLabel = new JLabel();
|
private final JLabel titleLabel = new JLabel();
|
||||||
|
private final JLabel groupLabel = new JLabel();
|
||||||
|
private final JButton cancelButton = new JButton();
|
||||||
|
private final JButton submitButton = new JButton();
|
||||||
|
private final JComboBox<Group> groupCombo = new JComboBox<>();
|
||||||
private final Supervisor sv;
|
private final Supervisor sv;
|
||||||
|
private final JTextArea mainTextLabel;
|
||||||
|
|
||||||
public ShowGroupForm(Supervisor sv, JTextArea mainTextLabel) {
|
public ShowGroupForm(Supervisor sv, JTextArea mainTextLabel) {
|
||||||
this.sv = sv;
|
this.sv = sv;
|
||||||
@@ -32,7 +31,7 @@ public class ShowGroupForm extends JFrame {
|
|||||||
|
|
||||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
titleLabel.setFont(new Font("sansserif", Font.PLAIN, 18));
|
||||||
setTitle("Show a Group");
|
setTitle("Show a Group");
|
||||||
|
|
||||||
titleLabel.setText("Show a group");
|
titleLabel.setText("Show a group");
|
||||||
@@ -42,10 +41,10 @@ public class ShowGroupForm extends JFrame {
|
|||||||
|
|
||||||
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
||||||
|
|
||||||
submitButton.addActionListener(this::submitButtonActionPerformed);
|
submitButton.addActionListener(this::submitEvent);
|
||||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
cancelButton.addActionListener(this::cancelEvent);
|
||||||
|
|
||||||
ComboBoxRenderer.setRenderer(groupCombo, sv.getFm().getGm().getGroups().toArray(new Group[0]));
|
ComboRenderer.setRenderer(groupCombo, sv.groupManager().getGroups().toArray(new Group[0]));
|
||||||
|
|
||||||
GroupLayout layout = new GroupLayout(getContentPane());
|
GroupLayout layout = new GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
@@ -67,7 +66,6 @@ public class ShowGroupForm extends JFrame {
|
|||||||
.addGap(47, 47, 47)
|
.addGap(47, 47, 47)
|
||||||
.addComponent(titleLabel)))
|
.addComponent(titleLabel)))
|
||||||
.addContainerGap(24, Short.MAX_VALUE)));
|
.addContainerGap(24, Short.MAX_VALUE)));
|
||||||
|
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
@@ -89,23 +87,20 @@ public class ShowGroupForm extends JFrame {
|
|||||||
this.setLocation(x, y);
|
this.setLocation(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void submitButtonActionPerformed(ActionEvent evt) {
|
private void submitEvent(ActionEvent evt) {
|
||||||
StringBuilder text = new StringBuilder();
|
StringBuilder text = new StringBuilder();
|
||||||
Group gr = (Group) Objects.requireNonNull(groupCombo.getSelectedItem());
|
Group gr = (Group) Objects.requireNonNull(groupCombo.getSelectedItem());
|
||||||
|
|
||||||
text.append("======================= Group Info =========================\n");
|
text.append("======================= Group Info =========================\n");
|
||||||
text.append("=================== Group: ").append(gr.getName()).append("=====================\n");
|
text.append("=================== Group: ").append(gr.getName()).append("=====================\n");
|
||||||
|
for (Student student : gr.getStudents())
|
||||||
for (Student student : gr.getStudents()) {
|
|
||||||
text.append("Name: ").append(student.getName()).append("\nEmail: ").append(student.getEmail())
|
text.append("Name: ").append(student.getName()).append("\nEmail: ").append(student.getEmail())
|
||||||
.append("\nEnrol date: ").append(student.getEnrollmentDate());
|
.append("\nEnrol date: ").append(student.getEnrollmentDate())
|
||||||
text.append("\n===============================================\n");
|
.append("\n===============================================\n");
|
||||||
}
|
|
||||||
mainTextLabel.setText(text.toString());
|
mainTextLabel.setText(text.toString());
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelButtonActionPerformed(ActionEvent evt) {
|
private void cancelEvent(ActionEvent evt) {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package org.lumijiez.gui.forms.student;
|
|||||||
|
|
||||||
import org.lumijiez.base.Faculty;
|
import org.lumijiez.base.Faculty;
|
||||||
import org.lumijiez.base.Group;
|
import org.lumijiez.base.Group;
|
||||||
import org.lumijiez.gui.util.ComboBoxRenderer;
|
import org.lumijiez.gui.util.ComboRenderer;
|
||||||
import org.lumijiez.gui.util.ComponentDecorator;
|
import org.lumijiez.gui.util.ComponentDecorator;
|
||||||
import org.lumijiez.gui.util.DisplayerManager;
|
import org.lumijiez.gui.util.DisplayHandler;
|
||||||
import org.lumijiez.managers.Supervisor;
|
import org.lumijiez.managers.Supervisor;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -15,32 +15,32 @@ import java.util.Date;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class AddStudentForm extends JFrame {
|
public class AddStudentForm extends JFrame {
|
||||||
private final Supervisor sv;
|
|
||||||
private final JLabel titleLabel = new JLabel();
|
private final JLabel titleLabel = new JLabel();
|
||||||
private final JComboBox<Group> groupCombo = new JComboBox<>();
|
|
||||||
private final JTextField nameField = new JTextField();
|
|
||||||
private final JButton submitButton = new JButton();
|
|
||||||
private final JButton cancelButton = new JButton();
|
|
||||||
private final JLabel nameLabel = new JLabel();
|
private final JLabel nameLabel = new JLabel();
|
||||||
private final JTextField surnameField = new JTextField();
|
|
||||||
private final JTextField emailField = new JTextField();
|
|
||||||
private final JLabel surnameLabel = new JLabel();
|
private final JLabel surnameLabel = new JLabel();
|
||||||
private final JLabel emailLabel = new JLabel();
|
private final JLabel emailLabel = new JLabel();
|
||||||
private final JComboBox<Faculty> facultyCombo = new JComboBox<>();
|
|
||||||
private final JLabel groupLabel = new JLabel();
|
private final JLabel groupLabel = new JLabel();
|
||||||
private final JLabel facultyLabel = new JLabel();
|
private final JLabel facultyLabel = new JLabel();
|
||||||
private final JComboBox<Integer> birthYearField = new JComboBox<>();
|
|
||||||
private final JComboBox<Integer> birthDayField = new JComboBox<>();
|
|
||||||
private final JComboBox<Integer> birthMonthField = new JComboBox<>();
|
|
||||||
private final JLabel birthYearLabel = new JLabel();
|
private final JLabel birthYearLabel = new JLabel();
|
||||||
private final JLabel birthDayLabel = new JLabel();
|
private final JLabel birthDayLabel = new JLabel();
|
||||||
private final JLabel birthMonthLabel = new JLabel();
|
private final JLabel birthMonthLabel = new JLabel();
|
||||||
private final JLabel enrolDayLabel = new JLabel();
|
private final JLabel enrolDayLabel = new JLabel();
|
||||||
|
private final JLabel enrolMonthLabel = new JLabel();
|
||||||
|
private final JLabel enrolYearLabel = new JLabel();
|
||||||
|
private final JButton submitButton = new JButton();
|
||||||
|
private final JButton cancelButton = new JButton();
|
||||||
|
private final JTextField nameField = new JTextField();
|
||||||
|
private final JTextField surnameField = new JTextField();
|
||||||
|
private final JTextField emailField = new JTextField();
|
||||||
|
private final JComboBox<Group> groupCombo = new JComboBox<>();
|
||||||
|
private final JComboBox<Faculty> facultyCombo = new JComboBox<>();
|
||||||
|
private final JComboBox<Integer> birthYearField = new JComboBox<>();
|
||||||
|
private final JComboBox<Integer> birthDayField = new JComboBox<>();
|
||||||
|
private final JComboBox<Integer> birthMonthField = new JComboBox<>();
|
||||||
private final JComboBox<Integer> enrolDayField = new JComboBox<>();
|
private final JComboBox<Integer> enrolDayField = new JComboBox<>();
|
||||||
private final JComboBox<Integer> enrolMonthField = new JComboBox<>();
|
private final JComboBox<Integer> enrolMonthField = new JComboBox<>();
|
||||||
private final JComboBox<Integer> enrolYearField = new JComboBox<>();
|
private final JComboBox<Integer> enrolYearField = new JComboBox<>();
|
||||||
private final JLabel enrolMonthLabel = new JLabel();
|
private final Supervisor sv;
|
||||||
private final JLabel enrolYearLabel = new JLabel();
|
|
||||||
|
|
||||||
public AddStudentForm(Supervisor sv) {
|
public AddStudentForm(Supervisor sv) {
|
||||||
this.sv = sv;
|
this.sv = sv;
|
||||||
@@ -76,7 +76,7 @@ public class AddStudentForm extends JFrame {
|
|||||||
|
|
||||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
titleLabel.setFont(new Font("sansserif", Font.PLAIN, 18));
|
||||||
setTitle("Add a Student");
|
setTitle("Add a Student");
|
||||||
|
|
||||||
titleLabel.setText("Add a new student");
|
titleLabel.setText("Add a new student");
|
||||||
@@ -96,11 +96,11 @@ public class AddStudentForm extends JFrame {
|
|||||||
|
|
||||||
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
||||||
|
|
||||||
submitButton.addActionListener(this::submitButtonActionPerformed);
|
submitButton.addActionListener(this::submitEvent);
|
||||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
cancelButton.addActionListener(this::cancelEvent);
|
||||||
|
|
||||||
ComboBoxRenderer.setRenderer(facultyCombo, sv.getFm().getFaculties().toArray(new Faculty[0]));
|
ComboRenderer.setRenderer(facultyCombo, sv.facultyManager().getFaculties().toArray(new Faculty[0]));
|
||||||
ComboBoxRenderer.setRenderer(groupCombo, sv.getFm().getGm().getGroups().toArray(new Group[0]));
|
ComboRenderer.setRenderer(groupCombo, sv.groupManager().getGroups().toArray(new Group[0]));
|
||||||
|
|
||||||
GroupLayout layout = new GroupLayout(getContentPane());
|
GroupLayout layout = new GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
@@ -240,11 +240,11 @@ public class AddStudentForm extends JFrame {
|
|||||||
this.setLocation(x, y);
|
this.setLocation(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelButtonActionPerformed(ActionEvent actionEvent) {
|
private void cancelEvent(ActionEvent actionEvent) {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void submitButtonActionPerformed(ActionEvent evt) {
|
private void submitEvent(ActionEvent evt) {
|
||||||
String name = nameField.getText();
|
String name = nameField.getText();
|
||||||
String surname = surnameField.getText();
|
String surname = surnameField.getText();
|
||||||
String email = emailField.getText();
|
String email = emailField.getText();
|
||||||
@@ -255,11 +255,9 @@ public class AddStudentForm extends JFrame {
|
|||||||
|
|
||||||
if (!name.isEmpty() && !surname.isEmpty() && !email.isEmpty()) {
|
if (!name.isEmpty() && !surname.isEmpty() && !email.isEmpty()) {
|
||||||
sv.addStudent(name, surname, email, group, faculty, birthDate, enrolDate);
|
sv.addStudent(name, surname, email, group, faculty, birthDate, enrolDate);
|
||||||
DisplayerManager.displayStudents();
|
DisplayHandler.displayStudents();
|
||||||
this.dispose();
|
this.dispose();
|
||||||
} else {
|
} else JOptionPane.showMessageDialog(null, "Fill in all the fields!", "Warning!", JOptionPane.INFORMATION_MESSAGE, null);
|
||||||
JOptionPane.showMessageDialog(null, "Fill in all the fields!", "Warning!", JOptionPane.INFORMATION_MESSAGE, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Group getSelectedGroup() {
|
private Group getSelectedGroup() {
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package org.lumijiez.gui.forms.student;
|
package org.lumijiez.gui.forms.student;
|
||||||
|
|
||||||
import org.lumijiez.base.Student;
|
import org.lumijiez.base.Student;
|
||||||
import org.lumijiez.gui.util.ComboBoxRenderer;
|
import org.lumijiez.gui.util.ComboRenderer;
|
||||||
import org.lumijiez.gui.util.ComponentDecorator;
|
import org.lumijiez.gui.util.ComponentDecorator;
|
||||||
import org.lumijiez.gui.util.DisplayerManager;
|
import org.lumijiez.gui.util.DisplayHandler;
|
||||||
import org.lumijiez.managers.Supervisor;
|
import org.lumijiez.managers.Supervisor;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -12,12 +12,12 @@ import java.awt.event.ActionEvent;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class DeleteStudentForm extends JFrame {
|
public class DeleteStudentForm extends JFrame {
|
||||||
private final Supervisor sv;
|
|
||||||
private final JButton cancelButton = new JButton();
|
|
||||||
private final JComboBox<Student> studentCombo = new JComboBox<>();
|
|
||||||
private final JLabel studentLabel = new JLabel();
|
|
||||||
private final JButton submitButton = new JButton();
|
|
||||||
private final JLabel titleLabel = new JLabel();
|
private final JLabel titleLabel = new JLabel();
|
||||||
|
private final JLabel studentLabel = new JLabel();
|
||||||
|
private final JButton cancelButton = new JButton();
|
||||||
|
private final JButton submitButton = new JButton();
|
||||||
|
private final JComboBox<Student> studentCombo = new JComboBox<>();
|
||||||
|
private final Supervisor sv;
|
||||||
|
|
||||||
public DeleteStudentForm(Supervisor sv) {
|
public DeleteStudentForm(Supervisor sv) {
|
||||||
this.sv = sv;
|
this.sv = sv;
|
||||||
@@ -28,20 +28,20 @@ public class DeleteStudentForm extends JFrame {
|
|||||||
|
|
||||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
titleLabel.setFont(new Font("sansserif", Font.PLAIN, 18));
|
||||||
setTitle("Delete a Student");
|
setTitle("Delete a Student");
|
||||||
|
|
||||||
ComboBoxRenderer.setRenderer(studentCombo, sv.getFm().getGm().getSm().getStudents().toArray(new Student[0]));
|
ComboRenderer.setRenderer(studentCombo, sv.studentManager().getStudents().toArray(new Student[0]));
|
||||||
|
|
||||||
studentLabel.setText("Student:");
|
|
||||||
submitButton.setText("Submit");
|
|
||||||
cancelButton.setText("Cancel");
|
|
||||||
titleLabel.setText("Delete Student");
|
|
||||||
|
|
||||||
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
||||||
|
|
||||||
submitButton.addActionListener(this::submitButtonActionPerformed);
|
cancelButton.setText("Cancel");
|
||||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
titleLabel.setText("Delete Student");
|
||||||
|
submitButton.setText("Submit");
|
||||||
|
studentLabel.setText("Student:");
|
||||||
|
|
||||||
|
submitButton.addActionListener(this::submitEvent);
|
||||||
|
cancelButton.addActionListener(this::cancelEvent);
|
||||||
|
|
||||||
GroupLayout layout = new GroupLayout(getContentPane());
|
GroupLayout layout = new GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
@@ -63,7 +63,6 @@ public class DeleteStudentForm extends JFrame {
|
|||||||
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
.addComponent(titleLabel)
|
.addComponent(titleLabel)
|
||||||
.addGap(51, 51, 51)));
|
.addGap(51, 51, 51)));
|
||||||
|
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
@@ -85,14 +84,14 @@ public class DeleteStudentForm extends JFrame {
|
|||||||
this.setLocation(x, y);
|
this.setLocation(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void submitButtonActionPerformed(ActionEvent evt) {
|
private void submitEvent(ActionEvent evt) {
|
||||||
Student student = ((Student) Objects.requireNonNull(studentCombo.getSelectedItem()));
|
Student student = ((Student) Objects.requireNonNull(studentCombo.getSelectedItem()));
|
||||||
sv.deleteStudent(student);
|
sv.deleteStudent(student);
|
||||||
DisplayerManager.displayStudents();
|
DisplayHandler.displayStudents();
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelButtonActionPerformed(ActionEvent evt) {
|
private void cancelEvent(ActionEvent evt) {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,9 +3,9 @@ package org.lumijiez.gui.forms.student;
|
|||||||
import org.lumijiez.base.Faculty;
|
import org.lumijiez.base.Faculty;
|
||||||
import org.lumijiez.base.Group;
|
import org.lumijiez.base.Group;
|
||||||
import org.lumijiez.base.Student;
|
import org.lumijiez.base.Student;
|
||||||
import org.lumijiez.gui.util.ComboBoxRenderer;
|
import org.lumijiez.gui.util.ComboRenderer;
|
||||||
import org.lumijiez.gui.util.ComponentDecorator;
|
import org.lumijiez.gui.util.ComponentDecorator;
|
||||||
import org.lumijiez.gui.util.DisplayerManager;
|
import org.lumijiez.gui.util.DisplayHandler;
|
||||||
import org.lumijiez.managers.Supervisor;
|
import org.lumijiez.managers.Supervisor;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -17,32 +17,32 @@ import java.util.Objects;
|
|||||||
|
|
||||||
public class EditStudentForm extends JFrame {
|
public class EditStudentForm extends JFrame {
|
||||||
private final JLabel bdayLabel = new JLabel();
|
private final JLabel bdayLabel = new JLabel();
|
||||||
|
private final JLabel bmonthLabel = new JLabel();
|
||||||
|
private final JLabel byearLabel = new JLabel();
|
||||||
|
private final JLabel edayLabel = new JLabel();
|
||||||
|
private final JLabel emailLabel = new JLabel();
|
||||||
|
private final JLabel emonthLabel = new JLabel();
|
||||||
|
private final JLabel eyearLabel = new JLabel();
|
||||||
|
private final JLabel facultyLabel = new JLabel();
|
||||||
|
private final JLabel groupLabel = new JLabel();
|
||||||
|
private final JLabel nameLabel = new JLabel();
|
||||||
|
private final JLabel studentLabel = new JLabel();
|
||||||
|
private final JLabel surnameLabel = new JLabel();
|
||||||
|
private final JLabel titleLabel = new JLabel();
|
||||||
|
private final JButton cancelButton = new JButton();
|
||||||
|
private final JButton submitButton = new JButton();
|
||||||
|
private final JTextField nameField = new JTextField();
|
||||||
|
private final JTextField emailField = new JTextField();
|
||||||
|
private final JTextField surnameField = new JTextField();
|
||||||
|
private final JComboBox<Faculty> facultyCombo = new JComboBox<>();
|
||||||
|
private final JComboBox<Group> groupCombo = new JComboBox<>();
|
||||||
|
private final JComboBox<Student> studentCombo = new JComboBox<>();
|
||||||
private final JComboBox<Integer> birthdayCombo;
|
private final JComboBox<Integer> birthdayCombo;
|
||||||
private final JComboBox<Integer> birthmonthCombo;
|
private final JComboBox<Integer> birthmonthCombo;
|
||||||
private final JComboBox<Integer> birthyearCombo;
|
private final JComboBox<Integer> birthyearCombo;
|
||||||
private final JLabel bmonthLabel = new JLabel();
|
|
||||||
private final JLabel byearLabel = new JLabel();
|
|
||||||
private final JButton cancelButton = new JButton();
|
|
||||||
private final JLabel edayLabel = new JLabel();
|
|
||||||
private final JTextField emailField = new JTextField();
|
|
||||||
private final JLabel emailLabel = new JLabel();
|
|
||||||
private final JLabel emonthLabel = new JLabel();
|
|
||||||
private final JComboBox<Integer> enroldayCombo;
|
private final JComboBox<Integer> enroldayCombo;
|
||||||
private final JComboBox<Integer> enrolmonthCombo;
|
private final JComboBox<Integer> enrolmonthCombo;
|
||||||
private final JComboBox<Integer> enrolyearCombo;
|
private final JComboBox<Integer> enrolyearCombo;
|
||||||
private final JLabel eyearLabel = new JLabel();
|
|
||||||
private final JComboBox<Faculty> facultyCombo = new JComboBox<>();
|
|
||||||
private final JLabel facultyLabel = new JLabel();
|
|
||||||
private final JComboBox<Group> groupCombo = new JComboBox<>();
|
|
||||||
private final JLabel groupLabel = new JLabel();
|
|
||||||
private final JTextField nameField = new JTextField();
|
|
||||||
private final JLabel nameLabel = new JLabel();
|
|
||||||
private final JComboBox<Student> studentCombo = new JComboBox<>();
|
|
||||||
private final JLabel studentLabel = new JLabel();
|
|
||||||
private final JButton submitButton = new JButton();
|
|
||||||
private final JTextField surnameField = new JTextField();
|
|
||||||
private final JLabel surnameLabel = new JLabel();
|
|
||||||
private final JLabel titleLabel = new JLabel();
|
|
||||||
private final Supervisor sv;
|
private final Supervisor sv;
|
||||||
|
|
||||||
public EditStudentForm(Supervisor sv) {
|
public EditStudentForm(Supervisor sv) {
|
||||||
@@ -76,7 +76,7 @@ public class EditStudentForm extends JFrame {
|
|||||||
|
|
||||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
titleLabel.setFont(new Font("sansserif", Font.PLAIN, 18));
|
||||||
setTitle("Edit a Student");
|
setTitle("Edit a Student");
|
||||||
|
|
||||||
titleLabel.setText("Edit a student");
|
titleLabel.setText("Edit a student");
|
||||||
@@ -95,19 +95,18 @@ public class EditStudentForm extends JFrame {
|
|||||||
edayLabel.setText("New enrol day:");
|
edayLabel.setText("New enrol day:");
|
||||||
cancelButton.setText("Cancel");
|
cancelButton.setText("Cancel");
|
||||||
|
|
||||||
studentCombo.addActionListener(this::studentComboActionPerformed);
|
studentCombo.addActionListener(this::studentComboEvent);
|
||||||
submitButton.addActionListener(this::submitButtonActionPerformed);
|
submitButton.addActionListener(this::submitEvent);
|
||||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
cancelButton.addActionListener(this::cancelEvent);
|
||||||
|
|
||||||
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
||||||
|
|
||||||
ComboBoxRenderer.setRenderer(facultyCombo, sv.getFm().getFaculties().toArray(new Faculty[0]));
|
ComboRenderer.setRenderer(facultyCombo, sv.facultyManager().getFaculties().toArray(new Faculty[0]));
|
||||||
ComboBoxRenderer.setRenderer(groupCombo, sv.getFm().getGm().getGroups().toArray(new Group[0]));
|
ComboRenderer.setRenderer(groupCombo, sv.groupManager().getGroups().toArray(new Group[0]));
|
||||||
ComboBoxRenderer.setRenderer(studentCombo, sv.getFm().getGm().getSm().getStudents().toArray(new Student[0]));
|
ComboRenderer.setRenderer(studentCombo, sv.studentManager().getStudents().toArray(new Student[0]));
|
||||||
|
|
||||||
Student student = ((Student) Objects.requireNonNull(studentCombo.getSelectedItem()));
|
Student student = ((Student) Objects.requireNonNull(studentCombo.getSelectedItem()));
|
||||||
facultyCombo.setSelectedItem(student.getFaculty());
|
facultyCombo.setSelectedItem(student.getFaculty());
|
||||||
System.out.println("lol:" + facultyCombo.getSelectedItem());
|
|
||||||
groupCombo.setSelectedItem(student.getGroup());
|
groupCombo.setSelectedItem(student.getGroup());
|
||||||
emailField.setText(student.getEmail());
|
emailField.setText(student.getEmail());
|
||||||
nameField.setText(student.getName());
|
nameField.setText(student.getName());
|
||||||
@@ -250,11 +249,11 @@ public class EditStudentForm extends JFrame {
|
|||||||
this.setLocation(x, y);
|
this.setLocation(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelButtonActionPerformed(ActionEvent actionEvent) {
|
private void cancelEvent(ActionEvent actionEvent) {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void submitButtonActionPerformed(ActionEvent evt) {
|
private void submitEvent(ActionEvent evt) {
|
||||||
String name = nameField.getText();
|
String name = nameField.getText();
|
||||||
String surname = surnameField.getText();
|
String surname = surnameField.getText();
|
||||||
String email = emailField.getText();
|
String email = emailField.getText();
|
||||||
@@ -282,15 +281,14 @@ public class EditStudentForm extends JFrame {
|
|||||||
Date birthDate = birthCalendar.getTime();
|
Date birthDate = birthCalendar.getTime();
|
||||||
Date enrolDate = enrolCalendar.getTime();
|
Date enrolDate = enrolCalendar.getTime();
|
||||||
|
|
||||||
if (!name.isEmpty() && !surname.isEmpty() && !email.isEmpty()) {
|
if (!name.isEmpty() && !surname.isEmpty() && !email.isEmpty())
|
||||||
sv.editStudent(student, name, surname, email, group, faculty, birthDate, enrolDate);
|
sv.editStudent(student, name, surname, email, group, faculty, birthDate, enrolDate);
|
||||||
}
|
|
||||||
|
|
||||||
DisplayerManager.displayStudents();
|
DisplayHandler.displayStudents();
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void studentComboActionPerformed(ActionEvent evt) {
|
private void studentComboEvent(ActionEvent evt) {
|
||||||
Student student = ((Student) Objects.requireNonNull(studentCombo.getSelectedItem()));
|
Student student = ((Student) Objects.requireNonNull(studentCombo.getSelectedItem()));
|
||||||
facultyCombo.setSelectedItem(student.getFaculty());
|
facultyCombo.setSelectedItem(student.getFaculty());
|
||||||
groupCombo.setSelectedItem(student.getGroup());
|
groupCombo.setSelectedItem(student.getGroup());
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package org.lumijiez.gui.forms.student;
|
|||||||
import org.lumijiez.base.Grade;
|
import org.lumijiez.base.Grade;
|
||||||
import org.lumijiez.base.Student;
|
import org.lumijiez.base.Student;
|
||||||
import org.lumijiez.enums.Subjects;
|
import org.lumijiez.enums.Subjects;
|
||||||
import org.lumijiez.gui.util.ComboBoxRenderer;
|
import org.lumijiez.gui.util.ComboRenderer;
|
||||||
import org.lumijiez.gui.util.ComponentDecorator;
|
import org.lumijiez.gui.util.ComponentDecorator;
|
||||||
import org.lumijiez.managers.Supervisor;
|
import org.lumijiez.managers.Supervisor;
|
||||||
|
|
||||||
@@ -13,19 +13,18 @@ import java.awt.event.ActionEvent;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class GradeStudentForm extends JFrame {
|
public class GradeStudentForm extends JFrame {
|
||||||
private final Supervisor sv;
|
Integer[] grades = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
|
||||||
private final JTextArea mainTextLabel;
|
|
||||||
private final JButton cancelButton = new JButton();
|
|
||||||
private final JComboBox<Subjects> subjectCombo = new JComboBox<>();
|
|
||||||
private final JLabel gradeLabel = new JLabel();
|
private final JLabel gradeLabel = new JLabel();
|
||||||
private final JComboBox<Student> studentCombo = new JComboBox<>();
|
|
||||||
private final JLabel studentLabel = new JLabel();
|
private final JLabel studentLabel = new JLabel();
|
||||||
private final JLabel subjectLabel = new JLabel();
|
private final JLabel subjectLabel = new JLabel();
|
||||||
private final JButton submitButton = new JButton();
|
|
||||||
private final JLabel titleLabel = new JLabel();
|
private final JLabel titleLabel = new JLabel();
|
||||||
Integer[] grades = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
|
private final JButton cancelButton = new JButton();
|
||||||
|
private final JButton submitButton = new JButton();
|
||||||
|
private final JComboBox<Subjects> subjectCombo = new JComboBox<>();
|
||||||
|
private final JComboBox<Student> studentCombo = new JComboBox<>();
|
||||||
private final JComboBox<Integer> gradeCombo = new JComboBox<>(grades);
|
private final JComboBox<Integer> gradeCombo = new JComboBox<>(grades);
|
||||||
|
private final Supervisor sv;
|
||||||
|
private final JTextArea mainTextLabel;
|
||||||
|
|
||||||
public GradeStudentForm(Supervisor sv, JTextArea mainTextLabel) {
|
public GradeStudentForm(Supervisor sv, JTextArea mainTextLabel) {
|
||||||
this.sv = sv;
|
this.sv = sv;
|
||||||
@@ -37,7 +36,7 @@ public class GradeStudentForm extends JFrame {
|
|||||||
|
|
||||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
titleLabel.setFont(new Font("sansserif", Font.PLAIN, 18));
|
||||||
setTitle("Grade A Student");
|
setTitle("Grade A Student");
|
||||||
|
|
||||||
titleLabel.setText("Grade a student");
|
titleLabel.setText("Grade a student");
|
||||||
@@ -49,11 +48,11 @@ public class GradeStudentForm extends JFrame {
|
|||||||
|
|
||||||
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
||||||
|
|
||||||
submitButton.addActionListener(this::submitButtonActionPerformed);
|
submitButton.addActionListener(this::submitEvent);
|
||||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
cancelButton.addActionListener(this::cancelEvent);
|
||||||
|
|
||||||
ComboBoxRenderer.setRenderer(subjectCombo, Subjects.values());
|
ComboRenderer.setRenderer(subjectCombo, Subjects.values());
|
||||||
ComboBoxRenderer.setRenderer(studentCombo, sv.getFm().getGm().getSm().getStudents().toArray(new Student[0]));
|
ComboRenderer.setRenderer(studentCombo, sv.studentManager().getStudents().toArray(new Student[0]));
|
||||||
|
|
||||||
GroupLayout layout = new GroupLayout(getContentPane());
|
GroupLayout layout = new GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
@@ -88,7 +87,6 @@ public class GradeStudentForm extends JFrame {
|
|||||||
.addGap(129, 129, 129)
|
.addGap(129, 129, 129)
|
||||||
.addComponent(titleLabel)
|
.addComponent(titleLabel)
|
||||||
.addGap(0, 0, Short.MAX_VALUE)));
|
.addGap(0, 0, Short.MAX_VALUE)));
|
||||||
|
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
@@ -117,7 +115,7 @@ public class GradeStudentForm extends JFrame {
|
|||||||
this.setLocation(x, y);
|
this.setLocation(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void submitButtonActionPerformed(ActionEvent evt) {
|
private void submitEvent(ActionEvent evt) {
|
||||||
Student student = ((Student) Objects.requireNonNull(studentCombo.getSelectedItem()));
|
Student student = ((Student) Objects.requireNonNull(studentCombo.getSelectedItem()));
|
||||||
Subjects subject = Subjects.getEnum(Objects.requireNonNull(subjectCombo.getSelectedItem()).toString());
|
Subjects subject = Subjects.getEnum(Objects.requireNonNull(subjectCombo.getSelectedItem()).toString());
|
||||||
int intGrade = (Integer) Objects.requireNonNull(gradeCombo.getSelectedItem());
|
int intGrade = (Integer) Objects.requireNonNull(gradeCombo.getSelectedItem());
|
||||||
@@ -127,15 +125,13 @@ public class GradeStudentForm extends JFrame {
|
|||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append("============================================================\n");
|
builder.append("============================================================\n");
|
||||||
builder.append("Grades for ").append(student.getFullname()).append(" from ").append(student.getGroup().getName()).append(":\n");
|
builder.append("Grades for ").append(student.getFullname()).append(" from ").append(student.getGroup().getName()).append(":\n");
|
||||||
for (Grade gr : student.getGrades()) {
|
for (Grade gr : student.getGrades()) builder.append(gr.getSubject()).append(": ").append(gr.getGrade()).append("\n");
|
||||||
builder.append(gr.getSubject()).append(": ").append(gr.getGrade()).append("\n");
|
|
||||||
}
|
|
||||||
builder.append("============================================================\n");
|
builder.append("============================================================\n");
|
||||||
mainTextLabel.setText(builder.toString());
|
mainTextLabel.setText(builder.toString());
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelButtonActionPerformed(ActionEvent evt) {
|
private void cancelEvent(ActionEvent evt) {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
package org.lumijiez.gui.forms.student;
|
package org.lumijiez.gui.forms.student;
|
||||||
|
|
||||||
import org.lumijiez.base.Student;
|
import org.lumijiez.base.Student;
|
||||||
import org.lumijiez.gui.util.ComboBoxRenderer;
|
import org.lumijiez.gui.util.ComboRenderer;
|
||||||
import org.lumijiez.gui.util.ComponentDecorator;
|
import org.lumijiez.gui.util.ComponentDecorator;
|
||||||
import org.lumijiez.gui.util.DisplayerManager;
|
import org.lumijiez.gui.util.DisplayHandler;
|
||||||
import org.lumijiez.managers.Supervisor;
|
import org.lumijiez.managers.Supervisor;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -12,12 +12,11 @@ import java.awt.event.ActionEvent;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class GraduateStudentForm extends JFrame {
|
public class GraduateStudentForm extends JFrame {
|
||||||
private final JButton cancelButton = new JButton();
|
|
||||||
private final JComboBox<Student> studentCombo = new JComboBox<>();
|
|
||||||
private final JLabel studentLabel = new JLabel();
|
private final JLabel studentLabel = new JLabel();
|
||||||
private final JButton submitButton = new JButton();
|
|
||||||
private final JLabel titleLabel = new JLabel();
|
private final JLabel titleLabel = new JLabel();
|
||||||
|
private final JButton cancelButton = new JButton();
|
||||||
|
private final JButton submitButton = new JButton();
|
||||||
|
private final JComboBox<Student> studentCombo = new JComboBox<>();
|
||||||
private final Supervisor sv;
|
private final Supervisor sv;
|
||||||
|
|
||||||
public GraduateStudentForm(Supervisor sv) {
|
public GraduateStudentForm(Supervisor sv) {
|
||||||
@@ -32,20 +31,17 @@ public class GraduateStudentForm extends JFrame {
|
|||||||
titleLabel.setFont(new Font("sansserif", Font.PLAIN, 18));
|
titleLabel.setFont(new Font("sansserif", Font.PLAIN, 18));
|
||||||
setTitle("Graduate a Student");
|
setTitle("Graduate a Student");
|
||||||
|
|
||||||
ComboBoxRenderer.setRenderer(studentCombo, sv.getFm().getGm().getSm().getStudents().toArray(new Student[0]));
|
ComboRenderer.setRenderer(studentCombo, sv.studentManager().getEnrolled().toArray(new Student[0]));
|
||||||
|
|
||||||
|
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
||||||
|
|
||||||
studentLabel.setText("Student:");
|
|
||||||
submitButton.setText("Submit");
|
submitButton.setText("Submit");
|
||||||
cancelButton.setText("Cancel");
|
cancelButton.setText("Cancel");
|
||||||
titleLabel.setText("Graduate a Student");
|
titleLabel.setText("Graduate a Student");
|
||||||
|
studentLabel.setText("Student:");
|
||||||
|
|
||||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
submitButton.addActionListener(this::cancelEvent);
|
||||||
submitButton.addActionListener(this::submitButtonActionPerformed);
|
cancelButton.addActionListener(this::submitEvent);
|
||||||
|
|
||||||
submitButton.setBackground(new Color(204, 255, 204));
|
|
||||||
cancelButton.setBackground(new Color(255, 204, 204));
|
|
||||||
|
|
||||||
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
|
||||||
|
|
||||||
GroupLayout layout = new GroupLayout(getContentPane());
|
GroupLayout layout = new GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
@@ -67,7 +63,6 @@ public class GraduateStudentForm extends JFrame {
|
|||||||
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
.addComponent(titleLabel)
|
.addComponent(titleLabel)
|
||||||
.addGap(51, 51, 51)));
|
.addGap(51, 51, 51)));
|
||||||
|
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
@@ -89,14 +84,14 @@ public class GraduateStudentForm extends JFrame {
|
|||||||
this.setLocation(x, y);
|
this.setLocation(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void submitButtonActionPerformed(ActionEvent evt) {
|
private void cancelEvent(ActionEvent evt) {
|
||||||
Student student = ((Student) Objects.requireNonNull(studentCombo.getSelectedItem()));
|
Student student = ((Student) Objects.requireNonNull(studentCombo.getSelectedItem()));
|
||||||
student.setGraduated(true);
|
student.setGraduated(true);
|
||||||
DisplayerManager.displayStudents();
|
DisplayHandler.displayStudents();
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelButtonActionPerformed(ActionEvent evt) {
|
private void submitEvent(ActionEvent evt) {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package org.lumijiez.gui.forms.student;
|
package org.lumijiez.gui.forms.student;
|
||||||
|
|
||||||
import org.lumijiez.base.Student;
|
import org.lumijiez.base.Student;
|
||||||
import org.lumijiez.gui.util.ComboBoxRenderer;
|
import org.lumijiez.gui.util.ComboRenderer;
|
||||||
import org.lumijiez.gui.util.ComponentDecorator;
|
import org.lumijiez.gui.util.ComponentDecorator;
|
||||||
import org.lumijiez.managers.Supervisor;
|
import org.lumijiez.managers.Supervisor;
|
||||||
|
|
||||||
@@ -11,13 +11,13 @@ import java.awt.event.ActionEvent;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class ShowStudentForm extends JFrame {
|
public class ShowStudentForm extends JFrame {
|
||||||
private final JTextArea mainTextLabel;
|
|
||||||
private final JButton cancelButton = new JButton();
|
|
||||||
private final JComboBox<Student> studentCombo = new JComboBox<>();
|
|
||||||
private final JLabel studentLabel = new JLabel();
|
private final JLabel studentLabel = new JLabel();
|
||||||
private final JButton submitButton = new JButton();
|
|
||||||
private final JLabel titleLabel = new JLabel();
|
private final JLabel titleLabel = new JLabel();
|
||||||
|
private final JButton cancelButton = new JButton();
|
||||||
|
private final JButton submitButton = new JButton();
|
||||||
|
private final JComboBox<Student> studentCombo = new JComboBox<>();
|
||||||
private final Supervisor sv;
|
private final Supervisor sv;
|
||||||
|
private final JTextArea mainTextLabel;
|
||||||
|
|
||||||
public ShowStudentForm(Supervisor sv, JTextArea mainTextLabel) {
|
public ShowStudentForm(Supervisor sv, JTextArea mainTextLabel) {
|
||||||
this.sv = sv;
|
this.sv = sv;
|
||||||
@@ -29,7 +29,7 @@ public class ShowStudentForm extends JFrame {
|
|||||||
|
|
||||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
titleLabel.setFont(new Font("sansserif", Font.PLAIN, 18));
|
||||||
setTitle("Show A Student");
|
setTitle("Show A Student");
|
||||||
|
|
||||||
titleLabel.setText("Show Student");
|
titleLabel.setText("Show Student");
|
||||||
@@ -39,10 +39,10 @@ public class ShowStudentForm extends JFrame {
|
|||||||
|
|
||||||
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
||||||
|
|
||||||
submitButton.addActionListener(this::submitButtonActionPerformed);
|
ComboRenderer.setRenderer(studentCombo, sv.studentManager().getStudents().toArray(new Student[0]));
|
||||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
|
||||||
|
|
||||||
ComboBoxRenderer.setRenderer(studentCombo, sv.getFm().getGm().getSm().getStudents().toArray(new Student[0]));
|
cancelButton.addActionListener(this::cancelEvent);
|
||||||
|
submitButton.addActionListener(this::submitEvent);
|
||||||
|
|
||||||
GroupLayout layout = new GroupLayout(getContentPane());
|
GroupLayout layout = new GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
@@ -66,7 +66,6 @@ public class ShowStudentForm extends JFrame {
|
|||||||
.addGap(52, 52, 52)
|
.addGap(52, 52, 52)
|
||||||
.addComponent(titleLabel)))
|
.addComponent(titleLabel)))
|
||||||
.addContainerGap(23, Short.MAX_VALUE)));
|
.addContainerGap(23, Short.MAX_VALUE)));
|
||||||
|
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
@@ -88,7 +87,7 @@ public class ShowStudentForm extends JFrame {
|
|||||||
this.setLocation(x, y);
|
this.setLocation(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void submitButtonActionPerformed(ActionEvent evt) {
|
private void submitEvent(ActionEvent evt) {
|
||||||
Student student = ((Student) Objects.requireNonNull(studentCombo.getSelectedItem()));
|
Student student = ((Student) Objects.requireNonNull(studentCombo.getSelectedItem()));
|
||||||
StringBuilder text = new StringBuilder();
|
StringBuilder text = new StringBuilder();
|
||||||
|
|
||||||
@@ -106,7 +105,7 @@ public class ShowStudentForm extends JFrame {
|
|||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelButtonActionPerformed(ActionEvent evt) {
|
private void cancelEvent(ActionEvent evt) {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package org.lumijiez.gui.forms.student;
|
|||||||
|
|
||||||
import org.lumijiez.base.Grade;
|
import org.lumijiez.base.Grade;
|
||||||
import org.lumijiez.base.Student;
|
import org.lumijiez.base.Student;
|
||||||
import org.lumijiez.gui.util.ComboBoxRenderer;
|
import org.lumijiez.gui.util.ComboRenderer;
|
||||||
import org.lumijiez.gui.util.ComponentDecorator;
|
import org.lumijiez.gui.util.ComponentDecorator;
|
||||||
import org.lumijiez.managers.Supervisor;
|
import org.lumijiez.managers.Supervisor;
|
||||||
|
|
||||||
@@ -12,14 +12,13 @@ import java.awt.event.ActionEvent;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
public class ShowStudentGradesForm extends JFrame {
|
public class ShowStudentGradesForm extends JFrame {
|
||||||
|
|
||||||
private final JTextArea mainTextLabel;
|
|
||||||
private final JButton cancelButton = new JButton();
|
|
||||||
private final JComboBox<Student> studentCombo = new JComboBox<>();
|
|
||||||
private final JLabel studentLabel = new JLabel();
|
private final JLabel studentLabel = new JLabel();
|
||||||
private final JButton submitButton = new JButton();
|
|
||||||
private final JLabel titleLabel = new JLabel();
|
private final JLabel titleLabel = new JLabel();
|
||||||
|
private final JButton cancelButton = new JButton();
|
||||||
|
private final JButton submitButton = new JButton();
|
||||||
|
private final JComboBox<Student> studentCombo = new JComboBox<>();
|
||||||
private final Supervisor sv;
|
private final Supervisor sv;
|
||||||
|
private final JTextArea mainTextLabel;
|
||||||
|
|
||||||
public ShowStudentGradesForm(Supervisor sv, JTextArea mainTextLabel) {
|
public ShowStudentGradesForm(Supervisor sv, JTextArea mainTextLabel) {
|
||||||
this.sv = sv;
|
this.sv = sv;
|
||||||
@@ -31,7 +30,7 @@ public class ShowStudentGradesForm extends JFrame {
|
|||||||
|
|
||||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||||
|
|
||||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
titleLabel.setFont(new Font("sansserif", Font.PLAIN, 18));
|
||||||
setTitle("Show Student Grades");
|
setTitle("Show Student Grades");
|
||||||
|
|
||||||
titleLabel.setText("Show Grades");
|
titleLabel.setText("Show Grades");
|
||||||
@@ -41,10 +40,10 @@ public class ShowStudentGradesForm extends JFrame {
|
|||||||
|
|
||||||
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
||||||
|
|
||||||
submitButton.addActionListener(this::submitButtonActionPerformed);
|
ComboRenderer.setRenderer(studentCombo, sv.studentManager().getStudents().toArray(new Student[0]));
|
||||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
|
||||||
|
|
||||||
ComboBoxRenderer.setRenderer(studentCombo, sv.getFm().getGm().getSm().getStudents().toArray(new Student[0]));
|
cancelButton.addActionListener(this::cancelEvent);
|
||||||
|
submitButton.addActionListener(this::submitEvent);
|
||||||
|
|
||||||
GroupLayout layout = new GroupLayout(getContentPane());
|
GroupLayout layout = new GroupLayout(getContentPane());
|
||||||
getContentPane().setLayout(layout);
|
getContentPane().setLayout(layout);
|
||||||
@@ -68,7 +67,6 @@ public class ShowStudentGradesForm extends JFrame {
|
|||||||
.addGap(50, 50, 50)
|
.addGap(50, 50, 50)
|
||||||
.addComponent(titleLabel)))
|
.addComponent(titleLabel)))
|
||||||
.addContainerGap(30, Short.MAX_VALUE)));
|
.addContainerGap(30, Short.MAX_VALUE)));
|
||||||
|
|
||||||
layout.setVerticalGroup(
|
layout.setVerticalGroup(
|
||||||
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
layout.createParallelGroup(GroupLayout.Alignment.LEADING)
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
@@ -90,20 +88,19 @@ public class ShowStudentGradesForm extends JFrame {
|
|||||||
this.setLocation(x, y);
|
this.setLocation(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void submitButtonActionPerformed(ActionEvent evt) {
|
private void submitEvent(ActionEvent evt) {
|
||||||
Student student = ((Student) Objects.requireNonNull(studentCombo.getSelectedItem()));
|
Student student = ((Student) Objects.requireNonNull(studentCombo.getSelectedItem()));
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
builder.append("============================================================\n");
|
builder.append("============================================================\n");
|
||||||
builder.append("Grades for ").append(student.getFullname()).append(" from ").append(student.getGroup().getName()).append(":\n");
|
builder.append("Grades for ").append(student.getFullname()).append(" from ").append(student.getGroup().getName()).append(":\n");
|
||||||
for (Grade grade : student.getGrades()) {
|
for (Grade grade : student.getGrades())
|
||||||
builder.append(grade.getSubject()).append(": ").append(grade.getGrade()).append("\n");
|
builder.append(grade.getSubject()).append(": ").append(grade.getGrade()).append("\n");
|
||||||
}
|
|
||||||
builder.append("============================================================\n");
|
builder.append("============================================================\n");
|
||||||
mainTextLabel.setText(builder.toString());
|
mainTextLabel.setText(builder.toString());
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelButtonActionPerformed(ActionEvent evt) {
|
private void cancelEvent(ActionEvent evt) {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import org.lumijiez.base.Group;
|
|||||||
import org.lumijiez.base.Student;
|
import org.lumijiez.base.Student;
|
||||||
import org.lumijiez.enums.StudyField;
|
import org.lumijiez.enums.StudyField;
|
||||||
import org.lumijiez.gui.util.ComponentDecorator;
|
import org.lumijiez.gui.util.ComponentDecorator;
|
||||||
import org.lumijiez.gui.util.DisplayerManager;
|
import org.lumijiez.gui.util.DisplayHandler;
|
||||||
import org.lumijiez.managers.Supervisor;
|
import org.lumijiez.managers.Supervisor;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -36,9 +36,9 @@ public class BatchGraduater extends JFrame {
|
|||||||
titleLabel.setFont(new Font("Segoe UI", Font.PLAIN, 24));
|
titleLabel.setFont(new Font("Segoe UI", Font.PLAIN, 24));
|
||||||
setTitle("Graduate a Batch of Students");
|
setTitle("Graduate a Batch of Students");
|
||||||
|
|
||||||
submitButton.addActionListener(this::submitButtonActionPerformed);
|
submitButton.addActionListener(this::submitEvent);
|
||||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
cancelButton.addActionListener(this::cancelEvent);
|
||||||
browseButton.addActionListener(this::browseButtonActionPerformed);
|
browseButton.addActionListener(this::browseEvent);
|
||||||
|
|
||||||
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
||||||
|
|
||||||
@@ -105,11 +105,11 @@ public class BatchGraduater extends JFrame {
|
|||||||
this.setLocation(x, y);
|
this.setLocation(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelButtonActionPerformed(ActionEvent evt) {
|
private void cancelEvent(ActionEvent evt) {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void browseButtonActionPerformed(ActionEvent evt) {
|
private void browseEvent(ActionEvent evt) {
|
||||||
JFileChooser fileChooser = new JFileChooser();
|
JFileChooser fileChooser = new JFileChooser();
|
||||||
int returnVal = fileChooser.showOpenDialog(this);
|
int returnVal = fileChooser.showOpenDialog(this);
|
||||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||||
@@ -118,66 +118,51 @@ public class BatchGraduater extends JFrame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void submitButtonActionPerformed(ActionEvent evt) {
|
private void submitEvent(ActionEvent evt) {
|
||||||
try (BufferedReader reader = new BufferedReader(new FileReader(filePane.getText()))) {
|
try (BufferedReader reader = new BufferedReader(new FileReader(filePane.getText()))) {
|
||||||
String line;
|
String line, name = "", surname = "", email = "", groupName = "", facultyName = "";
|
||||||
String name;
|
|
||||||
String surname;
|
|
||||||
String email;
|
|
||||||
String groupName;
|
|
||||||
String facultyName;
|
|
||||||
StudyField specialty;
|
|
||||||
|
|
||||||
while (true) {
|
while ((line = reader.readLine()) != null) {
|
||||||
line = reader.readLine();
|
if (line.isEmpty()) continue;
|
||||||
// Sorry for this
|
|
||||||
if (line == null) break;
|
|
||||||
if (line.isEmpty()) line = reader.readLine();
|
|
||||||
name = line.substring("name: ".length());
|
|
||||||
|
|
||||||
line = reader.readLine();
|
String[] parts = line.split(": ", 2);
|
||||||
// Sorry for this
|
if (parts.length != 2) continue;
|
||||||
if (line == null) break;
|
|
||||||
surname = line.substring("surname: ".length());
|
|
||||||
|
|
||||||
line = reader.readLine();
|
String field = parts[0], value = parts[1];
|
||||||
// Sorry for this
|
|
||||||
if (line == null) break;
|
|
||||||
email = line.substring("email: ".length());
|
|
||||||
|
|
||||||
line = reader.readLine();
|
switch (field) {
|
||||||
// Sorry for this again lol
|
case "name" -> name = value;
|
||||||
if (line == null) break;
|
case "surname" -> surname = value;
|
||||||
groupName = line.substring("group: ".length());
|
case "email" -> email = value;
|
||||||
|
case "group" -> groupName = value;
|
||||||
|
case "faculty" -> facultyName = value;
|
||||||
|
case "specialty" -> handleStudentGraduation(name, surname, email, groupName, facultyName, value);
|
||||||
|
default -> System.err.println("Error reading file!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
|
DisplayHandler.displayStudents();
|
||||||
|
|
||||||
line = reader.readLine();
|
this.dispose();
|
||||||
// Sorry for this again :((
|
}
|
||||||
if (line == null) break;
|
|
||||||
facultyName = line.substring("faculty: ".length());
|
|
||||||
|
|
||||||
line = reader.readLine();
|
private void handleStudentGraduation(String name, String surname, String email, String groupName, String facultyName, String fieldName) {
|
||||||
// This is the last one please don't hate me
|
StudyField specialty = (StudyField.getEnum(fieldName) == null) ? StudyField.DEFAULT_UNASSIGNED : StudyField.getEnum(fieldName);
|
||||||
if (line == null) break;
|
|
||||||
String spec = line.substring("specialty: ".length());
|
|
||||||
|
|
||||||
if (StudyField.getEnum(spec) == null) {
|
Faculty faculty = sv.getFacultyByName(facultyName);
|
||||||
specialty = StudyField.DEFAULT_UNASSIGNED;
|
if (faculty == null) {
|
||||||
} else specialty = StudyField.getEnum(spec);
|
|
||||||
|
|
||||||
Faculty faculty;
|
|
||||||
Group group;
|
|
||||||
|
|
||||||
if (sv.getFacultyByName(facultyName) == null) {
|
|
||||||
assert specialty != null;
|
assert specialty != null;
|
||||||
faculty = new Faculty(facultyName, specialty.getAbbreviation(), specialty);
|
faculty = new Faculty(facultyName, specialty.getAbbreviation(), specialty);
|
||||||
sv.addFaculty(faculty);
|
sv.addFaculty(faculty);
|
||||||
} else faculty = sv.getFacultyByName(facultyName);
|
}
|
||||||
|
|
||||||
|
Group group = sv.getGroupByName(groupName, faculty);
|
||||||
if (sv.getGroupByName(groupName, faculty) == null) {
|
if (group == null) {
|
||||||
group = new Group(groupName);
|
group = new Group(groupName);
|
||||||
sv.addGroup(group, sv.getFacultyByName(facultyName));
|
sv.addGroup(group, faculty);
|
||||||
} else group = sv.getGroupByName(groupName, faculty);
|
}
|
||||||
|
|
||||||
for (Student st : group.getStudents()) {
|
for (Student st : group.getStudents()) {
|
||||||
if (st.getName().equals(name) && st.getSurname().equals(surname) && st.getEmail().equals(email)) {
|
if (st.getName().equals(name) && st.getSurname().equals(surname) && st.getEmail().equals(email)) {
|
||||||
@@ -186,11 +171,4 @@ public class BatchGraduater extends JFrame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException ex) {
|
|
||||||
throw new RuntimeException(ex);
|
|
||||||
}
|
|
||||||
DisplayerManager.displayStudents();
|
|
||||||
|
|
||||||
this.dispose();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import org.lumijiez.base.Faculty;
|
|||||||
import org.lumijiez.base.Group;
|
import org.lumijiez.base.Group;
|
||||||
import org.lumijiez.enums.StudyField;
|
import org.lumijiez.enums.StudyField;
|
||||||
import org.lumijiez.gui.util.ComponentDecorator;
|
import org.lumijiez.gui.util.ComponentDecorator;
|
||||||
import org.lumijiez.gui.util.DisplayerManager;
|
import org.lumijiez.gui.util.DisplayHandler;
|
||||||
import org.lumijiez.managers.Supervisor;
|
import org.lumijiez.managers.Supervisor;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
@@ -38,9 +38,9 @@ public class BatchLoader extends JFrame {
|
|||||||
titleLabel.setFont(new java.awt.Font("Segoe UI", Font.PLAIN, 24));
|
titleLabel.setFont(new java.awt.Font("Segoe UI", Font.PLAIN, 24));
|
||||||
setTitle("Load a Batch of Students");
|
setTitle("Load a Batch of Students");
|
||||||
|
|
||||||
submitButton.addActionListener(this::submitButtonActionPerformed);
|
submitButton.addActionListener(this::submitEvent);
|
||||||
cancelButton.addActionListener(this::cancelButtonActionPerformed);
|
cancelButton.addActionListener(this::cancelEvent);
|
||||||
browseButton.addActionListener(this::browseButtonActionPerformed);
|
browseButton.addActionListener(this::browseEvent);
|
||||||
|
|
||||||
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
ComponentDecorator.submitAndCancel(submitButton, cancelButton);
|
||||||
|
|
||||||
@@ -107,11 +107,11 @@ public class BatchLoader extends JFrame {
|
|||||||
this.setLocation(x, y);
|
this.setLocation(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelButtonActionPerformed(ActionEvent evt) {
|
private void cancelEvent(ActionEvent evt) {
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void browseButtonActionPerformed(ActionEvent evt) {
|
private void browseEvent(ActionEvent evt) {
|
||||||
JFileChooser fileChooser = new JFileChooser();
|
JFileChooser fileChooser = new JFileChooser();
|
||||||
int returnVal = fileChooser.showOpenDialog(this);
|
int returnVal = fileChooser.showOpenDialog(this);
|
||||||
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
if (returnVal == JFileChooser.APPROVE_OPTION) {
|
||||||
@@ -120,87 +120,56 @@ public class BatchLoader extends JFrame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void submitButtonActionPerformed(ActionEvent evt) {
|
private void submitEvent(ActionEvent evt) {
|
||||||
try (BufferedReader reader = new BufferedReader(new FileReader(filePane.getText()))) {
|
try (BufferedReader reader = new BufferedReader(new FileReader(filePane.getText()))) {
|
||||||
String line;
|
|
||||||
String name;
|
|
||||||
String surname;
|
|
||||||
String email;
|
|
||||||
Date birth;
|
|
||||||
Date enrol;
|
|
||||||
String groupName;
|
|
||||||
String facultyName;
|
|
||||||
StudyField specialty;
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
line = reader.readLine();
|
|
||||||
// Sorry for this
|
|
||||||
if (line == null) break;
|
|
||||||
if (line.isEmpty()) line = reader.readLine();
|
|
||||||
name = line.substring("name: ".length());
|
|
||||||
|
|
||||||
line = reader.readLine();
|
|
||||||
// Sorry for this
|
|
||||||
if (line == null) break;
|
|
||||||
surname = line.substring("surname: ".length());
|
|
||||||
|
|
||||||
line = reader.readLine();
|
|
||||||
// Sorry for this
|
|
||||||
if (line == null) break;
|
|
||||||
email = line.substring("email: ".length());
|
|
||||||
|
|
||||||
line = reader.readLine();
|
|
||||||
// Sorry for this again lol
|
|
||||||
if (line == null) break;
|
|
||||||
groupName = line.substring("group: ".length());
|
|
||||||
|
|
||||||
line = reader.readLine();
|
|
||||||
// Sorry for this again :((
|
|
||||||
if (line == null) break;
|
|
||||||
facultyName = line.substring("faculty: ".length());
|
|
||||||
|
|
||||||
line = reader.readLine();
|
|
||||||
// Please forgive me
|
|
||||||
if (line == null) break;
|
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
birth = dateFormat.parse(line.substring("birthdate: ".length()));
|
String line, name = "", surname = "", email = "", groupName = "", facultyName = "";
|
||||||
|
Date birth = new Date(), enrol = new Date();
|
||||||
|
|
||||||
line = reader.readLine();
|
while ((line = reader.readLine()) != null) {
|
||||||
// I'm really sorry
|
if (line.isEmpty()) continue;
|
||||||
if (line == null) break;
|
|
||||||
enrol = dateFormat.parse(line.substring("enroldate: ".length()));
|
|
||||||
|
|
||||||
line = reader.readLine();
|
String[] parts = line.split(": ", 2);
|
||||||
// This is the last one please don't hate me
|
if (parts.length != 2) continue;
|
||||||
if (line == null) break;
|
|
||||||
String spec = line.substring("specialty: ".length());
|
|
||||||
|
|
||||||
if (StudyField.getEnum(spec) == null) {
|
String field = parts[0], value = parts[1];
|
||||||
specialty = StudyField.DEFAULT_UNASSIGNED;
|
|
||||||
} else specialty = StudyField.getEnum(spec);
|
|
||||||
|
|
||||||
Faculty faculty;
|
switch (field) {
|
||||||
Group group;
|
case "name" -> name = value;
|
||||||
|
case "surname" -> surname = value;
|
||||||
if (sv.getFacultyByName(facultyName) == null) {
|
case "email" -> email = value;
|
||||||
assert specialty != null;
|
case "group" -> groupName = value;
|
||||||
faculty = new Faculty(facultyName, specialty.getAbbreviation(), specialty);
|
case "faculty" -> facultyName = value;
|
||||||
sv.addFaculty(faculty);
|
case "birthdate" -> birth = dateFormat.parse(value);
|
||||||
} else faculty = sv.getFacultyByName(facultyName);
|
case "enroldate" -> enrol = dateFormat.parse(value);
|
||||||
|
case "specialty" -> handleStudentAddition(name, surname, email, groupName, facultyName, birth, enrol, value);
|
||||||
|
default -> System.err.println("Error reading file!");
|
||||||
if (sv.getGroupByName(groupName, faculty) == null) {
|
}
|
||||||
group = new Group(groupName);
|
|
||||||
sv.addGroup(group, sv.getFacultyByName(facultyName));
|
|
||||||
} else group = sv.getGroupByName(groupName, faculty);
|
|
||||||
|
|
||||||
sv.addStudent(name, surname, email, group, faculty, birth, enrol);
|
|
||||||
}
|
}
|
||||||
} catch (IOException | ParseException ex) {
|
} catch (IOException | ParseException ex) {
|
||||||
throw new RuntimeException(ex);
|
throw new RuntimeException(ex);
|
||||||
}
|
}
|
||||||
DisplayerManager.displayStudents();
|
DisplayHandler.displayStudents();
|
||||||
|
|
||||||
this.dispose();
|
this.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleStudentAddition(String name, String surname, String email, String groupName, String facultyName, Date birth, Date enrol, String fieldName) {
|
||||||
|
StudyField specialty = (StudyField.getEnum(fieldName) == null) ? StudyField.DEFAULT_UNASSIGNED : StudyField.getEnum(fieldName);
|
||||||
|
|
||||||
|
Faculty faculty = sv.getFacultyByName(facultyName);
|
||||||
|
if (faculty == null) {
|
||||||
|
assert specialty != null;
|
||||||
|
faculty = new Faculty(facultyName, specialty.getAbbreviation(), specialty);
|
||||||
|
sv.addFaculty(faculty);
|
||||||
|
}
|
||||||
|
|
||||||
|
Group group = sv.getGroupByName(groupName, faculty);
|
||||||
|
if (group == null) {
|
||||||
|
group = new Group(groupName);
|
||||||
|
sv.addGroup(group, faculty);
|
||||||
|
}
|
||||||
|
|
||||||
|
sv.addStudent(name, surname, email, group, faculty, birth, enrol);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ package org.lumijiez.gui.util;
|
|||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
public class ComboBoxRenderer {
|
// Generic function that takes a ComboBox with a <T> object and sets the DefaultListCellRenderer according to the object
|
||||||
|
public class ComboRenderer {
|
||||||
public static <T> void setRenderer(JComboBox<T> comboBox, T[] items) {
|
public static <T> void setRenderer(JComboBox<T> comboBox, T[] items) {
|
||||||
comboBox.setModel(new DefaultComboBoxModel<>(items));
|
comboBox.setModel(new DefaultComboBoxModel<>(items));
|
||||||
comboBox.setRenderer(new DefaultListCellRenderer() {
|
comboBox.setRenderer(new DefaultListCellRenderer() {
|
||||||
@@ -5,11 +5,11 @@ import org.lumijiez.base.Group;
|
|||||||
import org.lumijiez.base.Student;
|
import org.lumijiez.base.Student;
|
||||||
import org.lumijiez.gui.StudentManagementGUI;
|
import org.lumijiez.gui.StudentManagementGUI;
|
||||||
|
|
||||||
public class DisplayerManager {
|
public class DisplayHandler {
|
||||||
public static void displayStudents() {
|
public static void displayStudents() {
|
||||||
StringBuilder text = new StringBuilder();
|
StringBuilder text = new StringBuilder();
|
||||||
text.append("======================== Students ==========================\n");
|
text.append("======================== Students ==========================\n");
|
||||||
for (Student student : StudentManagementGUI.getSv().getFm().getGm().getSm().getStudents()) {
|
for (Student student : StudentManagementGUI.getSv().studentManager().getStudents()) {
|
||||||
text.append("Name: ").append(student.getFullname()).append("\nGroup: ").append(student.getGroup().getName())
|
text.append("Name: ").append(student.getFullname()).append("\nGroup: ").append(student.getGroup().getName())
|
||||||
.append("\nEmail: ").append(student.getEmail()).append("\nGraduated: ").append((student.isGraduated() ? "Yes" : "No"));
|
.append("\nEmail: ").append(student.getEmail()).append("\nGraduated: ").append((student.isGraduated() ? "Yes" : "No"));
|
||||||
text.append("\n===============================================\n");
|
text.append("\n===============================================\n");
|
||||||
@@ -20,7 +20,7 @@ public class DisplayerManager {
|
|||||||
public static void displayGroups() {
|
public static void displayGroups() {
|
||||||
StringBuilder text = new StringBuilder();
|
StringBuilder text = new StringBuilder();
|
||||||
text.append("========================= Groups ===========================\n");
|
text.append("========================= Groups ===========================\n");
|
||||||
for (Group group : StudentManagementGUI.getSv().getFm().getGm().getGroups()) {
|
for (Group group : StudentManagementGUI.getSv().groupManager().getGroups()) {
|
||||||
text.append("Name: ").append(group.getName()).append("\nFaculty: ").append(group.getFaculty().getName())
|
text.append("Name: ").append(group.getName()).append("\nFaculty: ").append(group.getFaculty().getName())
|
||||||
.append("\nNumber of students: ").append(group.getStudents().size());
|
.append("\nNumber of students: ").append(group.getStudents().size());
|
||||||
text.append("\n===============================================\n");
|
text.append("\n===============================================\n");
|
||||||
@@ -31,7 +31,7 @@ public class DisplayerManager {
|
|||||||
public static void displayFaculties() {
|
public static void displayFaculties() {
|
||||||
StringBuilder text = new StringBuilder();
|
StringBuilder text = new StringBuilder();
|
||||||
text.append("======================= Faculties =========================\n");
|
text.append("======================= Faculties =========================\n");
|
||||||
for (Faculty fac : StudentManagementGUI.getSv().getFm().getFaculties()) {
|
for (Faculty fac : StudentManagementGUI.getSv().facultyManager().getFaculties()) {
|
||||||
text.append("Name: ").append(fac.getName()).append("\nSpecialty: ").append(fac.getField().getName())
|
text.append("Name: ").append(fac.getName()).append("\nSpecialty: ").append(fac.getField().getName())
|
||||||
.append("\nAbbreviation: ").append(fac.getAbbreviation())
|
.append("\nAbbreviation: ").append(fac.getAbbreviation())
|
||||||
.append("\nNumber of groups: ").append(fac.getGroups().size());
|
.append("\nNumber of groups: ").append(fac.getGroups().size());
|
||||||
@@ -43,7 +43,7 @@ public class DisplayerManager {
|
|||||||
public static void displayGraduates() {
|
public static void displayGraduates() {
|
||||||
StringBuilder text = new StringBuilder();
|
StringBuilder text = new StringBuilder();
|
||||||
text.append("======================== Students ==========================\n");
|
text.append("======================== Students ==========================\n");
|
||||||
for (Student st : StudentManagementGUI.getSv().getFm().getGm().getSm().getStudents()) {
|
for (Student st : StudentManagementGUI.getSv().studentManager().getStudents()) {
|
||||||
if (st.isGraduated()) {
|
if (st.isGraduated()) {
|
||||||
text.append("Name: ").append(st.getFullname()).append("\nGroup: ").append(st.getGroup().getName())
|
text.append("Name: ").append(st.getFullname()).append("\nGroup: ").append(st.getGroup().getName())
|
||||||
.append("\nGraduated: ").append("Yes");
|
.append("\nGraduated: ").append("Yes");
|
||||||
@@ -56,7 +56,7 @@ public class DisplayerManager {
|
|||||||
public static void displayEnrolled() {
|
public static void displayEnrolled() {
|
||||||
StringBuilder text = new StringBuilder();
|
StringBuilder text = new StringBuilder();
|
||||||
text.append("======================== Students ==========================\n");
|
text.append("======================== Students ==========================\n");
|
||||||
for (Student st : StudentManagementGUI.getSv().getFm().getGm().getSm().getStudents()) {
|
for (Student st : StudentManagementGUI.getSv().studentManager().getStudents()) {
|
||||||
if (!st.isGraduated()) {
|
if (!st.isGraduated()) {
|
||||||
text.append("Name: ").append(st.getFullname()).append("\nGroup: ").append(st.getGroup().getName())
|
text.append("Name: ").append(st.getFullname()).append("\nGroup: ").append(st.getGroup().getName())
|
||||||
.append("\nGraduated: ").append("No");
|
.append("\nGraduated: ").append("No");
|
||||||
@@ -22,7 +22,7 @@ public class Supervisor implements Serializable {
|
|||||||
|
|
||||||
// Adds a faculty using the FacultyManager
|
// Adds a faculty using the FacultyManager
|
||||||
public void addFaculty(Faculty faculty) {
|
public void addFaculty(Faculty faculty) {
|
||||||
getFm().addFaculty(faculty);
|
facultyManager().addFaculty(faculty);
|
||||||
logger.logOperation("Faculty added: " + faculty.getName());
|
logger.logOperation("Faculty added: " + faculty.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -30,9 +30,9 @@ public class Supervisor implements Serializable {
|
|||||||
public void deleteFaculty(Faculty faculty) {
|
public void deleteFaculty(Faculty faculty) {
|
||||||
fm.deleteFaculty(faculty);
|
fm.deleteFaculty(faculty);
|
||||||
for (Group gr : faculty.getGroups()) {
|
for (Group gr : faculty.getGroups()) {
|
||||||
getFm().getGm().deleteGroup(gr);
|
groupManager().deleteGroup(gr);
|
||||||
for (Student st : gr.getStudents()) {
|
for (Student st : gr.getStudents()) {
|
||||||
getFm().getGm().getSm().deleteStudent(st);
|
studentManager().deleteStudent(st);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.logOperation("Faculty deleted : " + faculty.getName());
|
logger.logOperation("Faculty deleted : " + faculty.getName());
|
||||||
@@ -59,9 +59,9 @@ public class Supervisor implements Serializable {
|
|||||||
|
|
||||||
// Deletes a group, then deletes the students.
|
// Deletes a group, then deletes the students.
|
||||||
public void deleteGroup(Group group) {
|
public void deleteGroup(Group group) {
|
||||||
getFm().getGm().deleteGroup(group);
|
groupManager().deleteGroup(group);
|
||||||
for (Student st : group.getStudents()) {
|
for (Student st : group.getStudents()) {
|
||||||
getFm().getGm().getSm().deleteStudent(st);
|
studentManager().deleteStudent(st);
|
||||||
}
|
}
|
||||||
logger.logOperation("Group deleted: " + group.getName());
|
logger.logOperation("Group deleted: " + group.getName());
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ public class Supervisor implements Serializable {
|
|||||||
// Adds a student, using the StudentManager
|
// Adds a student, using the StudentManager
|
||||||
public void addStudent(String name, String surname, String email, Group group, Faculty faculty, Date birth, Date enrol) {
|
public void addStudent(String name, String surname, String email, Group group, Faculty faculty, Date birth, Date enrol) {
|
||||||
Student newStudent = new Student(name, surname, email, group, faculty, birth, enrol);
|
Student newStudent = new Student(name, surname, email, group, faculty, birth, enrol);
|
||||||
getFm().getGm().getSm().addStudent(newStudent);
|
studentManager().addStudent(newStudent);
|
||||||
logger.logOperation("Student added: " + newStudent.getFullname());
|
logger.logOperation("Student added: " + newStudent.getFullname());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -92,21 +92,21 @@ public class Supervisor implements Serializable {
|
|||||||
public void addGroup(Group group, Faculty faculty) {
|
public void addGroup(Group group, Faculty faculty) {
|
||||||
group.setFaculty(faculty);
|
group.setFaculty(faculty);
|
||||||
faculty.addGroup(group);
|
faculty.addGroup(group);
|
||||||
getFm().getGm().addGroup(group);
|
groupManager().addGroup(group);
|
||||||
logger.logOperation("Group added: " + group.getName());
|
logger.logOperation("Group added: " + group.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deletes a student, simple as that
|
// Deletes a student, simple as that
|
||||||
public void deleteStudent(Student st) {
|
public void deleteStudent(Student st) {
|
||||||
st.getGroup().deleteStudent(st);
|
st.getGroup().deleteStudent(st);
|
||||||
getFm().getGm().getSm().deleteStudent(st);
|
studentManager().deleteStudent(st);
|
||||||
logger.logOperation("Student deleted: " + st.getFullname());
|
logger.logOperation("Student deleted: " + st.getFullname());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Iterates through all faculties to get a faculty that matches the name
|
// Iterates through all faculties to get a faculty that matches the name
|
||||||
// In the future would be great to replace it using an UUID instead of a String name.
|
// In the future would be great to replace it using an UUID instead of a String name.
|
||||||
public Faculty getFacultyByName(String facultyName) {
|
public Faculty getFacultyByName(String facultyName) {
|
||||||
for (Faculty faculty : getFm().getFaculties()) {
|
for (Faculty faculty : facultyManager().getFaculties()) {
|
||||||
if (faculty.getName().equals(facultyName))
|
if (faculty.getName().equals(facultyName))
|
||||||
return faculty;
|
return faculty;
|
||||||
}
|
}
|
||||||
@@ -115,17 +115,25 @@ public class Supervisor implements Serializable {
|
|||||||
|
|
||||||
// Same thing as getFacultyByName() except for Groups
|
// Same thing as getFacultyByName() except for Groups
|
||||||
public Group getGroupByName(String groupName, Faculty faculty) {
|
public Group getGroupByName(String groupName, Faculty faculty) {
|
||||||
for (Group group : getFm().getGm().getGroups()) {
|
for (Group group : groupManager().getGroups()) {
|
||||||
if (group.getName().equals(groupName) && group.getFaculty().equals(faculty))
|
if (group.getName().equals(groupName) && group.getFaculty().equals(faculty))
|
||||||
return group;
|
return group;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FacultyManager getFm() {
|
public FacultyManager facultyManager() {
|
||||||
return fm;
|
return fm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public GroupManager groupManager() {
|
||||||
|
return fm.getGm();
|
||||||
|
}
|
||||||
|
|
||||||
|
public StudentManager studentManager() {
|
||||||
|
return fm.getGm().getSm();
|
||||||
|
}
|
||||||
|
|
||||||
public LogManager getLogger() {
|
public LogManager getLogger() {
|
||||||
return this.logger;
|
return this.logger;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user