Skip to content
This repository has been archived by the owner on Oct 29, 2021. It is now read-only.

Commit

Permalink
Improve course selection UI.
Browse files Browse the repository at this point in the history
Makes selecting the course from the list optional when there is a single entry.
  • Loading branch information
t0xicCode committed May 15, 2016
1 parent 13b5653 commit ce0e373
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions schedule-generator/ca/uottawa/ui/ClientGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -791,14 +791,19 @@ private void removeCourse() {
* Add the currently selected course.
*/
private void addCourse() {
if (lstSearchResults.getSelectedValue() == null) {
if (lstSearchResults.getSelectedValue() == null && lstSearchResults.getModel().getSize() != 1) {
display("No course selected!");
} else {
String courseCode = lstSearchResults.getSelectedValue().split(" ")[0];
//Determine if we're sending an optional or mandatory course.
String optional = chkOptional.isSelected() ? "OPTIONAL " : "";
send("ADD " + optional + courseCode);
return;
}

if (lstSearchResults.getSelectedValue() == null) {
lstSearchResults.setSelectedIndex(0);
}

String courseCode = lstSearchResults.getSelectedValue().split(" ")[0];
//Determine if we're sending an optional or mandatory course.
String optional = chkOptional.isSelected() ? "OPTIONAL " : "";
send("ADD " + optional + courseCode);
}

/**
Expand Down

0 comments on commit ce0e373

Please sign in to comment.