34,13 → 34,8 |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout; |
import com.google.gwt.core.client.GWT; |
|
public class StructureDetailVue extends LayoutContainer implements Rafraichissable { |
public class StructureDetailVue extends DetailVue implements Rafraichissable { |
|
private Mediateur mediateur = null; |
private Constantes i18nC = null; |
private HashMap<String, Valeur> ontologie = null; |
private ProjetListe projets = null; |
|
private String enteteTpl = null; |
private String identificationTpl = null; |
private String personnelTpl = null; |
49,7 → 44,6 |
private String conservationTpl = null; |
private String traitementConservationTpl = null; |
private String valorisationTpl = null; |
private String sautLigneTpl = null; |
private String typeTraitementConservationTpl = null; |
private String rechercheValorisationTpl = null; |
|
67,16 → 61,11 |
private TabItem valorisationOnglet = null; |
|
public StructureDetailVue(Mediateur mediateurCourant) { |
mediateur = mediateurCourant; |
i18nC = mediateur.i18nC; |
super(mediateurCourant); |
|
initialiserTousLesTpl(); |
ontologie = new HashMap<String, Valeur>(); |
chargerOntologie(); |
|
setLayout(new FitLayout()); |
setBorders(false); |
setScrollMode(Scroll.AUTO); |
|
panneauPrincipal = new ContentPanel(); |
panneauPrincipal.setLayout(new FlowLayout()); |
panneauPrincipal.setHeaderVisible(false); |
116,7 → 105,6 |
} |
|
private void chargerOntologie() { |
mediateur.selectionnerProjets(this); |
mediateur.obtenirListeValeurEtRafraichir(this, "stpr"); |
mediateur.obtenirListeValeurEtRafraichir(this, "stpu"); |
mediateur.obtenirListeValeurEtRafraichir(this, "statut"); |
445,22 → 433,6 |
return cHtml; |
} |
|
private void afficherOnglet(String template, Params parametres, TabItem onglet) { |
String cHtml = Format.substitute(template, parametres); |
|
Params cssParams = new Params(); |
cssParams.set("css_corps", ComposantClass.DETAIL_CORPS_CONTENU); |
cssParams.set("css_label", ComposantClass.LABEL); |
cssParams.set("css_indentation", ComposantClass.INDENTATION); |
cssParams.set("css_fieldset", ComposantClass.FIELDSET); |
cssParams.set("css_clear", ComposantClass.CLEAR); |
cHtml = Format.substitute(cHtml, cssParams); |
|
HtmlContainer corpsConteneurDuHtml = new HtmlContainer(cHtml); |
onglet.removeAll(); |
onglet.add(corpsConteneurDuHtml); |
} |
|
private void initialiserTousLesTpl() { |
initialiserEnteteHtmlTpl(); |
initialiserIdentificationTpl(); |
472,7 → 444,6 |
initialiserTypeTraitementConservationTpl(); |
initialiserValorisationTpl(); |
initialiserRechercheValorisationTpl(); |
initialiserSautLigneTpl(); |
} |
|
private void initialiserEnteteHtmlTpl() { |
644,10 → 615,6 |
"<span class='{css_indentation} {css_label}'>{i18n_recherche_type} :</span> {recherche_type}<br />"; |
} |
|
private void initialiserSautLigneTpl() { |
sautLigneTpl = "<br />\n"; |
} |
|
public void rafraichir(Object nouvelleDonnees) { |
if (nouvelleDonnees instanceof Structure) { |
structure = (Structure) nouvelleDonnees; |
667,17 → 634,6 |
GWT.log("Pas de correspondance dans la méthode rafraichir() de la classe "+this.getClass(), null); |
} |
} |
|
private void ajouterListeValeursAOntologie(ValeurListe ontologieReceptionnee) { |
Iterator<String> it = ontologieReceptionnee.keySet().iterator(); |
while (it.hasNext()) { |
String cle = it.next(); |
Valeur valeur = ontologieReceptionnee.get(cle); |
if (valeur != null) { |
ontologie.put(cle, valeur); |
} |
} |
} |
|
protected void allouerPersonnelAStructure(StructureAPersonneListe personnel) { |
structure.setPersonnel(personnel); |
730,90 → 686,4 |
|
return chaineARetourner; |
} |
|
protected String construireTxtTruck(String chaineAAnalyser) { |
ArrayList<String> termes = new ArrayList<String>(); |
|
if ((chaineAAnalyser != null) && (!chaineAAnalyser.trim().equals(""))) { |
String[] valeurs = chaineAAnalyser.split(";;"); |
int nbreValeurs = valeurs.length; |
if (nbreValeurs > 0) { |
for (int i = 0; i < nbreValeurs; i++) { |
String valeur = valeurs[i]; |
String valeurFormatee = formaterValeurTruck(valeur); |
termes.add(valeurFormatee); |
} |
} |
} |
|
String chaineARetourner = formaterTableauDeTxt(termes); |
return chaineARetourner; |
} |
|
private String formaterParenthese(String chaineAAfficher) { |
if (!chaineAAfficher.equals("")) { |
chaineAAfficher = "("+chaineAAfficher+")"; |
} |
return chaineAAfficher; |
} |
|
private String formaterAutre(String chaineAAfficher) { |
if (!chaineAAfficher.equals("")) { |
chaineAAfficher = " ["+i18nC.autres()+" : "+chaineAAfficher+"]"; |
} |
return chaineAAfficher; |
} |
|
private String formaterTableauDeTxt(ArrayList<String> tableauDeTxt) { |
String chaineAAfficher = ""; |
int tailleDuTableau = tableauDeTxt.size(); |
if (tailleDuTableau > 0) { |
int indexAvtDernier = tailleDuTableau - 1; |
for (int i = 0; i < tailleDuTableau; i++) { |
String mot = tableauDeTxt.get(i); |
if (i != indexAvtDernier) { |
chaineAAfficher += mot+", "; |
} else { |
chaineAAfficher += nettoyerPointFinal(mot)+"."; |
} |
} |
} |
return chaineAAfficher; |
} |
|
private String formaterOuiNon(String chaineAFormater) { |
String txtARetourner = ""; |
if (chaineAFormater.equals("0")) { |
txtARetourner = i18nC.non(); |
} else if (chaineAFormater.equals("1")) { |
txtARetourner = i18nC.oui(); |
} |
return txtARetourner; |
} |
|
private String formaterSautDeLigne(String chaineAFormater) { |
String txtARetourner = chaineAFormater.replaceAll("\n", sautLigneTpl); |
return txtARetourner; |
} |
|
private String formaterValeurTruck(String valeur) { |
String chaineARetourner = ""; |
|
if (valeur.matches("^[^#]+##[^$]+$")) { |
String[] cleValeur = valeur.split("##"); |
chaineARetourner = cleValeur[1]+" "+formaterParenthese(cleValeur[0]); |
} else if (!valeur.equals("")) { |
chaineARetourner = valeur; |
} else { |
GWT.log("Valeur truck posant problèlme :"+valeur, null); |
} |
|
return chaineARetourner; |
} |
|
private String nettoyerPointFinal(String mot) { |
mot = mot.replaceAll("[.]$", ""); |
return mot; |
} |
|
} |