| 935 | jpm | 1 | package org.tela_botanica.client.vues.personne;
 | 
        
           | 127 | gduche | 2 |   | 
        
           | 277 | jp_milcent | 3 | import org.tela_botanica.client.Mediateur;
 | 
        
           | 127 | gduche | 4 | import org.tela_botanica.client.RegistreId;
 | 
        
           | 1239 | cyprien | 5 | import org.tela_botanica.client.composants.InfoLogger;
 | 
        
           | 127 | gduche | 6 | import org.tela_botanica.client.interfaces.Rafraichissable;
 | 
        
           | 277 | jp_milcent | 7 | import org.tela_botanica.client.modeles.Information;
 | 
        
           | 1322 | gduche | 8 | import org.tela_botanica.client.modeles.ValeurListe;
 | 
        
           | 935 | jpm | 9 | import org.tela_botanica.client.modeles.personne.Personne;
 | 
        
           |  |  | 10 | import org.tela_botanica.client.modeles.personne.PersonneListe;
 | 
        
           | 1322 | gduche | 11 | import org.tela_botanica.client.synchronisation.Sequenceur;
 | 
        
           | 915 | jpm | 12 | import org.tela_botanica.client.util.Debug;
 | 
        
           | 1322 | gduche | 13 | import org.tela_botanica.client.util.UtilString;
 | 
        
           | 127 | gduche | 14 |   | 
        
           |  |  | 15 | import com.extjs.gxt.ui.client.Registry;
 | 
        
           |  |  | 16 | import com.extjs.gxt.ui.client.Style.LayoutRegion;
 | 
        
           |  |  | 17 | import com.extjs.gxt.ui.client.util.Margins;
 | 
        
           | 277 | jp_milcent | 18 | import com.extjs.gxt.ui.client.widget.Info;
 | 
        
           | 127 | gduche | 19 | import com.extjs.gxt.ui.client.widget.LayoutContainer;
 | 
        
           |  |  | 20 | import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
 | 
        
           |  |  | 21 | import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
 | 
        
           | 277 | jp_milcent | 22 | import com.google.gwt.core.client.GWT;
 | 
        
           | 127 | gduche | 23 |   | 
        
           |  |  | 24 | public class PersonneVue extends LayoutContainer implements Rafraichissable {
 | 
        
           |  |  | 25 |   | 
        
           | 436 | gduche | 26 | 	private PersonneListeVue panneauPersonneListe;
 | 
        
           |  |  | 27 | 	private PersonneDetailVue panneauPersonneDetail;
 | 
        
           | 529 | gduche | 28 | 	private Mediateur mediateur = null;
 | 
        
           | 127 | gduche | 29 |   | 
        
           | 1322 | gduche | 30 | 	//Sequenceur pour la gestion du synchrone
 | 
        
           |  |  | 31 | 	private Sequenceur sequenceur = new Sequenceur();
 | 
        
           |  |  | 32 |   | 
        
           | 529 | gduche | 33 | 	public PersonneVue(Mediateur mediateur) {
 | 
        
           |  |  | 34 | 		this.mediateur = mediateur;
 | 
        
           |  |  | 35 |   | 
        
           | 127 | gduche | 36 | 		BorderLayout layout = new BorderLayout();
 | 
        
           |  |  | 37 | 		layout.setEnableState(false);
 | 
        
           |  |  | 38 | 		setLayout(layout);
 | 
        
           |  |  | 39 |   | 
        
           | 436 | gduche | 40 | 		panneauPersonneListe = new PersonneListeVue();
 | 
        
           | 1322 | gduche | 41 |   | 
        
           |  |  | 42 | 		//Charger les ontologies nécessaires à l'affichage des personnes
 | 
        
           |  |  | 43 |   | 
        
           | 127 | gduche | 44 | 		this.add(panneauPersonneListe, new BorderLayoutData(LayoutRegion.CENTER));
 | 
        
           |  |  | 45 |   | 
        
           | 529 | gduche | 46 | 		panneauPersonneDetail = new PersonneDetailVue(mediateur);
 | 
        
           | 127 | gduche | 47 | 		BorderLayoutData southData = new BorderLayoutData(LayoutRegion.SOUTH, .5f, 200, 1000);
 | 
        
           |  |  | 48 | 		southData.setSplit(true);
 | 
        
           |  |  | 49 | 		southData.setMargins(new Margins(5, 0, 0, 0));
 | 
        
           | 150 | gduche | 50 | 		this.add(panneauPersonneDetail, southData);
 | 
        
           | 1367 | cyprien | 51 |   | 
        
           |  |  | 52 |   | 
        
           |  |  | 53 | 		mediateur.obtenirListeValeurEtRafraichir(this, "pays", sequenceur);
 | 
        
           |  |  | 54 | 		mediateur.obtenirListeValeurEtRafraichir(this, "tel", sequenceur);
 | 
        
           |  |  | 55 | 		mediateur.obtenirListeValeurEtRafraichir(this, "relationPersonnePublication", sequenceur);
 | 
        
           | 127 | gduche | 56 | 	}
 | 
        
           |  |  | 57 |   | 
        
           | 656 | gduche | 58 | 	public void rafraichir(Object nouvellesDonnees) {
 | 
        
           |  |  | 59 | 		if (nouvellesDonnees instanceof Personne) {
 | 
        
           | 1374 | cyprien | 60 | 			sequenceur.enfilerRafraichissement(panneauPersonneDetail, (Personne) nouvellesDonnees);
 | 
        
           | 656 | gduche | 61 | 		} else if (nouvellesDonnees instanceof PersonneListe) {
 | 
        
           |  |  | 62 | 			panneauPersonneListe.rafraichir((PersonneListe) nouvellesDonnees);
 | 
        
           |  |  | 63 | 		} else if (nouvellesDonnees instanceof Information)	{
 | 
        
           |  |  | 64 | 			Information info = (Information) nouvellesDonnees;
 | 
        
           | 1322 | gduche | 65 |   | 
        
           | 277 | jp_milcent | 66 | 			// Affichage des éventuels messages de déboguage ou d'alerte
 | 
        
           | 1322 | gduche | 67 | 			if (!UtilString.isEmpty(info.getMessages()))	{
 | 
        
           | 277 | jp_milcent | 68 | 				GWT.log(info.getMessages().toString(), null);
 | 
        
           |  |  | 69 | 			}
 | 
        
           | 1322 | gduche | 70 |   | 
        
           | 277 | jp_milcent | 71 | 			// Traitement en fonction des types d'information
 | 
        
           |  |  | 72 | 			if (info.getType().equals("liste_personne")) {
 | 
        
           | 597 | gduche | 73 | 				panneauPersonneListe.rafraichir((PersonneListe) info.getDonnee(0));
 | 
        
           | 1239 | cyprien | 74 | 				InfoLogger.display("Chargement d'une liste de personnes", "");
 | 
        
           | 618 | gduche | 75 | 			} else {
 | 
        
           |  |  | 76 | 				panneauPersonneListe.rafraichir(info);
 | 
        
           |  |  | 77 | 			}
 | 
        
           | 1322 | gduche | 78 | 		} else if (nouvellesDonnees instanceof ValeurListe)	{
 | 
        
           | 1367 | cyprien | 79 | 			panneauPersonneDetail.rafraichir((ValeurListe) nouvellesDonnees);
 | 
        
           | 127 | gduche | 80 | 		} else {
 | 
        
           | 851 | gduche | 81 | 			GWT.log(mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
 | 
        
           | 127 | gduche | 82 | 		}
 | 
        
           |  |  | 83 | 	}
 | 
        
           | 278 | jp_milcent | 84 | }
 |