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

Commit

Permalink
Merge pull request #10 from t0xicCode/single-course-select
Browse files Browse the repository at this point in the history
Improve course selection UI
  • Loading branch information
morinted authored Jun 16, 2016
2 parents 13b5653 + ce0e373 commit 25fc328
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 25fc328

Please sign in to comment.