Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 1328 → Rev 1329

/trunk/src/org/tela_botanica/client/vues/collection/CollectionFormCommentaire.java
338,10 → 338,7
if ((relationCollectionACommentaire.get("_etat_").equals("") || !relationCollectionACommentaire.get("_etat_").equals(aDonnee.ETAT_AJOUTE))
&& relationCollectionACommentaire.getId() != null
&& !relationCollectionACommentaire.getId().equals("")) {
Debug.log("Nbre commentaires supprimées avant:"+commentairesSupprimes.size());
commentairesSupprimes.put("id"+idGenere++, relationCollectionACommentaire);
Debug.log("Commentaires supprimées : "+relationCollectionACommentaire.getCommentaire().getId());
Debug.log("Nbre commentaires supprimées :"+commentairesSupprimes.size());
}
// Suppression de l'enregistrement de la grille
364,7 → 361,6
storeGrille.addListener(Store.Update, new Listener<StoreEvent<CollectionACommentaire>>() {
public void handleEvent(StoreEvent<CollectionACommentaire> ce) {
if (ce.getRecord().isModified("_type_") && !ce.getModel().get("_etat_").equals(aDonnee.ETAT_AJOUTE)) {
Debug.log("id type modifié : "+ce.getModel().get("_type_"));
ce.getModel().set("_etat_", aDonnee.ETAT_MODIFIE);
}
}
424,7 → 420,6
if (getField().getRawValue() != null ) {
retour = getField().getRawValue();
}
Debug.log("Post : "+retour);
return retour;
}
};
432,11 → 427,9
GridCellRenderer<CollectionACommentaire> typeRendu = new GridCellRenderer<CollectionACommentaire>() {
public String render(CollectionACommentaire model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<CollectionACommentaire> store, Grid<CollectionACommentaire> grid) {
String type = model.get("_type_");
Debug.log("Initialisation type origine :"+type);
if (typeCombo.getStore() != null && type != null && (type.matches("[0-9]+") || type.contains(aDonnee.SEPARATEUR_VALEURS))) {
type = typeCombo.formaterIdentifiantsEnTexte(type);
model.set("_type_", type);
Debug.log("Initialisation :"+type);
}
return type;
}
577,12 → 570,10
if (relationCollectionACommentaire.get("_etat_").equals(aDonnee.ETAT_MODIFIE)) {
corrigerChampsGrille(relationCollectionACommentaire);// Nous modifions l'id_type
commentairesModifies.put("id"+idGenere++, relationCollectionACommentaire);
Debug.log("Commentaires modifiés : "+relationCollectionACommentaire.getCommentaire().getTitre());
}
if (relationCollectionACommentaire.get("_etat_").equals(aDonnee.ETAT_AJOUTE)) {
corrigerChampsGrille(relationCollectionACommentaire);// Nous modifions l'id_type
commentairesAjoutes.put("id"+idGenere++, relationCollectionACommentaire);
Debug.log("Commentaires ajoutés : "+relationCollectionACommentaire.getCommentaire().getTitre());
}
// Initialisation de la grille
relationCollectionACommentaire.set("_etat_", "");
/trunk/src/org/tela_botanica/client/vues/collection/CollectionFormInventaire.java
28,7 → 28,6
private ChampCaseACocher digitalInventaireChp = null;
private ChampSliderPourcentage pourcentDigitalInventaireChp = null;
private ChampComboBoxListeValeurs etatInventaireCombo = null;
//DELETEME private TextArea typeDonneeInventaireChp = null;
 
public CollectionFormInventaire(Formulaire formulaireCourrant) {
initialiserOnglet(formulaireCourrant);
64,13 → 63,6
etatInventaireCombo = new ChampComboBoxListeValeurs(i18nC.etatInventaireCollection(), "inventaireEtat", tabIndex++);
etatInventaireCombo.setTabIndex(tabIndex++);
add(etatInventaireCombo, new FormData(300, 0));
/*DELETEME
typeDonneeInventaireChp = new TextArea();
typeDonneeInventaireChp.setTabIndex(tabIndex++);
typeDonneeInventaireChp.setFieldLabel(i18nC.typeDonneeInventaireCollection());
add(typeDonneeInventaireChp, new FormData(550, 0));*/
}
public void peupler() {
83,7 → 75,6
digitalInventaireChp.peupler(collectionBotanique.getInventaireDigital());
pourcentDigitalInventaireChp.peupler(collectionBotanique.getInventaireDigitalPourcent());
etatInventaireCombo.peupler(collectionBotanique.getInventaireEtat());
//DELETEME typeDonneeInventaireChp.setValue(collectionBotanique.getInventaireDonneesTypes());
}
}
97,7 → 88,6
collectionBotaniqueCollectee.setInventaireDigital(digitalInventaireChp.getValeur());
collectionBotaniqueCollectee.setInventaireDigitalPourcent(pourcentDigitalInventaireChp.getValeur());
collectionBotaniqueCollectee.setInventaireEtat(etatInventaireCombo.getValeur());
//DELETEME collectionBotaniqueCollectee.setInventaireDonneesTypes(typeDonneeInventaireChp.getValue());
}
}
/trunk/src/org/tela_botanica/client/vues/collection/CollectionFormPersonne.java
341,10 → 341,7
if ((relationCollectionPersonne.get("_etat_").equals("") || !relationCollectionPersonne.get("_etat_").equals(aDonnee.ETAT_AJOUTE))
&& relationCollectionPersonne.getId() != null
&& !relationCollectionPersonne.getId().equals("")) {
Debug.log("Nbre personnes supprimées avant:"+personnesSupprimees.size());
personnesSupprimees.put("id"+idGenere++, relationCollectionPersonne);
GWT.log("Personne supprimées : "+relationCollectionPersonne.getPersonne().getId()+" "+relationCollectionPersonne.getPersonne().getPrenom()+" "+relationCollectionPersonne.getPersonne().getNom(), null);
Debug.log("Nbre personnes supprimées :"+personnesSupprimees.size());
}
// Suppression de l'enregistrement de la grille
367,7 → 364,6
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)) {
Debug.log("id role modifié");
ce.getModel().set("_etat_", aDonnee.ETAT_MODIFIE);
}
}
422,7 → 418,6
public Object preProcessValue(Object valeur) {
Valeur retour = null;
if (valeur != null ) {
Debug.log(valeur.toString());
if (typeRelationCombo.getStore().findModel("nom", valeur.toString()) != null) {
retour = typeRelationCombo.getStore().findModel("nom", valeur.toString());
} else if (typeRelationCombo.getStore().findModel("abr", valeur.toString()) != null) {
604,18 → 599,14
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);
Debug.log("AVANT:"+relationCollectionPersonne.getIdRole());
CollectionAPersonne relationAAjouter = (CollectionAPersonne) relationCollectionPersonne.cloner(new CollectionAPersonne());
corrigerChampsGrille(relationAAjouter);// Nous modifions l'id_role
Debug.log("APRES:"+relationAAjouter.getIdRole());
personnesAjoutees.put("id"+idGenere++, relationAAjouter);
GWT.log("Personne modifiées : "+relationAAjouter.getPersonne().getPrenom()+" "+relationAAjouter.getPersonne().getNom(), null);
}
if (relationCollectionPersonne.get("_etat_").equals(aDonnee.ETAT_AJOUTE)) {
corrigerChampsGrille(relationCollectionPersonne);// Nous modifions l'id_role
personnesAjoutees.put("id"+idGenere++, relationCollectionPersonne);
GWT.log("Personne ajoutées : "+relationCollectionPersonne.getPersonne().getPrenom()+" "+relationCollectionPersonne.getPersonne().getNom(), null);
}
// Initialisation de la grille
relationCollectionPersonne.set("_etat_", "");
649,7 → 640,6
// Suppression des relations StructureAPersonne
if (personnesSupprimees.size() != 0) {
mediateur.supprimerCollectionAPersonne(this, personnesSupprimees);
Debug.log("Nbre personnes supprimées :"+personnesSupprimees.size());
}
}
}
/trunk/src/org/tela_botanica/client/vues/collection/CollectionFormPublication.java
323,10 → 323,7
if ((publicationLiee.get("_etat_").equals("") || !publicationLiee.get("_etat_").equals(aDonnee.ETAT_AJOUTE))
&& publicationLiee.getId() != null
&& !publicationLiee.getId().equals("")) {
Debug.log("Nbre publications supprimées avant:"+publicationsSupprimees.size());
publicationsSupprimees.put("id"+idGenere++, publicationLiee);
GWT.log("Publications supprimée : "+publicationLiee.getPublication().getId()+" "+publicationLiee.getPublication().getNomComplet(), null);
Debug.log("Nbre publications supprimées :"+publicationsSupprimees.size());
}
// Suppression de l'enregistrement de la grille
507,11 → 504,9
CollectionAPublication relationAAjouter = (CollectionAPublication) publicationLiee.cloner(new CollectionAPublication());
publicationsAjoutees.put("id"+idGenere++, relationAAjouter);
Debug.log(publicationLiee.toString());
}
if (publicationLiee.get("_etat_").equals(aDonnee.ETAT_AJOUTE)) {
publicationsAjoutees.put("id"+idGenere++, publicationLiee);
Debug.log(publicationLiee.toString());
}
// Initialisation de la grille
publicationLiee.set("_etat_", "");
529,12 → 524,10
// Ajout des relations CollectionAPublication
if (publicationsAjoutees.size() != 0) {
mediateur.ajouterCollectionAPublication(this, collection.getId(), publicationsAjoutees);
Debug.log("Nbre publications ajoutées :"+publicationsAjoutees.size());
}
// Suppression des relations CollectionAPublication
if (publicationsSupprimees.size() != 0) {
mediateur.supprimerCollectionAPublication(this, publicationsSupprimees);
Debug.log("Nbre publications supprimées :"+publicationsSupprimees.size());
}
}
}
/trunk/src/org/tela_botanica/client/vues/collection/CollectionFormGeneral.java
6,8 → 6,14
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.composants.ChampCaseACocher;
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
import org.tela_botanica.client.composants.ChampMultiValeurs;
import org.tela_botanica.client.composants.ChampMultiValeursMultiTypesPaginable;
import org.tela_botanica.client.composants.ConteneurMultiChamps;
import org.tela_botanica.client.composants.pagination.ProxyCollections;
import org.tela_botanica.client.composants.pagination.ProxyProjets;
import org.tela_botanica.client.composants.pagination.ProxyStructures;
import org.tela_botanica.client.composants.pagination.ProxyValeur;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.ValeurListe;
import org.tela_botanica.client.modeles.collection.Collection;
20,6 → 26,8
import org.tela_botanica.client.vues.Formulaire;
import org.tela_botanica.client.vues.FormulaireOnglet;
 
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.ModelType;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
47,9 → 55,9
 
private HiddenField<String> idCollectionChp = null;
private ComboBox<Projet> projetsCombo = null;
private ComboBox<Structure> structuresCombo = null;
private ComboBox<Collection> collectionsCombo = null;
private ChampComboBoxRechercheTempsReelPaginable projetsCombo = null;
private ChampComboBoxRechercheTempsReelPaginable structuresCombo = null;
private ChampComboBoxRechercheTempsReelPaginable collectionsCombo = null;
private ChampCaseACocher periodeConstitutionChp = null;
private ChampComboBoxListeValeurs groupementPrincipeCombo = null;
103,17 → 111,34
liaisonFieldSet.setCollapsible(true);
liaisonFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
projetsCombo = new ComboBox<Projet>();
projetsCombo.setTabIndex(tabIndex++);
projetsCombo.setFieldLabel(i18nC.projetChamp());
projetsCombo.setDisplayField("nom");
projetsCombo.setForceSelection(true);
projetsCombo.setValidator(new Validator() {
/*********************************/
/** Champ Projets **/
/*********************************/
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>();
projetsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyProjets, modelTypeProjets, displayNameProjets);
projetsCombo.setWidth(250, 600);
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.getCombo().setValidator(new Validator() {
public String validate(Field<?> field, String value) {
String retour = null;
if (field.getRawValue().equals("")) {
field.setValue(null);
} else if (projetsCombo.getStore().findModel("nom", field.getRawValue()) == null) {
} else if (projetsCombo.getStore().findModel("cpr_nom", field.getRawValue()) == null) {
String contenuBrut = field.getRawValue();
field.setValue(null);
field.setRawValue(contenuBrut);
122,24 → 147,37
return retour;
}
});
projetsCombo.setTriggerAction(TriggerAction.ALL);
projetsCombo.setStore(new ListStore<Projet>());
projetsCombo.addStyleName(ComposantClass.OBLIGATOIRE);
projetsCombo.addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
liaisonFieldSet.add(projetsCombo, new FormData(450, 0));
mediateur.selectionnerProjet(this, null, null);
 
liaisonFieldSet.add(projetsCombo, new FormData(600, 0));
structuresCombo = new ComboBox<Structure>();
structuresCombo.setTabIndex(tabIndex++);
structuresCombo.setFieldLabel(i18nC.lienStructureCollection());
structuresCombo.setDisplayField("nom");
structuresCombo.setForceSelection(true);
structuresCombo.setValidator(new Validator() {
/*************************************/
/** Champ Structures **/
/*************************************/
 
ModelType modelTypeStructures = new ModelType();
modelTypeStructures.setRoot("structures");
modelTypeStructures.setTotalName("nbElements");
modelTypeStructures.addField("cs_nom");
modelTypeStructures.addField("cs_id_structure");
String displayNameStructures = "cs_nom";
ProxyStructures<ModelData> proxyStructures = new ProxyStructures<ModelData>();
structuresCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyStructures, modelTypeStructures, displayNameStructures);
structuresCombo.setWidth(250, 600);
structuresCombo.getCombo().setTabIndex(tabIndex++);
structuresCombo.getCombo().setFieldLabel(i18nC.lienStructureCollection());
structuresCombo.getCombo().setForceSelection(true);
structuresCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE);
structuresCombo.getCombo().addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
structuresCombo.getCombo().setValidator(new Validator() {
public String validate(Field<?> field, String value) {
String retour = null;
if (field.getRawValue().equals("")) {
field.setValue(null);
} else if (structuresCombo.getStore().findModel("nom", field.getRawValue()) == null) {
} else if (structuresCombo.getStore().findModel("cs_nom", field.getRawValue()) == null) {
String contenuBrut = field.getRawValue();
field.setValue(null);
field.setRawValue(contenuBrut);
148,22 → 186,37
return retour;
}
});
structuresCombo.setTriggerAction(TriggerAction.ALL);
structuresCombo.setStore(new ListStore<Structure>());
liaisonFieldSet.add(structuresCombo, new FormData(450, 0));
mediateur.selectionnerStructureParProjet(this, null);
 
liaisonFieldSet.add(structuresCombo, new FormData(600, 0));
collectionsCombo = new ComboBox<Collection>();
collectionsCombo.setTabIndex(tabIndex++);
collectionsCombo.setFieldLabel(i18nC.lienMereCollection());
collectionsCombo.setDisplayField("nom");
collectionsCombo.setForceSelection(true);
collectionsCombo.setValidator(new Validator() {
/*************************************/
/** Champ Collections **/
/*************************************/
ModelType modelTypeCollections = new ModelType();
modelTypeCollections.setRoot("collections");
modelTypeCollections.setTotalName("nbElements");
modelTypeCollections.addField("cc_nom");
modelTypeCollections.addField("cc_id_collection");
String displayNameCollections = "cc_nom";
ProxyCollections<ModelData> proxyCollections = new ProxyCollections<ModelData>();
collectionsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyCollections, modelTypeCollections, displayNameCollections);
collectionsCombo.setWidth(250, 600);
collectionsCombo.getCombo().setTabIndex(tabIndex++);
collectionsCombo.getCombo().setFieldLabel(i18nC.lienMereCollection());
collectionsCombo.getCombo().setForceSelection(true);
collectionsCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE);
collectionsCombo.getCombo().addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
collectionsCombo.getCombo().setValidator(new Validator() {
public String validate(Field<?> field, String value) {
String retour = null;
if (field.getRawValue().equals("")) {
field.setValue(null);
} else if (collectionsCombo.getStore().findModel("nom", field.getRawValue()) == null) {
} else if (collectionsCombo.getStore().findModel("cc_nom", field.getRawValue()) == null) {
String contenuBrut = field.getRawValue();
field.setValue(null);
field.setRawValue(contenuBrut);
172,10 → 225,8
return retour;
}
});
collectionsCombo.setTriggerAction(TriggerAction.ALL);
collectionsCombo.setStore(new ListStore<Collection>());
liaisonFieldSet.add(collectionsCombo, new FormData(450, 0));
mediateur.selectionnerCollectionParProjet(this, null);
 
liaisonFieldSet.add(collectionsCombo, new FormData(600, 0));
this.add(liaisonFieldSet);
}
318,7 → 369,7
public ArrayList<String> verifier() {
ArrayList<String> messages = new ArrayList<String>();
if (projetsCombo.getValue() == null || !projetsCombo.isValid()) {
if (projetsCombo.getCombo().getValue() == null || !projetsCombo.getCombo().isValid()) {
messages.add(i18nM.selectionObligatoire(i18nC.articleUn()+" "+i18nC.projetSingulier(), i18nC.articleLa()+" "+i18nC.collectionSingulier()));
}
return messages;
359,57 → 410,48
private String getValeurComboProjets() {
String valeur = "";
if (projetsCombo.getValue() != null) {
valeur = projetsCombo.getValue().getId();
if (projetsCombo.getCombo().getValue() != null) {
Projet projet = new Projet(projetsCombo.getValeur());
valeur = projet.getId();
}
return valeur;
}
private void setValeurComboProjets() {
if (projetsCombo.getStore() != null && collection != null) {
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", collection.getIdProjet()));
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", collection.getIdProjet()));
}
}
private String getValeurComboStructures() {
String valeur = "";
if (structuresCombo.getValue() != null) {
valeur = structuresCombo.getValue().getId();
if (structuresCombo.getCombo().getValue() != null) {
Structure structure = new Structure(structuresCombo.getValeur());
valeur = structure.getId();
}
return valeur;
}
private void setValeurComboStructures() {
if (structuresCombo.getStore() != null && collection != null) {
structuresCombo.setValue(structuresCombo.getStore().findModel("id_structure", collection.getIdStructure()));
structuresCombo.getCombo().setValue(structuresCombo.getStore().findModel("cs_id_structure", collection.getIdStructure()));
}
}
private String getValeurComboCollections() {
String valeur = "";
if (collectionsCombo.getValue() != null) {
valeur = collectionsCombo.getValue().getId();
if (collectionsCombo.getCombo().getValue() != null) {
Collection collection = new Collection(collectionsCombo.getValeur());
valeur = collection.getId();
}
return valeur;
}
private void setValeurComboCollections() {
if (collectionsCombo.getStore() != null && collection != null) {
collectionsCombo.setValue(collectionsCombo.getStore().findModel("id_collection", collection.getCollectionMereId()));
if (collectionsCombo.getCombo().getStore() != null && collection != null) {
collectionsCombo.getCombo().setValue(collectionsCombo.getStore().findModel("id_collection", collection.getCollectionMereId()));
}
}
public void rafraichir(Object nouvellesDonnees) {
if (nouvellesDonnees instanceof ProjetListe) {
ProjetListe projets = (ProjetListe) nouvellesDonnees;
Formulaire.rafraichirComboBox(projets, projetsCombo);
setValeurComboProjets();
} else if (nouvellesDonnees instanceof StructureListe) {
StructureListe structures = (StructureListe) nouvellesDonnees;
Formulaire.rafraichirComboBox(structures, structuresCombo);
setValeurComboStructures();
} else if (nouvellesDonnees instanceof CollectionListe) {
CollectionListe collections = (CollectionListe) nouvellesDonnees;
Formulaire.rafraichirComboBox(collections, collectionsCombo);
setValeurComboCollections();
} else if (nouvellesDonnees instanceof ValeurListe) {
if (nouvellesDonnees instanceof ValeurListe) {
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
rafraichirValeurListe(listeValeurs);
} else {
/trunk/src/org/tela_botanica/client/vues/collection/CollectionDetailVue.java
1010,7 → 1010,8
} else {
etiquetteRenseignements += i18nC.inconnue();
}
etiquetteRenseignements += ": "+infos.get(cle)+"%,";
if (it.hasNext()) etiquetteRenseignements += ": "+infos.get(cle)+"%, ";
else etiquetteRenseignements += ": "+infos.get(cle)+"%.";
}
}
String precisionLocalite = construireTxtListeOntologie(collectionBotanique.getPrecisionLocalite());
/trunk/src/org/tela_botanica/client/vues/collection/CollectionForm.java
305,11 → 305,14
}
 
public boolean soumettreFormulaire() {
// Vérification de la validité des champs du formulaire
boolean formulaireValide = verifierFormulaire();
 
if (formulaireValide) {
// Collecte des données du formulaire
Collection collectionAEnregistrer = collecterCollection();
if (mode.equals(MODE_AJOUTER)) {
mediateur.ajouterCollection(this, collectionAEnregistrer);
} else if (mode.equals(MODE_MODIFIER)) {
356,7 → 359,7
collectionCollectee.setNom(nomChp.getValue());
collectionCollectee.setTypeNcd(typesCollectionCombo.getValue().getId());
}
 
private void collecterOnglets() {
generalOnglet.collecter();
personneOnglet.collecter();
366,7 → 369,7
inventaireOnglet.collecter();
commentaireOnglet.collecter();
}
 
public boolean verifierFormulaire() {
ArrayList<String> messages = new ArrayList<String>();