// ------------------------------- ControleurAdministrateur.java ------------------------------ /** Package ctrl regroupe les controleurs du modele. **/ package ctrl; import outils.XMLParserRepartiteur; import modmission.Lire; import java.io.*; public class ControleurAdministrateur { private int rep; private int rep1; private boolean encore = true; private boolean encore2 = true; private boolean encore3 = true; private boolean encore4 = true; private String nom; private String prenom; private static ControleurAdministrateur unCtrlAdmin = new ControleurAdministrateur(); private XMLParserRepartiteur unXMLRepart = new XMLParserRepartiteur(); public ControleurAdministrateur(){} public static ControleurAdministrateur getInstance() { return unCtrlAdmin; } public void menuLogin() throws IOException { while(encore) { /* Menu Principal */ System.out.println("==============================================="); System.out.println(" MENU LOGIN ADMINISTRATEUR"); System.out.println("==============================================="); System.out.println(" "); System.out.println(" Veuillez entrez votre identifiant : "); System.out.println(" (ou taper 0 pour quitter)"); System.out.println(" "); System.out.println("Identifiant: "); /* lecture du choix */ rep = Lire.lireInt(); if(rep == 1) { encore=false; menuGerer(); } else if(rep == 0) { } else { System.out.println("Votre identifiant n'est pas connu par le systeme"); } } } public void menuGerer() throws IOException { while(encore2) { /* Menu Principal */ System.out.println("==============================================="); System.out.println(" MENU GERER REPARTITEUR"); System.out.println("==============================================="); System.out.println(" "); System.out.println(" Vous voulez : "); System.out.println(" 1- Ajouter un Repartiteur"); System.out.println(" 2- Supprimer un Repartiteur"); System.out.println(" "); System.out.println(" (ou taper 0 pour quitter)"); System.out.println(" "); System.out.println("Entrer votre choix: "); /* lecture du choix */ rep1 = Lire.lireInt(); /* traitement du choix */ if(rep1 == 1) { ajouterRepartiteur(); } else if(rep1 == 2) { supprimerRepartiteur(); } else if(rep1 == 0) { } else { System.out.println("Choix non valide"); } } } public void ajouterRepartiteur() throws IOException { while(encore3) { /* Menu Principal */ System.out.println("==============================================="); System.out.println(" MENU GERER REPARTITEUR - AJOUTER"); System.out.println("==============================================="); System.out.println(" "); System.out.println(" Veuillez saisir : "); System.out.println(" Son Nom : "); nom = Lire.lireString(); System.out.println(" Son Prenom : "); prenom = Lire.lireString(); encore3=false; try { unXMLRepart.ajouteRepartiteur(nom,prenom); System.exit(0); } catch(Exception e){e.printStackTrace();} } } public void supprimerRepartiteur() throws IOException { /* Menu Principal */ System.out.println("==============================================="); System.out.println(" MENU GERER REPARTITEUR"); System.out.println("==============================================="); System.out.println(" "); System.out.println(" Liste des répartiteurs : "); System.out.println(unXMLRepart.getLesRepartiteurs().elementAt(1).getIdPersonnel()); System.out.println(" "); System.out.println(" Quel repartiteur voulez vous supprimer ? "); System.out.println(" "); System.out.println("Entrer votre choix: "); } }//fin class ControleurAdministrateur