Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 812 → Rev 813

/trunk/src/org/tela_botanica/client/vues/PublicationDetailVue.java
4,6 → 4,7
import org.tela_botanica.client.ComposantId;
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.ProjetListe;
import org.tela_botanica.client.modeles.Publication;
 
import com.extjs.gxt.ui.client.util.Format;
23,6 → 24,7
private Html contenu = null;
private Publication publication = null;
private boolean publicationChargementOk = false;
 
public PublicationDetailVue(Mediateur mediateurCourant) {
super(mediateurCourant);
53,7 → 55,7
enteteTpl =
"<div id='{css_id}'>"+
" <h1>{titre}</h1>"+
" <h2>{auteurs} ({annee})<span class='{css_meta}'>{projet} - {id} - {guid}</span></h2>" +
" <h2>{auteurs} ({annee})<span class='{css_meta}'>{projet} <br /> {i18n_id}:{id} - {guid}</span></h2>" +
"</div>";
}
88,6 → 90,8
enteteParams.set("css_id", ComposantId.ZONE_DETAIL_ENTETE);
enteteParams.set("css_meta", ComposantClass.META);
enteteParams.set("i18n_id", i18nC.id());
enteteParams.set("titre", publication.getTitre());
enteteParams.set("auteurs", publication.getAuteur());
enteteParams.set("annee", publication.getAnneeParution());
94,7 → 98,7
enteteParams.set("id", publication.getId());
enteteParams.set("guid", getGuid());
enteteParams.set("projet", construireTxtProjet(publication.getIdProjet()));
GWT.log("entete généré", null);
String eHtml = Format.substitute(enteteTpl, enteteParams);
entete.getElement().setInnerHTML(eHtml);
}
135,10 → 139,25
public void rafraichir(Object nouvellesDonnees) {
if (nouvellesDonnees instanceof Publication) {
publication = (Publication) nouvellesDonnees;
afficherDetail();
publicationChargementOk = true;
} else if (nouvellesDonnees instanceof ProjetListe) {
projets = (ProjetListe) nouvellesDonnees;
projetsChargementOk = true;
GWT.log("projets recu", null);
} else {
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
}
if (avoirDonneesChargees()) {
afficherDetail();
}
}
 
}
private boolean avoirDonneesChargees() {
boolean ok = false;
if (projetsChargementOk && publicationChargementOk) {
ok = true;
}
return ok;
}
}
/trunk/src/org/tela_botanica/client/vues/DetailVue.java
6,13 → 6,16
 
import org.tela_botanica.client.ComposantClass;
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.RegistreId;
import org.tela_botanica.client.i18n.Constantes;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Configuration;
import org.tela_botanica.client.modeles.Projet;
import org.tela_botanica.client.modeles.ProjetListe;
import org.tela_botanica.client.modeles.Valeur;
import org.tela_botanica.client.modeles.ValeurListe;
 
import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.util.Format;
import com.extjs.gxt.ui.client.util.Params;
28,8 → 31,12
protected Constantes i18nC = null;
 
protected HashMap<String, Valeur> ontologie = null;
protected boolean ontologieChargementOk = false;
private HashMap<Integer, String> ontologiesEnAttenteDeReception = null;
protected ProjetListe projets = null;
 
protected boolean projetsChargementOk = false;
protected String sautLigneTpl = null;
public DetailVue(Mediateur mediateurCourant) {
39,7 → 46,9
initialiserSautLigneTpl();
ontologie = new HashMap<String, Valeur>();
chargerOntologie();
ontologieChargementOk = false;
ontologiesEnAttenteDeReception = new HashMap<Integer, String>();
chargerProjets();
setLayout(new FitLayout());
setBorders(false);
50,18 → 59,20
sautLigneTpl = "<br />\n";
}
private void chargerOntologie() {
private void chargerProjets() {
mediateur.selectionnerProjets(this);
}
protected String construireTxtProjet(String idProjet) {
String chaineARetourner = idProjet;
if (projets != null) {
Projet projet = projets.get(idProjet);
String nomDuProjet = projet.getNom();
if (!nomDuProjet.equals("")) {
chaineARetourner = nomDuProjet;
if (projet != null) {
String nomDuProjet = projet.getNom();
if (!nomDuProjet.equals("")) {
chaineARetourner = nomDuProjet;
}
}
}
175,11 → 186,32
return txtARetourner;
}
protected void ajouterListeValeursAOntologie(ValeurListe ontologieReceptionnee) {
Iterator<String> it = ontologieReceptionnee.keySet().iterator();
protected void lancerChargementListesValeurs(String[] listesCodes) {
Configuration configuration = (Configuration) Registry.get(RegistreId.CONFIG);
for (int i = 0; i < listesCodes.length ; i++) {
String code = listesCodes[i];
ontologiesEnAttenteDeReception.put(configuration.getListeId(code), code);
mediateur.obtenirListeValeurEtRafraichir(this, code);
}
}
protected void receptionerOntologie(ValeurListe listeValeursReceptionnee) {
mettreAJourOntologieEnAttenteDeReception(listeValeursReceptionnee);
ajouterListeValeursAOntologie(listeValeursReceptionnee);
}
protected void mettreAJourOntologieEnAttenteDeReception(ValeurListe listeValeursReceptionnee) {
ontologiesEnAttenteDeReception.remove(listeValeursReceptionnee.getId());
if (ontologiesEnAttenteDeReception.size() == 0) {
ontologieChargementOk = true;
}
}
protected void ajouterListeValeursAOntologie(ValeurListe listeValeursReceptionnee) {
Iterator<String> it = listeValeursReceptionnee.keySet().iterator();
while (it.hasNext()) {
String cle = it.next();
Valeur valeur = ontologieReceptionnee.get(cle);
Valeur valeur = listeValeursReceptionnee.get(cle);
if (valeur != null) {
ontologie.put(cle, valeur);
}
219,5 → 251,4
return chaineARetourner;
}
}
/trunk/src/org/tela_botanica/client/vues/CollectionDetailVue.java
35,6 → 35,7
private String inventaireTpl = null;
private Collection collection = null;
private boolean collectionChargementOk = false;
private ContentPanel panneauPrincipal = null;
private Html entete = null;
120,8 → 121,7
enteteTpl =
"<div id='{css_id}'>"+
" <h1>{nom}</h1>"+
" <h2>{structure}<span class='{css_meta}'>{projet} - {id} - {guid}</span></h2>" +
" " +
" <h2>{structure}<span class='{css_meta}'>{projet} <br /> {i18n_id}:{id} - {guid}</span></h2>" +
"</div>";
}
214,25 → 214,37
}
private void chargerOntologie() {
mediateur.obtenirListeValeurEtRafraichir(this, "typeCollectionBota");
mediateur.obtenirListeValeurEtRafraichir(this, "typeCollectionNcd");
mediateur.obtenirListeValeurEtRafraichir(this, "typeDepot");
String[] listesCodes = {"typeCollectionBota", "typeCollectionNcd", "typeDepot"};
lancerChargementListesValeurs(listesCodes);
}
public void rafraichir(Object nouvellesDonnees) {
if (nouvellesDonnees instanceof Collection) {
collection = (Collection) nouvellesDonnees;
afficherDetail();
collectionChargementOk = true;
} else if (nouvellesDonnees instanceof ProjetListe) {
projets = (ProjetListe) nouvellesDonnees;
projetsChargementOk = true;
} else if (nouvellesDonnees instanceof ValeurListe) {
ValeurListe ontologieReceptionnee = (ValeurListe) nouvellesDonnees;
ajouterListeValeursAOntologie(ontologieReceptionnee);
ValeurListe listeValeursReceptionnee = (ValeurListe) nouvellesDonnees;
receptionerOntologie(listeValeursReceptionnee);
} else {
GWT.log("Pas de correspondance dans la méthode rafraichir() de la classe "+this.getClass(), null);
}
if (avoirDonneesChargees()) {
afficherDetail();
}
}
private boolean avoirDonneesChargees() {
boolean ok = false;
if (projetsChargementOk && collectionChargementOk && ontologieChargementOk) {
ok = true;
}
return ok;
}
private void afficherDetail() {
if (collection != null) {
afficherEntete();
252,6 → 264,8
enteteParams.set("css_id", ComposantId.ZONE_DETAIL_ENTETE);
enteteParams.set("css_meta", ComposantClass.META);
enteteParams.set("i18n_id", i18nC.id());
enteteParams.set("nom", collection.getNom());
enteteParams.set("structure", collection.getStructureNom());
enteteParams.set("id", collection.getId());