Schedule-Creator

Java GUI to create schedules for UNCG students
git clone git://git.wrycode.com/wrycode/archive/Schedule-Creator.git
Log | Files | Refs | README

commit 66d90ccae77145c772bc2cb586558a73599530d7
parent e55b5e4b10f13ea32e999df2d2e543fafd27a8e5
Author: toldge <47599909+toldge@users.noreply.github.com>
Date:   Mon, 13 Apr 2020 17:07:43 -0400

Toldge (#62)

* add some methods for Section and Schedule

* change to fit the style guide

Co-authored-by: Toldge <ntolodziecki@gmail.com>
Diffstat:
MScheduleCreator/controllers/CoursesController.java | 33++++++++++++++++-----------------
1 file changed, 16 insertions(+), 17 deletions(-)

diff --git a/ScheduleCreator/controllers/CoursesController.java b/ScheduleCreator/controllers/CoursesController.java @@ -5,7 +5,7 @@ package ScheduleCreator.controllers; * * @author Jamison Valentine, Ilyass Sfar, Nick Econopouly, Nathan Tolodzieki * - * Last Updated: 4/12/2020 + * Last Updated: 4/13/2020 */ import ScheduleCreator.Adapter; import java.io.IOException; @@ -17,7 +17,6 @@ import java.util.logging.Level; import java.util.logging.Logger; import java.util.regex.Matcher; import java.util.regex.Pattern; -import ScheduleCreator.Translator; import ScheduleCreator.models.Course; import ScheduleCreator.models.Schedule; import ScheduleCreator.models.Section; @@ -100,9 +99,9 @@ public class CoursesController implements Initializable { public void initialize(URL url, ResourceBundle rb) { try { this.loadSemesters(); - NUM_ROWS = scheduleGridPane.getRowConstraints().size(); - NUM_COLS = scheduleGridPane.getColumnConstraints().size(); - grid = new BorderPane[NUM_ROWS][NUM_COLS]; + this.NUM_ROWS = this.scheduleGridPane.getRowConstraints().size(); + this.NUM_COLS = this.scheduleGridPane.getColumnConstraints().size(); + this.grid = new BorderPane[NUM_ROWS][NUM_COLS]; this.drawGrid(); this.CRNPane.toFront(); } catch (Exception ex) { @@ -189,7 +188,7 @@ public class CoursesController implements Initializable { */ public void clearScheduleGrid() { for (BorderPane entry : this.entries) { - scheduleGridPane.getChildren().remove(entry); + this.scheduleGridPane.getChildren().remove(entry); } this.entries.clear(); } @@ -242,10 +241,10 @@ public class CoursesController implements Initializable { this.clearScheduleGrid(); if (this.currentSemester.getNumberOfSchedules() == 0) { - scheduleLabel.setText("0/0"); + this.scheduleLabel.setText("0/0"); } else if (this.currentSemester.getNumberOfSchedules() > 0) { this.loadSchedule(this.currentSemester.getSchedules().get(0)); - scheduleLabel.setText("1/" + this.currentSemester.getNumberOfSchedules()); + this.scheduleLabel.setText("1/" + this.currentSemester.getNumberOfSchedules()); } } @@ -298,7 +297,7 @@ public class CoursesController implements Initializable { this.availableCourses.setItems(this.courseList); // make up or down arrow on the keyboard begin to scroll the search results - searchField.setOnKeyReleased(new javafx.event.EventHandler<KeyEvent>() { + this.searchField.setOnKeyReleased(new javafx.event.EventHandler<KeyEvent>() { @Override public void handle(KeyEvent event) { switch (event.getCode()) { @@ -349,7 +348,7 @@ public class CoursesController implements Initializable { } public void loadSemesters() throws IOException { - List<String> semesters = adapter.getSemesters(); + List<String> semesters = this.adapter.getSemesters(); List<String> newList = new ArrayList(); Pattern p = Pattern.compile("([a-z]*)([0-9]{4})"); @@ -372,9 +371,9 @@ public class CoursesController implements Initializable { this.sectionTabPane.getTabs().clear(); this.selectedCoursesListView.setItems(FXCollections.observableList(this.currentSemester.getSelectedCourseStrings())); - for (Course course : this.currentSemester.getSelectedCourses()) { + CoursesController.currentSemester.getSelectedCourses().forEach((course) -> { this.createNewTab(course); - } + }); this.regenerateSchedules(); } @@ -457,8 +456,8 @@ public class CoursesController implements Initializable { public void drawGrid() { - for (int i = 1; i < NUM_ROWS; i++) { - for (int j = 1; j < NUM_COLS; j++) { + for (int i = 1; i < this.NUM_ROWS; i++) { + for (int j = 1; j < this.NUM_COLS; j++) { BorderPane region = new BorderPane(); region.setStyle(("-fx-border-color: black; -fx-border-width: .5;")); this.grid[i][j] = region; @@ -499,7 +498,7 @@ public class CoursesController implements Initializable { for (Integer col : getDays(_section)) { Label label = new Label(_section.getCourseID() + " - " + _section.getSectionNumber()); BorderPane entryContainer = new BorderPane(); - entryContainer.paddingProperty().set(new Insets(grid[row][col].heightProperty().multiply(topMargin).doubleValue(), 0, 0, 0)); + entryContainer.paddingProperty().set(new Insets(this.grid[row][col].heightProperty().multiply(topMargin).doubleValue(), 0, 0, 0)); StackPane pane = new StackPane(); Rectangle rect = new Rectangle(); @@ -510,12 +509,12 @@ public class CoursesController implements Initializable { pane.getChildren().addAll(rect, label); entryContainer.setTop(pane); - scheduleGridPane.getChildren().add(entryContainer); + this.scheduleGridPane.getChildren().add(entryContainer); GridPane.setConstraints(entryContainer, col, row, 1, GridPane.REMAINING, HPos.CENTER, VPos.TOP); BorderPane region = grid[row][col]; rect.heightProperty().bind(region.heightProperty().subtract(2).multiply(_section.getDurationHours())); rect.widthProperty().bind(region.widthProperty().subtract(2)); - entries.add(entryContainer); + this.entries.add(entryContainer); } }