Subversion Repositories eFlore/Applications.coel

Rev

Rev 448 | Rev 522 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 448 Rev 453
Line 32... Line 32...
32
import com.extjs.gxt.ui.client.widget.layout.AnchorLayout;
32
import com.extjs.gxt.ui.client.widget.layout.AnchorLayout;
33
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
33
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
34
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
34
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
35
import com.google.gwt.core.client.GWT;
35
import com.google.gwt.core.client.GWT;
Line 36... Line 36...
36
 
36
 
Line 37... Line -...
37
public class StructureDetailVue extends LayoutContainer implements Rafraichissable {
-
 
38
 
-
 
39
	private Mediateur mediateur = null;
-
 
40
	private Constantes i18nC = null;
-
 
41
	private HashMap<String, Valeur> ontologie = null;
-
 
42
	private ProjetListe projets = null;
37
public class StructureDetailVue extends DetailVue implements Rafraichissable {
43
	
38
 
44
	private String enteteTpl = null;
39
	private String enteteTpl = null;
45
	private String identificationTpl = null;
40
	private String identificationTpl = null;
46
	private String personnelTpl = null;
41
	private String personnelTpl = null;
47
	private String tableauPersonnelTpl = null;
42
	private String tableauPersonnelTpl = null;
48
	private String lignePersonnelTpl = null;
43
	private String lignePersonnelTpl = null;
49
	private String conservationTpl = null;
44
	private String conservationTpl = null;
50
	private String traitementConservationTpl = null;
-
 
51
	private String valorisationTpl = null;
45
	private String traitementConservationTpl = null;
52
	private String sautLigneTpl = null;
46
	private String valorisationTpl = null;
Line 53... Line 47...
53
	private String typeTraitementConservationTpl = null;
47
	private String typeTraitementConservationTpl = null;
54
	private String rechercheValorisationTpl = null;
48
	private String rechercheValorisationTpl = null;
Line 65... Line 59...
65
	private TabItem personnelOnglet = null;
59
	private TabItem personnelOnglet = null;
66
	private TabItem conservationOnglet = null;
60
	private TabItem conservationOnglet = null;
67
	private TabItem valorisationOnglet = null;
61
	private TabItem valorisationOnglet = null;
Line 68... Line 62...
68
	
62
	
69
	public StructureDetailVue(Mediateur mediateurCourant) {
63
	public StructureDetailVue(Mediateur mediateurCourant) {
70
		mediateur = mediateurCourant;
-
 
-
 
64
		super(mediateurCourant);
71
		i18nC = mediateur.i18nC; 
65
		
72
		initialiserTousLesTpl();
-
 
73
		ontologie = new HashMap<String, Valeur>();
66
		initialiserTousLesTpl();
Line 74... Line -...
74
		chargerOntologie();
-
 
75
		
-
 
76
		setLayout(new FitLayout());
-
 
77
		setBorders(false);
-
 
78
		setScrollMode(Scroll.AUTO);
67
		chargerOntologie();
79
		
68
		
80
		panneauPrincipal = new ContentPanel();
69
		panneauPrincipal = new ContentPanel();
81
		panneauPrincipal.setLayout(new FlowLayout());
70
		panneauPrincipal.setLayout(new FlowLayout());
Line 114... Line 103...
114
		panneauPrincipal.add(onglets);
103
		panneauPrincipal.add(onglets);
115
		add(panneauPrincipal);
104
		add(panneauPrincipal);
116
	}
105
	}
Line 117... Line 106...
117
 
106
 
118
	private void chargerOntologie() {
-
 
119
		mediateur.selectionnerProjets(this);
107
	private void chargerOntologie() {
120
		mediateur.obtenirListeValeurEtRafraichir(this, "stpr");
108
		mediateur.obtenirListeValeurEtRafraichir(this, "stpr");
121
		mediateur.obtenirListeValeurEtRafraichir(this, "stpu");
109
		mediateur.obtenirListeValeurEtRafraichir(this, "stpu");
122
		mediateur.obtenirListeValeurEtRafraichir(this, "statut");
110
		mediateur.obtenirListeValeurEtRafraichir(this, "statut");
123
		mediateur.obtenirListeValeurEtRafraichir(this, "fonction");
111
		mediateur.obtenirListeValeurEtRafraichir(this, "fonction");
Line 443... Line 431...
443
		}
431
		}
Line 444... Line 432...
444
		
432
		
445
		return cHtml;
433
		return cHtml;
Line 446... Line -...
446
	}
-
 
447
	
-
 
448
	private void afficherOnglet(String template, Params parametres, TabItem onglet) {
-
 
449
		String cHtml = Format.substitute(template, parametres);
-
 
450
		
-
 
451
		Params cssParams = new Params();
-
 
452
		cssParams.set("css_corps", ComposantClass.DETAIL_CORPS_CONTENU);
-
 
453
		cssParams.set("css_label", ComposantClass.LABEL);
-
 
454
		cssParams.set("css_indentation", ComposantClass.INDENTATION);
-
 
455
		cssParams.set("css_fieldset", ComposantClass.FIELDSET);
-
 
456
		cssParams.set("css_clear", ComposantClass.CLEAR);
-
 
457
		cHtml = Format.substitute(cHtml, cssParams);
-
 
458
		
-
 
459
		HtmlContainer corpsConteneurDuHtml = new HtmlContainer(cHtml);
-
 
460
		onglet.removeAll();
-
 
461
		onglet.add(corpsConteneurDuHtml);		
-
 
462
	}
434
	}
463
	
435
	
464
	private void initialiserTousLesTpl() {
436
	private void initialiserTousLesTpl() {
465
		initialiserEnteteHtmlTpl();
437
		initialiserEnteteHtmlTpl();
466
		initialiserIdentificationTpl();
438
		initialiserIdentificationTpl();
Line 470... Line 442...
470
		initialiserConservationTpl();
442
		initialiserConservationTpl();
471
		initialiserTraitementConservationTpl();
443
		initialiserTraitementConservationTpl();
472
		initialiserTypeTraitementConservationTpl();
444
		initialiserTypeTraitementConservationTpl();
473
		initialiserValorisationTpl();
445
		initialiserValorisationTpl();
474
		initialiserRechercheValorisationTpl();
446
		initialiserRechercheValorisationTpl();
475
		initialiserSautLigneTpl();
-
 
476
	}
447
	}
Line 477... Line 448...
477
	
448
	
478
	private void initialiserEnteteHtmlTpl() {
449
	private void initialiserEnteteHtmlTpl() {
479
		enteteTpl = 	
450
		enteteTpl = 	
Line 642... Line 613...
642
		rechercheValorisationTpl =
613
		rechercheValorisationTpl =
643
			"<span class='{css_indentation} {css_label}'>{i18n_recherche_provenance} :</span> {recherche_provenance}<br />"+
614
			"<span class='{css_indentation} {css_label}'>{i18n_recherche_provenance} :</span> {recherche_provenance}<br />"+
644
			"<span class='{css_indentation} {css_label}'>{i18n_recherche_type} :</span> {recherche_type}<br />";
615
			"<span class='{css_indentation} {css_label}'>{i18n_recherche_type} :</span> {recherche_type}<br />";
645
	}
616
	}
Line 646... Line -...
646
	
-
 
647
	private void initialiserSautLigneTpl() {
-
 
648
		sautLigneTpl = "<br />\n";
-
 
649
	}
-
 
650
		
617
	
651
	public void rafraichir(Object nouvelleDonnees) {
618
	public void rafraichir(Object nouvelleDonnees) {
652
		if (nouvelleDonnees instanceof Structure) {
619
		if (nouvelleDonnees instanceof Structure) {
653
			structure = (Structure) nouvelleDonnees;
620
			structure = (Structure) nouvelleDonnees;
654
			afficherDetailInstitution();
621
			afficherDetailInstitution();
Line 665... Line 632...
665
			}
632
			}
666
		} else {
633
		} else {
667
			GWT.log("Pas de correspondance dans la méthode rafraichir() de la classe "+this.getClass(), null);
634
			GWT.log("Pas de correspondance dans la méthode rafraichir() de la classe "+this.getClass(), null);
668
		}
635
		}
669
	}
636
	}
670
	
-
 
671
	private void ajouterListeValeursAOntologie(ValeurListe ontologieReceptionnee) {
-
 
672
		Iterator<String> it = ontologieReceptionnee.keySet().iterator();
-
 
673
		while (it.hasNext()) {
-
 
674
			String cle = it.next();
-
 
675
			Valeur valeur = ontologieReceptionnee.get(cle);
-
 
676
			if (valeur != null) {
-
 
677
				ontologie.put(cle, valeur);
-
 
678
			}
-
 
679
		}
-
 
680
	}
-
 
Line 681... Line 637...
681
 
637
 
682
	protected void allouerPersonnelAStructure(StructureAPersonneListe personnel) {
638
	protected void allouerPersonnelAStructure(StructureAPersonneListe personnel) {
683
		structure.setPersonnel(personnel);
639
		structure.setPersonnel(personnel);
Line 728... Line 684...
728
		String chaineAutres = formaterTableauDeTxt(autres);
684
		String chaineAutres = formaterTableauDeTxt(autres);
729
		String chaineARetourner = chaineTermes+formaterAutre(chaineAutres);
685
		String chaineARetourner = chaineTermes+formaterAutre(chaineAutres);
Line 730... Line 686...
730
		
686
		
731
		return chaineARetourner;
687
		return chaineARetourner;
732
	}
-
 
733
	
-
 
734
	protected String construireTxtTruck(String chaineAAnalyser) {
-
 
735
		ArrayList<String> termes = new ArrayList<String>();
-
 
736
		
-
 
737
		if ((chaineAAnalyser != null) && (!chaineAAnalyser.trim().equals("")))	{
-
 
738
			String[] valeurs = chaineAAnalyser.split(";;");
-
 
739
			int nbreValeurs = valeurs.length;
-
 
740
			if (nbreValeurs > 0)	{
-
 
741
				for (int i = 0; i < nbreValeurs; i++)	{
-
 
742
					String valeur = valeurs[i];
-
 
743
					String valeurFormatee = formaterValeurTruck(valeur);
-
 
744
					termes.add(valeurFormatee);
-
 
745
				}
-
 
746
			}
-
 
747
		}
-
 
748
		
-
 
749
		String chaineARetourner = formaterTableauDeTxt(termes);
-
 
750
		return chaineARetourner;
-
 
751
	}
-
 
752
	
-
 
753
	private String formaterParenthese(String chaineAAfficher) {
-
 
754
		if (!chaineAAfficher.equals("")) {
-
 
755
			chaineAAfficher = "("+chaineAAfficher+")";
-
 
756
		}
-
 
757
		return chaineAAfficher;
-
 
758
	}
-
 
759
	
-
 
760
	private String formaterAutre(String chaineAAfficher) {
-
 
761
		if (!chaineAAfficher.equals("")) {
-
 
762
			chaineAAfficher = " ["+i18nC.autres()+" : "+chaineAAfficher+"]";
-
 
763
		}
-
 
764
		return chaineAAfficher;
-
 
765
	}
-
 
766
	
-
 
767
	private String formaterTableauDeTxt(ArrayList<String> tableauDeTxt) {
-
 
768
		String chaineAAfficher = "";
-
 
769
		int tailleDuTableau = tableauDeTxt.size();
-
 
770
		if (tailleDuTableau > 0) {
-
 
771
			int indexAvtDernier = tailleDuTableau - 1;
-
 
772
			for (int i = 0; i < tailleDuTableau; i++)	{
-
 
773
				String mot = tableauDeTxt.get(i);
-
 
774
				if (i != indexAvtDernier) {
-
 
775
					chaineAAfficher += mot+", ";
-
 
776
				} else {
-
 
777
					chaineAAfficher += nettoyerPointFinal(mot)+".";
-
 
778
				}
-
 
779
			}
-
 
780
		}
-
 
781
		return chaineAAfficher;
-
 
782
	}
-
 
783
	
-
 
784
	private String formaterOuiNon(String chaineAFormater) {
-
 
785
		String txtARetourner = "";
-
 
786
		if (chaineAFormater.equals("0")) {
-
 
787
			txtARetourner = i18nC.non();
-
 
788
		} else if (chaineAFormater.equals("1")) {
-
 
789
			txtARetourner = i18nC.oui();
-
 
790
		}
-
 
791
		return txtARetourner;
-
 
792
	}
-
 
793
	
-
 
794
	private String formaterSautDeLigne(String chaineAFormater) {
-
 
795
		String txtARetourner = chaineAFormater.replaceAll("\n", sautLigneTpl);
-
 
796
		return txtARetourner;
-
 
797
	}
-
 
798
 
-
 
799
	private String formaterValeurTruck(String valeur) {
-
 
800
		String chaineARetourner = "";
-
 
801
		
-
 
802
		if (valeur.matches("^[^#]+##[^$]+$"))	{
-
 
803
			String[] cleValeur = valeur.split("##");
-
 
804
			chaineARetourner = cleValeur[1]+" "+formaterParenthese(cleValeur[0]);
-
 
805
		} else if (!valeur.equals(""))	{
-
 
806
			chaineARetourner = valeur;
-
 
807
		} else {
-
 
808
			GWT.log("Valeur truck posant problèlme :"+valeur, null);
-
 
809
		}
-
 
810
		
-
 
811
		return chaineARetourner;
-
 
812
	}
-
 
813
 
-
 
814
	private String nettoyerPointFinal(String mot) {
-
 
815
		mot = mot.replaceAll("[.]$", "");
-
 
816
		return mot;
-
 
817
	}
-
 
818
	
688
	}
819
}
689
}