Subversion Repositories eFlore/Applications.coel

Compare Revisions

No changes between revisions

Ignore whitespace Rev 1414 → Rev 1415

/trunk/src/org/tela_botanica/client/vues/structure/StructureVue.java
New file
0,0 → 1,58
package org.tela_botanica.client.vues.structure;
 
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.Structure;
import org.tela_botanica.client.modeles.structure.StructureListe;
import org.tela_botanica.client.synchronisation.Sequenceur;
 
import com.extjs.gxt.ui.client.Style.LayoutRegion;
import com.extjs.gxt.ui.client.util.Margins;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
import com.google.gwt.core.client.GWT;
 
public class StructureVue extends LayoutContainer implements Rafraichissable {
 
private Mediateur mediateur = null;
private StructureListeVue panneauInstitutionListe = null;
private StructureDetailVue panneauInstitutionDetail = null;
 
private Sequenceur sequenceur = new Sequenceur();
public StructureVue(Mediateur mediateurCourant) {
mediateur = mediateurCourant;
BorderLayout layout = new BorderLayout();
layout.setEnableState(false);
setLayout(layout);
 
panneauInstitutionListe = new StructureListeVue(mediateur);
add(panneauInstitutionListe, new BorderLayoutData(LayoutRegion.CENTER));
 
panneauInstitutionDetail = new StructureDetailVue(mediateur, sequenceur);
BorderLayoutData dispositionSud = new BorderLayoutData(LayoutRegion.SOUTH, .5f, 200, 1000);
dispositionSud.setSplit(true);
dispositionSud.setMargins(new Margins(5, 0, 0, 0));
add(panneauInstitutionDetail, dispositionSud);
}
 
public void rafraichir(Object nouvellesDonnees) {
// Nous passons l'objet aux méthodes rafraichir des panneaux composant le panneau principal Structure
if (nouvellesDonnees instanceof Structure) {
panneauInstitutionDetail.rafraichir(nouvellesDonnees);
} else if (nouvellesDonnees instanceof StructureListe) {
panneauInstitutionListe.rafraichir(nouvellesDonnees);
} else if (nouvellesDonnees instanceof Information) {
Information info = (Information) nouvellesDonnees;
if (info.getType().equals("liste_structure_a_personne")) {
panneauInstitutionDetail.rafraichir(nouvellesDonnees);
}
} else {
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
}
}
}
Property changes:
Added: svn:mergeinfo
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/vues/structure/StructureVue.java:r1136-1368
/trunk/src/org/tela_botanica/client/vues/structure/StructureListeVue.java
New file
0,0 → 1,199
package org.tela_botanica.client.vues.structure;
 
import java.util.ArrayList;
import java.util.List;
 
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.RegistreId;
import org.tela_botanica.client.composants.InfoLogger;
import org.tela_botanica.client.i18n.Constantes;
import org.tela_botanica.client.images.Images;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Information;
import org.tela_botanica.client.modeles.Utilisateur;
import org.tela_botanica.client.modeles.structure.Structure;
import org.tela_botanica.client.modeles.structure.StructureListe;
import org.tela_botanica.client.vues.BarrePaginationVue;
 
import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.Style.SortDir;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
 
public class StructureListeVue extends ContentPanel implements Rafraichissable {
private Mediateur mediateur = null;
private Constantes i18nC = null;
 
private Grid<Structure> grille = null;
private ListStore<Structure> store = null;
private Button modifier;
private Button supprimer;
private Button ajouter;
private BarrePaginationVue pagination = null;
 
public StructureListeVue(Mediateur mediateurCourant) {
mediateur = mediateurCourant;
i18nC = mediateur.i18nC;
setHeading(i18nC.titreStructureListe());
setLayout(new FitLayout());
ToolBar toolBar = new ToolBar();
ajouter = new Button(i18nC.ajouter());
ajouter.setIcon(Images.ICONES.ajouter());
ajouter.addSelectionListener(new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
mediateur.clicAjouterStructure();
}
});
toolBar.add(ajouter);
 
modifier = new Button(i18nC.modifier());
modifier.setIcon(Images.ICONES.formModifier());
modifier.addSelectionListener(new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
mediateur.clicModifierStructure(grille.getSelectionModel().getSelectedItems());
}
});
toolBar.add(modifier);
supprimer = new Button(i18nC.supprimer());
supprimer.setIcon(Images.ICONES.supprimer());
supprimer.addSelectionListener(new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
clicSupprimerStructure(grille.getSelectionModel().getSelectedItems());
}
});
toolBar.add(supprimer);
 
setTopComponent(toolBar);
 
List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
colonnes.add(new ColumnConfig("ville", "Ville", 150));
colonnes.add(new ColumnConfig("nom", "Nom", 450));
ColumnModel modeleDeColonne = new ColumnModel(colonnes);
GridSelectionModel<Structure> modeleDeSelection = new GridSelectionModel<Structure>();
modeleDeSelection.addSelectionChangedListener(new SelectionChangedListener<Structure>() {
public void selectionChanged(SelectionChangedEvent<Structure> event) {
Structure structureSelectionnee = (Structure) event.getSelectedItem();
clicListe(structureSelectionnee);
}
});
store = new ListStore<Structure>();
store.sort("ville", SortDir.ASC);
 
grille = new Grid<Structure>(store, modeleDeColonne);
grille.setWidth("100%");
grille.setAutoExpandColumn("nom");
grille.getView().setAutoFill(true);
grille.getView().setForceFit(true);
grille.setSelectionModel(modeleDeSelection);
grille.addListener(Events.ViewReady, new Listener<BaseEvent>() {
public void handleEvent(BaseEvent be) {
grille.getSelectionModel().select(0, false);
}
});
grille.addListener(Events.OnDoubleClick, new Listener<BaseEvent>() {
public void handleEvent(BaseEvent be) {
modifier.fireEvent(Events.Select);
}
});
add(grille);
// Définition de la barre de pagination
pagination = new BarrePaginationVue(new StructureListe(), mediateur);
setBottomComponent(pagination);
}
 
private void clicListe(Structure structure) {
if (structure != null && store.getCount() > 0) {
mediateur.clicListeStructure(structure);
}
}
private void clicSupprimerStructure(List<Structure> structuresASupprimer) {
mediateur.clicSupprimerStructure(this, structuresASupprimer);
}
 
private void gererEtatActivationBouton() {
int nbreElementDuMagazin = store.getCount();
if (nbreElementDuMagazin == 0) {
supprimer.disable();
modifier.disable();
} else if (nbreElementDuMagazin > 0) {
modifier.enable();
if (((Utilisateur) Registry.get(RegistreId.UTILISATEUR_COURANT)).isIdentifie()) {
supprimer.enable();
}
}
}
public void rafraichir(Object nouvellesDonnees) {
if (nouvellesDonnees instanceof StructureListe) {
StructureListe structures = (StructureListe) nouvellesDonnees;
pagination.setlistePaginable(structures);
pagination.rafraichir(structures.getPageTable());
if (structures != null) {
List<Structure> liste = structures.toList();
store.removeAll();
store.add(liste);
 
gererEtatActivationBouton();
mediateur.actualiserPanneauCentral();
grille.fireEvent(Events.ViewReady);
}
} else if (nouvellesDonnees instanceof Information) {
Information info = (Information) nouvellesDonnees;
if (info.getType().equals("suppression_structure")) {
// Affichage d'un message d'information
InfoLogger.display(i18nC.suppressionStructure(), info.toString().replaceAll("\n", "<br />"));
List<Structure> selectionStructure = grille.getSelectionModel().getSelectedItems();
if (info.toString().replaceAll("\n", "").equals("OK")) {
mediateur.supprimerStructureAPersonne(this, selectionStructure);
}
// Suppression des structures sélectionnées de la grille
final int taille = selectionStructure.size();
for (int i = 0; i < taille; i++) {
store.remove(selectionStructure.get(i));
}
gererEtatActivationBouton();
} else if (info.getType().equals("maj_utilisateur")) {
gererEtatActivationBouton();
} else if (info.getType().equals("suppression_structure_a_personne")) {
// Affichage d'un message d'information
InfoLogger.display(i18nC.suppressionStructureAPersonne(), info.toString().replaceAll("\n", "<br />"));
}
} else {
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
}
layout();
}
}
Property changes:
Added: svn:mergeinfo
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/vues/structure/StructureListeVue.java:r1136-1368
/trunk/src/org/tela_botanica/client/vues/structure/StructureDetailVue.java
New file
0,0 → 1,670
package org.tela_botanica.client.vues.structure;
 
import java.util.Iterator;
 
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.ValeurListe;
import org.tela_botanica.client.modeles.projet.ProjetListe;
import org.tela_botanica.client.modeles.structure.Structure;
import org.tela_botanica.client.modeles.structure.StructureAPersonne;
import org.tela_botanica.client.modeles.structure.StructureAPersonneListe;
import org.tela_botanica.client.modeles.structure.StructureConservation;
import org.tela_botanica.client.modeles.structure.StructureValorisation;
import org.tela_botanica.client.synchronisation.Sequenceur;
import org.tela_botanica.client.util.Debug;
import org.tela_botanica.client.vues.DetailVue;
 
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.util.Format;
import com.extjs.gxt.ui.client.util.Params;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Html;
import com.extjs.gxt.ui.client.widget.TabItem;
import com.extjs.gxt.ui.client.widget.TabPanel;
import com.extjs.gxt.ui.client.widget.layout.AnchorLayout;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
 
public class StructureDetailVue extends DetailVue implements Rafraichissable {
 
private String enteteTpl = null;
private String identificationTpl = null;
private String personnelTpl = null;
private String tableauPersonnelTpl = null;
private String lignePersonnelTpl = null;
private String conservationTpl = null;
private String traitementConservationTpl = null;
private String valorisationTpl = null;
private String typeTraitementConservationTpl = null;
private String rechercheValorisationTpl = null;
private Structure structure = null;
private boolean structureChargementOk = false;
private StructureAPersonneListe personnel = null;
private boolean personnelChargementOk = false;
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;
private TabItem conservationOnglet = null;
private TabItem valorisationOnglet = null;
private Sequenceur sequenceur;
public StructureDetailVue(Mediateur mediateurCourant, Sequenceur sequenceur) {
super(mediateurCourant);
this.sequenceur = sequenceur;
initialiserTousLesTpl();
chargerOntologie();
panneauPrincipal = new ContentPanel();
panneauPrincipal.setLayout(new FitLayout());
panneauPrincipal.setHeaderVisible(false);
panneauPrincipal.setBodyBorder(false);
entete = new Html();
entete.setId(ComposantId.ZONE_DETAIL_ENTETE);
panneauPrincipal.setTopComponent(entete);
onglets = new TabPanel();
onglets.setId(ComposantId.ZONE_DETAIL_CORPS);
onglets.setBodyBorder(false);
identificationOnglet = new TabItem(i18nC.structureInfoGeneral());
identificationOnglet.setLayout(new AnchorLayout());
identificationOnglet.setScrollMode(Scroll.AUTO);
onglets.add(identificationOnglet);
personnelOnglet = new TabItem(i18nC.structureInfoPersonnel());
personnelOnglet.setLayout(new AnchorLayout());
personnelOnglet.setScrollMode(Scroll.AUTO);
onglets.add(personnelOnglet);
conservationOnglet = new TabItem(i18nC.structureInfoConservation());
conservationOnglet.setLayout(new AnchorLayout());
conservationOnglet.setScrollMode(Scroll.AUTO);
onglets.add(conservationOnglet);
valorisationOnglet = new TabItem(i18nC.structureInfoValorisation());
valorisationOnglet.setLayout(new AnchorLayout());
valorisationOnglet.setScrollMode(Scroll.AUTO);
onglets.add(valorisationOnglet);
panneauPrincipal.add(onglets);
add(panneauPrincipal);
}
 
private void chargerOntologie() {
String[] listesCodes = {"stpr", "stpu", "pays", "statut", "fonction", "localStockage", "meubleStockage",
"parametreStockage", "autreCollection", "onep", "opRestau", "autreMateriel", "poisonTraitement",
"insecteTraitement", "actionValorisation", "continentEtFr", "typeRecherche"};
lancerChargementListesValeurs(listesCodes, this.sequenceur);
sequenceur.enfilerRafraichissement(this, new Information("ontologie_chargee"));
}
 
private void afficherDetailInstitution() {
if (structure != null) {
personnel = structure.getPersonnel();
valorisation = structure.getValorisation();
conservation = structure.getConservation();
afficherEntete();
afficherIdentification();
if (personnel != null) {
afficherPersonnel();
}
if (conservation != null) {
afficherConservation();
}
if (valorisation != null) {
afficherValorisation();
}
}
layout();
}
private void afficherEntete() {
Params enteteParams = new Params();
enteteParams.set("css_id", ComposantId.ZONE_DETAIL_ENTETE);
enteteParams.set("css_meta", ComposantClass.META);
enteteParams.set("i18n_id", i18nC.id());
enteteParams.set("nom", structure.getNom());
enteteParams.set("ville", structure.getVille());
enteteParams.set("id", structure.getId());
enteteParams.set("guid", structure.getGuid());
enteteParams.set("projet", construireTxtProjet(structure.getIdProjet()));
String eHtml = Format.substitute(enteteTpl, enteteParams);
entete.getElement().setInnerHTML(eHtml);
}
private void afficherIdentification() {
Params identificationParams = new Params();
identificationParams.set("i18n_titre_administratif", i18nC.titreAdministratif());
identificationParams.set("i18n_acronyme", i18nC.acronyme());
identificationParams.set("i18n_statut", i18nC.statut());
identificationParams.set("i18n_date_fondation", i18nC.dateFondation());
identificationParams.set("i18n_nbre_personnel", i18nC.nbrePersonnel());
identificationParams.set("i18n_titre_description", i18nC.description());
identificationParams.set("i18n_description", i18nC.description());
identificationParams.set("i18n_acces", i18nC.acces());
identificationParams.set("i18n_usage", i18nC.usage());
identificationParams.set("i18n_titre_adresse", i18nC.adresse());
identificationParams.set("i18n_adresse", i18nC.adresse());
identificationParams.set("i18n_adresse_complement", i18nC.adresseComplement());
identificationParams.set("i18n_cp", i18nC.codePostal());
identificationParams.set("i18n_ville", i18nC.ville());
identificationParams.set("i18n_region", i18nC.region());
identificationParams.set("i18n_pays", i18nC.pays());
identificationParams.set("i18n_latitude", i18nC.latitude());
identificationParams.set("i18n_longitude", i18nC.longitude());
identificationParams.set("i18n_titre_communication", i18nC.titreCommunication());
identificationParams.set("i18n_tel", i18nC.telephone());
identificationParams.set("i18n_fax", i18nC.FAX());
identificationParams.set("i18n_courriel", i18nC.courriel());
identificationParams.set("i18n_web", i18nC.siteWeb());
 
String acronyme = construireTxtTruck(structure.getIdAlternatif());
String typePrive = construireTxtListeOntologie(structure.getTypePrive());
String typePublic = construireTxtListeOntologie(structure.getTypePublic());
String pays = construireTxtListeOntologie(structure.getPays());
String web = construireTxtTruck(structure.getUrl(), false);
String latitude = structure.getLatitude();
String longitude = structure.getLongitude();
String latitudeLongitude = (!longitude.equals("") && !latitude.equals("")) ? latitude+" / "+longitude : "";
identificationParams.set("acronyme", acronyme);
identificationParams.set("statut", typePrive+typePublic);
identificationParams.set("date_fondation", structure.getAnneOuDateFondationFormatLong());
identificationParams.set("nbre_personnel", structure.getNbrePersonne());
identificationParams.set("description", structure.getDescription());
identificationParams.set("acces", structure.getConditionAcces());
identificationParams.set("usage", structure.getConditionUsage());
identificationParams.set("adresse", structure.getAdresse());
identificationParams.set("adresse_complement", structure.getAdresseComplement());
identificationParams.set("cp", structure.getCodePostal());
identificationParams.set("ville", structure.getVille());
if (structure.getRegion().toString().matches("[0-9]+")) {
if (ontologie.get(structure.getRegion()) == null) {
mediateur.obtenirValeurEtRafraichir(this, null, structure.getRegion(), sequenceur);
}
}
identificationParams.set("region", construireTxtListeOntologie(structure.getRegion()));
identificationParams.set("pays", pays);
identificationParams.set("latitude_longitude", latitudeLongitude);
identificationParams.set("tel", structure.getTelephoneFixe());
identificationParams.set("fax", structure.getFax());
identificationParams.set("courriel", structure.getCourriel());
identificationParams.set("web", web);
afficherOnglet(identificationTpl, identificationParams, identificationOnglet);
}
private void afficherPersonnel() {
String tableauPersonnelHtml = "";
if (personnel.size() > 0) {
tableauPersonnelHtml = construireTableauDuPersonnel();
}
Params personnelParams = new Params();
personnelParams.set("i18n_titre_personnel", i18nC.titrePersonnel());
personnelParams.set("i18n_nbre_personnel_collection", i18nC.nbrePersonnelCollection());
personnelParams.set("nbre_personnel_collection", personnel.size());
personnelParams.set("tableau_personnel", tableauPersonnelHtml);
afficherOnglet(personnelTpl, personnelParams, personnelOnglet);
}
private String construireTableauDuPersonnel() {
Params contenuParams = new Params();
contenuParams.set("i18n_titre_membre", i18nC.titreMembre());
contenuParams.set("i18n_fonction", i18nC.fonction());
contenuParams.set("i18n_prenom", i18nC.personnePrenom());
contenuParams.set("i18n_nom", i18nC.personneNom());
contenuParams.set("i18n_tel", i18nC.FIX());
contenuParams.set("i18n_fax", i18nC.FAX());
contenuParams.set("i18n_courriel", i18nC.courrielPrincipal());
contenuParams.set("i18n_statut", i18nC.statut());
contenuParams.set("i18n_tps_w", i18nC.tpsTravail());
contenuParams.set("i18n_specialite", i18nC.specialite());
contenuParams.set("i18n_contact", i18nC.boolContact());
String lignesPersonnel = "";
Iterator<String> it = personnel.keySet().iterator();
while (it.hasNext()) {
StructureAPersonne personne = personnel.get(it.next());
Params ligneParams = new Params();
String fonction = construireTxtListeOntologie(personne.getFonction());
String statut = construireTxtListeOntologie(personne.getStatut());
String contact = formaterOuiNon(personne.getContact());
ligneParams.set("fonction", fonction);
ligneParams.set("prenom", personne.getPrenom());
ligneParams.set("nom", personne.getNom());
ligneParams.set("tel_fix", personne.getTelephoneFixe());
ligneParams.set("tel_fax", personne.getFax());
ligneParams.set("courriel", personne.getCourriel());
ligneParams.set("statut", statut);
ligneParams.set("tps_w", personne.getBotaTravailHebdoTps());
ligneParams.set("specialite", personne.afficherSpecialite());
ligneParams.set("contact", contact);
lignesPersonnel += Format.substitute(lignePersonnelTpl, ligneParams);
}
contenuParams.set("lignes", lignesPersonnel);
String cHtml = Format.substitute(tableauPersonnelTpl, contenuParams);
return cHtml;
}
private void afficherConservation() {
Params conservationParams = new Params();
conservationParams.set("i18n_titre_conservation_personnel", i18nC.titreConservationPersonnel());
conservationParams.set("i18n_formation", i18nC.formation());
conservationParams.set("i18n_formation_interet", i18nC.formationInteret());
conservationParams.set("i18n_titre_local", i18nC.titreLocal());
conservationParams.set("i18n_local_specifique", i18nC.localSpecifique());
conservationParams.set("i18n_meuble_specifique", i18nC.meubleSpecifique());
conservationParams.set("i18n_local_parametre", i18nC.localParametre());
conservationParams.set("i18n_conservation_en_commun", i18nC.conservationEnCommun());
conservationParams.set("i18n_acces_controle", i18nC.accesControle());
conservationParams.set("i18n_titre_operation", i18nC.titreOperation());
conservationParams.set("i18n_restauration", i18nC.restauration());
conservationParams.set("i18n_materiel_conservation", i18nC.materielConservation());
conservationParams.set("i18n_traitement", i18nC.traitement());
conservationParams.set("i18n_titre_acquisition", i18nC.titreAcquisition());
conservationParams.set("i18n_acquisition_collection", i18nC.acquisitionCollection());
conservationParams.set("i18n_acquisition_echantillon", i18nC.acquisitionEchantillon());
conservationParams.set("formation", formaterOuiNon(conservation.getFormation()));
conservationParams.set("formation_info", formaterSautDeLigne(conservation.getFormationInfo()));
conservationParams.set("formation_interet", formaterOuiNon(conservation.getFormationInteret()));
conservationParams.set("meuble_specifique", conservation.getStockageMeuble());
String chaineAAnalyser = conservation.getStockageLocal();
String chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
conservationParams.set("local_specifique", chaineAAfficher);
chaineAAnalyser = conservation.getStockageMeuble();
chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
conservationParams.set("meuble_specifique", chaineAAfficher);
chaineAAnalyser = conservation.getStockageParametre();
chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
conservationParams.set("local_parametre", chaineAAfficher);
conservationParams.set("conservation_en_commun", formaterOuiNon(conservation.getCollectionCommune()));
chaineAAnalyser = conservation.getCollectionAutre();
chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
conservationParams.set("collection_autre", formaterParenthese(chaineAAfficher));
conservationParams.set("acces_controle", formaterOuiNon(conservation.getAccesControle()));
conservationParams.set("restauration", formaterOuiNon(conservation.getRestauration()));
chaineAAnalyser = conservation.getRestaurationOperation();
chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
conservationParams.set("restauration_operation", formaterParenthese(chaineAAfficher));
chaineAAnalyser = conservation.getMaterielConservation();
chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
conservationParams.set("materiel_conservation", chaineAAfficher);
chaineAAnalyser = conservation.getMaterielAutre();
chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
conservationParams.set("materiel_autre", formaterParenthese(chaineAAfficher));
conservationParams.set("traitement", formaterOuiNon(conservation.getTraitement()));
chaineAAnalyser = conservation.getTraitements();
chaineAAfficher = construireTxtListeOntologie(chaineAAnalyser);
conservationParams.set("traitements", formaterParenthese(chaineAAfficher));
conservationParams.set("acquisition_collection", formaterOuiNon(conservation.getAcquisitionCollection()));
conservationParams.set("acquisition_echantillon", formaterOuiNon(conservation.getAcquisitionEchantillon()));
conservationParams.set("acquisition_traitement_info", construireTraitement());
afficherOnglet(conservationTpl, conservationParams, conservationOnglet);
}
private String construireTraitement() {
String cHtml = "";
String echantillon = conservation.getAcquisitionEchantillon();
if (echantillon.equals("1")) {
Params traitementConservationParams = new Params();
traitementConservationParams.set("i18n_acquisition_traitement", i18nC.acquisitionTraitement());
traitementConservationParams.set("acquisition_traitement", formaterOuiNon(conservation.getAcquisitionTraitement()));
traitementConservationParams.set("acquisition_traitement_type_info", construireTraitementType());
cHtml = Format.substitute(traitementConservationTpl, traitementConservationParams);
}
return cHtml;
}
private String construireTraitementType() {
String cHtml = "";
String traitement = conservation.getAcquisitionTraitement();
if (traitement.equals("1")) {
Params typeTraitementParams = new Params();
typeTraitementParams.set("i18n_acquisition_traitement_insecte", i18nC.acquisitionTraitementInsecte());
typeTraitementParams.set("i18n_acquisition_traitement_poison", i18nC.acquisitionTraitementPoison());
String acquisitionTraitementInsecte = construireTxtListeOntologie(conservation.getAcquisitionTraitementInsecte());
typeTraitementParams.set("acquisition_traitement_insecte", acquisitionTraitementInsecte);
String acquisitionTraitementPoison = construireTxtListeOntologie(conservation.getAcquisitionTraitementPoison());
typeTraitementParams.set("acquisition_traitement_poison", acquisitionTraitementPoison);
cHtml = Format.substitute(typeTraitementConservationTpl, typeTraitementParams);
}
return cHtml;
}
private void afficherValorisation() {
Params valorisationParams = new Params();
valorisationParams.set("i18n_titre_action_valorisation", i18nC.titreActionValorisation());
valorisationParams.set("i18n_action", i18nC.action());
valorisationParams.set("i18n_action_publication", i18nC.actionPublication());
valorisationParams.set("i18n_collection_autre", i18nC.collectionAutre());
valorisationParams.set("i18n_action_future", i18nC.actionFuture());
valorisationParams.set("action", formaterOuiNon(valorisation.getAction()));
String actionInfo = construireTxtListeOntologie(valorisation.getActionInfo());
valorisationParams.set("action_info", formaterParenthese(actionInfo));
valorisationParams.set("action_publication", valorisation.getPublication());
String collectionAutre = construireTxtListeOntologie(valorisation.getCollectionAutre());
valorisationParams.set("collection_autre", collectionAutre);
valorisationParams.set("action_future", formaterOuiNon(valorisation.getActionFuture()));
valorisationParams.set("action_future_info", formaterParenthese(valorisation.getActionFutureInfo()));
 
valorisationParams.set("i18n_titre_recherche_scientifique", i18nC.titreRechercherScientifique());
valorisationParams.set("i18n_recherche", i18nC.recherche());
valorisationParams.set("recherche", formaterOuiNon(valorisation.getRecherche()));
valorisationParams.set("recherche_info", construireRecherche());
valorisationParams.set("i18n_titre_acces_usage", i18nC.titreAccesUsage());
valorisationParams.set("i18n_acces", i18nC.acces());
valorisationParams.set("i18n_visite", i18nC.visite());
valorisationParams.set("acces", formaterOuiNon(valorisation.getAccesSansMotif()));
valorisationParams.set("acces_info", formaterParenthese(valorisation.getAccesSansMotifInfo()));
valorisationParams.set("visite", formaterOuiNon(valorisation.getVisiteAvecMotif()));
valorisationParams.set("visite_info", formaterParenthese(valorisation.getVisiteAvecMotifInfo()));
afficherOnglet(valorisationTpl, valorisationParams, valorisationOnglet);
}
private String construireRecherche() {
String cHtml = "";
String recherche = valorisation.getRecherche();
if (recherche.equals("1")) {
Params rechercheParams = new Params();
rechercheParams.set("i18n_recherche_provenance", i18nC.rechercheProvenance());
rechercheParams.set("i18n_recherche_type", i18nC.rechercheType());
String rechercheProvenance = construireTxtListeOntologie(valorisation.getRechercheProvenance());
rechercheParams.set("recherche_provenance", rechercheProvenance);
String rechercheType = construireTxtListeOntologie(valorisation.getRechercheType());
rechercheParams.set("recherche_type", rechercheType);
cHtml = Format.substitute(rechercheValorisationTpl, rechercheParams);
}
return cHtml;
}
private void initialiserTousLesTpl() {
initialiserEnteteTpl();
initialiserIdentificationTpl();
initialiserPersonnelTpl();
initialiserTableauPersonnelTpl();
initialiserLignePersonnelTpl();
initialiserConservationTpl();
initialiserTraitementConservationTpl();
initialiserTypeTraitementConservationTpl();
initialiserValorisationTpl();
initialiserRechercheValorisationTpl();
}
private void initialiserEnteteTpl() {
enteteTpl =
"<div id='{css_id}'>"+
" <h1>{nom}</h1>"+
" <h2>{ville}<span class='{css_meta}'>{projet} <br /> {i18n_id}:{id} - {guid}</span></h2>" +
" " +
"</div>";
}
private void initialiserIdentificationTpl() {
identificationTpl =
"<div class='{css_corps}'>"+
" <div class='{css_fieldset}'>"+
" <h2>{i18n_titre_administratif}</h2>"+
" <span class='{css_label}'>{i18n_acronyme} :</span> {acronyme}<br />"+
" <span class='{css_label}'>{i18n_statut} :</span> {statut}<br />"+
" <span class='{css_label}'>{i18n_date_fondation} :</span> {date_fondation}<br />"+
" <span class='{css_label}'>{i18n_nbre_personnel} :</span> {nbre_personnel}<br />"+
" </div>"+
" <div class='{css_fieldset}'>"+
" <h2>{i18n_titre_description}</h2>"+
" <span class='{css_label}'>{i18n_description} :</span> {description}<br />"+
" <span class='{css_label}'>{i18n_acces} :</span> {acces}<br />"+
" <span class='{css_label}'>{i18n_usage} :</span> {usage}<br />"+
" </div>"+
" <hr class='{css_clear}'/>"+
" <div class='{css_fieldset}'>"+
" <h2>{i18n_titre_adresse}</h2>"+
" <span class='{css_label}'>{i18n_adresse} :</span> {adresse}<br />" +
" <span class='{css_label}'>{i18n_adresse_complement} :</span> {adresse_complement}<br />" +
" <span class='{css_label}'>{i18n_cp} :</span> {cp}<br />" +
" <span class='{css_label}'>{i18n_ville} :</span> {ville}<br />" +
" <span class='{css_label}'>{i18n_region} :</span> {region}<br />" +
" <span class='{css_label}'>{i18n_pays} :</span> {pays}<br />" +
" <span class='{css_label}'>{i18n_latitude} / {i18n_longitude} :</span> {latitude_longitude}<br />" +
" </div>"+
" <div class='{css_fieldset}'>"+
" <h2>{i18n_titre_communication}</h2>"+
" <span class='{css_label}'>{i18n_tel} :</span> {tel}<br />"+
" <span class='{css_label}'>{i18n_fax} :</span> {fax}<br />"+
" <span class='{css_label}'>{i18n_courriel} :</span> {courriel}<br />"+
" <span class='{css_label}'>{i18n_web} :</span> {web}<br />"+
" </div>"+
"</div>";
}
private void initialiserPersonnelTpl() {
personnelTpl =
"<div class='{css_corps}'>"+
" <h2>{i18n_titre_personnel}</h2>"+
" <p><span class='{css_label}'>{i18n_nbre_personnel_collection} :</span> {nbre_personnel_collection}</p>"+
" {tableau_personnel}"+
"</div>";
}
private void initialiserTableauPersonnelTpl() {
tableauPersonnelTpl =
"<h3>{i18n_titre_membre}</h3>"+
"<table>"+
" <thead>"+
" <tr>" +
" <th>{i18n_fonction}</th>" +
" <th>{i18n_prenom}</th>" +
" <th>{i18n_nom}</th>" +
" <th>{i18n_tel}</th>" +
" <th>{i18n_fax}</th>" +
" <th>{i18n_courriel}</th>" +
" <th>{i18n_statut}</th>" +
" <th>{i18n_tps_w}</th>" +
" <th>{i18n_specialite}</th>" +
" <th>{i18n_contact}</th>" +
" </tr>"+
" </thead>"+
" <tbody>"+
" {lignes}"+
" </tbody>"+
"</table>";
}
private void initialiserLignePersonnelTpl() {
lignePersonnelTpl =
"<tr>"+
" <td>{fonction}</td>"+
" <td>{prenom}</td>"+
" <td>{nom}</td>"+
" <td>{tel_fix}</td>" +
" <td>{tel_fax}</td>" +
" <td>{courriel}</td>" +
" <td>{statut}</td>" +
" <td>{tps_w}</td>" +
" <td>{specialite}</td>" +
" <td>{contact}</td>" +
"</tr>";
}
private void initialiserConservationTpl() {
conservationTpl =
"<div class='{css_corps}'>"+
" <div class='{css_fieldset}'>"+
" <h2>{i18n_titre_conservation_personnel}</h2>"+
" <span class='{css_label}'>{i18n_formation} :</span> {formation}<br />"+
" {formation_info}<br />"+
" <span class='{css_label}'>{i18n_formation_interet} :</span> {formation_interet}<br />"+
" </div>"+
" <div class='{css_fieldset}'>"+
" <h2>{i18n_titre_local}</h2>"+
" <span class='{css_label}'>{i18n_local_specifique} :</span> {local_specifique}<br />"+
" <span class='{css_label}'>{i18n_meuble_specifique} :</span> {meuble_specifique}<br />"+
" <span class='{css_label}'>{i18n_local_parametre} :</span> {local_parametre}<br />"+
" <span class='{css_label}'>{i18n_conservation_en_commun} :</span> {conservation_en_commun} {collection_autre}<br />"+
" <span class='{css_label}'>{i18n_acces_controle} :</span> {acces_controle}<br />"+
" </div>"+
" <hr class='{css_clear}'/>"+
" <div class='{css_fieldset}'>"+
" <h2>{i18n_titre_operation}</h2>"+
" <span class='{css_label}'>{i18n_restauration} :</span> {restauration} {restauration_operation}<br />"+
" <span class='{css_label}'>{i18n_materiel_conservation} :</span> {materiel_conservation} {materiel_autre}<br />"+
" <span class='{css_label}'>{i18n_traitement} :</span> {traitement} {traitements}<br />"+
" </div>"+
" <div class='{css_fieldset}'>"+
" <h2>{i18n_titre_acquisition}</h2>"+
" <span class='{css_label}'>{i18n_acquisition_collection} :</span> {acquisition_collection}<br />"+
" <span class='{css_label}'>{i18n_acquisition_echantillon} :</span> {acquisition_echantillon}<br />"+
" {acquisition_traitement_info}" +
" </div>"+
"</div>";
}
private void initialiserTraitementConservationTpl() {
traitementConservationTpl =
"<span class='{css_indentation} {css_label}'>{i18n_acquisition_traitement} :</span> {acquisition_traitement}<br />"+
" <div class='{css_indentation}'>"+
" {acquisition_traitement_type_info}"+
" </div>";
}
private void initialiserTypeTraitementConservationTpl() {
typeTraitementConservationTpl =
"<span class='{css_indentation} {css_label}'>{i18n_acquisition_traitement_insecte} :</span> {acquisition_traitement_insecte}<br />"+
"<span class='{css_indentation} {css_label}'>{i18n_acquisition_traitement_poison} :</span> {acquisition_traitement_poison}<br />";
}
private void initialiserValorisationTpl() {
valorisationTpl =
"<div class='{css_corps}'>"+
" <div class='{css_fieldset}'>"+
" <h2>{i18n_titre_action_valorisation}</h2>"+
" <span class='{css_label}'>{i18n_action} :</span> {action} {action_info}<br />"+
" <span class='{css_label}'>{i18n_action_publication} :</span> {action_publication}<br />"+
" <span class='{css_label}'>{i18n_collection_autre} :</span> {collection_autre}<br />"+
" <span class='{css_label}'>{i18n_action_future} :</span> {action_future} {action_future_info}<br />"+
" </div>"+
" <div class='{css_fieldset}'>"+
" <h2>{i18n_titre_recherche_scientifique}</h2>"+
" <span class='{css_label}'>{i18n_recherche} :</span> {recherche}<br />"+
" {recherche_info}"+
" </div>"+
" <hr class='{css_clear}'/>"+
" <div class='{css_fieldset}'>"+
" <h2>{i18n_titre_acces_usage}</h2>"+
" <span class='{css_label}'>{i18n_visite} :</span> {visite} {visite_info}<br />"+
" <span class='{css_label}'>{i18n_acces} :</span> {acces} {acces_info}<br />"+
" </div>"+
"</div>";
}
private void initialiserRechercheValorisationTpl() {
rechercheValorisationTpl =
"<span class='{css_indentation} {css_label}'>{i18n_recherche_provenance} :</span> {recherche_provenance}<br />"+
"<span class='{css_indentation} {css_label}'>{i18n_recherche_type} :</span> {recherche_type}<br />";
}
public void rafraichir(Object nouvellesDonnees) {
if (nouvellesDonnees instanceof Structure) {
structure = (Structure) nouvellesDonnees;
structureChargementOk = true;
} else if (nouvellesDonnees instanceof ProjetListe) {
projets = (ProjetListe) nouvellesDonnees;
projetsChargementOk = true;
} else if (nouvellesDonnees instanceof ValeurListe) {
ValeurListe listeValeursReceptionnee = (ValeurListe) nouvellesDonnees;
receptionerListeValeurs(listeValeursReceptionnee);
} else if (nouvellesDonnees instanceof Information) {
Information info = (Information) nouvellesDonnees;
if (info.getType().equals("liste_structure_a_personne")) {
allouerPersonnelAStructure((StructureAPersonneListe) info.getDonnee(0));
personnelChargementOk = true;
} else if (info.getType().equals("ontologie_chargee")) {
ontologieChargementOk = true;
}
} else {
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
}
if (avoirDonneesChargees()) {
afficherDetailInstitution();
}
}
protected void allouerPersonnelAStructure(StructureAPersonneListe personnel) {
structure.setPersonnel(personnel);
}
private boolean avoirDonneesChargees() {
boolean ok = false;
if (projetsChargementOk && structureChargementOk && personnelChargementOk && ontologieChargementOk) {
ok = true;
}
return ok;
}
}
Property changes:
Added: svn:mergeinfo
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/vues/structure/StructureDetailVue.java:r1136-1368
/trunk/src/org/tela_botanica/client/vues/structure/StructureForm.java
New file
0,0 → 1,2272
package org.tela_botanica.client.vues.structure;
 
import java.util.ArrayList;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
 
import org.tela_botanica.client.ComposantClass;
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.RegistreId;
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
import org.tela_botanica.client.composants.InfoLogger;
import org.tela_botanica.client.composants.pagination.ProxyPersonnes;
import org.tela_botanica.client.composants.pagination.ProxyProjets;
import org.tela_botanica.client.composants.pagination.ProxyValeur;
import org.tela_botanica.client.images.Images;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Information;
import org.tela_botanica.client.modeles.InterneValeur;
import org.tela_botanica.client.modeles.InterneValeurListe;
import org.tela_botanica.client.modeles.MenuApplicationId;
import org.tela_botanica.client.modeles.Valeur;
import org.tela_botanica.client.modeles.ValeurListe;
import org.tela_botanica.client.modeles.aDonnee;
import org.tela_botanica.client.modeles.collection.CollectionAPersonne;
import org.tela_botanica.client.modeles.personne.Personne;
import org.tela_botanica.client.modeles.personne.PersonneListe;
import org.tela_botanica.client.modeles.projet.Projet;
import org.tela_botanica.client.modeles.projet.ProjetListe;
import org.tela_botanica.client.modeles.structure.Structure;
import org.tela_botanica.client.modeles.structure.StructureAPersonne;
import org.tela_botanica.client.modeles.structure.StructureAPersonneListe;
import org.tela_botanica.client.modeles.structure.StructureConservation;
import org.tela_botanica.client.modeles.structure.StructureValorisation;
import org.tela_botanica.client.synchronisation.Sequenceur;
import org.tela_botanica.client.util.Debug;
import org.tela_botanica.client.util.Pattern;
import org.tela_botanica.client.util.UtilArray;
import org.tela_botanica.client.util.UtilString;
import org.tela_botanica.client.vues.Formulaire;
 
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.ModelType;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.EventType;
import com.extjs.gxt.ui.client.event.KeyListener;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.store.Record;
import com.extjs.gxt.ui.client.store.Store;
import com.extjs.gxt.ui.client.store.StoreEvent;
import com.extjs.gxt.ui.client.widget.Component;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Html;
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.TabItem;
import com.extjs.gxt.ui.client.widget.TabPanel;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.CheckBox;
import com.extjs.gxt.ui.client.widget.form.CheckBoxGroup;
import com.extjs.gxt.ui.client.widget.form.ComboBox;
import com.extjs.gxt.ui.client.widget.form.DateField;
import com.extjs.gxt.ui.client.widget.form.Field;
import com.extjs.gxt.ui.client.widget.form.FieldSet;
import com.extjs.gxt.ui.client.widget.form.HiddenField;
import com.extjs.gxt.ui.client.widget.form.LabelField;
import com.extjs.gxt.ui.client.widget.form.NumberField;
import com.extjs.gxt.ui.client.widget.form.Radio;
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
import com.extjs.gxt.ui.client.widget.form.TextArea;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.form.Validator;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
import com.extjs.gxt.ui.client.widget.grid.CheckColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.EditorGrid;
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
import com.extjs.gxt.ui.client.widget.grid.RowNumberer;
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.extjs.gxt.ui.client.widget.tips.ToolTipConfig;
import com.extjs.gxt.ui.client.widget.toolbar.SeparatorToolItem;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.NumberFormat;
import com.google.gwt.user.client.Window;
 
public class StructureForm extends Formulaire implements Rafraichissable {
private static int decompteRafraichissementPersonnel = 0;
private TabPanel onglets = null;
private TabItem identificationOnglet = null;
private TabItem personnelOnglet = null;
private TabItem conservationOnglet = null;
private TabItem valorisationOnglet = null;
 
private HiddenField<String> idStructureChp = null;
// Onglet IDENTIFICATION
private Structure identification = null;
private ListStore<Valeur> magazinLstpr = null;
private ComboBox<Valeur> comboLstpr = null;
private ListStore<Valeur> magazinLstpu = null;
private ComboBox<Valeur> comboLstpu = null;
private ListStore<Valeur> magazinLiStatut = null;
private ComboBox<Valeur> comboLiStatut = null;
private ListStore<Valeur> fonctionsMagazin = null;
private ComboBox<Valeur> fonctionsCombo = null;
private ComboBox<InterneValeur> comboAcronyme = null;
private TextField<String> ihChp = null;
private TextField<String> mnhnChp = null;
private ComboBox<InterneValeur> comboTypeStructure = null;
private TextField<String> nomStructureChp = null;
private TextField<String> dateFondationChp = null;
private TextArea descriptionChp = null;
private TextArea conditionAccesChp = null;
private TextArea conditionUsageChp = null;
private TextArea adrChp = null;
private TextArea adrComplementChp = null;
private TextField<String> cpChp = null;
private TextField<String> villeChp = null;
private ListStore<Valeur> magazinRegion = null;
private ComboBox<Valeur> comboRegion = null;
private ListStore<Valeur> magazinPays = null;
private ChampComboBoxRechercheTempsReelPaginable comboPays = null;
private TextField<String> latitudeChp = null;
private TextField<String> longitudeChp = null;
private TextField<String> telChp = null;
private TextField<String> faxChp = null;
private TextField<String> emailChp = null;
private TextField<String> urlChp = null;
 
// Onglet PERSONNEL
private StructureAPersonneListe personnel = null;
private StructureAPersonneListe personnelAjoute = null;
private StructureAPersonneListe personnelModifie = null;
private StructureAPersonneListe personnelSupprime = null;
private NumberField nbreTotalPersonneStructureChp = null;
private EditorGrid<StructureAPersonne> grillePersonnel = null;
private ListStore<StructureAPersonne> personnelGrilleMagazin = null;
// Onglet CONSERVATION
private StructureConservation conservation = null;
private RadioGroup formationMarkRGrpChp = null;
private RadioGroup interetFormationMarkRGrpChp = null;
private RadioGroup collectionCommuneMarkRGrpChp = null;
private RadioGroup accesControleMarkRGrpChp = null;
private RadioGroup restaurationMarkRGrpChp = null;
private RadioGroup traitementMarkRGrpChp = null;
private RadioGroup collectionAcquisitionMarkRGrpChp = null;
private RadioGroup echantillonAcquisitionMarkRGrpChp = null;
private TextField<String> localStockageAutreChp = null;
private TextField<String> meubleStockageAutreChp = null;
private TextField<String> parametreStockageAutreChp = null;
private TextField<String> collectionAutreAutreChp = null;
private TextField<String> autreCollectionAutreChp = null;
private TextField<String> opRestauAutreChp = null;
private TextField<String> autreMaterielAutreChp = null;
private TextField<String> poisonTraitementAutreChp = null;
private TextField<String> traitementAutreChp = null;
private TextField<String> insecteTraitementAutreChp = null;
private TextField<String> actionAutreChp = null;
private TextField<String> provenanceRechercheAutreChp = null;
private TextField<String> typeRechercheAutreChp = null;
private CheckBoxGroup localStockageTrukCacGrpChp = null;
private LayoutContainer localStockageTrukCp = null;
private CheckBoxGroup meubleStockageTrukCacGrpChp = null;
private LayoutContainer meubleStockageTrukCp = null;
private CheckBoxGroup parametreStockageTrukCacGrpChp = null;
private LayoutContainer parametreStockageTrukCp = null;
private LayoutContainer collectionAutreTrukCp = null;
private CheckBoxGroup collectionAutreTrukCacGrpChp = null;
private CheckBoxGroup opRestauTrukCacGrpChp = null;
private LayoutContainer opRestauTrukCp = null;
private CheckBoxGroup autreMaterielTrukCacGrpChp = null;
private LayoutContainer autreMaterielTrukCp = null;
private LayoutContainer traitementTrukCp = null;
private CheckBoxGroup traitementTrukCacGrpChp = null;
private LayoutContainer poisonTraitementTrukCp = null;
private LayoutContainer insecteTraitementTrukCp = null;
private CheckBoxGroup insecteTraitementTrukCacGrpChp = null;
private CheckBoxGroup poisonTraitementTrukCacGrpChp = null;
private LayoutContainer autreCollectionTrukCp = null;
private CheckBoxGroup autreCollectionTrukCacGrpChp = null;
private LayoutContainer provenanceRechercheTrukCp = null;
private CheckBoxGroup provenanceRechercheTrukCacGrpChp = null;
private CheckBoxGroup typeRechercheTrukCacGrpChp = null;
private LayoutContainer typeRechercheTrukCp = null;
private TextField<String> futureActionChp = null;
private TextField<String> sansMotifAccesChp = null;
private TextField<String> avecMotifAccesChp = null;
private TextField<String> formationChp = null;
private RadioGroup traitementAcquisitionMarkRGrpChp = null;
private LabelField traitementAcquisitionMarkLabel = null;
private RadioGroup materielConservationCeRGrpChp = null;
 
// Onglet VALORISATION
private StructureValorisation valorisation = null;
private RadioGroup actionMarkRGrpChp = null;
private LayoutContainer actionTrukCp = null;
private CheckBoxGroup actionTrukCacGrpChp = null;
private RadioGroup futureActionMarkRGrpChp = null;
private RadioGroup rechercheMarkRGrpChp = null;
private RadioGroup sansMotifAccesMarkRGrpChp = null;
private RadioGroup avecMotifAccesMarkRGrpChp = null;
private TextField<String> publicationChp = null;
private LayoutContainer materielConservationCp = null;
private ListStore<Personne> personneExistanteMagazin = null;
private ChampComboBoxRechercheTempsReelPaginable personneExistanteCombo = null;
private Button supprimerPersonnelBtn = null;
private ListStore<Projet> projetsMagazin = null;
private ChampComboBoxRechercheTempsReelPaginable projetsCombo = null;
private CellEditor fonctionEditor = null;
private List<Valeur> fonctionsListe = null;
private Sequenceur sequenceur;
public StructureForm(Mediateur mediateurCourrant, String modeDeCreation, Sequenceur sequenceur) {
initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.STRUCTURE);
this.sequenceur = sequenceur;
// Ajout du titre
panneauFormulaire.setHeading(i18nC.titreAjoutFormStructurePanneau());
// Création des onglets
onglets = creerOnglets();
// Ajout des onglets au formulaire général
panneauFormulaire.add(onglets);
}
protected TabPanel creerOnglets() {
TabPanel ongletsStructure = new TabPanel();
// NOTE : pour faire apparaître les scrollBar il faut définir la hauteur du panneau d'onglets à 100% (autoHeight ne semble pas fonctionner)
ongletsStructure.setHeight("100%");
// Onlget formulaire IDENTIFICATION
ongletsStructure.add(creerOngletIdentification());
// Onlget formulaire PERSONNEL
ongletsStructure.add(creerOngletPersonnel());
// Onlget formulaire CONSERVATION
ongletsStructure.add(creerOngletConservation());
// Onlget formulaire VALORISATION
ongletsStructure.add(creerOngletValorisation());
// Sélection de l'onglet par défaut
//ongletsStructure(personnelOnglet);
return ongletsStructure;
}
public void reinitialiserFormulaire() {
if (mode.equals(StructureForm.MODE_MODIFIER)) {
mediateur.afficherFormStructure(identification.getId());
} else {
mediateur.afficherFormStructure(null);
}
}
public boolean soumettreFormulaire() {
// Vérification de la validité des champs du formulaire
boolean fomulaireValide = verifierFormulaire();
if (fomulaireValide) {
// Collecte des données du formulaire
Structure structure = collecterStructureIdentification();
StructureConservation conservation = collecterStructureConservation();
StructureValorisation valorisation = collecterStructureValorisation();
collecterStructurePersonnel();
if (mode.equals(MODE_AJOUTER)) {
// Ajout des informations sur la Structure
mediateur.ajouterStructure(this, structure, conservation, valorisation);
// L'ajout des relations StructureAPersonne se fait quand la structure a été ajoutée
// Voir la méthode rafraichir().
} else if (mode.equals(MODE_MODIFIER)) {
// Modification des informations sur la Structure
if (structure == null && conservation == null && valorisation == null) {
InfoLogger.display("Modification d'une institution", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
} else {
mediateur.modifierStructure(this, identification.getId(), structure, conservation, valorisation);
}
if (personnelModifie.size() == 0 && personnelAjoute.size() == 0 && personnelSupprime.size() == 0) {
InfoLogger.display("Modification du personnel", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
} else {
if (personnelModifie.size() != 0) {
decompteRafraichissementPersonnel++;
mediateur.modifierStructureAPersonne(this, personnelModifie);
}
// Ajout des relations StructureAPersonne
if (personnelAjoute.size() != 0) {
decompteRafraichissementPersonnel++;
mediateur.ajouterStructureAPersonne(this, identification.getId(), personnelAjoute);
}
// Suppression des relations StructureAPersonne
if (personnelSupprime.size() != 0) {
decompteRafraichissementPersonnel++;
mediateur.supprimerStructureAPersonne(this, personnelSupprime);
}
}
}
}
return fomulaireValide;
}
public boolean verifierFormulaire() {
ArrayList<String> messages = new ArrayList<String>();
// Vérification des infos sur le nom de la structure
if ( (identificationOnglet.getData("acces").equals(true) && nomStructureChp.getValue() == null) ||
(identificationOnglet.getData("acces").equals(true) && nomStructureChp.getValue().equals("")) ||
(identificationOnglet.getData("acces").equals(false) && identification.getNom().equals(""))) {
messages.add("Veuillez indiquez un nom à l'institution.");
}
// Vérification des infos sur le projet de la structure
if ( (identificationOnglet.getData("acces").equals(true) && projetsCombo.getCombo().getValue() == null) ||
(identificationOnglet.getData("acces").equals(true) && projetsCombo.getCombo().getValue().equals("")) ||
(identificationOnglet.getData("acces").equals(false) && identification.getIdProjet().equals(""))) {
messages.add("Veuillez sélectionner un projet pour l'institution.");
}
// Vérification du Personnel
if (personnelOnglet.getData("acces").equals(true)) {
String personnelNumero = "";
int nbrePersonne = personnelGrilleMagazin.getCount();
for (int i = 0; i < nbrePersonne; i++) {
StructureAPersonne personne = personnelGrilleMagazin.getAt(i);
if (personne.getNom().equals("") || personne.getPrenom().equals("")) {
personnelNumero += (i != 0 ? ", " : "")+(i+1);
}
}
if (!personnelNumero.equals("")) {
messages.add("Veuillez indiquez un prénom et un nom au personnel numéro : "+personnelNumero);
}
}
 
//Vérification de la date de fondation
String valeurDateFondation = dateFondationChp.getValue();
if (!UtilString.isEmpty(valeurDateFondation) && (!valeurDateFondation.matches("\\d{2}/\\d{2}/\\d{4}") &&
!valeurDateFondation.matches("\\d{4}"))) {
messages.add("La date de fondation n'est pas au format jj/MM/AAAA ou AAAA");
}
// Affichage des messages d'alerte
if (messages.size() != 0) {
String[] a = {};
a = messages.toArray(a);
MessageBox.alert("Erreurs de saisies", UtilArray.implode(a, "\n\n"), null);
return false;
}
return true;
}
private StructureValorisation collecterStructureValorisation() {
StructureValorisation valorisationARetourner = null;
if (valorisationOnglet.getData("acces").equals(true)) {
// Création de l'objet
StructureValorisation valorisationCollectee = (StructureValorisation) valorisation.cloner(new StructureValorisation());
// ACTION
if (actionMarkRGrpChp.getValue() != null) {
valorisationCollectee.setAction(actionMarkRGrpChp.getValue().getValueAttribute());
}
// ACTION INFO
valorisationCollectee.setActionInfo(creerChaineDenormalisee(actionTrukCacGrpChp.getValues()));
valorisationCollectee.setActionInfo("AUTRE", actionAutreChp.getValue());
// PUBLICATION
valorisationCollectee.setPublication(publicationChp.getValue());
// COLLECTION AUTRE
valorisationCollectee.setCollectionAutre(creerChaineDenormalisee(autreCollectionTrukCacGrpChp.getValues()));
valorisationCollectee.setCollectionAutre("AUTRE", autreCollectionAutreChp.getValue());
// ACTION FUTURE
if (futureActionMarkRGrpChp.getValue() != null) {
valorisationCollectee.setActionFuture(futureActionMarkRGrpChp.getValue().getValueAttribute());
}
// ACTION FUTURE INFO
valorisationCollectee.setActionFutureInfo(futureActionChp.getValue());
// RECHERCHE
if (rechercheMarkRGrpChp.getValue() != null) {
valorisationCollectee.setRecherche(rechercheMarkRGrpChp.getValue().getValueAttribute());
 
// RECHERCHE PROVENANCE
valorisationCollectee.setRechercheProvenance(creerChaineDenormalisee(provenanceRechercheTrukCacGrpChp.getValues()));
valorisationCollectee.setRechercheProvenance("AUTRE", provenanceRechercheAutreChp.getValue());
// RECHERCHE TYPE
valorisationCollectee.setRechercheType(creerChaineDenormalisee(typeRechercheTrukCacGrpChp.getValues()));
valorisationCollectee.setRechercheType("AUTRE", typeRechercheAutreChp.getValue());
}
// ACCÈS SANS MOTIF
if (sansMotifAccesMarkRGrpChp.getValue() != null) {
valorisationCollectee.setAccesSansMotif(sansMotifAccesMarkRGrpChp.getValue().getValueAttribute());
}
// ACCÈS SANS MOTIF INFO
valorisationCollectee.setAccesSansMotifInfo(sansMotifAccesChp.getValue());
// VISITE AVEC MOTIF
if (avecMotifAccesMarkRGrpChp.getValue() != null) {
valorisationCollectee.setVisiteAvecMotif(avecMotifAccesMarkRGrpChp.getValue().getValueAttribute());
}
// VISITE AVEC MOTIF INFO
valorisationCollectee.setVisiteAvecMotifInfo(avecMotifAccesChp.getValue());
// Retour de l'objet
if (!valorisationCollectee.comparer(valorisation)) {
valorisationARetourner = valorisation = valorisationCollectee;
}
}
return valorisationARetourner;
}
private void peuplerStructureValorisation() {
if (mode.equals(MODE_AJOUTER)) {
// Indique que l'onglet a pu être modifié pour la méthode collecter...
valorisationOnglet.setData("acces", true);
// Initialisation de l'objet Structure
valorisation = new StructureValorisation();
}
if (mode.equals(MODE_MODIFIER) && valorisation != null && valorisationOnglet.getData("acces").equals(false)) {
// ACTION :
//TODO : check below:
((Radio) actionMarkRGrpChp.get((valorisation.getAction().equals("1") ? 0 : 1))).setValue(true);
// ACTION INFO
peuplerCasesACocher(valorisation.getActionInfo(), actionTrukCacGrpChp, actionAutreChp);
// PUBLICATION
publicationChp.setValue(valorisation.getPublication());
// COLLECTION AUTRE
peuplerCasesACocher(valorisation.getCollectionAutre(), autreCollectionTrukCacGrpChp, autreCollectionAutreChp);
// ACTION FUTURE
((Radio) futureActionMarkRGrpChp.get((valorisation.getActionFuture().equals("1") ? 0 : 1))).setValue(true);
// ACTION FUTURE INFO
futureActionChp.setValue(valorisation.getActionFutureInfo());
// RECHERCHE
((Radio) rechercheMarkRGrpChp.get((valorisation.getRecherche().equals("1") ? 0 : 1))).setValue(true);
// RECHERCHE PROVENANCE
peuplerCasesACocher(valorisation.getRechercheProvenance(), provenanceRechercheTrukCacGrpChp, provenanceRechercheAutreChp);
// RECHERCHE TYPE
peuplerCasesACocher(valorisation.getRechercheType(), typeRechercheTrukCacGrpChp, typeRechercheAutreChp);
 
// ACCÈS SANS MOTIF
((Radio) sansMotifAccesMarkRGrpChp.get((valorisation.getAccesSansMotif().equals("1") ? 0 : 1))).setValue(true);
// ACCÈS SANS MOTIF INFO
sansMotifAccesChp.setValue(valorisation.getAccesSansMotifInfo());
// VISITE AVEC MOTIF
((Radio) avecMotifAccesMarkRGrpChp.get((valorisation.getVisiteAvecMotif().equals("1") ? 0 : 1))).setValue(true);
// VISITE AVEC MOTIF INFO
avecMotifAccesChp.setValue(valorisation.getVisiteAvecMotifInfo());
// Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...
valorisationOnglet.setData("acces", true);
}
}
private StructureConservation collecterStructureConservation() {
StructureConservation conservationARetourner = null;
if (conservationOnglet.getData("acces").equals(true)) {
// Création de l'objet
StructureConservation conservationCollectee = (StructureConservation) conservation.cloner(new StructureConservation());
// FORMATION
if (formationMarkRGrpChp.getValue() != null) {
conservationCollectee.setFormation(formationMarkRGrpChp.getValue().getValueAttribute());
}
// FORMATION INFO
conservationCollectee.setFormationInfo(formationChp.getValue());
// FORMATION INTERET
if (interetFormationMarkRGrpChp.getValue() != null) {
conservationCollectee.setFormationInteret(interetFormationMarkRGrpChp.getValue().getValueAttribute());
}
// STOCKAGE LOCAL
conservationCollectee.setStockageLocal(creerChaineDenormalisee(localStockageTrukCacGrpChp.getValues()));
conservationCollectee.setStockageLocal("AUTRE", localStockageAutreChp.getValue());
// STOCKAGE MEUBLE
conservationCollectee.setStockageMeuble(creerChaineDenormalisee(meubleStockageTrukCacGrpChp.getValues()));
conservationCollectee.setStockageMeuble("AUTRE", meubleStockageAutreChp.getValue());
// STOCKAGE PAREMETRE
conservationCollectee.setStockageParametre(creerChaineDenormalisee(parametreStockageTrukCacGrpChp.getValues()));
conservationCollectee.setStockageParametre("AUTRE", parametreStockageAutreChp.getValue());
// COLLECTION COMMUNE
if (collectionCommuneMarkRGrpChp.getValue() != null) {
conservationCollectee.setCollectionCommune(collectionCommuneMarkRGrpChp.getValue().getValueAttribute());
}
// COLLECTION AUTRE
conservationCollectee.setCollectionAutre(creerChaineDenormalisee(collectionAutreTrukCacGrpChp.getValues()));
conservationCollectee.setCollectionAutre("AUTRE", collectionAutreAutreChp.getValue());
// ACCÈS CONTROLÉ
if (accesControleMarkRGrpChp.getValue() != null) {
conservationCollectee.setAccesControle(accesControleMarkRGrpChp.getValue().getValueAttribute());
}
// RESTAURATION
if (restaurationMarkRGrpChp.getValue() != null) {
conservationCollectee.setRestauration(restaurationMarkRGrpChp.getValue().getValueAttribute());
}
// RESTAURATION OPÉRATION
conservationCollectee.setRestaurationOperation(creerChaineDenormalisee(opRestauTrukCacGrpChp.getValues()));
conservationCollectee.setRestaurationOperation("AUTRE", opRestauAutreChp.getValue());
// MATERIEL CONSERVATION
if (materielConservationCeRGrpChp.getValue() != null) {
conservationCollectee.setMaterielConservation(materielConservationCeRGrpChp.getValue().getValueAttribute());
 
// MATERIEL AUTRE
conservationCollectee.setMaterielAutre(creerChaineDenormalisee(autreMaterielTrukCacGrpChp.getValues()));
conservationCollectee.setMaterielAutre("AUTRE", autreMaterielAutreChp.getValue());
}
// TRAITEMENT
if (traitementMarkRGrpChp.getValue() != null) {
conservationCollectee.setTraitement(traitementMarkRGrpChp.getValue().getValueAttribute());
}
// TRAIEMENTS
conservationCollectee.setTraitements(creerChaineDenormalisee(traitementTrukCacGrpChp.getValues()));
conservationCollectee.setTraitements("AUTRE", traitementAutreChp.getValue());
// ACQUISITION COLLECTION
if (collectionAcquisitionMarkRGrpChp.getValue() != null) {
conservationCollectee.setAcquisitionCollection(collectionAcquisitionMarkRGrpChp.getValue().getValueAttribute());
}
// ACQUISITION ECHANTILLON
if (echantillonAcquisitionMarkRGrpChp.getValue() != null) {
conservationCollectee.setAcquisitionEchantillon(echantillonAcquisitionMarkRGrpChp.getValue().getValueAttribute());
}
// ACQUISITION TRAITEMENT
if (traitementAcquisitionMarkRGrpChp.getValue() != null) {
conservationCollectee.setAcquisitionTraitement(traitementAcquisitionMarkRGrpChp.getValue().getValueAttribute());
}
// ACQUISITION TRAITEMENT POISON
conservationCollectee.setAcquisitionTraitementPoison(creerChaineDenormalisee(poisonTraitementTrukCacGrpChp.getValues()));
conservationCollectee.setAcquisitionTraitementPoison("AUTRE", poisonTraitementAutreChp.getValue());
// ACQUISITION TRAITEMENT INSECTE
conservationCollectee.setAcquisitionTraitementInsecte(creerChaineDenormalisee(insecteTraitementTrukCacGrpChp.getValues()));
conservationCollectee.setAcquisitionTraitementInsecte("AUTRE", insecteTraitementAutreChp.getValue());
// Retour de l'objet
if (!conservationCollectee.comparer(conservation)) {
GWT.log("Collecte différent de Retour", null);
conservationARetourner = conservation = conservationCollectee;
}
}
return conservationARetourner;
}
private void peuplerStructureConservation() {
if (mode.equals(MODE_AJOUTER)) {
// Indique que l'onglet a pu être modifié pour la méthode collecter...
conservationOnglet.setData("acces", true);
// Initialisation de l'objet Structure
conservation = new StructureConservation();
}
if (mode.equals(MODE_MODIFIER) && conservation != null && conservationOnglet.getData("acces").equals(false)) {
// FORMATION
// Bouton oui, à toujours l'index 0 donc on teste en fonction...
((Radio) formationMarkRGrpChp.get((conservation.getFormation().equals("1") ? 0 : 1))).setValue(true);
// FORMATION INFO
formationChp.setValue(conservation.getFormationInfo());
// FORMATION INTERET
((Radio) interetFormationMarkRGrpChp.get((conservation.getFormationInteret().equals("1") ? 0 : 1))).setValue(true);
// STOCKAGE LOCAL
peuplerCasesACocher(conservation.getStockageLocal(), localStockageTrukCacGrpChp,localStockageAutreChp);
// STOCKAGE MEUBLE
peuplerCasesACocher(conservation.getStockageMeuble(), meubleStockageTrukCacGrpChp, meubleStockageAutreChp);
// STOCKAGE PAREMETRE
peuplerCasesACocher(conservation.getStockageParametre(), parametreStockageTrukCacGrpChp, parametreStockageAutreChp);
// COLLECTION COMMUNE
((Radio) collectionCommuneMarkRGrpChp.get((conservation.getCollectionCommune().equals("1") ? 0 : 1))).setValue(true);
// COLLECTION AUTRE
peuplerCasesACocher(conservation.getCollectionAutre(), collectionAutreTrukCacGrpChp, collectionAutreAutreChp);
// ACCÈS CONTROLÉ
((Radio) accesControleMarkRGrpChp.get((conservation.getAccesControle().equals("1") ? 0 : 1))).setValue(true);
// RESTAURATION
((Radio) restaurationMarkRGrpChp.get((conservation.getRestauration().equals("1") ? 0 : 1))).setValue(true);
// RESTAURATION OPÉRATION
peuplerCasesACocher(conservation.getRestaurationOperation(), opRestauTrukCacGrpChp, opRestauAutreChp);
// MATERIEL CONSERVATION
peuplerBoutonsRadio(conservation.getMaterielConservation(), materielConservationCeRGrpChp);
// MATERIEL AUTRE
peuplerCasesACocher(conservation.getMaterielAutre(), autreMaterielTrukCacGrpChp, autreMaterielAutreChp);
// TRAITEMENT
((Radio) traitementMarkRGrpChp.get((conservation.getTraitement().equals("1") ? 0 : 1))).setValue(true);
// TRAITEMENTS
peuplerCasesACocher(conservation.getTraitements(), traitementTrukCacGrpChp, traitementAutreChp);
// ACQUISITION COLLECTION
((Radio) collectionAcquisitionMarkRGrpChp.get((conservation.getAcquisitionCollection().equals("1") ? 0 : 1))).setValue(true);
// ACQUISITION ECHANTILLON
((Radio) echantillonAcquisitionMarkRGrpChp.get((conservation.getAcquisitionEchantillon().equals("1") ? 0 : 1))).setValue(true);
// ACQUISITION TRAITEMENT
((Radio) traitementAcquisitionMarkRGrpChp.get((conservation.getAcquisitionTraitement().equals("1") ? 0 : 1))).setValue(true);
// ACQUISITION TRAITEMENT POISON
peuplerCasesACocher(conservation.getAcquisitionTraitementPoison(), poisonTraitementTrukCacGrpChp, poisonTraitementAutreChp);
// ACQUISITION TRAITEMENT INSECTE
peuplerCasesACocher(conservation.getAcquisitionTraitementInsecte(), insecteTraitementTrukCacGrpChp, insecteTraitementAutreChp);
// Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...
conservationOnglet.setData("acces", true);
}
}
private Structure collecterStructureIdentification() {
Structure structureARetourner = null;
if (identificationOnglet.getData("acces").equals(true)) {
Structure structureCollectee = (Structure) identification.cloner(new Structure());
structureCollectee.setId(idStructureChp.getValue());
structureCollectee.setNom(nomStructureChp.getValue());
// Récupération de l'identifiant du projet
if (projetsCombo.getCombo().getValue() != null) {
structureCollectee.setIdProjet(new Projet(projetsCombo.getValeur()).getId());
}
// Récupération de l'acronyme (= identifiant alternatif)
structureCollectee.setIdAlternatif(null);
if (comboAcronyme.getValue() != null) {
String typeAcronyme = comboAcronyme.getValue().getAbr();
if (typeAcronyme == "IH") {
structureCollectee.setIdAlternatif(typeAcronyme+"##"+ihChp.getValue());
} else if (typeAcronyme == "MNHN") {
structureCollectee.setIdAlternatif(typeAcronyme+"##"+mnhnChp.getValue());
}
}
// Récupération statut de la structure
structureCollectee.setTypePublic(null);
structureCollectee.setTypePrive(null);
if (comboTypeStructure.getValue() != null) {
String typeStructure = comboTypeStructure.getValue().getAbr();
if (typeStructure == "stpu" && comboLstpu.getValue() != null) {
structureCollectee.setTypePublic(comboLstpu.getValue().getId());
} else if (typeStructure == "stpr" && comboLstpr.getValue() != null) {
structureCollectee.setTypePrive(comboLstpr.getValue().getId());
}
}
String valeurDateFondation = dateFondationChp.getValue();
if (!UtilString.isEmpty(valeurDateFondation)) {
if (valeurDateFondation.matches("\\d{2}/\\d{2}/\\d{4}")) {
Date dateFondation = DateTimeFormat.getFormat("dd/MM/yyyy").parse(valeurDateFondation);
structureCollectee.setDateFondation(dateFondation);
} else if (valeurDateFondation.matches("\\d{4}")) {
structureCollectee.setDateFondation(valeurDateFondation + "-00-00");
}
}
structureCollectee.setDescription(descriptionChp.getValue());
structureCollectee.setConditionAcces(conditionAccesChp.getValue());
structureCollectee.setConditionUsage(conditionUsageChp.getValue());
structureCollectee.setAdresse(adrChp.getValue());
structureCollectee.setAdresseComplement(adrComplementChp.getValue());
structureCollectee.setCodePostal(cpChp.getValue());
structureCollectee.setVille(villeChp.getValue());
String strRegion = "";
Valeur valeurRegion = comboRegion.getValue();
if (valeurRegion == null) {
strRegion = "AUTRE##" + comboRegion.getRawValue();
} else {
strRegion = valeurRegion.getId();
}
structureCollectee.setRegion(strRegion);
structureCollectee.setPays(null);
if (comboPays.getCombo().getValue() != null) {
structureCollectee.setPays(new Valeur(comboPays.getValeur()).getId());
} else if (comboPays.getCombo().getRawValue() != "") {
structureCollectee.setPays(comboPays.getCombo().getRawValue());
}
structureCollectee.setLatitude(latitudeChp.getValue());
structureCollectee.setLongitude(longitudeChp.getValue());
structureCollectee.setTelephoneFixe(telChp.getValue());
structureCollectee.setFax(faxChp.getValue());
structureCollectee.setCourriel(emailChp.getValue());
structureCollectee.setUrl(Structure.URL_SITE, urlChp.getValue());
if (nbreTotalPersonneStructureChp.getValue() != null) {
structureCollectee.setNbrePersonne(nbreTotalPersonneStructureChp.getValue().intValue());
}
if (!structureCollectee.comparer(identification)) {
structureARetourner = identification = structureCollectee;
}
}
return structureARetourner;
}
private void peuplerStructureIdentification() {
if (mode.equals(MODE_AJOUTER)) {
// Indique que l'ongleta pu être modifié pour la méthode collecter...
identificationOnglet.setData("acces", true);
// Initialisation de l'objet Structure
identification = new Structure();
// Indication du projet sélectionné par défaut
String projetCourantId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getProjetId();
if (projetCourantId != null && !projetCourantId.equals("0")) {
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", projetCourantId));
}
}
if (mode.equals(MODE_MODIFIER) && identification != null && identificationOnglet.getData("acces").equals(false)) {
idStructureChp.setValue(identification.getId());
nomStructureChp.setValue(identification.getNom());
if (!identification.getIdProjet().equals("0")) {
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", identification.getIdProjet()));
}
if (!identification.getIdAlternatif().isEmpty()) {
String[] acronyme = identification.getIdAlternatif().split("##");
//#436 : Ne pas afficher "null"
if (UtilString.isEmpty(acronyme[1]) || acronyme[1].equals("null")) {
acronyme[1] = "";
}
if (acronyme[0].matches("^IH$")) {
comboAcronyme.setValue(InterneValeurListe.getTypeAcronymeIH());
ihChp.setValue(acronyme[1]);
} else if (acronyme[0].matches("^MNHN$")) {
comboAcronyme.setValue(InterneValeurListe.getTypeAcronymeMNHN());
mnhnChp.setValue(acronyme[1]);
}
}
if (!identification.getTypePrive().isEmpty()) {
if (identification.getTypePrive().matches("^[0-9]+$")) {
comboTypeStructure.setValue(InterneValeurListe.getTypePrivee());
comboLstpr.setValue(comboLstpr.getStore().findModel("id_valeur", identification.getTypePrive()));
}
} else if (!identification.getTypePublic().isEmpty()) {
if (identification.getTypePublic().matches("^[0-9]+$")) {
comboTypeStructure.setValue(InterneValeurListe.getTypePublique());
comboLstpu.setValue(comboLstpu.getStore().findModel("id_valeur", identification.getTypePublic()));
}
}
String dateFondation = identification.getAnneeOuDateFondation();
if (!dateFondation.equals("")) {
if (dateFondation.endsWith("00-00")) {
dateFondationChp.setValue(dateFondation.substring(0, 4));
} else {
Date date = DateTimeFormat.getFormat("yyyy-MM-dd").parse(dateFondation);
dateFondationChp.setValue(DateTimeFormat.getFormat("dd/MM/yyyy").format(date));
}
}
descriptionChp.setValue(identification.getDescription());
conditionAccesChp.setValue(identification.getConditionAcces());
conditionUsageChp.setValue(identification.getConditionUsage());
adrChp.setValue(identification.getAdresse());
adrComplementChp.setValue(identification.getAdresseComplement());
cpChp.setValue(identification.getCodePostal());
villeChp.setValue(identification.getVille());
mettreAJourRegion();
//(identification.getRegion());
if (identification.getPays().matches("^[0-9]+$")) {
comboPays.getCombo().setValue(comboPays.getStore().findModel("cmlv_id_valeur", identification.getPays()));
} else {
comboPays.getCombo().setRawValue(identification.getPays());
}
latitudeChp.setValue(identification.getLatitude());
longitudeChp.setValue(identification.getLongitude());
telChp.setValue(identification.getTelephoneFixe());
faxChp.setValue(identification.getFax());
emailChp.setValue(identification.getCourriel());
urlChp.setValue(identification.getUrl("WEB"));
nbreTotalPersonneStructureChp.setValue(identification.getNbrePersonne());
// Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...
identificationOnglet.setData("acces", true);
}
}
private TabItem creerOngletValorisation() {
valorisationOnglet = creerOnglet("Valorisation", "valorisation");
valorisationOnglet.setLayout(creerFormLayout(650, LabelAlign.TOP));
Listener<ComponentEvent> ecouteurSelection = new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
peuplerStructureValorisation();
valorisationOnglet.layout();
}
};
valorisationOnglet.addListener(Events.Select, ecouteurSelection);
actionMarkRGrpChp = creerChoixUniqueRadioGroupe("action_mark", "ouiNon");
actionMarkRGrpChp.setFieldLabel("Avez-vous réalisé des actions de valorisation de vos collections botaniques ou avez-vous été sollicités pour la valorisation de ces collections ?");
valorisationOnglet.add(actionMarkRGrpChp);
actionTrukCp = creerChoixMultipleCp();
actionTrukCp.hide();
actionTrukCacGrpChp = new CheckBoxGroup();
actionTrukCacGrpChp.setFieldLabel("Si oui, lesquelles ?");
valorisationOnglet.add(actionTrukCp);
mediateur.obtenirListeValeurEtRafraichir(this, "actionValorisation", sequenceur);
mediateur.obtenirListeValeurEtRafraichir(this, "statut", sequenceur);
publicationChp = new TextArea();
publicationChp.setFieldLabel("Quelques titres des ouvrages, articles scientifiques, ...");
valorisationOnglet.add(publicationChp, new FormData(550, 0));
autreCollectionTrukCp = creerChoixMultipleCp();
autreCollectionTrukCacGrpChp = new CheckBoxGroup();
autreCollectionTrukCacGrpChp.setFieldLabel("L'organisme dispose-t-il d'autres collections (permettant une valorisation pluridisciplinaire) ?");
valorisationOnglet.add(autreCollectionTrukCp);
mediateur.obtenirListeValeurEtRafraichir(this, "autreCollection", sequenceur);
futureActionMarkRGrpChp = creerChoixUniqueRadioGroupe("future_action_mark", "ouiNon");
futureActionMarkRGrpChp.setFieldLabel("Envisagez vous des actions de valorisation dans le cadre de votre politique culturelle ?");
valorisationOnglet.add(futureActionMarkRGrpChp);
futureActionChp = new TextArea();
futureActionChp.setFieldLabel("Si oui, lesquelles ?");
futureActionChp.hide();
futureActionChp.addListener(Events.Hide, new Listener<BaseEvent>() {
 
public void handleEvent(BaseEvent be) {
((TextArea) be.getSource()).setValue("");
}
});
valorisationOnglet.add(futureActionChp, new FormData(550, 0));
rechercheMarkRGrpChp = creerChoixUniqueRadioGroupe("recherche_mark", "ouiNon");
rechercheMarkRGrpChp.setFieldLabel("Vos collections botaniques sont-elles utilisées pour des recherches scientifiques ?");
valorisationOnglet.add(rechercheMarkRGrpChp);
provenanceRechercheTrukCp = creerChoixMultipleCp();
provenanceRechercheTrukCp.hide();
provenanceRechercheTrukCacGrpChp = new CheckBoxGroup();
provenanceRechercheTrukCacGrpChp.setFieldLabel("Si oui, par des chercheurs (professionnels ou amateurs) de quelle provenance ?");
valorisationOnglet.add(provenanceRechercheTrukCp);
mediateur.obtenirListeValeurEtRafraichir(this, "continentEtFr", sequenceur);
typeRechercheTrukCp = creerChoixMultipleCp();
typeRechercheTrukCp.hide();
typeRechercheTrukCacGrpChp = new CheckBoxGroup();
typeRechercheTrukCacGrpChp.setFieldLabel("Et pour quelles recherches ?");
valorisationOnglet.add(typeRechercheTrukCp);
mediateur.obtenirListeValeurEtRafraichir(this, "typeRecherche", sequenceur);
sansMotifAccesMarkRGrpChp = creerChoixUniqueRadioGroupe("sans_motif_acces_mark", "ouiNon");
sansMotifAccesMarkRGrpChp.setFieldLabel("Peut-on consulter vos collections botaniques sans motif de recherches scientifiques ?");
valorisationOnglet.add(sansMotifAccesMarkRGrpChp);
valorisationOnglet.add(sansMotifAccesChp = new TextArea(), new FormData(550, 0));
sansMotifAccesChp.hide();
sansMotifAccesChp.addListener(Events.Hide, new Listener<BaseEvent>() {
 
public void handleEvent(BaseEvent be) {
((TextArea) be.getSource()).setValue("");
}
});
sansMotifAccesChp.setFieldLabel("Si oui, quelles démarches doit-on faire pour les consulter ?");
avecMotifAccesMarkRGrpChp = creerChoixUniqueRadioGroupe("avec_motif_acces_mark", "ouiNon");
avecMotifAccesMarkRGrpChp.setFieldLabel("Peut-on visiter vos collections botaniques avec des objectifs de recherches scientifiques ?");
valorisationOnglet.add(avecMotifAccesMarkRGrpChp);
valorisationOnglet.add(avecMotifAccesChp = new TextArea(), new FormData(550, 0));
avecMotifAccesChp.hide();
avecMotifAccesChp.addListener(Events.Hide, new Listener<BaseEvent>() {
 
public void handleEvent(BaseEvent be) {
((TextArea) be.getSource()).setValue("");
}
});
avecMotifAccesChp.setFieldLabel("Si oui, quelles démarches doit-on faire pour les visiter ?");
return valorisationOnglet;
}
private TabItem creerOngletConservation() {
conservationOnglet = creerOnglet("Conservation", "conservation");
conservationOnglet.setLayout(creerFormLayout(650, LabelAlign.TOP));
Listener<ComponentEvent> ecouteurSelection = new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
peuplerStructureConservation();
conservationOnglet.layout();
}
};
conservationOnglet.addListener(Events.Select, ecouteurSelection);
formationMarkRGrpChp = creerChoixUniqueRadioGroupe("formation_mark", "ouiNon");
formationMarkRGrpChp.setFieldLabel("Le personnel s'occupant des collections a-t-il suivi des formations en conservations ?");
conservationOnglet.add(formationMarkRGrpChp);
formationChp = new TextArea();
formationChp.hide();
formationChp.addListener(Events.Hide, new Listener<BaseEvent>() {
 
public void handleEvent(BaseEvent be) {
((TextArea) be.getSource()).setValue("");
}
});
formationChp.setFieldLabel("Si oui, lesquelles ?");
conservationOnglet.add(formationChp);
interetFormationMarkRGrpChp = creerChoixUniqueRadioGroupe("interet_formation_mark", "ouiNon");
interetFormationMarkRGrpChp.setFieldLabel("Seriez vous intéressé par une formation à la conservation et à la restauration d'herbier ?");
conservationOnglet.add(interetFormationMarkRGrpChp);
localStockageTrukCacGrpChp = new CheckBoxGroup();
localStockageTrukCacGrpChp.setFieldLabel("Avez vous des locaux spécifiques de stockage des collections botaniques ?");
localStockageTrukCp = creerChoixMultipleCp();
conservationOnglet.add(localStockageTrukCp);
mediateur.obtenirListeValeurEtRafraichir(this, "localStockage", sequenceur);
meubleStockageTrukCp = creerChoixMultipleCp();
meubleStockageTrukCacGrpChp = new CheckBoxGroup();
meubleStockageTrukCacGrpChp.setFieldLabel("Avez vous des meubles spécifiques au stockage des collections botaniques ?");
conservationOnglet.add(meubleStockageTrukCp);
mediateur.obtenirListeValeurEtRafraichir(this, "meubleStockage", sequenceur);
parametreStockageTrukCp = creerChoixMultipleCp();
parametreStockageTrukCacGrpChp = new CheckBoxGroup();
parametreStockageTrukCacGrpChp.setFieldLabel("Quels paramètres maîtrisez vous ?");
conservationOnglet.add(parametreStockageTrukCp);
mediateur.obtenirListeValeurEtRafraichir(this, "parametreStockage", sequenceur);
collectionCommuneMarkRGrpChp = creerChoixUniqueRadioGroupe("collection_commune_mark", "ouiNon");
collectionCommuneMarkRGrpChp.setFieldLabel("Les collections botaniques sont-elles conservées avec d'autres collections dans les mêmes locaux (problème de conservation en commun) ?");
conservationOnglet.add(collectionCommuneMarkRGrpChp);
collectionAutreTrukCp = creerChoixMultipleCp();
collectionAutreTrukCacGrpChp = new CheckBoxGroup();
collectionAutreTrukCacGrpChp.setFieldLabel("Si oui, lesquelles ?");
collectionAutreTrukCp.hide();
conservationOnglet.add(collectionAutreTrukCp);
mediateur.obtenirListeValeurEtRafraichir(this, "autreCollection", sequenceur);
accesControleMarkRGrpChp = creerChoixUniqueRadioGroupe("mark_acces_controle", "ouiNon");
accesControleMarkRGrpChp.setFieldLabel("L'accès à vos collections botanique est-il contrôlé (ex. : manipulation réservées à des personnes compétentes) ?");
conservationOnglet.add(accesControleMarkRGrpChp);
restaurationMarkRGrpChp = creerChoixUniqueRadioGroupe("restauration_mark", "ouiNon");
restaurationMarkRGrpChp.setFieldLabel("Effectuez vous des opérations de restauration ou de remise en état de vos collections botaniques ?");
conservationOnglet.add(restaurationMarkRGrpChp);
opRestauTrukCp = creerChoixMultipleCp();
opRestauTrukCacGrpChp = new CheckBoxGroup();
opRestauTrukCacGrpChp.setFieldLabel("Si oui, lesquelles ?");
opRestauTrukCp.hide();
conservationOnglet.add(opRestauTrukCp);
mediateur.obtenirListeValeurEtRafraichir(this, "opRestau", sequenceur);
// Création d'un ContentPanel vide et du groupe de bouton radio
// Le groupe de bouton radio recevra les boutons au moment de la réception des données (rafraichir()) et ser à ce moment là ajouter au ContenetPanel
materielConservationCp = creerChoixMultipleCp();
conservationOnglet.add(materielConservationCp);
materielConservationCeRGrpChp = creerChoixUniqueRadioGroupe("materiel_conservation_ce", "onep");
materielConservationCeRGrpChp.setFieldLabel("Utilisez vous du matériel de conservation ?");
materielConservationCeRGrpChp.setToolTip(new ToolTipConfig("Matériel de conservation", "matériel spécialisé pour la conservation des archives ou du patrimoine fragile. Ce matériel possède des propriétés mécaniques et chimiques qui font qu'il résiste dans le temps et que sa dégradation n'entraîne pas de dommages sur le matériel qu'il aide à conserver. Exemples : papier neutre, papier gommé, etc..."));
mediateur.obtenirListeValeurEtRafraichir(this, "onep", sequenceur);
autreMaterielTrukCp = creerChoixMultipleCp();
autreMaterielTrukCacGrpChp = new CheckBoxGroup();
autreMaterielTrukCacGrpChp.setFieldLabel("Si non, qu'utilisez vous comme matériel ?");
autreMaterielTrukCp.hide();
conservationOnglet.add(autreMaterielTrukCp);
mediateur.obtenirListeValeurEtRafraichir(this, "autreMateriel", sequenceur);
traitementMarkRGrpChp = creerChoixUniqueRadioGroupe("traitement_mark", "ouiNon");
traitementMarkRGrpChp.setFieldLabel("Réalisez vous actuellement des traitements globaux contre les insectes ?");
conservationOnglet.add(traitementMarkRGrpChp);
traitementTrukCp = creerChoixMultipleCp();
traitementTrukCp.hide();
traitementTrukCacGrpChp = new CheckBoxGroup();
traitementTrukCacGrpChp.setFieldLabel("Si oui, lesquels ?");
conservationOnglet.add(traitementTrukCp);
mediateur.obtenirListeValeurEtRafraichir(this, "insecteTraitement", sequenceur);
collectionAcquisitionMarkRGrpChp = creerChoixUniqueRadioGroupe("collection_acquisition_mark", "ouiNon");
collectionAcquisitionMarkRGrpChp.setFieldLabel("Actuellement, vos collections botaniques s'accroissent-elles de nouvelles acquisitions ?");
conservationOnglet.add(collectionAcquisitionMarkRGrpChp);
echantillonAcquisitionMarkRGrpChp = creerChoixUniqueRadioGroupe("echantillon_acquisition_mark", "ouiNon");
echantillonAcquisitionMarkRGrpChp.setFieldLabel("Actuellement, mettez vous en herbier de nouveaux échantillons ?");
conservationOnglet.add(echantillonAcquisitionMarkRGrpChp);
 
traitementAcquisitionMarkRGrpChp = creerChoixUniqueRadioGroupe("traitement_acquisition_mark", "ouiNon");
traitementAcquisitionMarkRGrpChp.hide();
traitementAcquisitionMarkRGrpChp.setFieldLabel("Si oui, faites-vous un traitement contre les insectes avant l'intégration dans vos collections ?");
conservationOnglet.add(traitementAcquisitionMarkRGrpChp);
traitementAcquisitionMarkLabel = new LabelField();
traitementAcquisitionMarkLabel.hide();
traitementAcquisitionMarkLabel.setFieldLabel("Si oui, lesquels ?");
conservationOnglet.add(traitementAcquisitionMarkLabel);
poisonTraitementTrukCp = creerChoixMultipleCp();
poisonTraitementTrukCp.hide();
poisonTraitementTrukCacGrpChp = new CheckBoxGroup();
poisonTraitementTrukCacGrpChp.setFieldLabel("Empoisonnement");
poisonTraitementTrukCacGrpChp.setLabelStyle("font-weight:normal;text-decoration:underline;");
poisonTraitementTrukCacGrpChp.setLabelSeparator("");
conservationOnglet.add(poisonTraitementTrukCp);
mediateur.obtenirListeValeurEtRafraichir(this, "poisonTraitement", sequenceur);
insecteTraitementTrukCp = creerChoixMultipleCp();
insecteTraitementTrukCp.hide();
insecteTraitementTrukCacGrpChp = new CheckBoxGroup();
insecteTraitementTrukCacGrpChp.setLabelStyle("font-weight:normal;text-decoration:underline;");
insecteTraitementTrukCacGrpChp.setLabelSeparator("");
insecteTraitementTrukCacGrpChp.setFieldLabel("Désinsectisation");
conservationOnglet.add(insecteTraitementTrukCp);
mediateur.obtenirListeValeurEtRafraichir(this, "insecteTraitement", sequenceur);
conservationOnglet.add(new Html("<br />"));
return conservationOnglet;
}
private void collecterStructurePersonnel() {
if (personnelOnglet.getData("acces").equals(true)) {
personnelGrilleMagazin.commitChanges();
int nbrePersonne = personnelGrilleMagazin.getCount();
for (int i = 0; i < nbrePersonne; i++) {
StructureAPersonne personne = personnelGrilleMagazin.getAt(i);
// Seules les lignes ajoutées ou modifiées sont prises en compte.
Record record = personnelGrilleMagazin.getRecord(personne);
if (personnelGrilleMagazin.getModifiedRecords().contains(record) == true
|| (personne.get("etat") != null && (personne.get("etat").equals(StructureAPersonne.ETAT_AJOUTE) || personne.get("etat").equals(StructureAPersonne.ETAT_MODIFIE)) )) {
// Gestion de l'id de la structure
if (mode.equals("MODIF")) {
personne.setIdStructure(identification.getId());
}
// Récupération de l'id du projet de la structure qui servira aussi pour les Personnes crées dans ce formulaire
if (personne.getIdPersonne().equals("") && projetsCombo.getCombo().getValue() != null) {
personne.setIdProjetPersonne(new Projet(projetsCombo.getValeur()).getId());
}
// Gestion de la fonction
String fonction = personne.get("fonction");
if (fonction != null && !fonction.equals("")) {
Valeur valeurRecherche = fonctionsCombo.getStore().findModel("nom", fonction);
if (valeurRecherche != null) {
personne.setFonction(valeurRecherche.getId());
} else {
personne.setFonction("AUTRE", fonction);
}
} else {
personne.setFonction("");
}
 
// Gestion du nom complet
String nomComplet = personne.getPrenom()+" "+personne.getNom();
personne.setNomComplet(nomComplet);
// Gestion de la notion de "contact"
personne.setContact(false);
if (personne.get("contact").equals(true)) {
personne.setContact(true);
}
// Gestion du statut
String statut = personne.get("statut");
if (statut != null && !statut.equals("")) {
Valeur valeurRecherche = comboLiStatut.getStore().findModel("nom", statut);
if (valeurRecherche != null) {
personne.setStatut(valeurRecherche.getId());
} else {
personne.setStatut("AUTRE", statut);
}
} else {
personne.setStatut("");
}
// Gestion du temps de travail
personne.setBotaTravailHebdoTps(personne.get("travail").toString());
// Gestion du téléphone
String telephoneFixe = personne.get("tel_fix");
personne.setTelephoneFixe(telephoneFixe);
// Gestion du fax
String fax = personne.get("tel_fax");
personne.setFax(fax);
// Gestion du courriel
String courriel = personne.get("courriel");
personne.setCourriel(courriel);
// Gestion de la spécialité
String specialite = personne.get("specialite");
personne.setSpecialite(specialite);
// On met à faux le décès
personne.setDeces(Personne.ETRE_VIVANT);
// Ajout de la personne dans la liste correspondant à son état (ajouté ou modifié)
if (personne.get("etat") != null && personne.get("etat").equals(StructureAPersonne.ETAT_AJOUTE)) { // Une personne ajoutée
personnelAjoute.put(""+i, personne);
} else {// Une personne modifiée
personnelModifie.put(personne.getId(), personne);
}
} else {
GWT.log("Personne non modifiées : "+personne.getPrenom()+" "+personne.getNom(), null);
}
}
}
}
private void peuplerStructurePersonnel() {
if (mode.equals(MODE_MODIFIER) && personnel != null) {
ArrayList<StructureAPersonne> personnes = new ArrayList<StructureAPersonne>();
for (Iterator<String> it = personnel.keySet().iterator(); it.hasNext();) {
String index = it.next();
// Gestion de la fonction
if (fonctionsMagazin != null && !((String) personnel.get(index).getFonction()).startsWith("AUTRE##")) {
if (fonctionsMagazin.findModel("id_valeur", personnel.get(index).getFonction()) != null) {
personnel.get(index).set("fonction", fonctionsMagazin.findModel("id_valeur", personnel.get(index).getFonction()).getNom());
}
} else {
personnel.get(index).set("fonction", personnel.get(index).getFonction().replaceFirst("AUTRE##", ""));
}
// Gestion de la notion de "contact"
personnel.get(index).set("contact", (personnel.get(index).getContact().equals("1") ? true : false));
// Gestion du statut
if (magazinLiStatut != null && ((String) personnel.get(index).getStatut()).matches("^[0-9]+$")) {
personnel.get(index).set("statut", magazinLiStatut.findModel("id_valeur", personnel.get(index).getStatut()).getNom());
} else {
personnel.get(index).set("statut", personnel.get(index).getStatut().replaceFirst("AUTRE##", ""));
}
// Gestion de la specialite
if (((String) personnel.get(index).getSpecialite()).matches("^[0-9]+$")) {
// Author : Cyprien
// TODO
// Ici faire un combobox ?
// ...
} else {
personnel.get(index).set("specialite", personnel.get(index).getSpecialite().replaceFirst("AUTRE##", ""));
}
// Gestion du temps de travail
String tps = personnel.get(index).getBotaTravailHebdoTps();
personnel.get(index).set("travail", (tps.matches("^[0-9]+$") ? Integer.parseInt(tps) : 0));
personnes.add(personnel.get(index));
}
personnelGrilleMagazin.removeAll();
personnelGrilleMagazin.add(personnes);
// Nous vidons la variable personnel une fois qu'elle a remplie la grille
personnel = null;
}
}
private TabItem creerOngletPersonnel() {
// Création des objets contenant les manipulations de la grille
personnelModifie = new StructureAPersonneListe();
personnelAjoute = new StructureAPersonneListe();
personnelSupprime = new StructureAPersonneListe();
personnelOnglet = creerOnglet("Personnel", "personnel");
personnelOnglet.setLayout(creerFormLayout(400, LabelAlign.LEFT));
personnelOnglet.setStyleAttribute("padding", "0");
personnelOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
// Indique que l'onglet a été rempli et a pu être modifié pour la méthode collecter...
personnelOnglet.setData("acces", true);
 
// Rafraichissement du contenu de la grille du personnel
if (mode.equals(MODE_AJOUTER)) {
rafraichirPersonnel();
}
}
});
ContentPanel cp = new ContentPanel();
cp.setHeading("Personnes travaillant sur les collections");
cp.setIcon(Images.ICONES.table());
cp.setScrollMode(Scroll.AUTO);
cp.setLayout(new FitLayout());
//cp.setWidth(1250);
//cp.setHeight("100%");
cp.setFrame(true);
personnelGrilleMagazin = new ListStore<StructureAPersonne>();
personnelGrilleMagazin.setMonitorChanges(true);
personnelGrilleMagazin.addListener(Store.Add, new Listener<StoreEvent<StructureAPersonne>>() {
public void handleEvent(StoreEvent<StructureAPersonne> ce) {
// Activation du bouton supprimer si la grille contient un élément
if (grillePersonnel.getStore().getCount() > 0) {
supprimerPersonnelBtn.enable();
}
}
});
RowNumberer r = new RowNumberer();
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
 
GridSelectionModel<StructureAPersonne> sm = new GridSelectionModel<StructureAPersonne>();
configs.add(r);
ColumnConfig column = new ColumnConfig("fonction", "Fonction", 150);
fonctionsMagazin = new ListStore<Valeur>();
fonctionsCombo = new ComboBox<Valeur>();
fonctionsCombo.setTriggerAction(TriggerAction.ALL);
fonctionsCombo.setEditable(true);
fonctionsCombo.setDisplayField("nom");
fonctionsCombo.setStore(fonctionsMagazin);
mediateur.obtenirListeValeurEtRafraichir(this, "fonction", sequenceur);
fonctionEditor = new CellEditor(fonctionsCombo) {
@Override
public Object preProcessValue(Object valeur) {
Valeur retour = null;
if (valeur != null) {
String chaineTransmise = (String) valeur;
if (fonctionsMagazin.getCount() == 0 && fonctionsListe != null) {
fonctionsMagazin.add(fonctionsListe);
}
if (fonctionsMagazin.findModel("id_valeur", chaineTransmise) != null) {
retour = fonctionsMagazin.findModel("id_valeur", chaineTransmise);
} else if (fonctionsMagazin.findModel("nom", chaineTransmise) != null) {
retour = fonctionsMagazin.findModel("nom", chaineTransmise);
} else {
retour = new Valeur("", chaineTransmise, "", "");
}
}
return retour;
}
@Override
public Object postProcessValue(Object valeur) {
String retour = "";
Valeur fonctionTrouvee = null;
if (valeur == null) {
String valeurBrute = this.getField().getRawValue();
if (fonctionsMagazin.getCount() == 0 && fonctionsListe != null) {
fonctionsMagazin.add(fonctionsListe);
}
if (valeurBrute.matches("^[0-9]+$") && fonctionsMagazin.findModel("id_valeur", valeurBrute) != null) {
fonctionTrouvee = fonctionsMagazin.findModel("id_valeur", valeurBrute);
} else {
retour = valeurBrute;
}
} else if (valeur instanceof Valeur) {
fonctionTrouvee = (Valeur) valeur;
}
if (fonctionTrouvee != null) {
retour = fonctionTrouvee.getNom();
}
return retour;
}
};
column.setEditor(fonctionEditor);
configs.add(column);
column = new ColumnConfig("prenom", "Prénom", 100);
TextField<String> prenomChp = new TextField<String>();
prenomChp.setAllowBlank(false);
prenomChp.getMessages().setBlankText("Ce champ est obligatoire.");
prenomChp.setAutoValidate(true);
prenomChp.addStyleName(ComposantClass.OBLIGATOIRE);
prenomChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
column.setEditor(new CellEditor(prenomChp));
configs.add(column);
column = new ColumnConfig("nom", "Nom", 100);
TextField<String> nomChp = new TextField<String>();
nomChp.setAllowBlank(false);
nomChp.getMessages().setBlankText("Ce champ est obligatoire.");
nomChp.setAutoValidate(true);
nomChp.addStyleName(ComposantClass.OBLIGATOIRE);
nomChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
column.setEditor(new CellEditor(nomChp));
configs.add(column);
 
column = new ColumnConfig("tel_fix", "Téléphone fixe", 100);
TextField<String> telChp = new TextField<String>();
column.setEditor(new CellEditor(telChp));
configs.add(column);
 
column = new ColumnConfig("tel_fax", "Fax", 100);
TextField<String> faxChp = new TextField<String>();
column.setEditor(new CellEditor(faxChp));
configs.add(column);
column = new ColumnConfig("courriel", "Courriel principal", 200);
TextField<String> emailChp = new TextField<String>();
column.setEditor(new CellEditor(emailChp));
configs.add(column);
magazinLiStatut = new ListStore<Valeur>();
magazinLiStatut.add(new ArrayList<Valeur>());
comboLiStatut = new ComboBox<Valeur>();
comboLiStatut.setTriggerAction(TriggerAction.ALL);
comboLiStatut.setEditable(false);
comboLiStatut.disableTextSelection(true);
comboLiStatut.setDisplayField("nom");
comboLiStatut.setStore(magazinLiStatut);
mediateur.obtenirListeValeurEtRafraichir(this, "statut", sequenceur);
CellEditor statutEditor = new CellEditor(comboLiStatut) {
@Override
public Object preProcessValue(Object value) {
if (value == null) {
return value;
}
return comboLiStatut.getStore().findModel("nom", (String) value);
}
@Override
public Object postProcessValue(Object value) {
if (value == null) {
return value;
}
return ((Valeur) value).get("nom");
}
};
column = new ColumnConfig("statut", "Statut", 100);
column.setEditor(statutEditor);
configs.add(column);
column = new ColumnConfig("travail", "Travail hebdo (%)", 100);
column.setNumberFormat(NumberFormat.getFormat("##"));
NumberField tpsWChp = new NumberField();
tpsWChp.setFormat(NumberFormat.getFormat("##"));
tpsWChp.setToolTip("Ce champ doit contenir un nombre");
column.setEditor(new CellEditor(tpsWChp));
configs.add(column);
column = new ColumnConfig("specialite", "Spécialité principale", 150);
TextField<String> speChp = new TextField<String>();
column.setEditor(new CellEditor(speChp));
configs.add(column);
CheckColumnConfig checkColumn = new CheckColumnConfig("contact", "Contact ?", 60);
configs.add(checkColumn);
ToolBar toolBar = new ToolBar();
Button ajouterPersonnelBtn = new Button("Ajouter");
ajouterPersonnelBtn.setIcon(Images.ICONES.vcardAjouter());
ajouterPersonnelBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
StructureAPersonne membreDuPersonnel = new StructureAPersonne("", StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
ajouterMembreAGrillePersonnel(membreDuPersonnel);
}
});
toolBar.add(ajouterPersonnelBtn);
toolBar.add(new SeparatorToolItem());
supprimerPersonnelBtn = new Button("Supprimer");
supprimerPersonnelBtn.setIcon(Images.ICONES.vcardSupprimer());
supprimerPersonnelBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
StructureAPersonne personne = grillePersonnel.getSelectionModel().getSelectedItem();
if (personne != null) {
// Ajout de la personne supprimée à la liste
if (personne.getIdPersonne() != null && !personne.getIdPersonne().equals("")) {
personnelSupprime.put(personne.getId(), personne);
}
// Suppression de l'enregistrement de la grille
grillePersonnel.getStore().remove(personne);
// Désactivation du bouton supprimer si la grille contient plus d'élément
if (grillePersonnel.getStore().getCount() == 0) {
//TODO : check : Item -> component
ce.getComponent().disable();
}
}
}
});
toolBar.add(supprimerPersonnelBtn);
toolBar.add(new SeparatorToolItem());
Button rafraichirPersonnelBtn = new Button("Rafraichir");
rafraichirPersonnelBtn.setIcon(Images.ICONES.rafraichir());
rafraichirPersonnelBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
rafraichirPersonnel();
}
});
toolBar.add(rafraichirPersonnelBtn);
toolBar.add(new SeparatorToolItem());
personneExistanteMagazin = new ListStore<Personne>();
personneExistanteMagazin.add(new ArrayList<Personne>());
ModelType modelTypePersonnes = new ModelType();
modelTypePersonnes.setRoot("personnes");
modelTypePersonnes.setTotalName("nbElements");
modelTypePersonnes.addField("cp_fmt_nom_complet");
modelTypePersonnes.addField("cp_nom");
modelTypePersonnes.addField("cp_prenom");
modelTypePersonnes.addField("cp_truk_courriel");
modelTypePersonnes.addField("cp_truk_telephone");
modelTypePersonnes.addField("cp_ce_truk_specialite");
String displayNamePersonnes = "cp_fmt_nom_complet";
ProxyPersonnes<ModelData> proxyPersonnes = new ProxyPersonnes<ModelData>(sequenceur);
personneExistanteCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyPersonnes, modelTypePersonnes, displayNamePersonnes);
 
// TODO : dans GXT 2.0 plus besoin de l'adaptateur, on peut ajouter la combobox directement sur la toolbar
//> CHECK
toolBar.add(personneExistanteCombo);
Button ajouterPersonneExistanteBtn = new Button("Ajouter à la grille");
ajouterPersonneExistanteBtn.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
Personne personneExistante = new Personne(personneExistanteCombo.getValeur());
if (personneExistante != null) {
StructureAPersonne membreDuPersonnel = new StructureAPersonne(personneExistante, "", StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
ajouterMembreAGrillePersonnel(membreDuPersonnel);
}
}
});
toolBar.add(ajouterPersonneExistanteBtn);
cp.setTopComponent(toolBar);
 
ColumnModel cm = new ColumnModel(configs);
grillePersonnel = new EditorGrid<StructureAPersonne>(personnelGrilleMagazin, cm);
grillePersonnel.setHeight("100%");
grillePersonnel.setBorders(true);
grillePersonnel.setSelectionModel(sm);
grillePersonnel.addPlugin(checkColumn);
grillePersonnel.addPlugin(r);
grillePersonnel.getView().setForceFit(true);
grillePersonnel.setAutoExpandColumn("specialite");
grillePersonnel.setStripeRows(true);
grillePersonnel.setTrackMouseOver(true);
personnelGrilleMagazin.addListener(Store.Update, new Listener<StoreEvent<StructureAPersonne>>() {
public void handleEvent(StoreEvent<StructureAPersonne> ce) {
 
StructureAPersonne structureAPersonne = ce.getModel();
String etat = structureAPersonne.get("etat");
if (etat!=null && !etat.equals(aDonnee.ETAT_AJOUTE) && structureAPersonne!=null && !UtilString.isEmpty(structureAPersonne.getId())) {
ce.getModel().set("etat", aDonnee.ETAT_MODIFIE);
}
}
});
cp.add(grillePersonnel);
personnelOnglet.add(cp);
return personnelOnglet;
}
private TabItem creerOngletIdentification() {
//+-----------------------------------------------------------------------------------------------------------+
// Onlget formulaire IDENTIFICATION
identificationOnglet = creerOnglet("Identification", "identification");
identificationOnglet.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
peuplerStructureIdentification();
identificationOnglet.layout();
}
});
//+-----------------------------------------------------------------------------------------------------------+
// Champs cachés
idStructureChp = new HiddenField<String>();
//+-----------------------------------------------------------------------------------------------------------+
// Fieldset IDENTITÉ
FieldSet fieldSetIdentite = new FieldSet();
fieldSetIdentite.setHeading("Identité");
fieldSetIdentite.setCollapsible(true);
fieldSetIdentite.setLayout(creerFormLayout(120, LabelAlign.LEFT));
nomStructureChp = new TextField<String>();
nomStructureChp.setTabIndex(tabIndex++);
nomStructureChp.setFieldLabel("Nom de la structure");
nomStructureChp.setAllowBlank(false);
nomStructureChp.getMessages().setBlankText("Ce champ est obligatoire.");
nomStructureChp.addStyleName(ComposantClass.OBLIGATOIRE);
nomStructureChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
fieldSetIdentite.add(nomStructureChp, new FormData(450, 0));
ModelType modelTypeProjets = new ModelType();
modelTypeProjets.setRoot("projets");
modelTypeProjets.setTotalName("nbElements");
modelTypeProjets.addField("cpr_nom");
modelTypeProjets.addField("cpr_id_projet");
String displayNameProjets = "cpr_nom";
ProxyProjets<ModelData> proxyProjets = new ProxyProjets<ModelData>(sequenceur);
projetsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyProjets, modelTypeProjets, displayNameProjets);
projetsCombo.getCombo().setTabIndex(tabIndex++);
projetsCombo.getCombo().setFieldLabel(i18nC.projetChamp());
projetsCombo.getCombo().setForceSelection(true);
projetsCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE);
projetsCombo.getCombo().addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
projetsCombo.setWidth(120, 520);
fieldSetIdentite.add(projetsCombo, new FormData(520, 0));
// Création du sous-formulaire : Acronyme
LayoutContainer ligne = new LayoutContainer();
ligne.setLayout(new ColumnLayout());
ligne.setSize(600, -1);
LayoutContainer gauche = new LayoutContainer();
gauche.setLayout(creerFormLayout(120, LabelAlign.LEFT));
LayoutContainer droite = new LayoutContainer();
droite.setLayout(creerFormLayout(10, LabelAlign.LEFT));
ListStore<InterneValeur> acronymes = new ListStore<InterneValeur>();
acronymes.add(InterneValeurListe.getTypeAcronyme());
comboAcronyme = new ComboBox<InterneValeur>();
comboAcronyme.setTabIndex(tabIndex++);
comboAcronyme.setEmptyText("Sélectioner un type d'acronyme...");
comboAcronyme.setFieldLabel("Type d'acronyme");
comboAcronyme.setDisplayField("nom");
comboAcronyme.setStore(acronymes);
comboAcronyme.setEditable(false);
comboAcronyme.setTypeAhead(true);
comboAcronyme.setTriggerAction(TriggerAction.ALL);
comboAcronyme.addSelectionChangedListener(new SelectionChangedListener<InterneValeur>() {
@Override
public void selectionChanged(SelectionChangedEvent<InterneValeur> se) {
String acronymeAbr = se.getSelectedItem().getAbr();
if (acronymeAbr.equals("IH")) {
mnhnChp.hide();
ihChp.show();
} else if (acronymeAbr.equals("MNHN")) {
ihChp.hide();
mnhnChp.show();
} else if (acronymeAbr.equals("")) {
ihChp.hide();
mnhnChp.hide();
comboAcronyme.clearSelections();
}
}
});
gauche.add(comboAcronyme, new FormData("95%"));
ihChp = new TextField<String>();
ihChp.setTabIndex(tabIndex++);
ihChp.setLabelSeparator("");
ihChp.setToolTip("Index Herbariorum : herbier de plus de 5000 échantillons");
ihChp.hide();
droite.add(ihChp, new FormData("95%"));
mnhnChp = new TextField<String>();
mnhnChp.setTabIndex(tabIndex++);
mnhnChp.setLabelSeparator("");
mnhnChp.setToolTip("Acronyme MNHN : herbier de moins de 5000 échantillons");
mnhnChp.hide();
droite.add(mnhnChp, new FormData("95%"));
ligne.add(gauche, new ColumnData(.5));
ligne.add(droite, new ColumnData(.5));
fieldSetIdentite.add(ligne);
// Création du sous-formulaire : Type de Structure
LayoutContainer ligneTs = new LayoutContainer();
ligneTs.setLayout(new ColumnLayout());
ligneTs.setSize(600, -1);
LayoutContainer gaucheTs = new LayoutContainer();
gaucheTs.setLayout(creerFormLayout(120, LabelAlign.LEFT));
LayoutContainer droiteTs = new LayoutContainer();
droiteTs.setLayout(creerFormLayout(10, LabelAlign.LEFT));
ListStore<InterneValeur> typesStructure = new ListStore<InterneValeur>();
typesStructure.add(InterneValeurListe.getTypeStructure());
comboTypeStructure = new ComboBox<InterneValeur>();
comboTypeStructure.setTabIndex(tabIndex++);
comboTypeStructure.setEmptyText("Sélectioner un type de structure...");
comboTypeStructure.setFieldLabel("Statut des structures");
comboTypeStructure.setDisplayField("nom");
comboTypeStructure.setStore(typesStructure);
comboTypeStructure.setEditable(false);
comboTypeStructure.setTypeAhead(true);
comboTypeStructure.setTriggerAction(TriggerAction.ALL);
comboTypeStructure.addSelectionChangedListener(new SelectionChangedListener<InterneValeur>() {
@Override
public void selectionChanged(SelectionChangedEvent<InterneValeur> se) {
String typeAbr = se.getSelectedItem().getAbr();
if (typeAbr.equals("stpu")) {
comboLstpr.hide();
comboLstpu.show();
} else if (typeAbr.equals("stpr")) {
comboLstpu.hide();
comboLstpr.show();
} else if (typeAbr.equals("")) {
comboLstpr.hide();
comboLstpu.hide();
comboTypeStructure.clearSelections();
}
}
});
gaucheTs.add(comboTypeStructure, new FormData("95%"));
magazinLstpu = new ListStore<Valeur>();
comboLstpu = new ComboBox<Valeur>();
comboLstpu.setTabIndex(tabIndex++);
//comboLstpu.setFieldLabel("Statut des structures publiques");
comboLstpu.setLabelSeparator("");
comboLstpu.setDisplayField("nom");
comboLstpu.setEditable(false);
comboLstpu.setTriggerAction(TriggerAction.ALL);
comboLstpu.setStore(magazinLstpu);
comboLstpu.hide();
droiteTs.add(comboLstpu, new FormData("95%"));
mediateur.obtenirListeValeurEtRafraichir(this, "stpu", sequenceur);
magazinLstpr = new ListStore<Valeur>();
comboLstpr = new ComboBox<Valeur>();
comboLstpr.setTabIndex(tabIndex++);
//comboLstpr.setFieldLabel("Statut des structures privées");
comboLstpr.setLabelSeparator("");
comboLstpr.setDisplayField("nom");
comboLstpr.setEditable(false);
comboLstpr.setTriggerAction(TriggerAction.ALL);
comboLstpr.setStore(magazinLstpr);
comboLstpr.hide();
droiteTs.add(comboLstpr, new FormData("95%"));
mediateur.obtenirListeValeurEtRafraichir(this, "stpr", sequenceur);
ligneTs.add(gaucheTs, new ColumnData(0.5));
ligneTs.add(droiteTs, new ColumnData(0.5));
fieldSetIdentite.add(ligneTs);
dateFondationChp = new TextField();
dateFondationChp.setTabIndex(tabIndex++);
dateFondationChp.setFieldLabel("Date de fondation");
fieldSetIdentite.add(dateFondationChp);
nbreTotalPersonneStructureChp = new NumberField();
nbreTotalPersonneStructureChp.setFieldLabel("Nombre de personne travaillant dans l'institution");
nbreTotalPersonneStructureChp.setFormat(NumberFormat.getFormat("#"));
nbreTotalPersonneStructureChp.setToolTip(i18nC.champNumerique());
fieldSetIdentite.add(nbreTotalPersonneStructureChp);
 
identificationOnglet.add(fieldSetIdentite);
//+-----------------------------------------------------------------------------------------------------------+
// Fieldset DESCRIPTION
FieldSet fieldSetDescription = new FieldSet();
fieldSetDescription.setHeading("Description");
fieldSetDescription.setCollapsible(true);
fieldSetDescription.setLayout(creerFormLayout(120, LabelAlign.LEFT));
descriptionChp = new TextArea();
descriptionChp.setTabIndex(tabIndex++);
descriptionChp.setFieldLabel("Description");
fieldSetDescription.add(descriptionChp, new FormData(550, 0));
conditionAccesChp = new TextArea();
conditionAccesChp.setTabIndex(tabIndex++);
conditionAccesChp.setFieldLabel("Conditions d'accès");
fieldSetDescription.add(conditionAccesChp, new FormData(550, 0));
conditionUsageChp = new TextArea();
conditionUsageChp.setTabIndex(tabIndex++);
conditionUsageChp.setFieldLabel("Conditions d'usage");
fieldSetDescription.add(conditionUsageChp, new FormData(550, 0));
identificationOnglet.add(fieldSetDescription);
//+-----------------------------------------------------------------------------------------------------------+
// Fieldset ADRESSE
LayoutContainer principalFdAdresse = new LayoutContainer();
principalFdAdresse.setLayout(new ColumnLayout());
principalFdAdresse.setSize(1050, -1);
LayoutContainer gaucheFdAdresse = new LayoutContainer();
gaucheFdAdresse.setLayout(creerFormLayout(null, LabelAlign.LEFT));
LayoutContainer droiteFdAdresse = new LayoutContainer();
droiteFdAdresse.setLayout(creerFormLayout(100, LabelAlign.LEFT));
droiteFdAdresse.setWidth(700);
FieldSet fieldSetAdresse = new FieldSet();
fieldSetAdresse.setHeading("Adresse");
fieldSetAdresse.setCollapsible(true);
fieldSetAdresse.setLayout(creerFormLayout(null, LabelAlign.LEFT));
adrChp = new TextArea();
adrChp.setTabIndex(tabIndex++);
adrChp.setFieldLabel("Adresse (Nom du batiment, rue...)");
fieldSetAdresse.add(adrChp, new FormData(550, 0));
adrComplementChp = new TextArea();
adrComplementChp.setTabIndex(tabIndex++);
adrComplementChp.setFieldLabel("Complément d'adresse (BP, étage...)");
fieldSetAdresse.add(adrComplementChp, new FormData(550, 0));
cpChp = new TextField<String>();
cpChp.setTabIndex(tabIndex++);
cpChp.setFieldLabel("Code postal");
gaucheFdAdresse.add(cpChp, new FormData("95%"));
villeChp = new TextField<String>();
villeChp.setTabIndex(tabIndex++);
villeChp.setFieldLabel("Ville");
gaucheFdAdresse.add(villeChp, new FormData("95%"));
ModelType modelTypesPays = new ModelType();
modelTypesPays.setRoot("valeurs");
modelTypesPays.setTotalName("nbElements");
modelTypesPays.addField("cmlv_nom");
modelTypesPays.addField("cmlv_id_valeur");
modelTypesPays.addField("cmlv_abreviation");
modelTypesPays.addField("cmlv_description");
String displayNamePays = "cmlv_nom";
String nomListeTypes = "pays";
ProxyValeur<ModelData> proxyPays = new ProxyValeur<ModelData>(nomListeTypes, sequenceur);
comboPays = new ChampComboBoxRechercheTempsReelPaginable(proxyPays, modelTypesPays, displayNamePays);
comboPays.setWidth(100,500);
comboPays.getCombo().setTabIndex(tabIndex++);
comboPays.getCombo().setFieldLabel("Pays");
comboPays.getCombo().setForceSelection(true);
comboPays.getCombo().setTemplate(getTemplatePays());
SelectionChangedListener<ModelData> selectionChange = new SelectionChangedListener<ModelData>() {
public void selectionChanged(SelectionChangedEvent se) {
// Rafraichir avec le pays sélectionné
comboRegion.clear();
obtenirListeRegionParPays((new Valeur(se.getSelectedItem())).getAbreviation().toString());
}
};
comboPays.getCombo().addSelectionChangedListener(selectionChange);
droiteFdAdresse.add(comboPays, new FormData("95%"));
magazinRegion = new ListStore<Valeur>();
comboRegion = new ComboBox<Valeur>();
comboRegion.setTabIndex(tabIndex++);
comboRegion.setFieldLabel("Région");
comboRegion.setEmptyText("Sélectionner une région...");
comboRegion.setDisplayField("nom");
comboRegion.setTypeAhead(true);
comboRegion.setTriggerAction(TriggerAction.ALL);
comboRegion.setStore(magazinRegion);
droiteFdAdresse.add(comboRegion, new FormData("95%"));
 
latitudeChp = new TextField<String>();
latitudeChp.setRegex(Pattern.latitude);
latitudeChp.setToolTip("Format : nombre décimal positif ou négatif de 0 à 90.");
latitudeChp.getMessages().setRegexText("La valeur saisie n'est pas une latitude valide. Exemples de latitude : -45,302010 ou 45.252423 ou 25,16.");
latitudeChp.setTabIndex(tabIndex++);
latitudeChp.setFieldLabel("Latitude (Nord)");
gaucheFdAdresse.add(latitudeChp, new FormData("95%"));
longitudeChp = new TextField<String>();
longitudeChp.setRegex(Pattern.longitude);
longitudeChp.setToolTip("Format : nombre décimal positif ou négatif de 0 à 180.");
longitudeChp.getMessages().setRegexText("La valeur saisie n'est pas une longitude valide. Exemples de longitude : -150,302010 ou 150.252423 ou 25,16.");
longitudeChp.setTabIndex(tabIndex++);
longitudeChp.setFieldLabel("Longitude (Est)");
droiteFdAdresse.add(longitudeChp, new FormData("95%"));
principalFdAdresse.add(gaucheFdAdresse, new ColumnData(.5));
principalFdAdresse.add(droiteFdAdresse, new ColumnData(.5));
fieldSetAdresse.add(principalFdAdresse);
identificationOnglet.add(fieldSetAdresse);
//+-----------------------------------------------------------------------------------------------------------+
// Fieldset TÉLÉPHONE et EMAIL
LayoutContainer principalFdTelMail = new LayoutContainer();
principalFdTelMail.setLayout(new ColumnLayout());
principalFdTelMail.setSize(700, -1);
LayoutContainer gaucheFdTelMail = new LayoutContainer();
gaucheFdTelMail.setLayout(creerFormLayout(60, LabelAlign.LEFT));
LayoutContainer droiteFdTelMail = new LayoutContainer();
droiteFdTelMail.setLayout(creerFormLayout(60, LabelAlign.LEFT));
FieldSet fieldSetTelMail = new FieldSet();
fieldSetTelMail.setHeading("Communication");
fieldSetTelMail.setCollapsible(true);
fieldSetTelMail.setLayout(creerFormLayout(null, LabelAlign.LEFT));
telChp = new TextField<String>();
telChp.setTabIndex(tabIndex++);
telChp.setFieldLabel("Téléphone fixe");
gaucheFdTelMail.add(telChp, new FormData("95%"));
faxChp = new TextField<String>();
faxChp.setTabIndex(tabIndex++);
faxChp.setFieldLabel("Fax");
droiteFdTelMail.add(faxChp, new FormData("95%"));
emailChp = new TextField<String>();
emailChp.setTabIndex(tabIndex++);
emailChp.setFieldLabel("Courriel");
emailChp.setToolTip("Saisir le courriel de l'organisation, pas de courriel individuel. Ex. : accueil@organisation.org");
gaucheFdTelMail.add(emailChp, new FormData("95%"));
urlChp = new TextField<String>();
urlChp.setTabIndex(tabIndex++);
urlChp.setFieldLabel("Site web");
droiteFdTelMail.add(urlChp, new FormData("95%"));
principalFdTelMail.add(gaucheFdTelMail, new ColumnData(.5));
principalFdTelMail.add(droiteFdTelMail, new ColumnData(.5));
fieldSetTelMail.add(principalFdTelMail);
identificationOnglet.add(fieldSetTelMail);
return identificationOnglet;
}
public void obtenirListeRegionParPays(String strPays) {
mediateur.obtenirListeRegionsEtRafraichir(this, "region", strPays);
}
private void mettreAJourRegion() {
//Met à jour la combo box en sélectionnant la valeur enregistrée pour la personne
if (identification.get("ce_truk_region") != null && comboRegion.getStore().getCount() > 0) {
Valeur valeurRegion = comboRegion.getStore().findModel("id_valeur", identification.get("ce_truk_region"));
if (valeurRegion!=null) {
comboRegion.setValue(valeurRegion);
} else if (identification.get("ce_truk_region").toString().startsWith("AUTRE##")) {
comboRegion.setRawValue(identification.get("ce_truk_region").toString().replaceFirst("^AUTRE##", ""));
}
}
}
private native String getTemplatePays() /*-{
return [
'<tpl for=".">',
'<div class="x-combo-list-item">{cmlv_nom} ({cmlv_abreviation})</div>',
'</tpl>'
].join("");
}-*/;
private void peuplerCasesACocher(String donnees, CheckBoxGroup groupeCac, TextField<String> champAutre) {
String[] valeurs = donnees.split(";;");
for (int i = 0; i < valeurs.length; i++) {
if (valeurs[i].startsWith("AUTRE##")) {
champAutre.setValue(valeurs[i].replaceFirst("^AUTRE##", ""));
} else {
//TODO : check : List<CheckBox> cases = groupeCac.getAll();
List<Field<?>> cases = groupeCac.getAll();
for (int j = 0; j < cases.size(); j++) {
if (cases.get(j).getId().equals("val-"+valeurs[i])) {
((CheckBox) cases.get(j)).setValue(true);
}
}
}
}
}
private void peuplerBoutonsRadio(String valeur, RadioGroup groupeBr) {
//List<Radio> boutons = groupeBr.getAll();
List<Field<?>> boutons = groupeBr.getAll();
String id = valeur+"_"+groupeBr.getName().replace("_grp", "");
for (int i = 0; i < boutons.size(); i++) {
if (boutons.get(i).getId().equals(id)) {
((Radio) boutons.get(i)).setValue(true);
}
}
}
private String creerChaineDenormalisee(List<CheckBox> liste) {
String identifiants = "";
if (liste != null) {
int taille = liste.size();
for (int i = 0; i < taille; i++) {
CheckBox cac = liste.get(i);
if (cac.isEnabled()) {
identifiants = identifiants.concat(";;"+cac.getData("id"));
}
}
identifiants.replaceFirst("^;;", "");
}
return identifiants;
}
public void afficherChampSupplementaire(Radio radioBtn) {
//GWT.log("Nom btn : "+radioBtn.getName()+" - Nom group : "+radioBtn.getGroup().getName(), null);
// Valeur du bouton radio déclenchant l'affichage des composants cachés
String valeurPourAfficher = "oui";
// Construction de la liste des composants à afficher/cacher
String radioGroupeNom = radioBtn.getGroup().getName();
ArrayList<Object> composants = new ArrayList<Object>();
if (radioGroupeNom.equals("action_mark_grp")) {
composants.add(actionTrukCp);
} else if (radioGroupeNom.equals("future_action_mark_grp")) {
composants.add(futureActionChp);
} else if (radioGroupeNom.equals("sans_motif_acces_mark_grp")) {
composants.add(sansMotifAccesChp);
} else if (radioGroupeNom.equals("avec_motif_acces_mark_grp")) {
composants.add(avecMotifAccesChp);
} else if (radioGroupeNom.equals("recherche_mark_grp")) {
composants.add(provenanceRechercheTrukCp);
composants.add(typeRechercheTrukCp);
} else if (radioGroupeNom.equals("formation_mark_grp")) {
composants.add(formationChp);
} else if (radioGroupeNom.equals("collection_commune_mark_grp")) {
composants.add(collectionAutreTrukCp);
} else if (radioGroupeNom.equals("restauration_mark_grp")) {
composants.add(opRestauTrukCp);
} else if (radioGroupeNom.equals("traitement_mark_grp")) {
composants.add(traitementTrukCp);
} else if (radioGroupeNom.equals("echantillon_acquisition_mark_grp")) {
composants.add(traitementAcquisitionMarkRGrpChp);
} else if (radioGroupeNom.equals("traitement_acquisition_mark_grp")) {
composants.add(traitementAcquisitionMarkLabel);
composants.add(poisonTraitementTrukCp);
composants.add(insecteTraitementTrukCp);
} else if (radioGroupeNom.equals("materiel_conservation_ce_grp")) {
composants.add(autreMaterielTrukCp);
valeurPourAfficher = "non";
}
// Nous affichons/cachons les composant de la liste
final int nbreComposants = composants.size();
//GWT.log("Id : "+radioBtn.getId()+" - Class : "+radioBtn.getClass().toString()+"- Taille : "+tailleMax, null);
//Window.alert("Radio grp nom : "+radioGroupeNom+" - Id btn : "+radioBtn.getId()+" - Class : "+radioBtn.getClass().toString()+"- Taille : "+tailleMax);
for (int i = 0; i < nbreComposants; i++) {
// En fonction du type de bouton cliquer, on affiche ou cache les champs
String type = radioBtn.getBoxLabel().toLowerCase();
//GWT.log(type, null);
if (radioBtn.getValue() == true) {
if (type.equals(valeurPourAfficher)) {
((Component) composants.get(i)).show();
} else {
((Component) composants.get(i)).hide();
}
}
// Si on a à faire à un ContentPanel, on l'actualise pour déclencher l'affichage
if (composants.get(i) instanceof ContentPanel) {
((ContentPanel) composants.get(i)).layout();
}
}
}
public void rafraichir(Object nouvellesDonnees) {
try {
if (nouvellesDonnees instanceof Information) {
Information info = (Information) nouvellesDonnees;
rafraichirInformation(info);
} else if (nouvellesDonnees instanceof ValeurListe) {
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
rafraichirValeurListe(listeValeurs);
} else {
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
}
} catch (Exception e) {
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), e);
}
controlerFermeture();
}
public void rafraichirInformation(Information info) {
if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
GWT.log("MESSAGES:\n"+info.getMessages().toString(), null);
}
 
if (info.getType().equals("modif_structure")) {
InfoLogger.display("Modification d'une institution", info.toString());
} else if (info.getType().equals("ajout_structure")) {
if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
String structureId = (String) info.getDonnee(0);
InfoLogger.display("Ajout d'une Institution", "L'intitution '"+structureId+"' a bien été ajoutée");
// Suite à la récupération de l'id de l'institution nouvellement ajoutée nous ajoutons le personnel
mediateur.ajouterStructureAPersonne(this, structureId, personnelAjoute);
} else {
InfoLogger.display("Ajout d'une Institution", info.toString());
}
} else if (info.getType().equals("modif_structure_a_personne")) {
InfoLogger.display("Modification du Personnel", info.toString());
GWT.log("Decompte:"+decompteRafraichissementPersonnel, null);
testerLancementRafraichirPersonnel();
} else if (info.getType().equals("suppression_structure_a_personne")) {
InfoLogger.display("Suppression du Personnel", info.toString());
GWT.log("Decompte:"+decompteRafraichissementPersonnel, null);
testerLancementRafraichirPersonnel();
} else if (info.getType().equals("ajout_structure_a_personne")) {
InfoLogger.display("Ajout du Personnel", info.toString());
GWT.log("Decompte:"+decompteRafraichissementPersonnel, null);
testerLancementRafraichirPersonnel();
} else if (info.getType().equals("selection_structure")) {
InfoLogger.display("Modification d'une institution", info.toString());
String titre = i18nC.titreModifFormStructurePanneau();
if (info.getDonnee(0) != null) {
identification = (Structure) info.getDonnee(0);
if (onglets.getSelectedItem().equals(identificationOnglet)) {
peuplerStructureIdentification();
}
// Composition du titre
titre += " - ID : "+identification.getId();
}
if (info.getDonnee(1) != null) {
conservation = (StructureConservation) info.getDonnee(1);
if (onglets.getSelectedItem().equals(conservationOnglet)) {
peuplerStructureConservation();
}
}
if (info.getDonnee(2) != null) {
valorisation = (StructureValorisation) info.getDonnee(2);
if (valorisation != null) {
if (onglets.getSelectedItem().equals(valorisationOnglet)) {
peuplerStructureValorisation();
}
}
}
} else if (info.getType().equals("liste_structure_a_personne")) {
if (info.getDonnee(0) != null) {
personnel = (StructureAPersonneListe) info.getDonnee(0);
peuplerStructurePersonnel();
personnelOnglet.layout();
InfoLogger.display("Chargement du Personnel", "ok");
 
// Remise à zéro des modification dans la liste du personnel
personnelModifie = new StructureAPersonneListe();
personnelAjoute = new StructureAPersonneListe();
personnelSupprime = new StructureAPersonneListe();
}
}
}
public void rafraichirValeurListe(ValeurListe listeValeurs) {
List<Valeur> liste = listeValeurs.toList();
 
// Test pour savoir si la liste contient des éléments
if (liste.size() > 0) {
if (listeValeurs.getId().equals(config.getListeId("stpr"))) {
magazinLstpr.removeAll();
magazinLstpr.add(liste);
comboLstpr.setStore(magazinLstpr);
}
if (listeValeurs.getId().equals(config.getListeId("stpu"))) {
magazinLstpu.removeAll();
magazinLstpu.add(liste);
comboLstpu.setStore(magazinLstpu);
}
if (listeValeurs.getId().equals(config.getListeId("statut"))) {
magazinLiStatut.removeAll();
magazinLiStatut.add(liste);
comboLiStatut.setStore(magazinLiStatut);
}
if (listeValeurs.getId().equals(config.getListeId("fonction"))) {
// FIXME : le store ne contient pas tout le temps les données, chose étrange.
// On stocke donc les données dans une variables de la classe pour recharger le store si besoin.
fonctionsListe = liste;
fonctionsMagazin.removeAll();
fonctionsMagazin.add(liste);
fonctionsCombo.setStore(fonctionsMagazin);
}
if (listeValeurs.getId().equals(config.getListeId("region"))) {
magazinRegion.removeAll();
magazinRegion.add(liste);
comboRegion.setStore(magazinRegion);
mettreAJourRegion();
}
if (listeValeurs.getId().equals(config.getListeId("localStockage"))) {
localStockageAutreChp = new TextField<String>();
creerChoixMultipleCac(localStockageTrukCp, localStockageTrukCacGrpChp, listeValeurs, localStockageAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("meubleStockage"))) {
meubleStockageAutreChp = new TextField<String>();
creerChoixMultipleCac(meubleStockageTrukCp, meubleStockageTrukCacGrpChp, listeValeurs, meubleStockageAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("parametreStockage"))) {
parametreStockageAutreChp = new TextField<String>();
creerChoixMultipleCac(parametreStockageTrukCp, parametreStockageTrukCacGrpChp, listeValeurs, parametreStockageAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("autreCollection"))) {
if (collectionAutreTrukCp != null && collectionAutreTrukCp.getItemByItemId("collectionAutreTrukCacGrpChp") == null) {
collectionAutreTrukCacGrpChp.setId("collectionAutreTrukCacGrpChp");
collectionAutreAutreChp = new TextField<String>();
creerChoixMultipleCac(collectionAutreTrukCp, collectionAutreTrukCacGrpChp, listeValeurs, collectionAutreAutreChp);
}
if (autreCollectionTrukCp != null && autreCollectionTrukCp.getItemByItemId("autreCollectionTrukCacGrpChp") == null) {
autreCollectionTrukCacGrpChp.setId("autreCollectionTrukCacGrpChp");
autreCollectionAutreChp = new TextField<String>();
creerChoixMultipleCac(autreCollectionTrukCp, autreCollectionTrukCacGrpChp, listeValeurs, autreCollectionAutreChp);
}
}
if (listeValeurs.getId().equals(config.getListeId("opRestau"))) {
opRestauAutreChp = new TextField<String>();
creerChoixMultipleCac(opRestauTrukCp, opRestauTrukCacGrpChp, listeValeurs, opRestauAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("onep"))) {
creerChoixUniqueBoutonRadio(materielConservationCeRGrpChp, listeValeurs);
materielConservationCp.add(materielConservationCeRGrpChp);
materielConservationCp.layout();
}
if (listeValeurs.getId().equals(config.getListeId("autreMateriel"))) {
autreMaterielAutreChp = new TextField<String>();
creerChoixMultipleCac(autreMaterielTrukCp, autreMaterielTrukCacGrpChp, listeValeurs, autreMaterielAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("poisonTraitement"))) {
poisonTraitementAutreChp = new TextField<String>();
creerChoixMultipleCac(poisonTraitementTrukCp, poisonTraitementTrukCacGrpChp, listeValeurs, poisonTraitementAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("insecteTraitement"))) {
if (traitementTrukCp != null && traitementTrukCp.getItemByItemId("traitementTrukCacGrpChp") == null) {
traitementTrukCacGrpChp.setId("traitementTrukCacGrpChp");
traitementAutreChp = new TextField<String>();
creerChoixMultipleCac(traitementTrukCp, traitementTrukCacGrpChp, listeValeurs, traitementAutreChp);
}
if (insecteTraitementTrukCp != null && insecteTraitementTrukCp.getItemByItemId("insecteTraitementTrukCacGrpChp") == null) {
insecteTraitementTrukCacGrpChp.setId("insecteTraitementTrukCacGrpChp");
insecteTraitementAutreChp = new TextField<String>();
creerChoixMultipleCac(insecteTraitementTrukCp, insecteTraitementTrukCacGrpChp, listeValeurs, insecteTraitementAutreChp);
}
}
if (listeValeurs.getId().equals(config.getListeId("actionValorisation"))) {
actionAutreChp = new TextField<String>();
creerChoixMultipleCac(actionTrukCp, actionTrukCacGrpChp, listeValeurs, actionAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("continentEtFr"))) {
provenanceRechercheAutreChp = new TextField<String>();
creerChoixMultipleCac(provenanceRechercheTrukCp, provenanceRechercheTrukCacGrpChp, listeValeurs, provenanceRechercheAutreChp);
}
if (listeValeurs.getId().equals(config.getListeId("typeRecherche"))) {
typeRechercheAutreChp = new TextField<String>();
creerChoixMultipleCac(typeRechercheTrukCp, typeRechercheTrukCacGrpChp, listeValeurs, typeRechercheAutreChp);
}
//GWT.log("La liste #"+listeValeurs.getId()+" a été reçue!", null);
} else {
GWT.log("La liste #"+listeValeurs.getId()+" ne contient aucune valeurs!", null);
}
}
private void testerLancementRafraichirPersonnel() {
decompteRafraichissementPersonnel--;
if (decompteRafraichissementPersonnel == 0) {
// Nous rechargeons la liste du Personnel
rafraichirPersonnel();
}
}
private void rafraichirPersonnel() {
decompteRafraichissementPersonnel = 0;
if (mode.equals(MODE_MODIFIER)) {
initialiserGrillePersonnelEnModification();
} else if (mode.equals(MODE_AJOUTER)) {
initialiserGrillePersonnelEnAjout();
}
}
private void rafraichirPersonneExistante(String nom) {
mediateur.selectionnerPersonneParNomComplet(this, null, nom+"%", null);
}
private void ajouterMembreAGrillePersonnel(StructureAPersonne personnel) {
grillePersonnel.stopEditing();
personnelGrilleMagazin.insert(personnel, 0);
grillePersonnel.startEditing(0, 0);
}
private void initialiserGrillePersonnelEnAjout() {
personnelGrilleMagazin.removeAll();
StructureAPersonne conservateurDesCollections = new StructureAPersonne(StructureAPersonne.FONCTION_CONSERVATEUR, StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
ajouterMembreAGrillePersonnel(conservateurDesCollections);
StructureAPersonne directeurDuPersonnel = new StructureAPersonne(StructureAPersonne.FONCTION_DIRECTEUR, StructureAPersonne.ROLE_EQUIPE, StructureAPersonne.ETAT_AJOUTE);
ajouterMembreAGrillePersonnel(directeurDuPersonnel);
personnelOnglet.layout();
}
private void initialiserGrillePersonnelEnModification() {
mediateur.selectionnerStructureAPersonne(this, identification.getId(), StructureAPersonne.ROLE_EQUIPE, null);
}
}
Property changes:
Added: svn:mergeinfo
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/vues/structure/StructureForm.java:r1136-1368
/trunk/src/org/tela_botanica/client/vues/structure/.
New file
Property changes:
Added: svn:mergeinfo
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/vues/structure:r1136-1291