public void btnSaveCourse_Pressed() {
    Schedule schedule = Manager.INSTANCE.currentEditingSchedule;
    Classroom classroom = null;

    if (!chBxClassrooms.getSelectionModel().isEmpty()) {
      String classroomString = chBxClassrooms.getSelectionModel().getSelectedItem();
      for (Classroom classroomLocal : Manager.INSTANCE.classrooms) {
        if (classroomLocal.getInitials().equals(classroomString)) {
          classroom = classroomLocal;
          break;
        }
      }

      String alertMessage = "";

      String clashes = "";
      ICourse iCourse = Manager.INSTANCE.currentEditignICourse;
      for (Professor professor : ((Lecture) iCourse).getProfessors()) {
        String pClash = CourseModificationChecker.professorClash(professor, schedule, iCourse);
        if (!pClash.equals("")) {
          clashes +=
              professor.getName() + " " + professor.getLastnameFather() + ":" + pClash + "\n";
        }
      }

      if (!clashes.equals("")) {
        alertMessage +=
            "No se puede usar este horario, ya que tiene problemas de topes de horarios de profesores:\n"
                + clashes;
      }

      clashes =
          CourseModificationChecker.classroomClash(
              classroom, schedule, Manager.INSTANCE.currentEditignICourse);

      if (clashes != "") {
        alertMessage +=
            "No se puede crear la clase debido a que la sala esta ocupada en ese horario por otro(s) curso(s):\n"
                + clashes;
      }

      if (!alertMessage.equals("")) {
        ViewUtilities.showAlert(alertMessage);
      } else {
        Manager.INSTANCE.currentEditignICourse.setSchedule(schedule);
        Manager.INSTANCE.currentEditignICourse.setClassroom(classroom);

        if (isCreating) {
          Manager.INSTANCE.currentEditignCourse.addCourse(Manager.INSTANCE.currentEditignICourse);
        }

        Manager.INSTANCE.currentEditignICourse = null;
        Manager.INSTANCE.currentEditingSchedule = null;
        super.btnBack_Pressed();
      }
    } else {
      ViewUtilities.showAlert("Primero debes asignar una sala a la clase");
    }
  }
 public void btnRemoveICourse_Pressed() {
   if (Manager.INSTANCE.currentEditignICourse != null) {
     ArrayList<ICourse> courses = Manager.INSTANCE.currentEditignCourse.getCourses();
     if (courses.contains(Manager.INSTANCE.currentEditignICourse)) {
       courses.remove(Manager.INSTANCE.currentEditignICourse);
       Manager.INSTANCE.currentEditignCourse.setCourses(courses);
       super.btnBack_Pressed();
     } else {
       ViewUtilities.showAlert("The class is not in the classes of the course");
     }
   } else {
     ViewUtilities.showAlert("The ICourse is null");
   }
 }
  @Override
  public void setUp() {
    super.setUp();

    btnAddAssistantOrProfessor.setText(Messages.getUILabel(UILabel.ADD_PROFESSOR));
    btnRemoveAssistantOrProfessor.setText(Messages.getUILabel(UILabel.REMOVE_PROFESSOR));
    labelPickAssistantsOrProfessors.setText(Messages.getUILabel(UILabel.PICK_PROFESSOR));
    labelClasroomSelection.setText(Messages.getUILabel(UILabel.SELECT_CLASSROOM));
    btnSaveCourse.setText(Messages.getUILabel(UILabel.SAVE_ICOURSE));
    btnSeeSchedule.setText(Messages.getUILabel(UILabel.SEE_SCHEDULE));
    btnRemoveICourse.setText(Messages.getUILabel(UILabel.REMOVE_ICOURSE));

    ArrayList<String> classrooms = new ArrayList<String>();
    for (Classroom classroom : Manager.INSTANCE.classrooms) {
      classrooms.add(classroom.getInitials());
    }
    chBxClassrooms.setItems(FXCollections.observableArrayList(classrooms));
    ViewUtilities.autoComplete(chBxClassrooms);

    if (Manager.INSTANCE.currentEditignICourse instanceof Lecture
        & Manager.INSTANCE.currentEditignICourse != null) {
      isCreating = false;
      Lecture selectedLecture = (Lecture) Manager.INSTANCE.currentEditignICourse;

      Manager.INSTANCE.currentEditingSchedule = selectedLecture.getSchedule();

      ArrayList<String> professors = new ArrayList<String>();
      for (Professor professor : selectedLecture.getProfessors()) {
        professors.add(
            professor.getName()
                + " "
                + professor.getLastnameFather()
                + " "
                + professor.getLastnameMother()
                + "-"
                + professor.getRut());
      }
      listAssistantsOrProfessors.setItems(FXCollections.observableArrayList(professors));

      chBxClassrooms.getSelectionModel().select(selectedLecture.getClassroom().getInitials());

    } else {
      isCreating = true;
      Manager.INSTANCE.currentEditignICourse = new Lecture(null, null, new Schedule());
      Manager.INSTANCE.currentEditingSchedule =
          Manager.INSTANCE.currentEditignICourse.getSchedule();
    }

    ArrayList<String> professors2 = new ArrayList<String>();
    for (Professor professor : Manager.INSTANCE.professors) {
      professors2.add(
          professor.getName()
              + " "
              + professor.getLastnameFather()
              + " "
              + professor.getLastnameMother()
              + "-"
              + professor.getRut());
    }
    chBxAssistantsOrProfessors.setItems(FXCollections.observableArrayList(professors2));

    ViewUtilities.autoComplete(chBxAssistantsOrProfessors);
  }