Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 1467 → Rev 1468

/trunk/src/org/tela_botanica/client/vues/collection/CollectionForm.java
105,13 → 105,13
Valeur valeur = typesCollectionCombo.getValue();
// Gestion des onglets en fonction du type de collection
mediateur.activerChargement("");
mediateur.activerChargement(this, "Chargement des onglets");
if (valeur != null && valeur.getId().equals(Valeur.COLLECTION_NCD_HERBIER)) {
activerOngletsHerbier();
} else {
activerOngletsDefaut();
}
mediateur.desactiverChargement();
mediateur.desactiverChargement(this);
}
};
/trunk/src/org/tela_botanica/client/vues/collection/CollectionFormDescription.java
54,8 → 54,11
import com.extjs.gxt.ui.client.widget.grid.AggregationRowConfig;
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.SummaryType;
108,8 → 111,7
creerFieldsetPrecision();
creerStorePrecision();
creerUniteRangement();
creerUniteBase();
creerFieldSetTypesUnite();
creerFieldsetConservation();
creerFieldsetEtiquette();
creerFieldsetTraitement();
179,7 → 181,25
return precisionCombo;
}
private void creerUniteRangement() {
private void creerFieldSetTypesUnite() {
FieldSet typesUniteFieldSet = new FieldSet();
typesUniteFieldSet.setHeading(i18nC.collectionUniteType());
typesUniteFieldSet.setCollapsible(true);
typesUniteFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
etatUniteRangementCombo = new ChampComboBoxListeValeurs(i18nC.collectionUniteRangementEtatGeneral(), "etat");
etatUniteRangementCombo.setToolTip(i18nC.collectionUniteRangementEtatGeneralInfo());
etatUniteRangementCombo.setTrie("id_valeur");
etatUniteRangementCombo.setWidth(300);
typesUniteFieldSet.add(etatUniteRangementCombo);
typesUniteFieldSet.add(creerUniteRangement());
typesUniteFieldSet.add(creerUniteBase());
add(typesUniteFieldSet);
}
private ContentPanel creerUniteRangement() {
ContentPanel panneauGrille = creerPanneauContenantGrille(i18nC.collectionUniteRangementTitre());
uniteRangementGrille = creerGrilleUniteRangement();
189,7 → 209,7
ToolBar barreOutils = creerBarreOutilsGrilleUniteRangement();
panneauGrille.setTopComponent(barreOutils);
add(panneauGrille);
return panneauGrille;
}
private ContentPanel creerPanneauContenantGrille(String titre) {
198,7 → 218,8
panneau.setIcon(Images.ICONES.table());
panneau.setLayout(new FitLayout());
panneau.setFrame(true);
panneau.setScrollMode(Scroll.AUTO);
panneau.setSize(800, 200);
panneau.setScrollMode(Scroll.NONE);
panneau.setCollapsible(true);
panneau.setStyleAttribute("margin", "5px 0");
313,6 → 334,7
for (int i = 0; i < nbreUnite; i++) {
UniteRangement uniteDansGrille = uniteRangementGrille.getStore().getAt(i);
UniteRangement uniteEnregistree = unitesEnregistrees.get(uniteDansGrille.getId());
if (uniteEnregistree != null) {
uniteEnregistree.setType(uniteDansGrille.getType());
listeUniteMaj.add(uniteEnregistree);
324,7 → 346,7
Iterator<String> it = unitesEnregistrees.keySet().iterator();
while (it.hasNext()) {
String cle = it.next();
if (cle.matches(aDonnee.TYPE_AUTRE+aDonnee.SEPARATEUR_TYPE_VALEUR)) {
if (cle.matches(aDonnee.TYPE_AUTRE+aDonnee.SEPARATEUR_TYPE_VALEUR+"[a-zA-Z0-9]+")) {
UniteRangement uniteAutreEnregistree = unitesEnregistrees.get(cle);
listeUniteMaj.add(uniteAutreEnregistree);
}
360,12 → 382,12
uniteRangement.setId(uniteTypeIdDonnees[0]);
uniteRangement.setTypeAutre(false);
unitesEnregistrees.put(uniteTypeIdDonnees[0], uniteRangement);
} else {
} else {
uniteRangement.setType(uniteTypeIdDonnees[0]);
uniteRangement.setTypeAutre(true);
String id = aDonnee.TYPE_AUTRE+aDonnee.SEPARATEUR_TYPE_VALEUR+uniteTypeIdDonnees[0]+"-"+i;
uniteRangement.setId(id);
unitesEnregistrees.put(aDonnee.TYPE_AUTRE+aDonnee.SEPARATEUR_TYPE_VALEUR, uniteRangement);
unitesEnregistrees.put(aDonnee.TYPE_AUTRE+aDonnee.SEPARATEUR_TYPE_VALEUR+uniteTypeIdDonnees[0], uniteRangement);
}
}
}
382,16 → 404,7
Button supprimerBouton = creerBoutonSupprimerUniteRangement();
barreOutils.add(supprimerBouton);
barreOutils.add(new SeparatorToolItem());
barreOutils.add(new Text(i18nC.collectionUniteRangementEtatGeneralLabel()));
etatUniteRangementCombo = new ChampComboBoxListeValeurs("", "etat");
etatUniteRangementCombo.setEmptyText(i18nC.collectionUniteRangementEtatGeneral());
etatUniteRangementCombo.setToolTip(i18nC.collectionUniteRangementEtatGeneralInfo());
etatUniteRangementCombo.setTrie("id_valeur");
etatUniteRangementCombo.setWidth(300);
barreOutils.add(etatUniteRangementCombo);
 
return barreOutils;
}
438,7 → 451,7
return bouton;
}
private void creerUniteBase() {
private ContentPanel creerUniteBase() {
ContentPanel panneauGrille = creerPanneauContenantGrille(i18nC.collectionUniteBaseTitre());
uniteBaseGrille = creerGrilleUniteBase();
448,7 → 461,7
ToolBar barreOutils = creerBarreOutilsGrilleUniteBase();
panneauGrille.setTopComponent(barreOutils);
add(panneauGrille);
return panneauGrille;
}
private EditorGrid<UniteBase> creerGrilleUniteBase() {
592,7 → 605,7
Iterator<String> it = unitesEnregistrees.keySet().iterator();
while (it.hasNext()) {
String cle = it.next();
if (cle.matches(aDonnee.TYPE_AUTRE+aDonnee.SEPARATEUR_TYPE_VALEUR)) {
if (cle.matches(aDonnee.TYPE_AUTRE+aDonnee.SEPARATEUR_TYPE_VALEUR+"[a-zA-Z0-9]+")) {
UniteBase uniteAutreEnregistree = unitesEnregistrees.get(cle);
listeUniteMaj.add(uniteAutreEnregistree);
}
645,7 → 658,7
uniteBase.setTypeAutre(true);
String id = aDonnee.TYPE_AUTRE+aDonnee.SEPARATEUR_TYPE_VALEUR+uniteTypeIdDonnees[0]+"-"+i;
uniteBase.setId(id);
unitesEnregistrees.put(aDonnee.TYPE_AUTRE+aDonnee.SEPARATEUR_TYPE_VALEUR, uniteBase);
unitesEnregistrees.put(aDonnee.TYPE_AUTRE+aDonnee.SEPARATEUR_TYPE_VALEUR+uniteTypeIdDonnees[0], uniteBase);
}
}
}
/trunk/src/org/tela_botanica/client/vues/collection/CollectionFormPersonne.java
1,18 → 1,18
package org.tela_botanica.client.vues.collection;
 
import java.util.ArrayList;
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.composants.ChampComboBoxRechercheTempsReelPaginable;
import org.tela_botanica.client.composants.GrillePaginable;
import org.tela_botanica.client.composants.InfoLogger;
import org.tela_botanica.client.composants.pagination.ProxyCollectionAPersonne;
import org.tela_botanica.client.composants.pagination.ProxyPersonnes;
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.Valeur;
import org.tela_botanica.client.modeles.ValeurListe;
import org.tela_botanica.client.modeles.aDonnee;
19,16 → 19,9
import org.tela_botanica.client.modeles.collection.Collection;
import org.tela_botanica.client.modeles.collection.CollectionAPersonne;
import org.tela_botanica.client.modeles.collection.CollectionAPersonneListe;
import org.tela_botanica.client.modeles.collection.UniteBase;
import org.tela_botanica.client.modeles.collection.UniteRangement;
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.publication.Publication;
import org.tela_botanica.client.modeles.structure.StructureAPersonne;
import org.tela_botanica.client.synchronisation.Sequenceur;
import org.tela_botanica.client.util.Debug;
import org.tela_botanica.client.util.UtilString;
import org.tela_botanica.client.vues.FenetreForm;
import org.tela_botanica.client.vues.Formulaire;
import org.tela_botanica.client.vues.FormulaireBarreValidation;
40,18 → 33,14
import com.extjs.gxt.ui.client.data.ModelType;
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.Events;
import com.extjs.gxt.ui.client.event.KeyListener;
import com.extjs.gxt.ui.client.event.FieldEvent;
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;
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.Text;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
64,20 → 53,14
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;
import com.extjs.gxt.ui.client.widget.layout.AnchorLayout;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
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.dom.client.Element;
import com.google.gwt.event.dom.client.KeyCodes;
 
public class CollectionFormPersonne extends FormulaireOnglet implements Rafraichissable {
87,7 → 70,8
private ContentPanel panneauPrincipal = null;
private ToolBar barreOutils = null;
private EditorGrid<CollectionAPersonne> grille;
private GrillePaginable<ModelData> grille;
private ComboBox<Valeur> typeRelationCombo = null;
private CollectionAPersonneListe personnesAjoutees = null;
111,16 → 95,17
setText(Mediateur.i18nC.collectionPersonne());
setStyleAttribute("padding", "0");
initialiser();
panneauPrincipal = creerPanneauContenantGrille();
barreOutils = creerBarreOutilsGrille();
panneauPrincipal.setTopComponent(barreOutils);
grille = creerGrille();
panneauPrincipal.add(grille);
mediateur.obtenirListeValeurEtRafraichir(this, "ion", null);
mediateur.obtenirListeValeurEtRafraichir(this, "relationPersonneCollection", null);
mediateur.obtenirListeValeurEtRafraichir(this, "ion", sequenceur);
mediateur.obtenirListeValeurEtRafraichir(this, "relationPersonneCollection", sequenceur);
add(panneauPrincipal);
initialiser();
}
private void initialiser() {
129,9 → 114,6
personnesAjoutees = new CollectionAPersonneListe();
personnesSupprimees = new CollectionAPersonneListe();
// Actualisation de l'état des boutons de la barre d'outils
actualiserEtatBoutonsBarreOutils();
collection = ((CollectionForm) formulaire).collection;
}
194,8 → 176,9
Button bouton = new Button(i18nC.modifier());
bouton.setIcon(Images.ICONES.vcardModifier());
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
CollectionAPersonne personneSaisiSelectionne = grille.getSelectionModel().getSelectedItem();
public void componentSelected(ButtonEvent ce) {
CollectionAPersonne personneSaisiSelectionne = new CollectionAPersonne(grille.getSelection());
if (personneSaisiSelectionne == null) {
InfoLogger.display(i18nC.informationTitreGenerique(), i18nC.selectionnerPersonne());
} else {
210,7 → 193,7
private FenetreForm creerFenetreModaleAvecFormulairePersonne(String mode) {
String personneId = null;
if (mode.equals(Formulaire.MODE_MODIFIER)) {
CollectionAPersonne personneSaisieSelectionnee = grille.getSelectionModel().getSelectedItem();
CollectionAPersonne personneSaisieSelectionnee = new CollectionAPersonne(grille.getSelection());
personneId = personneSaisieSelectionnee.getIdPersonne();
}
264,7 → 247,7
bouton.setIcon(Images.ICONES.vcardSupprimer());
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
CollectionAPersonne personneSaisiSelectionnee = grille.getSelectionModel().getSelectedItem();
ModelData personneSaisiSelectionnee = grille.getSelection();
if (personneSaisiSelectionnee == null) {
InfoLogger.display(i18nC.informationTitreGenerique(), i18nC.selectionnerPersonne());
} else {
303,7 → 286,7
modelTypePersonnes.addField("cp_deces_lieu");
String displayNamePersonnes = "cp_fmt_nom_complet";
ProxyPersonnes<ModelData> proxyPersonnes = new ProxyPersonnes<ModelData>(sequenceur);
ProxyPersonnes<ModelData> proxyPersonnes = new ProxyPersonnes<ModelData>(null);
recherchePersonnesCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyPersonnes, modelTypePersonnes, displayNamePersonnes);
recherchePersonnesCombo.getCombo().setForceSelection(true);
325,7 → 308,7
recherchePersonnesCombo.getCombo().addListener(Events.Select, new Listener<BaseEvent>() {
public void handleEvent(BaseEvent be) {
if (personnesSaisisComboBox.getValeur() instanceof ModelData) {
if (personnesSaisisComboBox.getValeur() instanceof ModelData) {
Personne personneSaisiSelectionnee = new Personne(personnesSaisisComboBox.getValeur());
ajouterDansGrille(personneSaisiSelectionnee);
personnesSaisisComboBox.getCombo().setValue(null);
343,8 → 326,9
private void ajouterDansGrille(Personne personne, String relation, int index) {
if (personne != null) {
CollectionAPersonne relationCollectionPersonne = new CollectionAPersonne();
relationCollectionPersonne.setPersonne(personne);
relationCollectionPersonne.setPersonnePourGrillePaginable(personne);
relationCollectionPersonne.setIdPersonne(personne.getId());
if (relation != null) {
relationCollectionPersonne.set("_role_", relation);
}
352,84 → 336,92
if (mode.equals(Formulaire.MODE_MODIFIER)) {
relationCollectionPersonne.setIdCollection(collection.getId());
}
relationCollectionPersonne.set("_etat_", aDonnee.ETAT_AJOUTE);
corrigerChampsGrille(relationCollectionPersonne);
// FIXME besoin de ça ?
//corrigerChampsGrille(relationCollectionPersonne);
// Ajout à la grille
grille.stopEditing();
grille.getStore().insert(relationCollectionPersonne, index);
grille.startEditing(index, 0);
grille.getSelectionModel().select(index, false);
grille.getGrille().stopEditing();
grille.getGrille().getStore().insert(relationCollectionPersonne, index);
grille.getGrille().startEditing(index, 0);
grille.getGrille().getSelectionModel().select(index, false);
}
}
private void supprimerDansGrille(CollectionAPersonne relationCollectionPersonne) {
private void supprimerDansGrille(ModelData relationCollectionPersonne) {
CollectionAPersonne cap = new CollectionAPersonne(relationCollectionPersonne);
if (relationCollectionPersonne != null) {
// Ajout de la personne supprimée à la liste
if ((relationCollectionPersonne.get("_etat_").equals("") || !relationCollectionPersonne.get("_etat_").equals(aDonnee.ETAT_AJOUTE))
&& relationCollectionPersonne.getId() != null
&& !relationCollectionPersonne.getId().equals("")) {
personnesSupprimees.put("id"+idGenere++, relationCollectionPersonne);
if ((relationCollectionPersonne.get("_etat_") == null
|| relationCollectionPersonne.get("_etat_").equals("")
|| !relationCollectionPersonne.get("_etat_").equals(aDonnee.ETAT_AJOUTE))
&& cap.getId() != null
&& !cap.getId().equals("")) {
personnesSupprimees.put("id"+idGenere++, cap);
grille.getStore().remove(relationCollectionPersonne);
}
// Suppression de l'enregistrement de la grille
grille.getStore().remove(relationCollectionPersonne);
}
}
 
private EditorGrid<CollectionAPersonne> creerGrille() {
ListStore<CollectionAPersonne> storeGrille = new ListStore<CollectionAPersonne>();
storeGrille.addListener(Store.Add, new Listener<StoreEvent<CollectionAPersonne>>() {
public void handleEvent(StoreEvent<CollectionAPersonne> ce) {
actualiserEtatBoutonsBarreOutils();
}
});
storeGrille.addListener(Store.Remove, new Listener<StoreEvent<CollectionAPersonne>>() {
public void handleEvent(StoreEvent<CollectionAPersonne> ce) {
actualiserEtatBoutonsBarreOutils();
}
});
storeGrille.addListener(Store.Update, new Listener<StoreEvent<CollectionAPersonne>>() {
public void handleEvent(StoreEvent<CollectionAPersonne> ce) {
if (ce.getRecord().isModified("_role_") && !ce.getModel().get("_etat_").equals(aDonnee.ETAT_AJOUTE)) {
ce.getModel().set("_etat_", aDonnee.ETAT_MODIFIE);
}
}
});
private GrillePaginable<ModelData> creerGrille() {
RowNumberer pluginLigneNumero = new RowNumberer();
// ModelType
ModelType modelTypeCollectionAPersonne = new ModelType();
modelTypeCollectionAPersonne.setRoot("collectionsAPersonne");
modelTypeCollectionAPersonne.setTotalName("nbElements");
modelTypeCollectionAPersonne.addField("cp_fmt_nom_complet");
modelTypeCollectionAPersonne.addField("cp_nom");
modelTypeCollectionAPersonne.addField("cp_prenom");
modelTypeCollectionAPersonne.addField("cp_code_postal");
modelTypeCollectionAPersonne.addField("cp_naissance_date");
modelTypeCollectionAPersonne.addField("cp_naissance_lieu");
modelTypeCollectionAPersonne.addField("cp_ce_deces");
modelTypeCollectionAPersonne.addField("cp_deces_date");
modelTypeCollectionAPersonne.addField("cp_deces_lieu");
modelTypeCollectionAPersonne.addField("ccap_id_collection");
modelTypeCollectionAPersonne.addField("ccap_id_personne");
modelTypeCollectionAPersonne.addField("ccap_id_role");
// Proxy
ProxyCollectionAPersonne<ModelData> proxyCollectionAPersonne = new ProxyCollectionAPersonne<ModelData>(null, collection.getId(), null);
 
// Colonnes
List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
colonnes.add(pluginLigneNumero);
colonnes.add(new RowNumberer());
colonnes.add(creerColonneRole());
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("naissance_date", i18nC.date(), 75));
colonnes.add(new ColumnConfig("naissance_lieu", i18nC.lieu(), 100));
colonnes.add(new ColumnConfig("cp_fmt_nom_complet", i18nC.personneNomComplet(), 150));
colonnes.add(new ColumnConfig("cp_nom", i18nC.personneNom(), 75));
colonnes.add(new ColumnConfig("cp_prenom", i18nC.personnePrenom(), 75));
colonnes.add(new ColumnConfig("cp_naissance_date", i18nC.date(), 75));
colonnes.add(new ColumnConfig("cp_naissance_lieu", i18nC.lieu(), 100));
colonnes.add(creerColonneDeces());
colonnes.add(new ColumnConfig("deces_date", i18nC.date(), 75));
colonnes.add(new ColumnConfig("deces_lieu", i18nC.lieu(), 100));
colonnes.add(new ColumnConfig("cp_deces_date", i18nC.date(), 75));
colonnes.add(new ColumnConfig("cp_deces_lieu", i18nC.lieu(), 100));
GridSelectionModel<CollectionAPersonne> modeleDeSelection = new GridSelectionModel<CollectionAPersonne>();
// Modèle de colonnes
ColumnModel modeleDeColonnes = new ColumnModel(colonnes);
modeleDeColonnes.addHeaderGroup(0, 1, new HeaderGroupConfig(i18nC.personneIdentite(), 1, 4));
modeleDeColonnes.addHeaderGroup(0, 5, new HeaderGroupConfig(i18nC.personneNaissance(), 1, 2));
modeleDeColonnes.addHeaderGroup(0, 7, new HeaderGroupConfig(i18nC.personneDeces(), 1, 3));
EditorGrid<CollectionAPersonne> grillePersonne = new EditorGrid<CollectionAPersonne>(storeGrille, modeleDeColonnes);
grillePersonne.setHeight("100%");
grillePersonne.setBorders(true);
grillePersonne.setSelectionModel(modeleDeSelection);
grillePersonne.addPlugin(pluginLigneNumero);
grillePersonne.getView().setForceFit(true);
grillePersonne.setAutoExpandColumn("fmt_nom_complet");
grillePersonne.setStripeRows(true);
grillePersonne.setTrackMouseOver(true);
// Grille
GrillePaginable<ModelData> grillePaginable = new GrillePaginable<ModelData>(modelTypeCollectionAPersonne, proxyCollectionAPersonne, colonnes, modeleDeColonnes);
return grillePersonne;
// Rajouter des écouteurs
grillePaginable.getStore().addListener(Store.Update, new Listener<StoreEvent<ModelData>>() {
public void handleEvent(StoreEvent<ModelData> ce) {
if (ce.getRecord().isModified("_role_") && ce.getModel().get("_etat_") == null || !ce.getModel().get("_etat_").equals(aDonnee.ETAT_AJOUTE)) {
ce.getModel().set("_etat_", aDonnee.ETAT_MODIFIE);
}
}
});
return grillePaginable;
}
private ColumnConfig creerColonneRole() {
441,9 → 433,11
typeRelationCombo.setEditable(false);
typeRelationCombo.addStyleName(ComposantClass.OBLIGATOIRE);
typeRelationCombo.addListener(Events.Select, Formulaire.creerEcouteurChampObligatoire());
CellEditor editeurRelation = new CellEditor(typeRelationCombo) {
public Object preProcessValue(Object valeur) {
 
CellEditor editeurRelation = new CellEditor(typeRelationCombo) {
// Sert à retourner un ModelData à partir d'une String (la string est passée par le Renderer)
public Object preProcessValue(Object valeur) {
Valeur retour = null;
if (valeur != null ) {
if (typeRelationCombo.getStore().findModel("nom", valeur.toString()) != null) {
455,45 → 449,53
}
}
return retour;
}
 
public Object postProcessValue(Object valeur) {
}
// Sert à retourner un String à Partir d'une Valeur
// en postProcess on remplace la valeur du champ par l'Id de la valeur au lieu de son Nom
public Object postProcessValue(Object valeur) {
String retour = null;
if (valeur != null ) {
if (valeur instanceof Valeur) {
Valeur valeurOntologie = (Valeur) valeur;
retour = valeurOntologie.getNom();
String id = valeurOntologie.getId();
retour = id;
}
}
return retour;
}
}
};
GridCellRenderer<CollectionAPersonne> relationRendu = new GridCellRenderer<CollectionAPersonne>() {
public String render(CollectionAPersonne modele, String property, ColumnData config, int rowIndex, int colIndex, ListStore<CollectionAPersonne> store, Grid<CollectionAPersonne> grille) {
// Gestion du texte afficher dans la cellule
String role = modele.get("_role_");
if (typeRelationCombo.getStore() != null && role.matches("[0-9]+")) {
// Sert à afficher le nom du role au lieu de l'id
GridCellRenderer<ModelData> relationRendu = new GridCellRenderer<ModelData>() {
public String render(ModelData modele, String property, ColumnData config, int rowIndex, int colIndex, ListStore<ModelData> store, Grid<ModelData> grille) {
// Gestion du texte afficher dans la cellule
CollectionAPersonne cap = new CollectionAPersonne(modele);
 
String role = cap.getIdRole();
modele.set("_role_", role);
 
if (typeRelationCombo.getStore() != null && typeRelationCombo.getStore().getCount() > 0 && role.matches("[0-9]+")) {
role = typeRelationCombo.getStore().findModel("id_valeur", role).getNom();
}
modele.set("_role_", role);
 
return role;
}
};
ColumnConfig typeRelationColonne = new ColumnConfig("_role_", i18nC.typeRelationPersonneCollection(), 75);
typeRelationColonne.setEditor(editeurRelation);
typeRelationColonne.setRenderer(relationRendu);
return typeRelationColonne;
}
public ColumnConfig creerColonneDeces() {
GridCellRenderer<CollectionAPersonne> decesRendu = new GridCellRenderer<CollectionAPersonne>() {
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.findModel("id_valeur", modele.getPersonne().getDeces()).getNom();
GridCellRenderer<ModelData> decesRendu = new GridCellRenderer<ModelData>() {
public String render(ModelData modele, String property, ColumnData config, int rowIndex, int colIndex, ListStore<ModelData> store, Grid<ModelData> grid) {
CollectionAPersonne cap = new CollectionAPersonne(modele);
String deces = cap.getPersonne().getDeces();
if (listeIon != null && cap.getPersonne().getDeces().matches("[0-9]+")) {
deces = listeIon.findModel("id_valeur", cap.getPersonne().getDeces()).getNom();
}
modele.set("_deces_", deces);
return deces;
505,6 → 507,7
}
public void actualiserEtatBoutonsBarreOutils() {
// Activation des boutons si la grille contient un élément
if (grille.getStore().getCount() > 0) {
personnesBoutonSupprimer.enable();
529,7 → 532,7
}
}
private void rafraichirValeurListe(ValeurListe listeValeurs) {
private void rafraichirValeurListe(ValeurListe listeValeurs) {
if (listeValeurs.getId().equals(config.getListeId("ion"))) {
listeIon = new ListStore<Valeur>();
listeIon.add(listeValeurs.toList());
547,9 → 550,7
String type = info.getType();
if (info.getType().equals("liste_collection_a_personne")) {
if (info.getDonnee(0) != null) {
initialiser();
collection.setPersonnesLiees((CollectionAPersonneListe) info.getDonnee(0));
peupler();
}
} else if (info.getType().equals("ajout_collection")) {
if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
562,7 → 563,7
} else if (type.equals("personne_modifiee")) {
if (info.getDonnee(0) != null) {
Personne personne = (Personne) info.getDonnee(0);
CollectionAPersonne personneDansGrille = grille.getStore().findModel("id_personne", personne.getId());
ModelData personneDansGrille = grille.getStore().findModel("id_personne", personne.getId());
int index = grille.getStore().indexOf(personneDansGrille);
grille.getStore().remove(personneDansGrille);
String role = (String) personneDansGrille.get("_role_");
577,18 → 578,12
InfoLogger.display("Modification des personnes liées à la collection", info.toString());
} else if (info.getType().equals("suppression_collection_a_personne")) {
InfoLogger.display("Suppression des personnes liées à la collection", info.toString());
actualiserGrille();
} else if (info.getType().equals("ajout_collection_a_personne")) {
InfoLogger.display("Ajout des personnes liées à la collection", info.toString());
}
}
public void peupler() {
grille.getStore().removeAll();
grille.getStore().add(collection.getPersonnesLiees().toList());
layout();
InfoLogger.display(i18nC.chargementPersonne(), i18nC.ok());
}
public ArrayList<String> verifier() {
ArrayList<String> messages = new ArrayList<String>();
String personneNumero = "";
596,7 → 591,7
if (nbrePersonne > 0) {
for (int i = 0; i < nbrePersonne; i++) {
CollectionAPersonne personne = grille.getStore().getAt(i);
CollectionAPersonne personne = new CollectionAPersonne(grille.getStore().getAt(i));
if (personne.get("_role_").equals("")) {
personneNumero += (i != 0 ? ", " : "")+(i+1);
}
613,8 → 608,10
if (etreAccede()) {
int nbrePersonne = grille.getStore().getCount();
for (int i = 0; i < nbrePersonne; i++) {
CollectionAPersonne relationCollectionPersonne = grille.getStore().getAt(i);
CollectionAPersonne relationCollectionPersonne = new CollectionAPersonne(grille.getStore().getAt(i));
if (relationCollectionPersonne.get("_etat_") != null) {
if (relationCollectionPersonne.get("_etat_").equals(aDonnee.ETAT_MODIFIE)) {
// Comme il est impossible de modifier les relations nous supprimons l'ancien enregistrement et ajoutons un nouveau avec le nouveau id_role
personnesSupprimees.put("id"+idGenere++, relationCollectionPersonne);
641,6 → 638,7
if (role.matches("[0-9]+")) {
champModele = "id_valeur";
}
 
if (typeRelationCombo.getStore().findModel(champModele, role) != null) {
String idRole = typeRelationCombo.getStore().findModel(champModele, role).getId();
relationCollectionPersonne.setIdRole(idRole);
649,6 → 647,7
 
public void soumettre() {
if (mode.equals(Formulaire.MODE_MODIFIER)) {
if (personnesAjoutees.size() == 0 && personnesSupprimees.size() == 0) {
InfoLogger.display("Modification des personnes liées", "Rien n'a été enregistré car le formulaire n'a pas été modifié.");
} else {
664,10 → 663,6
}
}
private void obtenirPersonnesSaisis(String nom) {
mediateur.selectionnerPersonneParNomComplet(this, null, "%"+nom+"%", null);
}
private void actualiserGrille() {
if (mode.equals(Formulaire.MODE_MODIFIER)) {
mediateur.selectionnerCollectionAPersonne(this, collection.getId(), null, null);
/trunk/src/org/tela_botanica/client/vues/collection/CollectionFormPublication.java
150,7 → 150,7
bouton.setIcon(Images.ICONES.vcardAjouter());
bouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
fenetreFormulaire = creerFenetreModaleAvecFormulairePersonne(Formulaire.MODE_AJOUTER);
fenetreFormulaire = creerFenetreModaleAvecFormulairePublication(Formulaire.MODE_AJOUTER);
fenetreFormulaire.show();
}
});
167,7 → 167,7
if (publicationSaisieSelectionnee == null) {
InfoLogger.display(i18nC.informationTitreGenerique(), i18nC.selectionnerPublication());
} else {
fenetreFormulaire = creerFenetreModaleAvecFormulairePersonne(Formulaire.MODE_MODIFIER);
fenetreFormulaire = creerFenetreModaleAvecFormulairePublication(Formulaire.MODE_MODIFIER);
fenetreFormulaire.show();
}
}
175,7 → 175,7
return bouton;
}
private FenetreForm creerFenetreModaleAvecFormulairePersonne(String mode) {
private FenetreForm creerFenetreModaleAvecFormulairePublication(String mode) {
String publicationId = null;
if (mode.equals(Formulaire.MODE_MODIFIER)) {
CollectionAPublication publicationSaisiSelectionne = grille.getSelectionModel().getSelectedItem();
218,7 → 218,7
fenetre.hide();
} else if (code.equals(FormulaireBarreValidation.CODE_BOUTON_REINITIALISER)) {
fenetreFormulaire.hide();
fenetreFormulaire = creerFenetreModaleAvecFormulairePersonne(formulaire.mode);
fenetreFormulaire = creerFenetreModaleAvecFormulairePublication(formulaire.mode);
fenetreFormulaire.show();
}
}
/trunk/src/org/tela_botanica/client/vues/collection/CollectionFormGeneral.java
128,7 → 128,7
modelTypeProjets.addField("cpr_id_projet");
String displayNameProjets = "cpr_nom";
ProxyProjets<ModelData> proxyProjets = new ProxyProjets<ModelData>(sequenceur);
ProxyProjets<ModelData> proxyProjets = new ProxyProjets<ModelData>(null);
projetsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyProjets, modelTypeProjets, displayNameProjets);
projetsCombo.setWidth(250, 600);
167,7 → 167,7
modelTypeStructures.addField("cs_id_structure");
String displayNameStructures = "cs_nom";
ProxyStructures<ModelData> proxyStructures = new ProxyStructures<ModelData>(sequenceur);
ProxyStructures<ModelData> proxyStructures = new ProxyStructures<ModelData>(null);
structuresCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyStructures, modelTypeStructures, displayNameStructures);
structuresCombo.setWidth(250, 600);
205,7 → 205,7
modelTypeCollections.addField("cc_ce_mere");
String displayNameCollections = "cc_nom";
ProxyCollections<ModelData> proxyCollections = new ProxyCollections<ModelData>(sequenceur);
ProxyCollections<ModelData> proxyCollections = new ProxyCollections<ModelData>(null);
collectionsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyCollections, modelTypeCollections, displayNameCollections);
collectionsCombo.setWidth(250, 600);
418,9 → 418,14
}
return valeur;
}
private void setValeurComboProjets() {
if (projetsCombo.getStore() != null && collection != null) {
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", collection.getIdProjet()));
private void setValeurComboProjets() {
if (projetsCombo.getCombo().getStore() != null
&& collection != null
&& collection.getIdProjet() != null
&& !UtilString.isEmpty(collection.getIdProjet())) {
projetsCombo.chargerValeurInitiale(collection.getIdProjet(), "cpr_id_projet");
} else {
projetsCombo.getCombo().setValue(null);
}
}
433,10 → 438,7
return valeur;
}
private void setValeurComboStructures() {
/*if (structuresCombo.getStore() != null && collection != null) {
structuresCombo.getCombo().setValue(structuresCombo.getStore().findModel("cs_id_structure", collection.getIdStructure()));
}*/
if (structuresCombo.getCombo().getStore() != null
if (structuresCombo.getCombo().getStore() != null
&& collection != null
&& collection.getStructureNom() != null
&& !UtilString.isEmpty(collection.getStructureNom())) {