Tiny code clean-ups
This commit is contained in:
@@ -15,11 +15,8 @@ public class Faculty implements Serializable {
|
||||
}
|
||||
|
||||
private String name;
|
||||
|
||||
private String abbreviation;
|
||||
|
||||
private List<Group> groups = new ArrayList<>();
|
||||
|
||||
private final List<Group> groups = new ArrayList<>();
|
||||
private StudyField field;
|
||||
|
||||
public void addGroup(Group group) {
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.io.Serializable;
|
||||
|
||||
public class Grade implements Serializable {
|
||||
private final Subjects subject;
|
||||
|
||||
private final int grade;
|
||||
|
||||
public Grade(Subjects subject, int grade) {
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
|
||||
*/
|
||||
package org.lumijiez.gui;
|
||||
|
||||
import org.lumijiez.data.DataDeserializer;
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
|
||||
*/
|
||||
package org.lumijiez.gui.forms.faculty;
|
||||
|
||||
import org.lumijiez.base.Faculty;
|
||||
import org.lumijiez.enums.StudyField;
|
||||
import org.lumijiez.gui.StudentManagementGUI;
|
||||
import org.lumijiez.gui.util.ComponentDecorator;
|
||||
import org.lumijiez.gui.util.DisplayerManager;
|
||||
import org.lumijiez.managers.Supervisor;
|
||||
@@ -40,7 +35,8 @@ public class EditFacultyForm extends JFrame {
|
||||
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18)); // NOI18N
|
||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
||||
|
||||
titleLabel.setText("Edit a faculty");
|
||||
submitButton.setText("Submit");
|
||||
cancelButton.setText("Cancel");
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
|
||||
*/
|
||||
package org.lumijiez.gui.forms.faculty;
|
||||
|
||||
import org.lumijiez.base.Faculty;
|
||||
import org.lumijiez.gui.StudentManagementGUI;
|
||||
import org.lumijiez.gui.util.ComponentDecorator;
|
||||
import org.lumijiez.gui.util.DisplayerManager;
|
||||
import org.lumijiez.managers.Supervisor;
|
||||
@@ -34,7 +29,7 @@ public class RemoveFacultyForm extends JFrame {
|
||||
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18)); // NOI18N
|
||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
||||
|
||||
titleLabel.setText("Remove a faculty");
|
||||
submitButton.setText("Submit");
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
|
||||
*/
|
||||
package org.lumijiez.gui.forms.faculty;
|
||||
|
||||
import org.lumijiez.base.Faculty;
|
||||
@@ -33,7 +29,7 @@ public class ShowFacultyForm extends JFrame {
|
||||
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18)); // NOI18N
|
||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
||||
|
||||
titleLabel.setText("Show a faculty");
|
||||
submitButton.setText("Submit");
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
|
||||
*/
|
||||
package org.lumijiez.gui.forms.group;
|
||||
|
||||
import org.lumijiez.base.Faculty;
|
||||
@@ -36,7 +32,7 @@ public class AddGroupForm extends JFrame {
|
||||
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18)); // NOI18N
|
||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
||||
|
||||
titleLabel.setText("Add a new group");
|
||||
nameField.setText("Name...");
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
|
||||
*/
|
||||
package org.lumijiez.gui.forms.group;
|
||||
|
||||
import org.lumijiez.base.Group;
|
||||
import org.lumijiez.gui.StudentManagementGUI;
|
||||
import org.lumijiez.gui.util.ComponentDecorator;
|
||||
import org.lumijiez.gui.util.DisplayerManager;
|
||||
import org.lumijiez.managers.Supervisor;
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
|
||||
*/
|
||||
package org.lumijiez.gui.forms.group;
|
||||
|
||||
import org.lumijiez.base.Faculty;
|
||||
import org.lumijiez.base.Group;
|
||||
import org.lumijiez.gui.StudentManagementGUI;
|
||||
import org.lumijiez.gui.util.ComponentDecorator;
|
||||
import org.lumijiez.gui.util.DisplayerManager;
|
||||
import org.lumijiez.managers.Supervisor;
|
||||
@@ -40,7 +35,7 @@ public class EditGroupForm extends JFrame {
|
||||
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18)); // NOI18N
|
||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
||||
|
||||
titleLabel.setText("Edit a group");
|
||||
nameField.setText("Name...");
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
|
||||
*/
|
||||
package org.lumijiez.gui.forms.group;
|
||||
|
||||
import org.lumijiez.base.Faculty;
|
||||
import org.lumijiez.base.Group;
|
||||
import org.lumijiez.base.Student;
|
||||
import org.lumijiez.gui.util.ComponentDecorator;
|
||||
@@ -35,7 +30,7 @@ public class ShowGroupForm extends JFrame {
|
||||
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18)); // NOI18N
|
||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
||||
titleLabel.setText("Show a group");
|
||||
groupLabel.setText("Group:");
|
||||
cancelButton.setText("Cancel");
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
|
||||
*/
|
||||
package org.lumijiez.gui.forms.student;
|
||||
|
||||
import org.lumijiez.base.Faculty;
|
||||
@@ -83,7 +79,7 @@ public class AddStudentForm extends JFrame {
|
||||
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18)); // NOI18N
|
||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
||||
|
||||
titleLabel.setText("Add a new student");
|
||||
submitButton.setText("Submit");
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
|
||||
*/
|
||||
package org.lumijiez.gui.forms.student;
|
||||
|
||||
import org.lumijiez.base.Student;
|
||||
import org.lumijiez.gui.StudentManagementGUI;
|
||||
import org.lumijiez.gui.util.ComponentDecorator;
|
||||
import org.lumijiez.gui.util.DisplayerManager;
|
||||
import org.lumijiez.managers.Supervisor;
|
||||
import org.lumijiez.gui.util.ComboBoxRenderers;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -33,7 +29,7 @@ public class DeleteStudentForm extends JFrame {
|
||||
|
||||
setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
|
||||
|
||||
titleLabel.setFont(new java.awt.Font("sansserif", 0, 18)); // NOI18N
|
||||
titleLabel.setFont(new java.awt.Font("sansserif", Font.PLAIN, 18));
|
||||
titleLabel.setText("Delete Student");
|
||||
|
||||
ComboBoxRenderers.setStudentRenderer(studentCombo);
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
|
||||
*/
|
||||
package org.lumijiez.gui.forms.student;
|
||||
|
||||
import org.lumijiez.base.Faculty;
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
|
||||
*/
|
||||
package org.lumijiez.gui.forms.student;
|
||||
|
||||
import org.lumijiez.base.Grade;
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
|
||||
*/
|
||||
package org.lumijiez.gui.forms.student;
|
||||
|
||||
import org.lumijiez.base.Student;
|
||||
import org.lumijiez.gui.StudentManagementGUI;
|
||||
import org.lumijiez.gui.util.ComponentDecorator;
|
||||
import org.lumijiez.gui.util.DisplayerManager;
|
||||
import org.lumijiez.managers.Supervisor;
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
|
||||
*/
|
||||
package org.lumijiez.gui.forms.student;
|
||||
|
||||
import org.lumijiez.base.Student;
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
|
||||
*/
|
||||
package org.lumijiez.gui.forms.student;
|
||||
|
||||
import org.lumijiez.base.Grade;
|
||||
|
||||
@@ -127,67 +127,67 @@ public class FilePicker extends JFrame {
|
||||
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");
|
||||
birth = dateFormat.parse(line.substring("birthdate: ".length()));
|
||||
|
||||
line = reader.readLine();
|
||||
// I'm really sorry
|
||||
if (line == null) break;
|
||||
enrol = dateFormat.parse(line.substring("enroldate: ".length()));
|
||||
|
||||
line = reader.readLine();
|
||||
// This is the last one please don't hate me
|
||||
if (line == null) break;
|
||||
String spec = line.substring("specialty: ".length());
|
||||
|
||||
|
||||
if (StudyField.getEnum(spec) == null) {
|
||||
specialty = StudyField.DEFAULT_UNASSIGNED;
|
||||
} else {
|
||||
specialty = StudyField.getEnum(spec);
|
||||
}
|
||||
} else specialty = StudyField.getEnum(spec);
|
||||
|
||||
Faculty faculty;
|
||||
Group group;
|
||||
|
||||
if (sv.getFacultyByName(facultyName) == null) {
|
||||
assert specialty != null;
|
||||
faculty = new Faculty(facultyName, specialty.getAbbreviation(), specialty);
|
||||
sv.addFaculty(faculty);
|
||||
} else {
|
||||
faculty = sv.getFacultyByName(facultyName);
|
||||
}
|
||||
} else faculty = sv.getFacultyByName(facultyName);
|
||||
|
||||
|
||||
if (sv.getGroupByName(groupName, faculty) == null) {
|
||||
group = new Group(groupName);
|
||||
sv.addGroup(group, sv.getFacultyByName(facultyName));
|
||||
} else {
|
||||
group = sv.getGroupByName(groupName, faculty);
|
||||
}
|
||||
|
||||
System.out.println(name + "\n" + surname+ "\n" + email+ "\n" + group.getName()+ "\n" + faculty.getName()+ "\n" + birth+ "\n" + enrol);
|
||||
} else group = sv.getGroupByName(groupName, faculty);
|
||||
|
||||
sv.addStudent(name, surname, email, group, faculty, birth, enrol);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user