Collection formations = DaoManager.getFormationDao().getFormations();
Collection formations = null; if (UserDao.TYPE_SECRETARY.equals(mainFrame.getUserConnected().getUserType())) formations = mainFrame.getUserConnected().getFormationsInCharge(); else formations = DaoManager.getFormationDao().getFormations();
		public void itemStateChanged(ItemEvent event) {			if (ItemEvent.SELECTED == event.getStateChange()) {				jcbSubjectEDT.removeAllItems();				jcbGroupEDT.removeAllItems();				try {				    jcbSubjectEDT.setEnabled(false);				    jcbGroupEDT.setEnabled(false);				    if (!noLoadTimetable && mainFrame.getModel().getTimetable() != null) {					    mainFrame.getModel().setTimetable(null);					    mainFrame.getModel().fireCloseTimetable(false);				    }					if (TYPE_FORMATION.equals(event.getItem())) {					    Collection formations = null;					    if (UserDao.TYPE_SECRETARY.equals(mainFrame.getUserConnected().getUserType()))					        formations = mainFrame.getUserConnected().getFormationsInCharge();					    else					        formations = DaoManager.getFormationDao().getFormations();						jcbSubjectEDT.addItem(TYPE_VIDE);						for (Iterator i = formations.iterator(); i.hasNext(); ) {							Formation formation = (Formation) i.next();							jcbSubjectEDT.addItem(new ComboBoxItem(formation.getHeading(), formation.getIdFormation()));						}						jcbSubjectEDT.setEnabled(true);					} else if (TYPE_ENSEIGNANT.equals(event.getItem())) {						Collection teachers = DaoManager.getUserDao().getTeachers();						jcbSubjectEDT.addItem(TYPE_VIDE);						for (Iterator i = teachers.iterator(); i.hasNext(); ) {							User teacher = (User) i.next();							jcbSubjectEDT.addItem(new ComboBoxItem(teacher.getName()+" "+teacher.getFirstName(), teacher.getIdUser()));						}						jcbSubjectEDT.setEnabled(true);					} else if (TYPE_LOCAL.equals(event.getItem())) {						Collection rooms = DaoManager.getElementDao().getRooms();						jcbSubjectEDT.addItem(TYPE_VIDE);						for (Iterator i = rooms.iterator(); i.hasNext(); ) {							Room room = (Room) i.next();							jcbSubjectEDT.addItem(new ComboBoxItem(room.getName(),room.getIdRoom()));						}						jcbSubjectEDT.setEnabled(true);					} else if (TYPE_MATERIEL.equals(event.getItem())) {						Collection materials = DaoManager.getElementDao().getMaterials();						jcbSubjectEDT.addItem(TYPE_VIDE);						for (Iterator i = materials.iterator(); i.hasNext(); ) {							Material material = (Material) i.next();							jcbSubjectEDT.addItem(new ComboBoxItem(material.getName(), material.getIdMaterial()));						}						jcbSubjectEDT.setEnabled(true);					} else if (TYPE_GROUPE.equals(event.getItem())) {						Collection formations = DaoManager.getFormationDao().getFormations();						jcbSubjectEDT.addItem(TYPE_VIDE);						for (Iterator i = formations.iterator(); i.hasNext(); ) {							Formation formation = (Formation) i.next();							jcbSubjectEDT.addItem(new ComboBoxItem(formation.getHeading(), formation.getIdFormation()));						}						jcbSubjectEDT.setEnabled(true);					}				} catch (Exception e) {					JOptionPane.showMessageDialog(null, "Une erreur interne est survenue", "Erreur", JOptionPane.ERROR_MESSAGE);				}			}		}