Subversion Repositories eFlore/Applications.coel

Compare Revisions

No changes between revisions

Ignore whitespace Rev 1512 → Rev 1513

/trunk/src/org/tela_botanica/client/vues/collection/CollectionFormPersonne.java
1,7 → 1,9
package org.tela_botanica.client.vues.collection;
 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import org.tela_botanica.client.ComposantClass;
import org.tela_botanica.client.Mediateur;
409,8 → 411,12
modeleDeColonnes.addHeaderGroup(0, 5, new HeaderGroupConfig(i18nC.personneNaissance(), 1, 2));
modeleDeColonnes.addHeaderGroup(0, 7, new HeaderGroupConfig(i18nC.personneDeces(), 1, 3));
HashMap<String, String> virtualFields = new HashMap<String, String>();
virtualFields.put("_role_", "ccap_id_role");
virtualFields.put("_etat_", "");
// Grille
GrillePaginable<ModelData> grillePaginable = new GrillePaginable<ModelData>(modelTypeCollectionAPersonne, proxyCollectionAPersonne, colonnes, modeleDeColonnes);
GrillePaginable<ModelData> grillePaginable = new GrillePaginable<ModelData>(modelTypeCollectionAPersonne, virtualFields, proxyCollectionAPersonne, colonnes, modeleDeColonnes);
// Rajouter des écouteurs
grillePaginable.getStore().addListener(Store.Update, new Listener<StoreEvent<ModelData>>() {
437,7 → 443,7
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) {
public Object preProcessValue(Object valeur) {
Valeur retour = null;
if (valeur != null ) {
if (typeRelationCombo.getStore().findModel("nom", valeur.toString()) != null) {
453,7 → 459,7
// 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) {
public Object postProcessValue(Object valeur) {
String retour = null;
if (valeur != null ) {
if (valeur instanceof Valeur) {
470,15 → 476,10
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);
 
String role = modele.get("_role_");
if (typeRelationCombo.getStore() != null && typeRelationCombo.getStore().getCount() > 0 && role.matches("[0-9]+")) {
role = typeRelationCombo.getStore().findModel("id_valeur", role).getNom();
}
 
return role;
}
};
562,8 → 563,8
}
} else if (type.equals("personne_modifiee")) {
if (info.getDonnee(0) != null) {
Personne personne = (Personne) info.getDonnee(0);
ModelData personneDansGrille = grille.getStore().findModel("id_personne", personne.getId());
Personne personne = (Personne) info.getDonnee(0);
ModelData personneDansGrille = grille.getStore().findModel("ccap_id_personne", personne.getId());
int index = grille.getStore().indexOf(personneDansGrille);
grille.getStore().remove(personneDansGrille);
String role = (String) personneDansGrille.get("_role_");
591,8 → 592,7
if (nbrePersonne > 0) {
for (int i = 0; i < nbrePersonne; i++) {
CollectionAPersonne personne = new CollectionAPersonne(grille.getStore().getAt(i));
if (personne.get("_role_").equals("")) {
if (grille.getStore().getAt(i).get("_role_").equals("")) {
personneNumero += (i != 0 ? ", " : "")+(i+1);
}
}
609,10 → 609,11
int nbrePersonne = grille.getStore().getCount();
for (int i = 0; i < nbrePersonne; i++) {
CollectionAPersonne relationCollectionPersonne = new CollectionAPersonne(grille.getStore().getAt(i));
relationCollectionPersonne.set("_role_", grille.getStore().getAt(i).get("_role_"));
if (relationCollectionPersonne.get("_etat_") != null) {
if (grille.getStore().getAt(i).get("_etat_") != null) {
if (relationCollectionPersonne.get("_etat_").equals(aDonnee.ETAT_MODIFIE)) {
if (grille.getStore().getAt(i).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);
620,12 → 621,12
corrigerChampsGrille(relationAAjouter);// Nous modifions l'id_role
personnesAjoutees.put("id"+idGenere++, relationAAjouter);
}
if (relationCollectionPersonne.get("_etat_").equals(aDonnee.ETAT_AJOUTE)) {
if (grille.getStore().getAt(i).get("_etat_").equals(aDonnee.ETAT_AJOUTE)) {
corrigerChampsGrille(relationCollectionPersonne);// Nous modifions l'id_role
personnesAjoutees.put("id"+idGenere++, relationCollectionPersonne);
}
// Initialisation de la grille
relationCollectionPersonne.set("_etat_", "");
grille.getStore().getAt(i).set("_etat_", "");
}
}
grille.getStore().commitChanges();
Property changes:
Modified: svn:mergeinfo
Merged /trunk/src/org/tela_botanica/client/vues/collection/CollectionFormPersonne.java:r11-933
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/vues/collection/CollectionFormPersonne.java:r1417-1511