Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 874 → Rev 875

/trunk/src/org/tela_botanica/client/vues/PersonneForm.java
24,6 → 24,7
import org.tela_botanica.client.modeles.PersonneListe;
import org.tela_botanica.client.modeles.Projet;
import org.tela_botanica.client.modeles.ProjetListe;
import org.tela_botanica.client.modeles.Publication;
import org.tela_botanica.client.modeles.Utilisateur;
import org.tela_botanica.client.modeles.Valeur;
import org.tela_botanica.client.modeles.ValeurListe;
87,7 → 88,7
private Mediateur mediateur;
private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG);
private Personne personneSelectionnee, personneSauvegarde = null;
private String mode = "";
protected String mode = "";
//hmIdentite[...] référence par une chaine de caractère tous les composants de l'onglet Identite
private HashMap<String, Widget>hmIdentite = new HashMap<String, Widget>();
100,32 → 101,45
public static final String MODE_AJOUTER = "AJOUT";
public static final String MODE_MODIFIER = "MODIF";
private final String personneId;
private Personne personne = null;
private String personneId = null;
private FormBinding binding = null;
// CONSTRUCTEUR
public PersonneForm(Mediateur mediateurCourrant, String mode, String personneId) {
initialiserPersonneForm(mediateurCourrant, personneId);
}
public PersonneForm(Mediateur mediateurCourrant, String personneId, Rafraichissable vueARafraichirApresValidation) {
vueExterneARafraichirApresValidation = vueARafraichirApresValidation;
initialiserPersonneForm(mediateurCourrant, personneId);
}
public PersonneForm(Mediateur mediateur, String mode, String personneId) {
private void initialiserPersonneForm(Mediateur mediateurCourrant, String personneIdCourrant) {
personne = new Personne();
personne.setId(personneIdCourrant);
personneId = personneIdCourrant;
this.personneId = personneId;
this.mediateur = mediateur;
initialiserFormulaire(mediateur, mode, MenuApplicationId.PERSONNE);
String modeDeCreation = (personneId.isEmpty() ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER);
initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.PERSONNE);
 
initialiserComposants();
genererTitreFormulaire();
String titreFormulaire = "";
if (mode.equals(MODE_MODIFIER)) {
titreFormulaire = mediateur.i18nC.personneModeModifier() + " ID: " + personneId;
} else {
titreFormulaire = mediateur.i18nC.personneModeAjout();
if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
mediateur.selectionnerPersonne(this, personne, null);
}
panneauFormulaire.setHeading(titreFormulaire);
}
private void genererTitreFormulaire() {
String titre = i18nC.personneModeAjout();
if (mode.equals(Formulaire.MODE_MODIFIER)) {
titre = i18nC.personneModeModifier()+" - "+i18nC.id()+": "+personneId;
}
panneauFormulaire.setHeading(titre);
}
public void initialiserComposants() {
personneSelectionnee = new Personne();
personneSauvegarde = new Personne();
148,7 → 162,7
TabPanel formulaireOnglets = new TabPanel();
//Tab 1 : identite
tiIdentite = new TabItem(mediateur.i18nC.personneIdentite());
tiIdentite = new TabItem(i18nC.personneIdentite());
tiIdentite.setLayout(new FormLayout());
tiIdentite.setScrollMode(Scroll.AUTO);
156,13 → 170,13
hmIdentite.put("tiIdentite", tiIdentite);
//Tab 2 : Adresse
tiAdresses = new TabItem(mediateur.i18nC.adresse());
tiAdresses = new TabItem(i18nC.adresse());
tiAdresses.setLayout(new FormLayout());
tiAdresses.setScrollMode(Scroll.AUTO);
formulaireOnglets.add(tiAdresses);
//Tab 3 : Infos Naturalistes
tiInfosNat = new TabItem(mediateur.i18nC.personneInfoNat());
tiInfosNat = new TabItem(i18nC.personneInfoNat());
tiInfosNat.setLayout(new FormLayout());
tiInfosNat.setScrollMode(Scroll.AUTO);
200,13 → 214,13
formLayout.setLabelAlign(LabelAlign.LEFT);
FieldSet fsProjet = new FieldSet();
fsProjet.setHeading(mediateur.i18nC.menuProjet());
fsProjet.setHeading(i18nC.menuProjet());
fsProjet.setLayout(new FormLayout());
ListStore<Projet> storeProjets = new ListStore<Projet>();
ComboBox cbProjets = new ComboBox<Projet>();
cbProjets.setFieldLabel(mediateur.i18nC.personneProjet()+ " :");
cbProjets.setEmptyText(mediateur.i18nC.txtListeProjetDefaut());
cbProjets.setFieldLabel(i18nC.personneProjet()+ " :");
cbProjets.setEmptyText(i18nC.txtListeProjetDefaut());
cbProjets.setLabelSeparator("");
cbProjets.setDisplayField("nom");
cbProjets.setEditable(false);
227,7 → 241,7
// Nom complet : Affiché que si valeurs saisies
LabelField nomComplet = new LabelField();
nomComplet.setFieldLabel(mediateur.i18nC.personneNomComplet() +" :");
nomComplet.setFieldLabel(i18nC.personneNomComplet() +" :");
nomComplet.hide();
fsNoms.add(nomComplet);
469,7 → 483,7
LayoutContainer lcLogoUrl = new LayoutContainer();
hmIdentite.put("lcLogoUrl", lcLogoUrl);
ChampMultiValeursImage logo = new ChampMultiValeursImage(mediateur.i18nC.personneLogos());
ChampMultiValeursImage logo = new ChampMultiValeursImage(i18nC.personneLogos());
logo.setImageHeight("150px");
logo.setValeurParDefaut("http://");
logo.setValidation(Pattern.url, "http://www.monsite.com/mon_image.jpg");
606,11 → 620,11
FieldSet fsInfosNat = new FieldSet();
fsInfosNat.setTitle("Informations Naturaliste");
ChampMultiValeurs specialite = new ChampMultiValeurs(mediateur.i18nC.personneSpecialite());
ChampMultiValeurs specialite = new ChampMultiValeurs(i18nC.personneSpecialite());
fsInfosNat.add(specialite);
hmInfosNat.put("specialite", specialite);
ChampMultiValeursMultiTypes recolte = new ChampMultiValeursMultiTypes(mediateur.i18nC.personneRecolte());
ChampMultiValeursMultiTypes recolte = new ChampMultiValeursMultiTypes(i18nC.personneRecolte());
recolte.initialiserType("pays");
hmInfosNat.put("recolte", recolte);
/trunk/src/org/tela_botanica/client/vues/FormulaireOnglet.java
31,6 → 31,7
parametrer(this);
addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
setAcces(true);
actualiser();
}
});
/trunk/src/org/tela_botanica/client/vues/CollectionForm.java
1,5 → 1,7
package org.tela_botanica.client.vues;
 
import java.util.ArrayList;
 
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
import org.tela_botanica.client.interfaces.Rafraichissable;
7,6 → 9,7
import org.tela_botanica.client.modeles.Information;
import org.tela_botanica.client.modeles.MenuApplicationId;
import org.tela_botanica.client.modeles.Valeur;
import org.tela_botanica.client.util.UtilArray;
 
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.ButtonEvent;
14,6 → 17,7
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.Info;
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;
169,7 → 173,7
GWT.log("MESSAGES:\n"+info.getMessages().toString(), null);
}
if (info.getType().equals("modif_structure")) {
if (info.getType().equals("modif_collection")) {
Info.display("Modification d'une collection", info.toString());
} else if (info.getType().equals("selection_collection")) {
Info.display("Modification d'une collection", info.toString());
178,6 → 182,17
}
peupler();
actualiserTitrePanneau();
} else if (info.getType().equals("ajout_collection")) {
if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
String collectionId = (String) info.getDonnee(0);
Info.display("Ajout d'une collection", "La collection '"+collectionId+"' a bien été ajoutée");
// Suite à la récupération de l'id de l'institution nouvellement ajoutée nous ajoutons les personnes et les publications liées
personneOnglet.rafraichir(info);
publicationOnglet.rafraichir(info);
} else {
Info.display("Ajout d'une Institution", info.toString());
}
}
}
192,6 → 207,7
 
private void peuplerOnglets() {
generalOnglet.peupler();
personneOnglet.peupler();
}
 
private void actualiserTitrePanneau() {
239,10 → 255,16
mediateur.modifierCollection(this, collection);
}
}
soumettreOnglets();
}
return fomulaireValide;
}
private void soumettreOnglets() {
personneOnglet.soumettre();
}
protected void reinitialiserFormulaire() {
if (mode.equals(StructureForm.MODE_MODIFIER)) {
mediateur.afficherFormCollection(collection.getId());
274,6 → 296,34
}
protected boolean verifierFormulaire() {
ArrayList<String> messages = new ArrayList<String>();
// Vérification des infos sur le nom de la collection
if (nomChp.getValue() == null || nomChp.getValue().equals("") || collection.getNom().equals("")) {
messages.add("Veuillez donner un nom à la collection.");
}
// Vérification des infos sur le type de collection
if (typesCollectionCombo.getValue() == null || typesCollectionCombo.getValue().equals("") || collection.getIdProjet().equals("")) {
messages.add("Veuillez sélectionner un type pour la collection.");
}
messages.addAll(verifierOnglets());
// Affichage des messages d'alerte
if (messages.size() != 0) {
String[] tableauDesMessages = {};
tableauDesMessages = messages.toArray(tableauDesMessages);
MessageBox.alert("Erreurs de saisies", UtilArray.implode(tableauDesMessages, "<br />"), null);
return false;
}
return true;
}
private ArrayList<String> verifierOnglets() {
ArrayList<String> messages = new ArrayList<String>();
messages.addAll(generalOnglet.verifier());
messages.addAll(personneOnglet.verifier());
return messages;
}
}
/trunk/src/org/tela_botanica/client/vues/Formulaire.java
61,6 → 61,7
protected String menuIdCourant = null;
protected static Boolean clicBoutonvalidation = false;
protected Rafraichissable vueExterneARafraichirApresValidation = null;
 
public FormPanel getFormulaire() {
return panneauFormulaire;
/trunk/src/org/tela_botanica/client/vues/CollectionFormGeneral.java
1,5 → 1,7
package org.tela_botanica.client.vues;
 
import java.util.ArrayList;
 
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
import org.tela_botanica.client.composants.ChampMultiValeurs;
68,9 → 70,6
setId("general");
setText(Mediateur.i18nC.collectionGeneral());
collection = ((CollectionForm) formulaire).collection;
collectionCollectee = ((CollectionForm) formulaire).collectionCollectee;
creerChampsCache();
creerFieldsetLiaison();
creerFieldsetAdministratif();
79,6 → 78,11
creerFieldsetType();
}
 
private void initialiserCollection() {
collection = ((CollectionForm) formulaire).collection;
collectionCollectee = ((CollectionForm) formulaire).collectionCollectee;
}
private void creerChampsCache() {
// Champs cachés
idCollectionChp = new HiddenField<String>();
273,8 → 277,12
}
public void peupler() {
initialiserCollection();
if (collection != null) {
idCollectionChp.setValue(collection.getId());
setValeurComboProjets();
setValeurComboStructures();
setValeurComboCollections();
typeDepotCombo.peupler(collection.getTypeDepot());
coteChp.setValue(collection.getCote());
292,15 → 300,27
lieuCouvertureChp.peupler(collection.getCouvertureLieu());
specimenTypeCombo.peupler(collection.getSpecimenType());
nbreTypeChp.setValue(Integer.parseInt(collection.getSpecimenTypeNbre()));
nbreTypeChp.setValue((collection.getSpecimenTypeNbre().equals("") ? 0 : Integer.parseInt(collection.getSpecimenTypeNbre())));
precisionTypeNbreCombo.peupler(collection.getSpecimenTypeNbrePrecision());
classementSpecimenTypeCombo.peupler(collection.getSpecimenTypeClassement());
}
}
public ArrayList<String> verifier() {
ArrayList<String> messages = new ArrayList<String>();
if (projetsCombo.getValue() == null || projetsCombo.getValue().equals("") || collection.getIdProjet().equals("")) {
messages.add("Veuillez sélectionner un projet pour la collection.");
}
return messages;
}
public void collecter() {
initialiserCollection();
if (etreAccede()) {
collectionCollectee.setId(idCollectionChp.getValue());
collectionCollectee.setCollectionMereId(getValeurComboProjets());
collectionCollectee.setIdStructure(getValeurComboStructures());
collectionCollectee.setCollectionMereId(getValeurComboCollections());
collectionCollectee.setTypeDepot(typeDepotCombo.getValeur());
collectionCollectee.setCote(coteChp.getValue());
324,19 → 344,40
}
}
private void mettreAJourValeurComboProjets() {
private String getValeurComboProjets() {
String valeur = "";
if (projetsCombo.getValue() != null) {
valeur = projetsCombo.getValue().getId();
}
return valeur;
}
private void setValeurComboProjets() {
if (projetsCombo.getStore() != null && collection != null) {
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", collection.getIdProjet()));
}
}
private void mettreAJourValeurComboStructures() {
private String getValeurComboStructures() {
String valeur = "";
if (structuresCombo.getValue() != null) {
valeur = structuresCombo.getValue().getId();
}
return valeur;
}
private void setValeurComboStructures() {
if (structuresCombo.getStore() != null && collection != null) {
structuresCombo.setValue(structuresCombo.getStore().findModel("id_structure", collection.getIdStructure()));
}
}
private void mettreAJourValeurComboCollections() {
private String getValeurComboCollections() {
String valeur = "";
if (collectionsCombo.getValue() != null) {
valeur = collectionsCombo.getValue().getId();
}
return valeur;
}
private void setValeurComboCollections() {
if (collectionsCombo.getStore() != null && collection != null) {
collectionsCombo.setValue(collectionsCombo.getStore().findModel("id_collection", collection.getCollectionMereId()));
}
346,15 → 387,15
if (nouvellesDonnees instanceof ProjetListe) {
ProjetListe projets = (ProjetListe) nouvellesDonnees;
Formulaire.rafraichirComboBox(projets, projetsCombo);
mettreAJourValeurComboProjets();
setValeurComboProjets();
} else if (nouvellesDonnees instanceof StructureListe) {
StructureListe structures = (StructureListe) nouvellesDonnees;
Formulaire.rafraichirComboBox(structures, structuresCombo);
mettreAJourValeurComboStructures();
setValeurComboStructures();
} else if (nouvellesDonnees instanceof CollectionListe) {
CollectionListe collections = (CollectionListe) nouvellesDonnees;
Formulaire.rafraichirComboBox(collections, collectionsCombo);
mettreAJourValeurComboCollections();
setValeurComboCollections();
} else if (nouvellesDonnees instanceof ValeurListe) {
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
rafraichirValeurListe(listeValeurs);
/trunk/src/org/tela_botanica/client/vues/StructureForm.java
1852,7 → 1852,7
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
}
} catch (Exception e) {
GWT.log(mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), e);
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), e);
}
controlerFermetureApresRafraichissement();
/trunk/src/org/tela_botanica/client/vues/CollectionFormPersonne.java
7,14 → 7,20
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.images.Images;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Collection;
import org.tela_botanica.client.modeles.CollectionAPersonne;
import org.tela_botanica.client.modeles.CollectionAPersonneListe;
import org.tela_botanica.client.modeles.Information;
import org.tela_botanica.client.modeles.InterneValeur;
import org.tela_botanica.client.modeles.Personne;
import org.tela_botanica.client.modeles.PersonneListe;
import org.tela_botanica.client.modeles.Publication;
import org.tela_botanica.client.modeles.StructureAPersonne;
import org.tela_botanica.client.modeles.UniteBase;
import org.tela_botanica.client.modeles.UniteRangement;
import org.tela_botanica.client.modeles.Valeur;
import org.tela_botanica.client.modeles.ValeurListe;
import org.tela_botanica.client.modeles.aDonnee;
 
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.ButtonEvent;
25,6 → 31,7
import com.extjs.gxt.ui.client.event.Listener;
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.ContentPanel;
33,12 → 40,15
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
import com.extjs.gxt.ui.client.widget.form.ComboBox;
import com.extjs.gxt.ui.client.widget.form.FormPanel;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnData;
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.Grid;
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer;
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
import com.extjs.gxt.ui.client.widget.grid.HeaderGroupConfig;
import com.extjs.gxt.ui.client.widget.grid.RowNumberer;
50,19 → 60,25
 
public class CollectionFormPersonne extends FormulaireOnglet implements Rafraichissable {
private Collection collection = null;
private Collection collectionCollectee = null;
private ContentPanel panneauPrincipal = null;
private ToolBar barreOutils = null;
private Grid<Personne> grille;
private Grid<CollectionAPersonne> grille;
private ComboBox<Valeur> typeRelationCombo = null;
private PersonneListe personnes = null;
private PersonneListe personnesAjoutes = null;
private PersonneListe personnesSupprimes = null;
private CollectionAPersonneListe personnes = null;
private CollectionAPersonneListe personnesAjoutees = null;
private CollectionAPersonneListe personnesModifiees = null;
private CollectionAPersonneListe personnesSupprimees = null;
private ComboBox<Personne> personnesSaisisComboBox = null;
private Button personnesBoutonSupprimer = null;
private Button personnesBoutonModifier = null;
private Button ajouterPersonneSaisiBouton = null;
private ValeurListe listeIon = null;
private FenetreForm fenetreFormulaire = null;
private static final String ETAT_AJOUTE = "A";
private static final String ETAT_SUPPRIME = "S";
77,6 → 93,7
panneauPrincipal.setTopComponent(barreOutils);
grille = creerGrille();
panneauPrincipal.add(grille);
mediateur.obtenirListeValeurEtRafraichir(this, "ion");
mediateur.obtenirListeValeurEtRafraichir(this, "relationPersonneCollection");
add(panneauPrincipal);
85,12 → 102,18
private void initialiser() {
// Remise à zéro des modification dans la liste des auteurs
personnesAjoutes = new PersonneListe();
personnesSupprimes = new PersonneListe();
personnesAjoutees = new CollectionAPersonneListe();
personnesModifiees = new CollectionAPersonneListe();
personnesSupprimees = new CollectionAPersonneListe();
// Actualisation de l'état des boutons de la barre d'outils
actualiserEtatBoutonsBarreOutils();
}
private void initialiserCollection() {
collection = ((CollectionForm) formulaire).collection;
collectionCollectee = ((CollectionForm) formulaire).collectionCollectee;
}
private ContentPanel creerPanneauContenantGrille() {
ContentPanel panneau = new ContentPanel();
111,7 → 134,7
barreOutils.add(new Text(" ou "));
personnesSaisisComboBox = creerComboBoxAuteursSaisis();
personnesSaisisComboBox = creerComboBoxPersonnesSaisies();
barreOutils.add(personnesSaisisComboBox);
barreOutils.add(new SeparatorToolItem());
136,10 → 159,11
Button bouton = new Button(i18nC.ajouter());
bouton.setIcon(Images.ICONES.vcardAjouter());
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
 
@Override
public void componentSelected(ButtonEvent ce) {
FenetreForm fenetre = creerFenetreModaleAvecFormulairePersonne(Formulaire.MODE_AJOUTER);
fenetre.show();
fenetreFormulaire = creerFenetreModaleAvecFormulairePersonne(Formulaire.MODE_AJOUTER);
fenetreFormulaire.show();
}
});
return bouton;
151,12 → 175,12
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
Personne auteurSaisiSelectionne = grille.getSelectionModel().getSelectedItem();
if (auteurSaisiSelectionne == null) {
CollectionAPersonne personneSaisiSelectionne = grille.getSelectionModel().getSelectedItem();
if (personneSaisiSelectionne == null) {
Info.display(i18nC.informationTitreGenerique(), i18nC.selectionnerPersonne());
} else {
FenetreForm fenetre = creerFenetreModaleAvecFormulairePersonne(Formulaire.MODE_MODIFIER);
fenetre.show();
fenetreFormulaire = creerFenetreModaleAvecFormulairePersonne(Formulaire.MODE_MODIFIER);
fenetreFormulaire.show();
}
}
});
164,33 → 188,30
}
private FenetreForm creerFenetreModaleAvecFormulairePersonne(String mode) {
String personneId = null;
if (mode.equals(Formulaire.MODE_MODIFIER)) {
CollectionAPersonne personneSaisieSelectionnee = grille.getSelectionModel().getSelectedItem();
personneId = personneSaisieSelectionnee.getId();
}
final FenetreForm fenetre = new FenetreForm("");
final PersonneForm formulaire = creerFormulairePersonne(fenetre);
final PersonneForm formulaire = creerFormulairePersonne(fenetre, personneId);
fenetre.add(formulaire);
return fenetre;
}
private PersonneForm creerFormulairePersonne(final FenetreForm fenetre) {
PersonneForm formulaire = new PersonneForm(mediateur, PersonneForm.MODE_AJOUTER, null);
/*fenetre.setHeading(formulaire.getHeading());
formulaire.setHeaderVisible(false);
formulaire.setTopComponent(null);*/
private PersonneForm creerFormulairePersonne(final FenetreForm fenetre, String personneId) {
PersonneForm formulaire = new PersonneForm(mediateur, personneId, this);
FormPanel panneauFormulaire = formulaire.getFormulaire();
fenetre.setHeading(panneauFormulaire.getHeading());
panneauFormulaire.setHeaderVisible(false);
panneauFormulaire.setTopComponent(null);
 
// TODO : gérer la barre d'outil avec des évènements spécifique au contexte de fenêtre modale
SelectionListener<ButtonEvent> ecouteur = creerEcouteurValidationFormulairePersonne(fenetre, formulaire);
final ButtonBar barreValidation = new FormulaireBarreValidation(ecouteur);
//formulaire.setBottomComponent(barreValidation);
panneauFormulaire.setBottomComponent(barreValidation);
if (mode.equals(Formulaire.MODE_MODIFIER)) {
// TODO : simplifier la gestion de l'ajout des données d'une Personne au form pour la modification... (pas besoin de passer par une liste).
Information info = new Information("liste_personne");
PersonneListe personnes = new PersonneListe();
Personne auteurSaisiSelectionne = grille.getSelectionModel().getSelectedItem();
personnes.put(auteurSaisiSelectionne.getId(), auteurSaisiSelectionne);
info.setDonnee(0, personnes);
formulaire.rafraichir(info);
}
return formulaire;
}
200,20 → 221,17
public void componentSelected(ButtonEvent ce) {
String code = ((Button) ce.getComponent()).getData("code");
if (code.equals(FormulaireBarreValidation.CODE_BOUTON_VALIDER)) {
Boolean ok = formulaire.enregistrer();
if (ok == true) {
// Fermer fenêtre et ajouter/modifier l'élément dans la liste
if (formulaire.soumettreFormulaire()) {
fenetre.hide();
}
fenetre.hide();
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_APPLIQUER)) {
Boolean ok = formulaire.enregistrer();
if (ok == true) {
// Fermer fenêtre et ajouter/modifier l'élément dans la liste
}
formulaire.soumettreFormulaire();
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_ANNULER)) {
fenetre.hide();
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_REINITIALISER)) {
formulaire.reinitialiserFormulaire();
fenetreFormulaire.hide();
fenetreFormulaire = creerFenetreModaleAvecFormulairePersonne(formulaire.mode);
fenetreFormulaire.show();
}
}
};
227,11 → 245,11
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent ce) {
Personne auteurSaisiSelectionne = grille.getSelectionModel().getSelectedItem();
if (auteurSaisiSelectionne == null) {
CollectionAPersonne personneSaisiSelectionnee = grille.getSelectionModel().getSelectedItem();
if (personneSaisiSelectionnee == null) {
Info.display(i18nC.informationTitreGenerique(), i18nC.selectionnerPersonne());
} else {
supprimerDansGrille(auteurSaisiSelectionne);
supprimerDansGrille(personneSaisiSelectionnee);
}
}
});
250,7 → 268,7
return bouton;
}
private ComboBox<Personne> creerComboBoxAuteursSaisis() {
private ComboBox<Personne> creerComboBoxPersonnesSaisies() {
ListStore<Personne> personnesSaisiesStore = new ListStore<Personne>();
personnesSaisiesStore.add(new ArrayList<Personne>());
274,8 → 292,8
@Override
public void handleEvent(BaseEvent be) {
if (personnesSaisisComboBox.getValue() instanceof Personne) {
Personne auteurSaisiSelectionne = personnesSaisisComboBox.getValue();
ajouterDansGrille(auteurSaisiSelectionne);
Personne personneSaisiSelectionnee = personnesSaisisComboBox.getValue();
ajouterDansGrille(personneSaisiSelectionnee);
personnesSaisisComboBox.setValue(null);
}
}
285,33 → 303,38
private void ajouterDansGrille(Personne personne) {
if (personne != null) {
CollectionAPersonne relationCollectionPersonne = new CollectionAPersonne();
relationCollectionPersonne.setPersonne(personne);
// Ajout de la personne ajoutée à la liste
if (personne.getId() != null && !personne.getId().equals("")) {
personnesAjoutes.put(personne.getId(), personne);
if (relationCollectionPersonne.getId() != null && !relationCollectionPersonne.getId().equals("")) {
personnesAjoutees.put(relationCollectionPersonne.getId(), relationCollectionPersonne);
}
// Définition de l'état
personne.set("etat", ETAT_AJOUTE);
relationCollectionPersonne.set("etat", ETAT_AJOUTE);
// Ajout à la grille
grille.getStore().insert(personne, 0);
grille.getStore().insert(relationCollectionPersonne, 0);
grille.getSelectionModel().select(0, false);
}
}
private void supprimerDansGrille(Personne personne) {
if (personne != null) {
private void supprimerDansGrille(CollectionAPersonne relationCollectionPersonne) {
if (relationCollectionPersonne != null) {
// Ajout de la personne supprimée à la liste
if ((personne.get("etat") == null || !personne.get("etat").equals(ETAT_AJOUTE)) && personne.getId() != null && !personne.getId().equals("")) {
personnesSupprimes.put(personne.getId(), personne);
if ((relationCollectionPersonne.get("etat") == null || !relationCollectionPersonne.get("etat").equals(ETAT_AJOUTE))
&& relationCollectionPersonne.getId() != null
&& !relationCollectionPersonne.getId().equals("")) {
personnesSupprimees.put(relationCollectionPersonne.getId(), relationCollectionPersonne);
}
// Suppression de l'enregistrement de la grille
grille.getStore().remove(personne);
grille.getStore().remove(relationCollectionPersonne);
}
}
 
private Grid<Personne> creerGrille() {
private Grid<CollectionAPersonne> creerGrille() {
ListStore<Personne> storeGrille = new ListStore<Personne>();
storeGrille.addListener(Store.Add, new Listener<StoreEvent<Personne>>() {
public void handleEvent(StoreEvent<Personne> ce) {
363,7 → 386,7
}
};
ColumnConfig typeRelationColonne = new ColumnConfig("type_relation", i18nC.typeRelationPersonneCollection(), 75);
ColumnConfig typeRelationColonne = new ColumnConfig("id_role", i18nC.typeRelationPersonneCollection(), 75);
typeRelationColonne.setEditor(editeurRelation);
colonnes.add(typeRelationColonne);
370,15 → 393,13
colonnes.add(new ColumnConfig("fmt_nom_complet", i18nC.personneNomComplet(), 150));
colonnes.add(new ColumnConfig("nom", i18nC.personneNom(), 75));
colonnes.add(new ColumnConfig("prenom", i18nC.personnePrenom(), 75));
colonnes.add(new ColumnConfig("prefixe", i18nC.personnePrefixe(), 50));
//colonnes.add(new ColumnConfig("truk_nom_autre", i18nC.personneNomAutre(), 200));
colonnes.add(new ColumnConfig("naissance_date", i18nC.date(), 75));
colonnes.add(new ColumnConfig("naissance_lieu", i18nC.lieu(), 100));
colonnes.add(new ColumnConfig("ce_deces", i18nC.personneDecedeeInterogation(), 50));
colonnes.add(creerColonneDeces());
colonnes.add(new ColumnConfig("deces_date", i18nC.date(), 75));
colonnes.add(new ColumnConfig("deces_lieu", i18nC.lieu(), 100));
GridSelectionModel<Personne> modeleDeSelection = new GridSelectionModel<Personne>();
GridSelectionModel<CollectionAPersonne> modeleDeSelection = new GridSelectionModel<CollectionAPersonne>();
ColumnModel modeleDeColonnes = new ColumnModel(colonnes);
modeleDeColonnes.addHeaderGroup(0, 1, new HeaderGroupConfig(i18nC.personneIdentite(), 1, 4));
385,7 → 406,7
modeleDeColonnes.addHeaderGroup(0, 5, new HeaderGroupConfig(i18nC.personneNaissance(), 1, 2));
modeleDeColonnes.addHeaderGroup(0, 7, new HeaderGroupConfig(i18nC.personneDeces(), 1, 3));
EditorGrid<Personne> grillePersonne = new EditorGrid<Personne>(storeGrille, modeleDeColonnes);
EditorGrid<CollectionAPersonne> grillePersonne = new EditorGrid<CollectionAPersonne>(storeGrille, modeleDeColonnes);
grillePersonne.setHeight("100%");
grillePersonne.setBorders(true);
grillePersonne.setSelectionModel(modeleDeSelection);
398,6 → 419,23
return grillePersonne;
}
public ColumnConfig creerColonneDeces() {
GridCellRenderer<CollectionAPersonne> decesRendu = new GridCellRenderer<CollectionAPersonne>() {
@Override
public String render(CollectionAPersonne modele, String property, ColumnData config, int rowIndex, int colIndex, ListStore<CollectionAPersonne> store, Grid<CollectionAPersonne> grid) {
String deces = modele.getPersonne().getDeces();
if (listeIon != null && modele.getPersonne().getDeces().matches("[0-9]+")) {
deces = listeIon.get(modele.getPersonne().getDeces()).getNom();
}
modele.set("_deces_", deces);
return deces;
}
};
ColumnConfig decesColonne = new ColumnConfig("_deces_", Mediateur.i18nC.personneDecedeeInterogation(), 50);
decesColonne.setRenderer(decesRendu);
return decesColonne;
}
public void actualiserEtatBoutonsBarreOutils() {
// Activation des boutons si la grille contient un élément
if (grille.getStore().getCount() > 0) {
424,7 → 462,9
}
private void rafraichirValeurListe(ValeurListe listeValeurs) {
if (listeValeurs.getId().equals(config.getListeId("relationPersonneCollection"))) {
if (listeValeurs.getId().equals(config.getListeId("ion"))) {
listeIon = listeValeurs;
} else if (listeValeurs.getId().equals(config.getListeId("relationPersonneCollection"))) {
Formulaire.rafraichirComboBox(listeValeurs, typeRelationCombo);
} else {
GWT.log("Gestion de la liste "+listeValeurs.getId()+" non implémenté!", null);
452,14 → 492,100
//auteurs = (CollectionAPersonneListe) info.getDonnee(0);
peupler();
}
} else if (info.getType().equals("ajout_collection")) {
if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
String collectionId = (String) info.getDonnee(0);
// Suite à la récupération de l'id de la collection nouvellement ajoutée nous ajoutons les personnes liées
// En mode AJOUT, il ne peut que y avoir des personnes liées ajoutées
mediateur.ajouterCollectionAPersonne(this, collectionId, personnesAjoutees);
} else {
Info.display("Ajout d'une Institution", info.toString());
}
} else if (info.getType().equals("modif_collection_a_personne")) {
Info.display("Modification des personnes liées à la collection", info.toString());
} else if (info.getType().equals("suppression_collection_a_personne")) {
Info.display("Suppression des personnes liées à la collection", info.toString());
} else if (info.getType().equals("ajout_collection_a_personne")) {
Info.display("Ajout des personnes liées à la collection", info.toString());
}
}
 
private void peupler() {
public void peupler() {
initialiserCollection();
layout();
Info.display(i18nC.chargementPersonne(), i18nC.ok());
}
 
public ArrayList<String> verifier() {
ArrayList<String> messages = new ArrayList<String>();
String personneNumero = "";
int nbrePersonne = grille.getStore().getCount();
if (nbrePersonne > 0) {
for (int i = 0; i < nbrePersonne; i++) {
CollectionAPersonne personne = grille.getStore().getAt(i);
if (personne.getIdRole().equals("")) {
personneNumero += (i != 0 ? ", " : "")+(i+1);
}
}
if (!personneNumero.equals("")) {
messages.add("Veuillez indiquez le type de relation existant entre la collection et les personnes numéros : "+personneNumero);
}
}
return messages;
}
public void collecter() {
initialiserCollection();
if (etreAccede()) {
int nbrePersonne = grille.getStore().getCount();
for (int i = 0; i < nbrePersonne; i++) {
CollectionAPersonne personne = grille.getStore().getAt(i);
// Seules les lignes ajoutées ou modifiées sont prises en compte.
Record enregistrement = grille.getStore().getRecord(personne);
if (grille.getStore().getModifiedRecords().contains(enregistrement) == true
|| (personne.get("etat") != null && personne.get("etat").equals(aDonnee.ETAT_AJOUTE) )) {
// Gestion de l'id de la structure
if (mode.equals(Formulaire.MODE_MODIFIER)) {
personne.setIdCollection(collection.getId());
}
// Ajout de la personne dans la liste correspondant à son état (ajouté ou modifié)
if (personne.get("etat") != null && personne.get("etat").equals(aDonnee.ETAT_AJOUTE)) {// Une personne ajoutée
personnesAjoutees.put(""+i, personne);
} else {// Une personne modifiée
personnesModifiees.put(personne.getId(), personne);
}
} else {
GWT.log("Personne non modifiées : "+personne.getPersonne().getPrenom()+" "+personne.getPersonne().getNom(), null);
}
}
}
}
public void soumettre() {
if (mode.equals(Formulaire.MODE_MODIFIER)) {
if (personnesModifiees.size() == 0 && personnesAjoutees.size() == 0 && personnesSupprimees.size() == 0) {
Info.display("Modification des personnes liées", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
} else {
if (personnesModifiees.size() != 0) {
mediateur.modifierCollectionAPersonne(this, personnesModifiees);
}
// Ajout des relations CollectionAPersonne
if (personnesAjoutees.size() != 0) {
mediateur.ajouterCollectionAPersonne(this, collection.getId(), personnesAjoutees);
}
// Suppression des relations StructureAPersonne
if (personnesSupprimees.size() != 0) {
mediateur.supprimerCollectionAPersonne(this, personnesSupprimees);
}
}
}
}
private void obtenirPersonnesSaisis(String nom) {
mediateur.selectionnerPersonneParNomComplet(this, null, nom+"%");
}
/trunk/src/org/tela_botanica/client/vues/PublicationForm.java
66,9 → 66,6
private boolean publicationValideOk = false;
private boolean auteursValideOk = false;
 
private Rafraichissable vueExterneARafraichirApresValidation = null;
 
 
public PublicationForm(Mediateur mediateurCourrant, String publicationId) {
initialiserPublicationForm(mediateurCourrant, publicationId);
}
/trunk/src/org/tela_botanica/client/vues/CollectionDetailVue.java
128,9 → 128,7
" <span class='{css_label}'>{i18n_cote} :</span> {cote}<br />"+
" <span class='{css_label}'>{i18n_mere} :</span> {mere}<br />"+
" <span class='{css_label}'>{i18n_type_ncd} :</span> {type_ncd}<br />"+
" <span class='{css_label}'>{i18n_type_botanique} :</span> {type_botanique}<br />"+
" <span class='{css_label}'>{i18n_type_depot} :</span> {type_depot}<br />"+
" <span class='{css_label}'>{i18n_nbre_echantillon} :</span> {nbre_echantillon}<br />"+
" </div>"+
" <div class='{css_fieldset}'>"+
" <h2>{i18n_general_collection_titre}</h2>"+
170,6 → 168,8
"<div class='{css_corps}'>"+
" <div class='{css_fieldset}'>"+
" <h2>{i18n_titre_description}</h2>"+
" <span class='{css_label}'>{i18n_type_botanique} :</span> {type_botanique}<br />"+
" <span class='{css_label}'>{i18n_nbre_echantillon} :</span> {nbre_echantillon}<br />"+
" </div>"+
" <hr class='{css_clear}'/>"+
"</div>";
196,7 → 196,7
}
private void chargerOntologie() {
String[] listesCodes = {"typeCollectionBota", "typeCollectionNcd", "typeDepot"};
String[] listesCodes = {"typeCollectionBota", "typeCollectionNcd", "typeDepot", "groupementPrincipe", "realisationBut"};
lancerChargementListesValeurs(listesCodes);
}
266,9 → 266,7
generalParams.set("i18n_cote", i18nC.cote());
generalParams.set("i18n_mere", i18nC.collectionMere());
generalParams.set("i18n_type_ncd", i18nC.typeCollectionNcd());
generalParams.set("i18n_type_botanique", i18nC.typeCollectionBotanique());
generalParams.set("i18n_type_depot", i18nC.typeDepot());
generalParams.set("i18n_nbre_echantillon", i18nC.nbreEchantillon());
 
generalParams.set("i18n_general_collection_titre", i18nC.collectionGeneralTitre());
generalParams.set("i18n_description", i18nC.description());
283,8 → 281,9
String nomAlternatif = construireTxtTruck(collection.getNomAlternatif());
String urls = construireTxtTruck(collection.getUrls());
String typeNcd = construireTxtListeOntologie(collection.getTypeNcd());
String typeBota = construireTxtListeOntologie(collection.getBotanique().getType());
String typeDepot = construireTxtListeOntologie(collection.getTypeDepot());
String groupementBut = construireTxtListeOntologie(collection.getGroupementBut());
String groupementPrincipe = construireTxtListeOntologie(collection.getGroupementPrincipe());
generalParams.set("nom_alternatif", nomAlternatif);
generalParams.set("acronyme", acronyme);
292,16 → 291,14
generalParams.set("cote", collection.getCote());
generalParams.set("mere", collection.getCollectionMereNom());
generalParams.set("type_ncd", typeNcd);
generalParams.set("type_botanique", typeBota);
generalParams.set("type_depot", typeDepot);
generalParams.set("nbre_echantillon", collection.getBotanique().getNbreEchantillon());
 
generalParams.set("description", collection.getDescription());
generalParams.set("description_specialiste", collection.getDescriptionSpecialiste());
generalParams.set("historique", collection.getHistorique());
generalParams.set("web", urls);
generalParams.set("groupement_principe", collection.getGroupementPrincipe());
generalParams.set("groupement_but", collection.getGroupementBut());
generalParams.set("groupement_principe", groupementPrincipe);
generalParams.set("groupement_but", groupementBut);
afficherOnglet(generalTpl, generalParams, generalOnglet);
}
323,7 → 320,14
private void afficherDescription() {
Params descriptionParams = new Params();
descriptionParams.set("i18n_titre_description", i18nC.collectionDescriptionTitre());
descriptionParams.set("i18n_type_botanique", i18nC.typeCollectionBotanique());
descriptionParams.set("i18n_nbre_echantillon", i18nC.nbreEchantillon());
String typeBota = construireTxtListeOntologie(collection.getBotanique().getType());
descriptionParams.set("type_botanique", typeBota);
descriptionParams.set("nbre_echantillon", collection.getBotanique().getNbreEchantillon());
afficherOnglet(descriptionTpl, descriptionParams, descriptionOnglet);
}