Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 377 → Rev 379

/trunk/src/org/tela_botanica/client/vues/StructureVue.java
2,6 → 2,7
 
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Information;
import org.tela_botanica.client.modeles.Structure;
import org.tela_botanica.client.modeles.StructureListe;
 
41,6 → 42,11
panneauInstitutionDetail.rafraichir(nouvelleDonnees);
} else if (nouvelleDonnees instanceof StructureListe) {
panneauInstitutionListe.rafraichir(nouvelleDonnees);
} else if (nouvelleDonnees instanceof Information) {
Information info = (Information) nouvelleDonnees;
if (info.getType().equals("liste_structure_a_personne")) {
panneauInstitutionDetail.rafraichir(nouvelleDonnees);
}
} else {
GWT.log("Pas de correspondance dans la méthode rafraichir() de la classe "+this.getClass(), null);
}
/trunk/src/org/tela_botanica/client/vues/StructureListePanneauVue.java
99,7 → 99,6
store.sort("ville", SortDir.ASC);
binder = new TableBinder<Structure>(table, store);
binder.setAutoSelect(true);
binder.addSelectionChangedListener(new SelectionChangedListener<Structure>() {
public void selectionChanged(SelectionChangedEvent<Structure> event) {
Structure m = (Structure) event.getSelectedItem();
110,24 → 109,26
setLayout(new FitLayout());
}
 
private void clicListe(Structure institution) {
mediateur.clicListeInstitution(institution);
private void clicListe(Structure structure) {
if (store.getCount() > 0) {
mediateur.clicListeStructure(structure);
}
}
 
public void rafraichir(Object nouvelleDonnees) {
if (nouvelleDonnees instanceof StructureListe) {
StructureListe institutions = (StructureListe) nouvelleDonnees;
StructureListe structures = (StructureListe) nouvelleDonnees;
setHeading("Institutions");
List<Structure> liste = (List<Structure>) institutions.toList();
List<Structure> liste = (List<Structure>) structures.toList();
store.removeAll();
store.add(liste);
 
if (institutions.size() > 0) {
mediateur.actualiserPanneauCentral();
if (store.getCount() > 0) {
table.getSelectionModel().select(0);
}
mediateur.actualiserPanneauCentral();
} else if (nouvelleDonnees instanceof Information) {
Information info = (Information) nouvelleDonnees;
if (info.getType().equals("suppression_structure")) {
/trunk/src/org/tela_botanica/client/vues/StructureDetailPanneauVue.java
1,9 → 1,18
package org.tela_botanica.client.vues;
 
import java.util.Iterator;
import java.util.Map.Entry;
 
import org.tela_botanica.client.ComposantClass;
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.Information;
import org.tela_botanica.client.modeles.Structure;
import org.tela_botanica.client.modeles.StructureAPersonne;
import org.tela_botanica.client.modeles.StructureAPersonneListe;
import org.tela_botanica.client.modeles.StructureConservation;
import org.tela_botanica.client.modeles.StructureValorisation;
 
import com.extjs.gxt.ui.client.Events;
import com.extjs.gxt.ui.client.Style.Scroll;
25,19 → 34,24
private Mediateur mediateur = null;
private String enteteTpl = null;
private String contenuTpl = null;
private String identificationTpl = null;
private String personnelTpl = null;
private String lignePersonnelTpl = null;
private Structure structure = null;
private StructureAPersonneListe personnel = null;
private StructureValorisation valorisation = null;
private StructureConservation conservation = null;
private ContentPanel panneauPrincipal = null;
private Html entete = null;
private TabPanel onglets = null;
private TabItem identificationOnglet = null;
private TabItem personnelOnglet = null;
 
public StructureDetailPanneauVue(Mediateur mediateurCourant) {
mediateur = mediateurCourant;
initialiserEnteteHtmlTpl();
initialiserContenuHtmlTpl();
initialiserTousLesTpl();
setLayout(new FitLayout());
setBorders(false);
50,17 → 64,25
entete = new Html();
entete.setId(ComposantId.ZONE_DETAIL);
entete.setId(ComposantId.ZONE_DETAIL_ENTETE);
panneauPrincipal.setTopComponent(entete);
onglets = new TabPanel();
onglets.setId(ComposantId.ZONE_DETAIL_CORPS);
onglets.setHeight("100%");
onglets.setBorders(false);
onglets.setBodyBorder(false);
 
identificationOnglet = new TabItem("Général");
identificationOnglet.setBorders(false);
identificationOnglet.setScrollMode(Scroll.AUTO);
onglets.add(identificationOnglet);
personnelOnglet = new TabItem("Personnel");
personnelOnglet.setBorders(false);
personnelOnglet.setScrollMode(Scroll.AUTO);
onglets.add(personnelOnglet);
panneauPrincipal.add(onglets);
add(panneauPrincipal);
}
68,7 → 90,10
private void afficherDetailInstitution(Structure structureCourante) {
if (structureCourante != null) {
structure = structureCourante;
 
personnel = structure.getPersonnel();
valorisation = structure.getValorisation();
conservation = structure.getConservation();
afficherEntete();
afficherIdentification();
}
77,9 → 102,9
private void afficherEntete() {
Params enteteParams = new Params();
enteteParams.add(ComposantId.ZONE_DETAIL);
enteteParams.add(structure.getNom());
enteteParams.add(structure.getVille());
enteteParams.set("id", ComposantId.ZONE_DETAIL_ENTETE);
enteteParams.set("nom", structure.getNom());
enteteParams.set("ville", structure.getVille());
String eHtml = Format.substitute(enteteTpl, enteteParams);
entete.getElement().setInnerHTML(eHtml);
87,49 → 112,150
private void afficherIdentification() {
Params contenuParams = new Params();
contenuParams.add(structure.getDescription());
contenuParams.add(structure.getAdresse());
contenuParams.add(structure.getCodePostal());
contenuParams.add(structure.getVille());
contenuParams.add(structure.getRegion());
contenuParams.add(structure.getPays());
contenuParams.add(structure.getTelephone());
contenuParams.add(structure.getFax());
contenuParams.add(structure.getCourriel());
contenuParams.add(structure.getConditionAcces());
contenuParams.add(ComposantId.ZONE_DETAIL_CORPS);
 
String cHtml = Format.substitute(contenuTpl, contenuParams);
contenuParams.set("css_class", ComposantClass.DETAIL_CORPS_CONTENU);
contenuParams.set("description", structure.getDescription());
contenuParams.set("adresse", structure.getAdresse());
contenuParams.set("code_postal", structure.getCodePostal());
contenuParams.set("ville", structure.getVille());
contenuParams.set("region", structure.getRegion());
contenuParams.set("pays", structure.getPays());
contenuParams.set("tel", structure.getTelephone());
contenuParams.set("fax", structure.getFax());
contenuParams.set("courriel", structure.getCourriel());
contenuParams.set("acces", structure.getConditionAcces());
String cHtml = Format.substitute(identificationTpl, contenuParams);
HtmlContainer corpsConteneurDuHtml = new HtmlContainer(cHtml);
identificationOnglet.removeAll();
identificationOnglet.add(corpsConteneurDuHtml);
}
private void afficherPersonnel() {
Params contenuParams = new Params();
contenuParams.set("css_class", ComposantClass.DETAIL_CORPS_CONTENU);
contenuParams.set("fonction", mediateur.i18nC.fonction());
contenuParams.set("prenom", mediateur.i18nC.prenom());
contenuParams.set("nom", mediateur.i18nC.nom());
contenuParams.set("tel", mediateur.i18nC.telephoneFixe());
contenuParams.set("fax", mediateur.i18nC.fax());
contenuParams.set("courriel", mediateur.i18nC.courrielPrincipal());
contenuParams.set("statut", mediateur.i18nC.statut());
contenuParams.set("tps_w", mediateur.i18nC.tpsTravail());
contenuParams.set("specialite", mediateur.i18nC.specialite());
contenuParams.set("contact", mediateur.i18nC.boolContact());
String lignesPersonnel = "";
personnel = structure.getPersonnel();
Iterator<String> it = personnel.keySet().iterator();
while (it.hasNext()) {
StructureAPersonne personne = personnel.get(it.next());
Params ligneParams = new Params();
ligneParams.set("fonction", personne.getFonction());
ligneParams.set("prenom", personne.getPrenom());
ligneParams.set("nom", personne.getNom());
ligneParams.set("tel", personne.getTelephone());
ligneParams.set("fax", personne.getFax());
ligneParams.set("courriel", personne.getCourriel());
ligneParams.set("statut", personne.getStatut());
ligneParams.set("tps_w", personne.getBotaTravailHebdoTps());
ligneParams.set("specialite", personne.afficherSpecialite());
ligneParams.set("contact", personne.getContact());
lignesPersonnel += Format.substitute(lignePersonnelTpl, ligneParams);
}
contenuParams.set("lignes", lignesPersonnel);
String cHtml = Format.substitute(personnelTpl, contenuParams);
HtmlContainer corpsConteneurDuHtml = new HtmlContainer(cHtml);
personnelOnglet.removeAll();
personnelOnglet.add(corpsConteneurDuHtml);
}
private void initialiserTousLesTpl() {
initialiserEnteteHtmlTpl();
initialiserIdentificationTpl();
initialiserPersonnelTpl();
initialiserLignePersonnelTpl();
}
private void initialiserEnteteHtmlTpl() {
enteteTpl = "<div id='{0}'>"+
" <h1>{1}</h1>"+
" <h2>{2}</h2>" +
enteteTpl = "<div id='{id}'>"+
" <h1>{nom}</h1>"+
" <h2>{ville}</h2>" +
"</div>";
}
private void initialiserContenuHtmlTpl() {
contenuTpl = "<div id='{10}'>"+
private void initialiserIdentificationTpl() {
identificationTpl =
"<div class='{css_class}'>"+
" <h2>Renseignements administratifs</h2>"+
" <span style='font-weight:bold;'>Condition d'accès :</span> {9}<br />"+
" <span style='font-weight:bold;'>Adresse :</span> {1}, {2} {3}, {4}, {5}<br />"+
" <span style='font-weight:bold;'>Téléphone :</span> {6}<br />"+
" <span style='font-weight:bold;'>Fax :</span> {7}<br />"+
" <span style='font-weight:bold;'>Courriel :</span> {8}<br />"+
" {0}"+
" <span style='font-weight:bold;'>Condition d'accès :</span> {acces}<br />"+
" <span style='font-weight:bold;'>Adresse :</span> {adresse}, {code_postal} {ville}, {region}, {pays}<br />"+
" <span style='font-weight:bold;'>Téléphone :</span> {tel}<br />"+
" <span style='font-weight:bold;'>Fax :</span> {fax}<br />"+
" <span style='font-weight:bold;'>Courriel :</span> {courriel}<br />"+
" {description}"+
"</div>";
}
private void initialiserPersonnelTpl() {
personnelTpl =
"<div class='{css_class}'>"+
" <h2>Personnel</h2>"+
" <table>"+
" <thead>"+
" <tr>" +
" <th>{fonction}</th>" +
" <th>{prenom}</th>" +
" <th>{nom}</th>" +
" <th>{tel}</th>" +
" <th>{fax}</th>" +
" <th>{courriel}</th>" +
" <th>{statut}</th>" +
" <th>{tps_w}</th>" +
" <th>{specialite}</th>" +
" <th>{contact}</th>" +
" </tr>"+
" </thead>"+
" <tbody>"+
" {lignes}"+
" </tbody>"+
" </table>"+
"</div>";
}
private void initialiserLignePersonnelTpl() {
lignePersonnelTpl =
"<tr>"+
" <td>{fonction}</td>"+
" <td>{prenom}</td>"+
" <td>{nom}</td>"+
" <td>{tel}</td>" +
" <td>{fax}</td>" +
" <td>{courriel}</td>" +
" <td>{statut}</td>" +
" <td>{tps_w}</td>" +
" <td>{specialite}</td>" +
" <td>{contact}</td>" +
"</tr>";
}
public void rafraichir(Object nouvelleDonnees) {
if (nouvelleDonnees instanceof Structure) {
afficherDetailInstitution((Structure) nouvelleDonnees);
} if (nouvelleDonnees instanceof Information) {
Information info = (Information) nouvelleDonnees;
if (info.getType().equals("liste_structure_a_personne")) {
allouerPersonnelAStructure((StructureAPersonneListe) info.getDonnee(0));
afficherPersonnel();
layout();
}
} else {
GWT.log("Pas de correspondance dans la méthode rafraichir() de la classe "+this.getClass(), null);
}
}
 
private void allouerPersonnelAStructure(StructureAPersonneListe personnel) {
structure.setPersonnel(personnel);
}
 
}