Subversion Repositories eFlore/Applications.coel

Compare Revisions

No changes between revisions

Ignore whitespace Rev 1764 → Rev 1763

/trunk/src/org/tela_botanica/client/composants/pagination/ProxyCommentaires.java
10,6 → 10,7
import org.tela_botanica.client.modeles.Information;
import org.tela_botanica.client.modeles.ValeurListe;
import org.tela_botanica.client.modeles.ValeurListeAsyncDao;
import org.tela_botanica.client.modeles.projet.Projet;
import org.tela_botanica.client.synchronisation.Sequenceur;
import org.tela_botanica.client.util.Debug;
import org.tela_botanica.client.util.UtilString;
/trunk/src/org/tela_botanica/client/composants/pagination/ProxyProjets.java
New file
0,0 → 1,72
package org.tela_botanica.client.composants.pagination;
 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
 
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.RegistreId;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Information;
import org.tela_botanica.client.modeles.ValeurListe;
import org.tela_botanica.client.modeles.ValeurListeAsyncDao;
import org.tela_botanica.client.modeles.projet.Projet;
import org.tela_botanica.client.synchronisation.Sequenceur;
import org.tela_botanica.client.util.Debug;
import org.tela_botanica.client.util.UtilString;
 
import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.data.BasePagingLoadConfig;
import com.extjs.gxt.ui.client.data.BasePagingLoadResult;
import com.extjs.gxt.ui.client.data.DataReader;
import com.extjs.gxt.ui.client.data.MemoryProxy;
import com.extjs.gxt.ui.client.data.ModelData;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.user.client.rpc.AsyncCallback;
 
public class ProxyProjets<D> extends Proxy {
public ProxyProjets(Sequenceur sequenceur) {
super(sequenceur);
}
@Override
public void load(TransformateurJSONaModelData reader, Object loadConfig, AsyncCallback callback, String recherche) {
this.reader = reader;
this.callback = callback;
this.loadConfig = loadConfig;
 
BasePagingLoadConfig lc = (BasePagingLoadConfig) loadConfig;
if (UtilString.isNumber(recherche, false)) {
mediateur.selectionnerProjet(this, recherche, "array", true, sequenceur);
} else {
mediateur.selectionnerProjet(this, recherche, lc.getOffset(), lc.getLimit(), sequenceur);
}
}
@Override
@SuppressWarnings("unchecked")
public void rafraichir(Object nouvellesDonnees) {
try {
data = nouvellesDonnees;
D d = null;
 
if (reader != null) {
d = (D) reader.read(loadConfig, data);
} else {
d = (D) data;
if (d instanceof List)
{
d = (D) new ArrayList((List) d);
}
}
 
callback.onSuccess(d);
} catch (Exception e) {
callback.onFailure(e);
}
}
}
/trunk/src/org/tela_botanica/client/composants/pagination/ProxyPublications.java
10,6 → 10,7
import org.tela_botanica.client.modeles.Information;
import org.tela_botanica.client.modeles.ValeurListe;
import org.tela_botanica.client.modeles.ValeurListeAsyncDao;
import org.tela_botanica.client.modeles.projet.Projet;
import org.tela_botanica.client.synchronisation.Sequenceur;
import org.tela_botanica.client.util.Debug;
import org.tela_botanica.client.util.UtilString;
/trunk/src/org/tela_botanica/client/composants/pagination/ProxyStructures.java
39,7 → 39,7
 
BasePagingLoadConfig lc = (BasePagingLoadConfig) loadConfig;
if (UtilString.isNumber(recherche, false)) {
mediateur.selectionnerStructureAvecPaginationProgressive(this, nom, null, "array", lc.getOffset(), lc.getLimit(), sequenceur, false);
mediateur.selectionnerStructureAvecPaginationProgressive(this, nom, null, null, "array", lc.getOffset(), lc.getLimit(), sequenceur, false);
} else {
mediateur.selectionnerStructure(this, nom, lc.getOffset(), lc.getLimit(), sequenceur, false);
}
/trunk/src/org/tela_botanica/client/modeles/collection/Collection.java
106,6 → 106,14
this.set("id_collection", idCollection);
}
// CE PROJET
public String getIdProjet() {
return renvoyerValeurCorrecte("ce_projet");
}
public void setIdProjet(String idProjet) {
this.set("ce_projet", idProjet);
}
// COLLECTION MERE ID
public String getCollectionMereId() {
return renvoyerValeurCorrecte("ce_mere");
/trunk/src/org/tela_botanica/client/modeles/collection/CollectionListe.java
125,6 → 125,6
public void filtrerParNomEtPage(String nom, int pageCourante) {
currentPage = pageCourante;
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
mediateur.selectionnerCollection(vueARafraichir, null, "%" + nom + "%", currentPage, nbElementsPage, null);
mediateur.selectionnerCollection(vueARafraichir, mediateur.getProjetId(), "%" + nom + "%", currentPage, nbElementsPage, null);
}
}
/trunk/src/org/tela_botanica/client/modeles/collection/CollectionAsyncDao.java
8,6 → 8,7
import org.tela_botanica.client.http.JsonRestRequestCallback;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Information;
import org.tela_botanica.client.modeles.projet.ProjetListe;
import org.tela_botanica.client.synchronisation.Reponse;
import org.tela_botanica.client.util.Debug;
import org.tela_botanica.client.util.UtilDAO;
43,11 → 44,11
* est renvoyé à l'appelant
* // FIXME : si la taille de la liste est supérieure à la limite du JREST (150), ce deuxieme mode ne fonctionne pas
*/
public void selectionner(final boolean paginationProgressive, final String collectionId, final String nomCollection, final int start, final int nbElements, final Integer seqId) {
public void selectionner(final boolean paginationProgressive, final String projetId, final String collectionId, final String nomCollection, final int start, final int nbElements, final Integer seqId) {
 
// Ajout des paramètres et données à selectionner dans l'URL
String nom = (nomCollection == null) ? "%" : nomCollection+"%";
String[] parametres = {collectionId, nom};
String[] parametres = {projetId, collectionId, nom};
HashMap<String, String> restrictions = new HashMap<String, String>();
/trunk/src/org/tela_botanica/client/modeles/structure/StructureAPersonne.java
264,6 → 264,14
//+---------------------------------------------------------------------------------------------------------------+
// CHAMPS PROVENANT de la TABLE COEL_PERSONNE
// ID PROJET PERSONNE
public String getIdProjetPersonne() {
return renvoyerValeurCorrecte("ce_projet");
}
public void setIdProjetPersonne(String ipp) {
set("ce_projet", ipp);
}
// PRÉNOM
public String getPrenom() {
return renvoyerValeurCorrecte("prenom");
/trunk/src/org/tela_botanica/client/modeles/structure/StructureAPersonneAsyncDao.java
197,6 → 197,7
"&csap_ce_truk_statut=" + URL.encodeComponent(personnel.getStatut()) +
"&csap_mark_contact=" + URL.encodeComponent(personnel.getContact()) +
"&csap_bota_travail_hebdo_tps=" + URL.encodeComponent(personnel.getBotaTravailHebdoTps()) +
"&cp_ce_projet=" + URL.encodeComponent(personnel.getIdProjetPersonne()) +
"&cp_prenom=" + URL.encodeComponent(personnel.getPrenom()) +
"&cp_nom=" + URL.encodeComponent(personnel.getNom()) +
"&cp_fmt_nom_complet=" + URL.encodeComponent(personnel.getNomComplet()) +
/trunk/src/org/tela_botanica/client/modeles/structure/Structure.java
92,6 → 92,13
this.set("id_structure", idStructure);
}
public String getIdProjet() {
return renvoyerValeurCorrecte("ce_projet");
}
public void setIdProjet(String idProjet) {
this.set("ce_projet", idProjet);
}
public String getIdMere() {
return renvoyerValeurCorrecte("ce_mere");
}
152,6 → 159,13
this.set("ce_truk_type_public", typePublic);
}
public String getAbreviationProjet() {
return renvoyerValeurCorrecte("_abreviationprojet_");
}
public void setAbreviationProjet(String abreviation) {
this.set("_abreviationprojet_", abreviation);
}
public String getAdresse() {
return (String) renvoyerValeurCorrecte("adresse_01");
}
/trunk/src/org/tela_botanica/client/modeles/structure/StructureListe.java
116,12 → 116,12
public void selectionnerStructure() {
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
mediateur.selectionnerStructure(vueARafraichir, null, null, currentPage, nbElementsPage, null, true);
mediateur.selectionnerStructure(vueARafraichir, null, mediateur.getProjetId(), null, currentPage, nbElementsPage, null, true);
}
public void filtrerParNom(String nom) {
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
mediateur.selectionnerStructure(vueARafraichir, null, "%" + nom + "%", 0, nbElementsPage, null, true);
mediateur.selectionnerStructure(vueARafraichir, mediateur.getProjetId(), null, "%" + nom + "%", 0, nbElementsPage, null, true);
}
 
128,6 → 128,6
public void filtrerParNomEtPage(String nom, int pageCourante) {
currentPage = pageCourante;
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
mediateur.selectionnerStructure(vueARafraichir, null, "%" + nom + "%", currentPage, nbElementsPage, null, true);
mediateur.selectionnerStructure(vueARafraichir, mediateur.getProjetId(), null, "%" + nom + "%", currentPage, nbElementsPage, null, true);
}
}
/trunk/src/org/tela_botanica/client/modeles/structure/StructureAsyncDao.java
9,6 → 9,7
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Information;
import org.tela_botanica.client.modeles.personne.PersonneListe;
import org.tela_botanica.client.modeles.projet.ProjetListe;
import org.tela_botanica.client.synchronisation.Reponse;
import org.tela_botanica.client.util.UtilDAO;
 
42,8 → 43,8
* est renvoyé à l'appelant
* // FIXME : si la taille de la liste est supérieure à la limite du JREST (150), ce deuxieme mode ne fonctionne pas
*/
public void selectionner(final boolean paginationProgressive, final String structureId, final String nomStructure, final String formatRetour, final int start, final int nbElements, final Integer seqId, final boolean searchCity) {
String[] parametres = {structureId, nomStructure};
public void selectionner(final boolean paginationProgressive, final String projetId, final String structureId, final String nomStructure, final String formatRetour, final int start, final int nbElements, final Integer seqId, final boolean searchCity) {
String[] parametres = {projetId, structureId, nomStructure};
 
HashMap<String, String> restrictions = new HashMap<String, String>();
 
244,7 → 245,9
postDonnees += "&cs_id_structure=" + URL.encodeComponent(structureId);
}
postDonnees += "&cs_ce_mere=" + URL.encodeComponent(str.getIdMere()) +
postDonnees += "&cpr_abreviation=" + URL.encodeComponent(str.getAbreviationProjet());
postDonnees += "&cs_ce_projet=" + URL.encodeComponent(str.getIdProjet()) +
"&cs_ce_mere=" + URL.encodeComponent(str.getIdMere()) +
"&cs_guid=" + URL.encodeComponent(str.getGuid()) +
"&cs_truk_identifiant_alternatif=" + URL.encodeComponent(str.getIdAlternatif()) +
"&cs_nom=" + URL.encodeComponent(str.getNom()) +
/trunk/src/org/tela_botanica/client/modeles/ValeurListeAsyncDao.java
84,8 → 84,6
* @param 'pagination' est un booléen qui définit si la requête doit être paginée ou non.
* @param 'recherche' est une chaîne de caractères représentant tout ou partie du nom d'un projet.
* Si la chaîne est vide, alors tous les projets sont recherchés.
* (la notion de projet a été supprimée)
* //TODO: pertinence de ce paramètre
* @param 'start' et 'limit' sont les paramètres indispensables à la pagination. 'start'
* est le paramètre qui décrit le numéro du tuple de départ et 'limit' le nombre
* d'éléments à collecter.
/trunk/src/org/tela_botanica/client/modeles/commentaire/Commentaire.java
106,6 → 106,13
this.set("id_commentaire", idCommentaire);
}
public String getIdProjet() {
return renvoyerValeurCorrecte("ce_projet");
}
public void setIdProjet(String idProjet) {
this.set("ce_projet", idProjet);
}
public String getCommentairePereId() {
return renvoyerValeurCorrecte("ce_pere");
}
/trunk/src/org/tela_botanica/client/modeles/commentaire/CommentaireAsyncDao.java
40,11 → 40,11
* est renvoyé à l'appelant
* // FIXME : si la taille de la liste est supérieure à la limite du JREST (150), ce deuxieme mode ne fonctionne pas
*/
public void selectionner(final boolean paginationProgressive, final String commentaireId, final String titre, final int start, final int nbElements, final Integer seqId) {
public void selectionner(final boolean paginationProgressive, final String commentaireId, final String projetId, final String titre, final int start, final int nbElements, final Integer seqId) {
 
// Ajout des paramètres et données à selectionner dans l'URL
String nom = (titre == null) ? "%" : titre+"%";
String[] parametres = {commentaireId, nom};
String[] parametres = {projetId, commentaireId, nom};
HashMap<String, String> restrictions = new HashMap<String, String>();
/trunk/src/org/tela_botanica/client/modeles/projet/Projet.java
New file
0,0 → 1,149
package org.tela_botanica.client.modeles.projet;
 
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
 
import org.tela_botanica.client.modeles.aDonnee;
import org.tela_botanica.client.util.Debug;
 
import com.extjs.gxt.ui.client.data.ModelData;
import com.google.gwt.json.client.JSONObject;
 
public class Projet extends aDonnee {
private static final long serialVersionUID = 6733053168274995082L;
 
private static final String PREFIXE = "cpr";
public static String[] champsObligatoires = {"cpr_id_projet"};
public Projet() {}
public Projet(JSONObject liste) {
initialiserModele(liste);
}
public Projet(ModelData model)
{
Map<String, Object> a = model.getProperties();
 
Set<String> cles = a.keySet();
Iterator<String> it = cles.iterator();
while (it.hasNext()) {
String cle = it.next();
if (a.get(cle) != null) {
String cleObjet = cle.replaceFirst("^"+getPrefixe()+"_", "");
this.set(cleObjet, a.get(cle));
}
}
}
@Override
protected String getPrefixe() {
return PREFIXE;
}
protected String[] getChampsObligatoires() {
return champsObligatoires;
}
public String getId() {
return renvoyerValeurCorrecte("id_projet");
}
public void setId(String projetId) {
set("id_projet", projetId);
}
public String getNom() {
return renvoyerValeurCorrecte("nom");
}
public void setNom(String nom) {
set("nom", nom);
}
public String getAbreviation() {
return renvoyerValeurCorrecte("abreviation");
}
public void setAbreviation(String abrev) {
set("abreviation", abrev);
}
public String getResume() {
return renvoyerValeurCorrecte("resume");
}
public void setResume(String valeur) {
set("resume", valeur);
}
public String getDescription() {
return renvoyerValeurCorrecte("description");
}
public void setDescription(String valeur) {
set("description", valeur);
}
public String getUrl() {
return renvoyerValeurCorrecte("url");
}
public void setUrl(String valeur) {
set("url", valeur);
}
public String getMotsCles() {
return renvoyerValeurCorrecte("mot_cles");
}
public void setMotsCles(String valeur) {
set("mot_cles", valeur);
}
public String getCitation() {
return renvoyerValeurCorrecte("citation");
}
public void setCitation(String valeur) {
set("citation", valeur);
}
public String getLicence() {
return renvoyerValeurCorrecte("licence");
}
public void setLicence(String valeur) {
set("licence", valeur);
}
 
public String getLangueId() {
return renvoyerValeurCorrecte("ce_langue");
}
public void setLangue(String valeur) {
set("ce_langue", valeur);
}
public String getIndexationHeure() {
return renvoyerValeurCorrecte("indexation_heure");
}
public void setIndexationHeure(String valeur) {
set("indexation_heure", valeur);
}
public String getIndexationDuree() {
return renvoyerValeurCorrecte("ce_indexation_duree");
}
public void setIndexationDuree(String valeur) {
set("ce_indexation_duree", valeur);
}
public String getIndexationFreq() {
return renvoyerValeurCorrecte("ce_indexation_freq");
}
public void setIndexationFreq(String valeur) {
set("ce_indexation_freq", valeur);
}
public String getMarkPublic() {
return renvoyerValeurCorrecte("mark_public");
}
public void setMarkPublic(String valeur) {
set("mark_public", valeur);
}
}
Property changes:
Added: svn:mergeinfo
Merged /trunk/src/org/tela_botanica/client/modeles/projet/Projet.java:r11-934,1209-1382
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/projet/Projet.java:r1383-1511
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/modeles/projet/Projet.java:r1136-1368
/trunk/src/org/tela_botanica/client/modeles/projet/ProjetListe.java
New file
0,0 → 1,136
package org.tela_botanica.client.modeles.projet;
 
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.RegistreId;
import org.tela_botanica.client.interfaces.ListePaginable;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.aDonneeListe;
 
import com.extjs.gxt.ui.client.Registry;
import com.google.gwt.i18n.client.Dictionary;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONNumber;
import com.google.gwt.json.client.JSONObject;
 
/**
* Classe contenant les informations sur les Structures renvoyées par un objet de type DAO.
*
* @author Grégoire DUCHÉ
*
*/
public class ProjetListe extends aDonneeListe<Projet> implements ListePaginable {
private static final long serialVersionUID = -9030260944108896455L;
private int currentPage = 0;
private int nbElementsPage = Integer.valueOf(((Dictionary) Dictionary.getDictionary("configuration")).get("nbElementsPage"));
private int nbElementsTotal;
private Rafraichissable vueARafraichir;
 
public ProjetListe() {
super();
}
/**
* Constructeur avec paramètre
* @param taille la taille de la table de hachage
*/
public ProjetListe(int taille) {
super(taille);
}
/**
* Constructeur pour une liste de projets
* @param dates
*/
public ProjetListe(JSONArray ListeDeProjets) {
super(ListeDeProjets.size());
initialiserProjetListe(ListeDeProjets);
}
public ProjetListe(JSONArray ListeDeProjets, JSONNumber nbElements, Rafraichissable vueARafraichir) {
super(ListeDeProjets.size());
this.nbElementsTotal = Integer.valueOf(nbElements.toString());
this.vueARafraichir = vueARafraichir;
initialiserProjetListe(ListeDeProjets);
}
private void initialiserProjetListe(JSONArray ListeDeProjets) {
final int taillemax = ListeDeProjets.size();
for (int i = 0; i < taillemax; i++) {
JSONObject projetCourant = ListeDeProjets.get(i).isObject();
if (projetCourant != null) {
Projet projet = new Projet(projetCourant);
this.put(projet.getId(), projet);
}
}
}
public void changerNumeroPage(int pageCourante) {
currentPage = pageCourante;
selectionnerStructure();
}
 
public void changerTaillePage(int nouvelleTaillePage) {
nbElementsPage = nouvelleTaillePage;
selectionnerStructure();
}
public void recharger() {
selectionnerStructure();
}
public void setPageCourante(int pageCourante) {
this.currentPage = pageCourante;
}
 
public void setTaillePage(int taillePage) {
this.nbElementsPage = taillePage;
}
public int[] getPageTable() {
int[] page = new int[4];
// nombre de pages au total
page[0] = calculerNbPages();
// Page En Cours
page[1] = currentPage;
// nbElementsParPage
page[2] = nbElementsPage;
// et le dernier le nombre total d'éléments
page[3] = nbElementsTotal;
return page;
}
/**
* Calcule le nombre de pages nécessaires pour afficher un nombre d'élements
* donnés en fonction de la taille de page en cours
*
* @return le nombre de pages
*/
public int calculerNbPages() {
// À cause de la bétise de java pour les conversion implicite, on fait quelques conversions manuellement
// pour eviter qu'il arrondisse mal la division nombre de pages = (nombre d'element / taille de la page)
// arrondie à l'entier supérieur.
double nPage = (1.0 * nbElementsTotal) / (1.0 * nbElementsPage);
double nPageRound = Math.ceil(nPage);
Double nPageInt = new Double(nPageRound);
 
// Convertion en entier
return nPageInt.intValue();
}
public void selectionnerStructure() {
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
mediateur.selectionnerProjet(vueARafraichir, mediateur.getProjetId(), null, currentPage, nbElementsPage, null, false, null);
}
public void filtrerParNom(String nom) {
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
mediateur.selectionnerProjet(vueARafraichir, mediateur.getProjetId(), "%" + nom + "%", 0, nbElementsPage, null, false, null);
}
 
public void filtrerParNomEtPage(String nom, int pageCourante) {
currentPage = pageCourante;
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
mediateur.selectionnerProjet(vueARafraichir, mediateur.getProjetId(), "%" + nom + "%", currentPage, nbElementsPage, null, false, null);
}
}
Property changes:
Added: svn:mergeinfo
Merged /trunk/src/org/tela_botanica/client/modeles/projet/ProjetListe.java:r11-934,1209-1382
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/projet/ProjetListe.java:r1383-1511
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/modeles/projet/ProjetListe.java:r1136-1368
/trunk/src/org/tela_botanica/client/modeles/projet/ProjetAsyncDao.java
New file
0,0 → 1,223
package org.tela_botanica.client.modeles.projet;
 
import java.util.HashMap;
 
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.RegistreId;
import org.tela_botanica.client.http.JsonRestRequestBuilder;
import org.tela_botanica.client.http.JsonRestRequestCallback;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Information;
import org.tela_botanica.client.modeles.structure.StructureListe;
import org.tela_botanica.client.synchronisation.Reponse;
import org.tela_botanica.client.util.Debug;
import org.tela_botanica.client.util.UtilDAO;
 
import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.widget.Info;
import com.google.gwt.core.client.GWT;
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.json.client.JSONValue;
 
public class ProjetAsyncDao {
private static final String SERVICE_NOM = "CoelProjet";
String utilisateurId = null;
private Rafraichissable vueARafraichir = null;
public ProjetAsyncDao(Rafraichissable vueARafraichirCourrante) {
if (Mediateur.DEBUG) System.out.println("|| ProjetAsyncDao > vueARafraichir = "+vueARafraichirCourrante.getClass().toString());
vueARafraichir = vueARafraichirCourrante;
utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId();
}
 
/**
* @param paginationProgressive : définit le mode de consultation de la base de données
* - True : la consultation des données est progressive, ce qui signifie que la liste est chargée (paginée) au
* fur et à mesure de la consultation des données par l'utilisateur.
* - False : la consultation des données est classique : un seul appel à la base de données est effectué, le retour
* est renvoyé à l'appelant
* // FIXME : si la taille de la liste est supérieure à la limite du JREST (150), ce deuxieme mode ne fonctionne pas
*/
public void selectionner(final boolean paginationProgressive, final String projetId, final String nomProjet, final int start, final int nbElements, final String formatRetour, final Integer seqId) {
String nom = (nomProjet == null) ? "%" : nomProjet+"%";
String[] param = {projetId, nom};
HashMap<String, String> restrictions = new HashMap<String, String>();
 
/* ne jamais effectuer de limitation du nombre de projet car, lorsqu'on édite une institution, le "projet"
est obligatoire, cependant, si l'ID du projet de cette institution n'est pas présent dans la première page
de la liste dynamique téléchargée initialement (offset 0 -> 10), le champ reste invalide / rouge,
rendant impossible la modification rapide de la structure.
 
Pour cette raison, la liste des projets est toujours récupérée en intégralité. */
if (false && nbElements != -1) {
restrictions.put("limit", String.valueOf(nbElements));
}
 
if ((formatRetour != null) && (formatRetour != "")) {
restrictions.put("formatRetour", formatRetour);
}
/** GESTION DE LA REQUETE dans le cas d'une liste paginée progressive **/
if (paginationProgressive) {
 
/** DEFINITION DU TUPLE DE DEPART **/
restrictions.put("start", String.valueOf(start));
/** CONSTRUCTION DE LA REQUETE **/
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, param, restrictions);
 
/** ENVOI DE LA REQUETE **/
rb.envoyerRequete(null, new JsonRestRequestCallback()
{
/** RECEPTION DE LA REPONSE **/
public void surReponse(JSONValue responseValue)
{
/** Dans le cas d'une liste paginée, vueARafraichir est un objet Proxy.
* On retourne l'objet JSON au proxy afin que ce soit lui qui le traite **/
if (seqId != null) {
Reponse reponseRequete = new Reponse(responseValue, seqId);
vueARafraichir.rafraichir(reponseRequete);
}
else {
vueARafraichir.rafraichir(responseValue);
}
}
});
}
/** GESTION DE LA REQUETE dans le cas d'une liste NON paginée progressive **/
else {
/** DEFINITION DU TUPLE DE DEPART **/
restrictions.put("start", String.valueOf(start*nbElements));
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, param, restrictions);
rb.envoyerRequete(null, new JsonRestRequestCallback() {
public void surReponse(JSONValue responseValue) {
if (responseValue != null) {
JSONObject responseObject = responseValue.isObject();
if (responseObject != null) {
// Si la réponse est un tableau, alors c'est une liste de projets qui a été retournée
if (responseObject.get("projets").isArray() != null) {
JSONArray reponse = responseObject.get("projets").isArray();
ProjetListe projets;
projets = new ProjetListe(reponse, responseObject.get("nbElements").isNumber(), vueARafraichir);
projets.setTaillePage(nbElements);
projets.setPageCourante(start);
 
if (seqId != null) {
Reponse retourRequete = new Reponse(projets, seqId);
vueARafraichir.rafraichir(retourRequete);
} else {
vueARafraichir.rafraichir(projets);
}
// Si la réponse est un objet, alors c'est un unique projet qui a été retourné
} else if (responseObject.get("projets").isObject() != null) {
JSONObject reponse = responseObject.get("projets").isObject();
Projet projet = new Projet(reponse);
Information info = new Information("selection_projet");
info.setDonnee(0, projet);
 
if (seqId != null) {
Reponse reponseRequete = new Reponse(info, seqId);
vueARafraichir.rafraichir(reponseRequete);
}
else {
vueARafraichir.rafraichir(info);
}
}
} else {
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un objet ou un tableau JSON et vaut : "+responseValue.toString(), null);
}
} else {
// Dans le cas, où nous demandons tous les projets et qu'il n'y en a pas, nous retournons un objet vide
if (projetId == null) {
ProjetListe projets = new ProjetListe(0);
if (seqId != null) {
Reponse reponseRequete = new Reponse(projets, seqId);
vueARafraichir.rafraichir(reponseRequete);
}
else {
vueARafraichir.rafraichir(projets);
}
}
}
}
});
}
}
public void ajouter(Projet projet) {
String postDonneesEncodees = projet.obtenirChainePOST()+"&cmhl_ce_modifier_par="+utilisateurId;
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM);
rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() {
@Override
public void surReponse(JSONValue reponseValeur) {
traiterReponse(reponseValeur, "ajout_projet");
}
}) ;
}
public void modifier(Projet projet) {
String[] parametres = {projet.getId()};
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres);
String postDonneesEncodees = projet.obtenirChainePOST()+"&cmhl_ce_modifier_par="+utilisateurId;
rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() {
@Override
public void surReponse(JSONValue reponseValeur) {
traiterReponse(reponseValeur, "modif_projet");
}
});
}
 
public void supprimer(String projetsId) {
String[] parametres = {utilisateurId, projetsId};
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres);
rb.envoyerRequeteSuppression(new JsonRestRequestCallback() {
@Override
public void surReponse(JSONValue reponseValeur) {
traiterReponse(reponseValeur, "suppression_projet");
}
});
}
private void traiterReponse(JSONValue reponseValeur, String type) {
Information info = new Information(type);
String idsNonSuppr = "";
// Si la requête est un succès, réception d'une chaîne
if (type.equals("suppression_projet") && reponseValeur.isArray() != null) {
JSONArray tableauInfo = reponseValeur.isArray();
idsNonSuppr = tableauInfo.get(0).isString().stringValue();
} else if (reponseValeur.isString() != null) {
String idOuMessage = reponseValeur.isString().stringValue();
if (idOuMessage.matches("^[0-9]+$")) {
info.setDonnee(idOuMessage);
} else {
info.setDonnee("");
info.setMessage(idOuMessage);
}
} else {
info.setDeboguage("La réponse n'est pas une chaine JSON.");
}
info.setDonnee(1, idsNonSuppr);
vueARafraichir.rafraichir(info);
}
}
Property changes:
Added: svn:mergeinfo
Merged /trunk/src/org/tela_botanica/client/modeles/projet/ProjetAsyncDao.java:r11-934,1209-1382
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/projet/ProjetAsyncDao.java:r1383-1511
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/modeles/projet/ProjetAsyncDao.java:r1136-1368
/trunk/src/org/tela_botanica/client/modeles/projet/ProjetVersion.java
New file
0,0 → 1,84
package org.tela_botanica.client.modeles.projet;
 
import java.util.Iterator;
import java.util.Set;
 
import org.tela_botanica.client.modeles.aDonnee;
 
import com.google.gwt.json.client.JSONObject;
 
public class ProjetVersion extends aDonnee {
 
/**
*
*/
private static final long serialVersionUID = 1L;
 
private static final String PREFIXE = "cprv";
public static String[] champsObligatoires = {"cpr_id_projet"};
public ProjetVersion() {
//this.set("mark_contact", false);
super();
}
public ProjetVersion(JSONObject liste) {
// l'objet JSON est une table de hachage
Set<String> im = liste.keySet();
 
// Parcourt pour chaque clé
for (Iterator<String> it = im.iterator(); it.hasNext();) {
// Si elle est associée à une valeur, nous l'ajoutons
String cle = it.next();
// Suppression de l'abréviation du champ. Inutile dans le contexte d'un objet
String cleObjet = cle.replaceFirst("^"+PREFIXE+"_", "");
if (liste.get(cle).isString() != null) {
String valeur = liste.get(cle).isString().stringValue();
this.set(cleObjet, valeur);
} else {
// Sinon, nous ajoutons la clé avec une valeur vide
String valeur = " ";
this.set(cleObjet, valeur);
}
}
}
@Override
protected String getPrefixe() {
return PREFIXE;
}
protected String[] getChampsObligatoires() {
return champsObligatoires;
}
public String getIdVersion() {
return renvoyerValeurCorrecte("id_version");
}
public String getIdProjet() {
return renvoyerValeurCorrecte("id_projet");
}
public String getNom() {
return renvoyerValeurCorrecte("nom");
}
public String getCode() {
return renvoyerValeurCorrecte("code");
}
public String getDateDebut() {
return renvoyerValeurCorrecte("date_debut");
}
public String getDateFin() {
return renvoyerValeurCorrecte("date_fin");
}
public String getMeta() {
return renvoyerValeurCorrecte("ce_meta ");
}
 
 
}
Property changes:
Added: svn:mergeinfo
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/modeles/projet/ProjetVersion.java:r1136-1368
Merged /trunk/src/org/tela_botanica/client/modeles/projet/ProjetVersion.java:r11-934,1209-1382
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/modeles/projet/ProjetVersion.java:r1383-1511
/trunk/src/org/tela_botanica/client/modeles/publication/Publication.java
109,6 → 109,13
setValeurCorrecte("id_publication", idPublication);
}
public String getIdProjet() {
return renvoyerValeurCorrecte("ce_projet");
}
public void setIdProjet(String idProjet) {
setValeurCorrecte("ce_projet", idProjet);
}
public String getNomComplet() {
return renvoyerValeurCorrecte("fmt_nom_complet");
}
/trunk/src/org/tela_botanica/client/modeles/publication/PublicationListe.java
113,17 → 113,17
public void selectionnerPublication() {
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
mediateur.selectionnerPublication(vueARafraichir, null, null, currentPage, nbElementsPage, null);
mediateur.selectionnerPublication(vueARafraichir, mediateur.getProjetId(), null, null, currentPage, nbElementsPage, null);
}
public void filtrerParNom(String nom) {
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
mediateur.selectionnerPublicationParNomComplet(vueARafraichir, "%" + nom + "%");
mediateur.selectionnerPublicationParNomComplet(vueARafraichir, mediateur.getProjetId(), "%" + nom + "%");
}
 
public void filtrerParNomEtPage(String nom, int pageCourante) {
currentPage = pageCourante;
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
mediateur.selectionnerPublication(vueARafraichir, null, "%" + nom + "%", currentPage, nbElementsPage, null);
mediateur.selectionnerPublication(vueARafraichir, mediateur.getProjetId(), null, "%" + nom + "%", currentPage, nbElementsPage, null);
}
}
/trunk/src/org/tela_botanica/client/modeles/publication/PublicationAsyncDao.java
41,10 → 41,10
* est renvoyé à l'appelant
* // FIXME : si la taille de la liste est supérieure à la limite du JREST (150), ce deuxieme mode ne fonctionne pas efficacement (on ne voit pas les enregistrement suivants)
*/
public void selectionner(final boolean paginationProgressive, final String publicationId, String nomComplet, final int start, final int nbElements, final Integer seqId) {
public void selectionner(final boolean paginationProgressive, final String publicationId, String projetId, String nomComplet, final int start, final int nbElements, final Integer seqId) {
String nom = (nomComplet == null) ? "%" : nomComplet+"%";
String[] param = {publicationId, nom};
String[] param = {publicationId, projetId, nom};
HashMap<String, String> restrictions = new HashMap<String, String>();
89,7 → 89,7
if (responseValue != null) {
JSONObject responseObject = responseValue.isObject();
if (responseObject != null) {
// Si la réponse est un tableau, alors c'est une liste de publications qui a été retournée
// Si la réponse est un tableau, alors c'est une liste de projets qui a été retournée
if (responseObject.get("publications").isArray() != null) {
JSONArray reponse = responseObject.get("publications").isArray();
107,7 → 107,7
vueARafraichir.rafraichir(publications);
}
// Si la réponse est un objet, alors c'est une unique publication qui a été retournée
// Si la réponse est un objet, alors c'est un unique projet qui a été retourné
} else if (responseObject.get("publications").isObject() != null) {
JSONObject reponse = responseObject.get("publications").isObject();
/trunk/src/org/tela_botanica/client/modeles/MenuApplicationId.java
3,6 → 3,7
public class MenuApplicationId {
public static final String ACCUEIL = "Accueil";
public static final String PROJET = "Projets";
public static final String STRUCTURE = "Structures";
public static final String COLLECTION = "Collections";
public static final String PERSONNE = "Personnes";
/trunk/src/org/tela_botanica/client/modeles/personne/Personne.java
140,6 → 140,11
else this.set(PREFIXE+"_id_personne", personneId);
}
// ID PROJET
public String getIdProjet() {
return renvoyerValeurCorrecte("ce_projet");
}
// NOM COMPLET
public String getNomComplet() {
return renvoyerValeurCorrecte("fmt_nom_complet");
/trunk/src/org/tela_botanica/client/modeles/personne/PersonneListe.java
11,7 → 11,6
import com.google.gwt.json.client.JSONArray;
import com.google.gwt.json.client.JSONNumber;
import com.google.gwt.json.client.JSONObject;
import com.google.gwt.user.client.Window;
 
/**
* Classe contenant les informations sur les Personnes renvoyées par un objet de type DAO.
126,10 → 125,7
 
public void selectionnerPersonne() {
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
// Utilisation d'une valeur nulle "typée" pour éviter un ambiguité sur l'appel de méthode et donc
// une erreur
Personne personne = new Personne();
mediateur.selectionnerPersonne(vueARafraichir, personne, currentPage, nbElementsPage, null);
mediateur.selectionnerPersonne(vueARafraichir, null, mediateur.getProjetId(), currentPage, nbElementsPage, null);
}
 
public void filtrerParNom(String nom) {
136,7 → 132,7
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
Personne personne = new Personne();
personne.setNom("%" + nom + "%");
mediateur.selectionnerPersonne(vueARafraichir, personne, currentPage, nbElementsPage, null);
mediateur.selectionnerPersonne(vueARafraichir, personne, mediateur.getProjetId(), currentPage, nbElementsPage, null);
}
 
public void filtrerParNomEtPage(String nom, int pageCourante) {
/trunk/src/org/tela_botanica/client/modeles/personne/PersonneAsyncDao.java
41,10 → 41,10
* est renvoyé à l'appelant
* // FIXME : si la taille de la liste est supérieure à la limite du JREST (150), ce deuxieme mode ne fonctionne pas
*/
public void selectionner(final boolean paginationProgressive, String personneId, String nomComplet, final int start, final int nbElements, final Integer seqId) {
public void selectionner(final boolean paginationProgressive, String personneId, String projetId, String nomComplet, final int start, final int nbElements, final Integer seqId) {
 
String nom = (nomComplet == null) ? "%" : "%"+nomComplet+"%";
String[] parametres = {personneId, nom};
String[] parametres = {personneId, projetId, nom};
HashMap<String, String> restrictions = new HashMap<String, String>();
58,7 → 58,7
/** GESTION DE LA REQUETE dans le cas d'une liste paginée progressive **/
if (paginationProgressive) {
 
/** DEFINITION DU TUPLE DE DEPART **/
restrictions.put("start", String.valueOf(start));
/trunk/src/org/tela_botanica/client/i18n/Constantes.properties
69,6 → 69,7
# Formulaire
champObligatoire = Ce champ est obligatoire.
champNumerique = Ce champ doit contenir un nombre
projetChamp = Projet
 
# Pagination
page = Page
98,7 → 99,10
 
# Menus
titreMenu = Menu
txtListeProjetDefaut = Choisissez un projet...
tousProjets = Tous les projets
menuAccueil = Accueil
menuProjet = Projets
menuStructure = Institutions
menuCollection = Collections
menuPersonne = Personnes
156,7 → 160,33
accueilChargementSucces = Votre page d'accueil a été correctement chargée
 
# +--------------------------------------------------------------------------------------------------------------------+
# projet
projetSingulier = projet
projetTitreFormAjout = Ajout d'un projet
projetTitreFormModif = Modification d'un projet
projetTitreInfoGenerale = Informations générales
projetTitreSuppression = Suppression de projet(s)
publicationNomComplet = Nom complet
projetNom = Nom
projetAbreviation = Abréviation
projetResume = Résumé
projetDescription = Description
projetUrl = Url
projetTitreComplement = Complément
projetMotsCles = Mots-clés
projetCitation = Citation
projetLicence = Licence
projetLangue = Langue
projetTitreIndexation = Indexation
projetIndexationDuree = Durée d'indexation
projetIndexationHeure = Heure d'indexation
projetIndexationFrequence = Fréquence d'indexation
projetMarkPublic = Public
projetMessageHeureMinute = L'heure d'indexation doit être au format 'HH:mm'. Exemples : 15:23, 00:00 ou 23:05.
projetMessageNom = Veuillez saisir le nom du projet !
projetMessageAbreviation = Veuillez saisir l'abréviation du projet !
projetMessageDescription = Veuillez saisir la description du projet !
projetMessageResume = Veuillez saisir le résumé du projet !
 
# +--------------------------------------------------------------------------------------------------------------------+
# Structure : titres
503,6 → 533,7
 
personneInfoNat = Informations Naturalistes
tabPublications = Publications liées
personneProjet = Projet
personneLogos = Images
 
personneBiographie = Biographie
/trunk/src/org/tela_botanica/client/i18n/Constantes.java
64,6 → 64,7
// Formulaire
String champObligatoire();
String champNumerique();
String projetChamp();
// Pagination
String page();
93,7 → 94,9
// Menu
String titreMenu();
String txtListeProjetDefaut();
String menuAccueil();
String menuProjet();
String menuStructure();
String menuCollection();
String menuPersonne();
146,7 → 149,34
String accueilEnregistrementSucces();
String accueilChargementSucces();
// +---------------------------------------------------------------------------------------------------------------+
// Projet
String projetSingulier();
String projetTitreFormAjout();
String projetTitreFormModif();
String projetTitreInfoGenerale();
String projetTitreSuppression();
String publicationNomComplet();
String projetNom();
String projetAbreviation();
String projetResume();
String projetDescription();
String projetUrl();
String projetTitreComplement();
String projetMotsCles();
String projetCitation();
String projetLicence();
String projetLangue();
String projetTitreIndexation();
String projetIndexationDuree();
String projetIndexationHeure();
String projetIndexationFrequence();
String projetMarkPublic();
String projetMessageHeureMinute();
String projetMessageNom();
String projetMessageAbreviation();
String projetMessageDescription();
String projetMessageResume();
// +---------------------------------------------------------------------------------------------------------------+
// Structure : titres
496,6 → 526,7
String personneInfoNat();
String tabPublications();
String personneProjet();
// +---------------------------------------------------------------------------------------------------------------+
// Publication
537,6 → 568,7
String personnePublication();
String personneOngletPublication();
String typeRelationPersonne();
String tousProjets();
// Journal
String titreJournal();
/trunk/src/org/tela_botanica/client/vues/publication/PublicationDetailVue.java
4,6 → 4,7
import org.tela_botanica.client.ComposantId;
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.projet.ProjetListe;
import org.tela_botanica.client.modeles.publication.Publication;
import org.tela_botanica.client.vues.DetailVue;
 
55,7 → 56,7
enteteTpl =
"<div id='{css_id}'>"+
" <h1>{titre}</h1>"+
" <h2>{auteurs} ({annee})<span class='{css_meta}'><br /> {i18n_id}:{id} - {guid}</span></h2>" +
" <h2>{auteurs} ({annee})<span class='{css_meta}'>{projet} <br /> {i18n_id}:{id} - {guid}</span></h2>" +
"</div>";
}
94,6 → 95,7
enteteParams.set("annee", publication.getAnneeParution());
enteteParams.set("id", publication.getId());
enteteParams.set("guid", getGuid());
enteteParams.set("projet", construireTxtProjet(publication.getIdProjet()));
 
String eHtml = Format.substitute(enteteTpl, enteteParams);
entete.getElement().setInnerHTML(eHtml);
101,6 → 103,7
public String getGuid() {
String guid = "URN:tela-botanica.org:";
guid += "coel"+publication.getIdProjet()+":";
guid += "pub"+publication.getId();
return guid;
}
136,6 → 139,9
if (nouvellesDonnees instanceof Publication) {
publication = (Publication) nouvellesDonnees;
publicationChargementOk = true;
} else if (nouvellesDonnees instanceof ProjetListe) {
projets = (ProjetListe) nouvellesDonnees;
projetsChargementOk = true;
} else {
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
}
147,7 → 153,7
private boolean avoirDonneesChargees() {
boolean ok = false;
if (publicationChargementOk) {
if (projetsChargementOk && publicationChargementOk) {
ok = true;
}
return ok;
/trunk/src/org/tela_botanica/client/vues/publication/PublicationForm.java
12,6 → 12,7
import org.tela_botanica.client.composants.InfoLogger;
import org.tela_botanica.client.composants.pagination.ProxyPersonnes;
import org.tela_botanica.client.composants.pagination.ProxyPersonnesAPublication;
import org.tela_botanica.client.composants.pagination.ProxyProjets;
import org.tela_botanica.client.composants.pagination.ProxyStructures;
import org.tela_botanica.client.images.Images;
import org.tela_botanica.client.interfaces.Rafraichissable;
19,6 → 20,7
import org.tela_botanica.client.modeles.MenuApplicationId;
import org.tela_botanica.client.modeles.aDonnee;
import org.tela_botanica.client.modeles.personne.Personne;
import org.tela_botanica.client.modeles.projet.Projet;
import org.tela_botanica.client.modeles.publication.Publication;
import org.tela_botanica.client.modeles.publication.PublicationAPersonne;
import org.tela_botanica.client.modeles.publication.PublicationAPersonneListe;
96,6 → 98,7
private PublicationAPersonneListe auteursModifies = null;
private ContentPanel auteursFieldset = null;
private ChampComboBoxRechercheTempsReelPaginable projetsCombo = null;
private FieldSet generalitesFieldset = null;
private TextField<String> titreChp = null;
688,7 → 691,40
generalitesFieldset.setHeadingHtml("Informations générales");
generalitesFieldset.setCollapsible(true);
generalitesFieldset.setLayout(layout);
 
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>(null);
projetsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyProjets, modelTypeProjets, displayNameProjets);
projetsCombo.setWidth(200, 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("cpr_nom", field.getRawValue()) == null) {
String contenuBrut = field.getRawValue();
field.setValue(null);
field.setRawValue(contenuBrut);
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
}
return retour;
}
});
generalitesFieldset.add(projetsCombo, new FormData(600, 0));
titreChp = new TextField<String>();
titreChp.setName("cpu");
titreChp.setFieldLabel("Titre de l'article ou de l'ouvrage");
879,6 → 915,7
}
private void peuplerFormulaire() {
setValeurComboProjets();
titreChp.setValue(publication.getTitre());
collectionChp.setValue(publication.getCollection());
uriChp.setValue(publication.getURI());
899,6 → 936,7
private Publication collecterPublication() {
 
Publication publicationCollectee = (Publication) publication.cloner(new Publication());
publicationCollectee.setIdProjet(getValeurComboProjets());
publicationCollectee.setAuteur(construireIntituleAuteur());
String titre = titreChp.getValue();
1089,6 → 1127,29
//+----------------------------------------------------------------------------------------------------------------+
// Accesseurs
private String getValeurComboProjets() {
String valeur = "";
if (projetsCombo.getValeur() != null) {
Projet projet = new Projet(projetsCombo.getValeur());
valeur = projet.getId();
}
return valeur;
}
private void setValeurComboProjets() {
if (mode.equals(Formulaire.MODE_MODIFIER) && publication != null) {
if (projetsCombo.getCombo().getStore() != null
&& publication != null
&& publication.getIdProjet() != null
&& !UtilString.isEmpty(publication.getIdProjet())) {
projetsCombo.chargerValeurInitiale(publication.getIdProjet(), "cpr_id_projet");
}
} else if (mode.equals(Formulaire.MODE_AJOUTER)) {
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", mediateur.getProjetId()));
} else {
projetsCombo.getCombo().setValue(null);
}
}
//+----------------------------------------------------------------------------------------------------------------+
// Rafraichir
/trunk/src/org/tela_botanica/client/vues/ContenuVue.java
7,13 → 7,14
import org.tela_botanica.client.modeles.collection.CollectionListe;
import org.tela_botanica.client.modeles.commentaire.CommentaireListe;
import org.tela_botanica.client.modeles.personne.PersonneListe;
import org.tela_botanica.client.modeles.projet.ProjetListe;
import org.tela_botanica.client.modeles.publication.PublicationListe;
import org.tela_botanica.client.modeles.structure.StructureListe;
 
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
 
public class ContenuVue extends LayoutContainer implements Rafraichissable {
38,7 → 39,9
//+----------------------------------------------------------------------------------------------------------------+
public void rafraichir(Object nouvellesDonnees) {
if (nouvellesDonnees instanceof StructureListe) {
if (nouvellesDonnees instanceof ProjetListe) {
mediateur.afficherListeProjets((ProjetListe) nouvellesDonnees);
} else if (nouvellesDonnees instanceof StructureListe) {
mediateur.afficherListeStructures((StructureListe) nouvellesDonnees);
} else if (nouvellesDonnees instanceof CollectionListe) {
mediateur.afficherListeCollections((CollectionListe) nouvellesDonnees);
/trunk/src/org/tela_botanica/client/vues/FiltreVue.java
New file
0,0 → 1,132
package org.tela_botanica.client.vues;
 
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
import org.tela_botanica.client.composants.pagination.ProxyProjets;
import org.tela_botanica.client.i18n.Constantes;
import org.tela_botanica.client.images.Images;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.projet.Projet;
import org.tela_botanica.client.synchronisation.Sequenceur;
 
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.ModelType;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.ComponentEvent;
import com.extjs.gxt.ui.client.event.KeyListener;
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.form.Field;
import com.extjs.gxt.ui.client.widget.form.Validator;
import com.extjs.gxt.ui.client.widget.layout.BoxLayout;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
import com.extjs.gxt.ui.client.widget.layout.HBoxLayout;
import com.google.gwt.event.dom.client.KeyCodes;
 
public class FiltreVue extends ContentPanel implements Rafraichissable {
private Mediateur mediateur = null;
private Constantes i18nC = null;
private Sequenceur sequenceur = new Sequenceur();
private ChampComboBoxRechercheTempsReelPaginable projetsCombo = null;
private Button annulerFiltre = null;
public FiltreVue(Mediateur mediateurCourrant) {
mediateur = mediateurCourrant;
i18nC = Mediateur.i18nC;
setHeadingHtml(i18nC.titreFiltre());
setLayout(new HBoxLayout());
setLayoutOnChange(true);
 
/*********************************/
/** 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>(null);
projetsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyProjets, modelTypeProjets, displayNameProjets);
projetsCombo.getCombo().setEmptyText("Tous les projets");
projetsCombo.getCombo().setAllowBlank(true);
projetsCombo.getCombo().setForceSelection(false);
projetsCombo.getCombo().setEditable(true);
projetsCombo.setWidth(215);
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("cpr_nom", field.getRawValue()) == null) {
String contenuBrut = field.getRawValue();
field.setValue(null);
field.setRawValue(contenuBrut);
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
}
return retour;
}
});
// Ajout d'un écouteur pour le changement => enregistre la valeur courante du projet dans le registre
projetsCombo.getCombo().addSelectionChangedListener(new SelectionChangedListener<ModelData>() {
public void selectionChanged(SelectionChangedEvent<ModelData> se) {
if (se.getSelectedItem() != null) {
mediateur.activerChargement(this, i18nC.chargement());
Projet projet = new Projet (se.getSelectedItem());
mediateur.selectionnerProjetCourant(projet);
mediateur.desactiverChargement(this);
annulerFiltre.setEnabled(true);
}
}
});
 
add(projetsCombo);
/** Bouton "annuler" filtre **/
annulerFiltre = new Button();
annulerFiltre.setIcon(Images.ICONES.annuler());
annulerFiltre.setEnabled(false);
add(annulerFiltre);
final Projet tousProjets = new Projet();
tousProjets.set("nom", i18nC.tousProjets());
annulerFiltre.addSelectionListener(new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
projetsCombo.getCombo().clear();
mediateur.activerChargement(this, i18nC.chargement());
mediateur.selectionnerProjetCourant(tousProjets);
mediateur.desactiverChargement(this);
annulerFiltre.setEnabled(false);
}
});
}
public String getProjet() {
if (projetsCombo.getValeur() != null) {
Projet projet = new Projet(projetsCombo.getValeur());
return projet.getAbreviation();
} else {
return null;
}
 
}
public void rafraichir(Object nouvellesDonnees) {
// empty ...
}
}
Property changes:
Added: svn:mergeinfo
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/vues/FiltreVue.java:r1136-1368
Merged /trunk/src/org/tela_botanica/client/vues/FiltreVue.java:r11-981,1209-1382
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/vues/FiltreVue.java:r1383-1511
/trunk/src/org/tela_botanica/client/vues/personne/PersonneFormPublication.java
295,6 → 295,7
modelTypePublications.addField("cpu_fascicule");
modelTypePublications.addField("cpu_date_parution");
modelTypePublications.addField("cpu_ce_truk_editeur");
modelTypePublications.addField("cpu_ce_projet");
modelTypePublications.addField("cpu_collection");
String displayNamePublications = "cpu_fmt_nom_complet";
721,6 → 722,6
}
private void obtenirPublicationsSaisies(String nom) {
mediateur.selectionnerPublicationParNomComplet(this, "%"+nom+"%");
mediateur.selectionnerPublicationParNomComplet(this, null, "%"+nom+"%");
}
}
/trunk/src/org/tela_botanica/client/vues/personne/PersonneListeVue.java
15,9 → 15,13
import org.tela_botanica.client.modeles.personne.Personne;
import org.tela_botanica.client.modeles.personne.PersonneAsyncDao;
import org.tela_botanica.client.modeles.personne.PersonneListe;
import org.tela_botanica.client.modeles.projet.Projet;
import org.tela_botanica.client.util.Debug;
import org.tela_botanica.client.vues.BarrePaginationVue;
 
import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.Style.SortDir;
import com.extjs.gxt.ui.client.data.ModelComparer;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.Events;
27,6 → 31,8
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.store.Store;
import com.extjs.gxt.ui.client.store.StoreSorter;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
79,7 → 85,7
modifier = new Button(Mediateur.i18nC.modifier());
modifier.setIcon(Images.ICONES.formModifier());
modifier.addSelectionListener(new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent ce) {
public void componentSelected(ButtonEvent ce) {
mediateur.clicModifierPersonne(grille.getSelectionModel().getSelectedItems());
}
});
147,7 → 153,6
@Override
public void handleEvent(BaseEvent be) {
GridEvent ge = (GridEvent<Personne>) be;
ge.preventDefault();
// TODO rajouter un test sur le sort state pour trier par nom par défaut
// bref, on verra plus tard parce que c'est chiant et qu'on en a marre de coel
String tri = ge.getSortInfo().getSortField();
226,9 → 231,6
if (info.getType().equals("maj_utilisateur")) {
gererEtatActivationBouton();
} else if(info.getType().equals("personne_modifiee")) {
// curieusement la suppression efface aussi l'index de l'élément
// car elle redéclenche l'évenement de selection (on le stocke donc temporairement)
int temporaire = indexElementSelectionne;
if(personneSelectionnee != null) {
store.remove(indexElementSelectionne);
personneSelectionnee = null;
236,8 → 238,7
Personne personneModifiee = (Personne)info.getDonnee(0);
// au cas ou le bouton appliquer aurait été cliqué avant de valider
store.remove(personneModifiee);
indexElementSelectionne = temporaire;
store.insert(personneModifiee, temporaire);
store.insert(personneModifiee, indexElementSelectionne);
personneSelectionnee = personneModifiee;
int indexElementSelectionne = store.indexOf(personneSelectionnee);
grille.getSelectionModel().select(indexElementSelectionne, false);
/trunk/src/org/tela_botanica/client/vues/personne/PersonneForm.java
28,6 → 28,8
import org.tela_botanica.client.modeles.ValeurListe;
import org.tela_botanica.client.modeles.personne.Personne;
import org.tela_botanica.client.modeles.personne.PersonneListe;
import org.tela_botanica.client.modeles.projet.Projet;
import org.tela_botanica.client.modeles.projet.ProjetListe;
import org.tela_botanica.client.modeles.publication.Publication;
import org.tela_botanica.client.modeles.publication.PublicationAPersonneListe;
import org.tela_botanica.client.modeles.publication.PublicationListe;
63,6 → 65,7
import com.extjs.gxt.ui.client.widget.ContentPanel;
import org.tela_botanica.client.composants.InfoLogger;
import org.tela_botanica.client.composants.pagination.Proxy;
import org.tela_botanica.client.composants.pagination.ProxyProjets;
import org.tela_botanica.client.composants.pagination.ProxyValeur;
 
import com.extjs.gxt.ui.client.widget.TabItem;
151,7 → 154,7
mediateur.obtenirListeValeurEtRafraichir(this, "relationPersonnePublication", sequenceur);
mediateur.obtenirListeValeurEtRafraichir(this, "relationPersonnePublication", null);
if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
mediateur.selectionnerPersonne(this, personne.getId(), sequenceur);
mediateur.selectionnerPersonne(this, personne, null, sequenceur);
}
}
233,6 → 236,37
// Création des champs
FormLayout formLayout = new FormLayout();
formLayout.setLabelAlign(LabelAlign.LEFT);
//+------------------------------------------------------------------------------------------------------------+
// Fieldset PROJET
FieldSet fsProjet = new FieldSet();
fsProjet.setHeadingHtml(i18nC.menuProjet());
fsProjet.setLayout(new FormLayout());
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>(null);
ChampComboBoxRechercheTempsReelPaginable cbProjets = new ChampComboBoxRechercheTempsReelPaginable(proxyProjets, modelTypeProjets, displayNameProjets);
cbProjets.setWidth(100, 600);
cbProjets.getCombo().setTabIndex(tabIndex++);
cbProjets.getCombo().setFieldLabel(i18nC.personneProjet());
cbProjets.getCombo().setEmptyText(i18nC.txtListeProjetDefaut());
cbProjets.getCombo().addStyleName(ComposantClass.OBLIGATOIRE);
cbProjets.getCombo().addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
cbProjets.getCombo().setAllowBlank(false);
cbProjets.getCombo().setEditable(false);
fsProjet.add(cbProjets, new FormData(600, 0));
hmIdentite.put("cbProjets", cbProjets);
left.add(fsProjet);
//+------------------------------------------------------------------------------------------------------------+
// Fieldset NOM
745,7 → 779,7
 
public void rafraichirPublicationsExistante(String nomPubli) {
nomPubli +="%";
mediateur.selectionnerPublicationParNomComplet(this, nomPubli);
mediateur.selectionnerPublicationParNomComplet(this, null, nomPubli);
}
/**
823,6 → 857,14
hmAdresse.getComboBox("cbRegion").setVisible(true);
}
} else if (nouvellesDonnees instanceof ProjetListe) {
ProjetListe projets = (ProjetListe) nouvellesDonnees;
List<Projet> liste = projets.toList();
ComboBox cbProjets = hmIdentite.getComboBox("cbProjets");
ListStore<Projet> storeProjets= cbProjets.getStore();
storeProjets.removeAll();
storeProjets.add(liste);
cbProjets.setStore(storeProjets);
} else if (nouvellesDonnees instanceof PublicationListe) {
PublicationListe publicationListe = (PublicationListe) nouvellesDonnees;
List<Publication> liste = publicationListe.toList();
960,6 → 1002,15
private void mettreAJourPersonne(Personne personne) {
//Mise à jour de la personne
ChampComboBoxRechercheTempsReelPaginable cbProjets = hmIdentite.getComboBoxRechercheTempsReelPaginable("cbProjets");
if (cbProjets.getCombo().getStore() != null
&& personne != null
&& personne.getIdProjet() != null
&& !UtilString.isEmpty(personne.getIdProjet())) {
cbProjets.chargerValeurInitiale(personne.getIdProjet(), "cpr_id_projet");
} else {
cbProjets.getCombo().setValue(null);
}
//Prefixe
String prefixe = personne.get("ce_truk_prefix");
1152,6 → 1203,14
boolean success = true;
LinkedList<String> lstMessageErreur = new LinkedList<String>();
ChampComboBoxRechercheTempsReelPaginable cbProjets = hmIdentite.getComboBoxRechercheTempsReelPaginable("cbProjets");
if (cbProjets.getValeur() == null) {
lstMessageErreur.add("Le projet n'a pas été renseigné");
} else {
Projet projet = new Projet(cbProjets.getValeur());
personneSelectionnee.set("ce_projet", projet.getId());
}
String strTfNom = (String) hmIdentite.getTextField("tfNom").getValue();
if ((strTfNom == null)||(strTfNom.trim().equals(""))) {
lstMessageErreur.add("Le nom n'a pas été saisi");
/trunk/src/org/tela_botanica/client/vues/collection/CollectionFormGeneral.java
10,10 → 10,12
import org.tela_botanica.client.composants.ChampMultiValeurs;
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.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.ValeurListe;
import org.tela_botanica.client.modeles.collection.Collection;
import org.tela_botanica.client.modeles.projet.Projet;
import org.tela_botanica.client.modeles.structure.Structure;
import org.tela_botanica.client.synchronisation.Sequenceur;
import org.tela_botanica.client.util.Debug;
45,6 → 47,7
 
private HiddenField<String> idCollectionChp = null;
private ChampComboBoxRechercheTempsReelPaginable projetsCombo = null;
private ChampComboBoxRechercheTempsReelPaginable structuresCombo = null;
private ChampComboBoxRechercheTempsReelPaginable collectionsCombo = null;
105,6 → 108,44
//+-----------------------------------------------------------------------------------------------------------+
// 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>(null);
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("cpr_nom", field.getRawValue()) == null) {
String contenuBrut = field.getRawValue();
field.setValue(null);
field.setRawValue(contenuBrut);
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
}
return retour;
}
});
 
liaisonFieldSet.add(projetsCombo, new FormData(600, 0));
//+-----------------------------------------------------------------------------------------------------------+
// Champ Structures
 
ModelType modelTypeStructures = new ModelType();
288,6 → 329,7
initialiserCollection();
if (collection != null) {
idCollectionChp.setValue(collection.getId());
setValeurComboProjets();
setValeurComboStructures();
setValeurComboCollections();
316,6 → 358,9
public ArrayList<String> verifier() {
ArrayList<String> messages = new ArrayList<String>();
if (projetsCombo.getCombo().getValue() == null || !projetsCombo.getCombo().isValid()) {
messages.add(i18nM.selectionObligatoire(i18nC.articleUn()+" "+i18nC.projetSingulier(), i18nC.articleLa()+" "+i18nC.collectionSingulier()));
}
return messages;
}
324,6 → 369,7
// l'onglet collection est obligatoirement rempli lors d'un ajout
if (this.mode == Formulaire.MODE_AJOUTER || etreAccede()) {
collectionCollectee.setId(idCollectionChp.getValue());
collectionCollectee.setIdProjet(getValeurComboProjets());
collectionCollectee.setIdStructure(getValeurComboStructures());
collectionCollectee.setCollectionMereId(getValeurComboCollections());
352,6 → 398,25
}
}
private String getValeurComboProjets() {
String valeur = "";
if (projetsCombo.getCombo().getValue() != null) {
Projet projet = new Projet(projetsCombo.getValeur());
valeur = projet.getId();
}
return valeur;
}
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);
}
}
private String getValeurComboStructures() {
String valeur = "";
if (structuresCombo.getCombo().getValue() != null) {
/trunk/src/org/tela_botanica/client/vues/collection/CollectionDetailVue.java
21,6 → 21,7
import org.tela_botanica.client.modeles.collection.UniteRangement;
import org.tela_botanica.client.modeles.commentaire.Commentaire;
import org.tela_botanica.client.modeles.personne.Personne;
import org.tela_botanica.client.modeles.projet.ProjetListe;
import org.tela_botanica.client.modeles.publication.Publication;
import org.tela_botanica.client.modeles.structure.Structure;
import org.tela_botanica.client.synchronisation.Sequenceur;
163,7 → 164,7
enteteTpl =
"<div id='{css_id}'>"+
" <h1>{nom}</h1>"+
" <h2>{structure}<span class='{css_meta}'><br /> {i18n_id}:{id} - {guid}</span></h2>" +
" <h2>{structure}<span class='{css_meta}'>{projet} <br /> {i18n_id}:{id} - {guid}</span></h2>" +
"</div>";
}
514,6 → 515,9
if (nouvellesDonnees instanceof Collection) {
collection = (Collection) nouvellesDonnees;
collectionChargementOk = true;
} else if (nouvellesDonnees instanceof ProjetListe) {
projets = (ProjetListe) nouvellesDonnees;
projetsChargementOk = true;
} else if (nouvellesDonnees instanceof ValeurListe) {
ValeurListe listeValeursReceptionnee = (ValeurListe) nouvellesDonnees;
receptionerListeValeurs(listeValeursReceptionnee);
554,7 → 558,7
private boolean avoirDonneesChargees() {
boolean ok = false;
if (collectionChargementOk && ontologieChargementOk && personnesLieesChargementOk && publicationsLieesChargementOk && commentairesLieesChargementOk) {
if (projetsChargementOk && collectionChargementOk && ontologieChargementOk && personnesLieesChargementOk && publicationsLieesChargementOk && commentairesLieesChargementOk) {
ok = true;
}
return ok;
585,6 → 589,7
enteteParams.set("structure", collection.getStructureNom());
enteteParams.set("id", collection.getId());
enteteParams.set("guid", collection.getGuid());
enteteParams.set("projet", construireTxtProjet(collection.getIdProjet()));
String eHtml = Format.substitute(enteteTpl, enteteParams);
entete.getElement().setInnerHTML(eHtml);
/trunk/src/org/tela_botanica/client/vues/collection/CollectionForm.java
379,7 → 379,8
// Vérification des infos sur le type de collection
if (typesCollectionCombo.getValue() == null
|| typesCollectionCombo.getValue().equals("")) {
|| typesCollectionCombo.getValue().equals("")
|| (mode.equals(MODE_MODIFIER) && collection != null && collection.getIdProjet().equals(""))) {
messages.add("Veuillez sélectionner un type pour la collection.");
}
/trunk/src/org/tela_botanica/client/vues/collection/CollectionFormCommentaire.java
290,6 → 290,7
modelTypeCommentaires.setTotalName("nbElements");
modelTypeCommentaires.addField("ccm_id_commentaire");
modelTypeCommentaires.addField("ccm_ce_pere");
modelTypeCommentaires.addField("ccm_ce_projet");
modelTypeCommentaires.addField("ccm_titre");
modelTypeCommentaires.addField("ccm_texte");
modelTypeCommentaires.addField("ccm_ponderation");
388,6 → 389,7
modelTypeCollectionACommentaire.addField("ccm_ponderation");
modelTypeCollectionACommentaire.addField("ccm_mark_public");
modelTypeCollectionACommentaire.addField("ccm_ce_pere");
modelTypeCollectionACommentaire.addField("ccm_ce_projet");
// Proxy
ProxyCollectionACommentaire<ModelData> proxyCollectionACommentaire = new ProxyCollectionACommentaire<ModelData>(null, collection.getId());
/trunk/src/org/tela_botanica/client/vues/collection/CollectionFormPublication.java
273,6 → 273,7
modelTypePublications.addField("cpu_fascicule");
modelTypePublications.addField("cpu_date_parution");
modelTypePublications.addField("cpu_ce_truk_editeur");
modelTypePublications.addField("cpu_ce_projet");
String displayNamePublications = "cpu_fmt_nom_complet";
ProxyPublications<ModelData> proxyPublications= new ProxyPublications<ModelData>(null);
/trunk/src/org/tela_botanica/client/vues/NavigationVue.java
12,6 → 12,7
public class NavigationVue extends ContentPanel {
private Mediateur mediateur = null;
private MenuVue menu = null;
private FiltreVue filtre = null;
public NavigationVue(Mediateur mediateurCourant) {
mediateur = mediateurCourant;
23,9 → 24,16
menu = new MenuVue(mediateur);
add(menu, new VBoxLayoutData(new Margins(0)));
filtre = new FiltreVue(mediateur);
add(filtre, new VBoxLayoutData(new Margins(0)));
}
public MenuVue getMenu() {
return menu;
}
public FiltreVue getFiltre() {
return filtre;
}
}
/trunk/src/org/tela_botanica/client/vues/structure/StructureFormIdentification.java
12,6 → 12,7
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
import org.tela_botanica.client.composants.ChampNombre;
import org.tela_botanica.client.composants.InfoLogger;
import org.tela_botanica.client.composants.pagination.ProxyProjets;
import org.tela_botanica.client.composants.pagination.ProxyValeur;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Information;
20,6 → 21,7
import org.tela_botanica.client.modeles.Valeur;
import org.tela_botanica.client.modeles.ValeurListe;
import org.tela_botanica.client.modeles.personne.Personne;
import org.tela_botanica.client.modeles.projet.Projet;
import org.tela_botanica.client.modeles.structure.Structure;
import org.tela_botanica.client.modeles.structure.StructureAPersonne;
import org.tela_botanica.client.modeles.structure.StructureAPersonneListe;
176,6 → 178,8
public ListStore<Personne> personneExistanteMagazin;
public ChampComboBoxRechercheTempsReelPaginable personneExistanteCombo;
public Button supprimerPersonnelBtn;
public ListStore<Projet> projetsMagazin;
public ChampComboBoxRechercheTempsReelPaginable projetsCombo;
public CellEditor fonctionEditor;
public List<Valeur> fonctionsListe;
public Sequenceur sequenceur;
218,6 → 222,24
nomStructureChp.addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
fieldSetIdentite.add(nomStructureChp, new FormData(450, 0));
ModelType modelTypeProjets = new ModelType();
modelTypeProjets.setRoot("projets");
modelTypeProjets.setTotalName("nbElements");
modelTypeProjets.addField("cpr_nom");
modelTypeProjets.addField("cpr_id_projet");
String displayNameProjets = "cpr_nom";
ProxyProjets<ModelData> proxyProjets = new ProxyProjets<ModelData>(null);
projetsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyProjets, modelTypeProjets, displayNameProjets);
projetsCombo.getCombo().setTabIndex(tabIndex++);
projetsCombo.getCombo().setFieldLabel(i18nC.projetChamp());
projetsCombo.getCombo().setForceSelection(true);
projetsCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE);
projetsCombo.getCombo().addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
projetsCombo.setWidth(120, 520);
fieldSetIdentite.add(projetsCombo, new FormData(520, 0));
// Création du sous-formulaire : Acronyme
LayoutContainer ligne = new LayoutContainer();
ligne.setLayout(new ColumnLayout());
565,11 → 587,19
this.setData("acces", true);
// Initialisation de l'objet Structure
identification = new Structure();
// Indication du projet sélectionné par défaut
String projetCourantId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getProjetId();
if (projetCourantId != null && !projetCourantId.equals("0")) {
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", projetCourantId));
}
}
 
if (formulaireCourant.mode.equals(Formulaire.MODE_MODIFIER) && identification != null && getData("acces").equals(false)) {
idStructureChp.setValue(identification.getId());
nomStructureChp.setValue(identification.getNom());
if (!identification.getIdProjet().equals("0")) {
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", identification.getIdProjet()));
}
if (!identification.getIdAlternatif().isEmpty()) {
String[] acronyme = identification.getIdAlternatif().split("##");
649,6 → 679,10
structureCollectee.setId(idStructureChp.getValue());
structureCollectee.setNom(nomStructureChp.getValue());
// Récupération de l'identifiant du projet
if (projetsCombo.getCombo().getValue() != null) {
structureCollectee.setIdProjet(new Projet(projetsCombo.getValeur()).getId());
}
// Récupération de l'acronyme (= identifiant alternatif)
structureCollectee.setIdAlternatif(null);
if (comboAcronyme.getValue() != null) {
809,6 → 843,13
messages.add("Veuillez indiquez un nom à l'institution.");
}
// Vérification des infos sur le projet de la structure
if ( (this.getData("acces").equals(true) && projetsCombo.getCombo().getValue() == null) ||
(this.getData("acces").equals(true) && projetsCombo.getCombo().getValue().equals("")) ||
(this.getData("acces").equals(false) && identification.getIdProjet().equals(""))) {
messages.add("Veuillez sélectionner un projet pour l'institution.");
}
//Vérification de la date de fondation
String valeurDateFondation = dateFondationChp.getValue();
if (!UtilString.isEmpty(valeurDateFondation) && (!valeurDateFondation.matches("\\d{2}/\\d{2}/\\d{4}") &&
818,4 → 859,12
return messages;
}
public ModelData getValeurProjetCombo() {
return projetsCombo.getCombo().getValue();
}
public ModelData getValeurProjet() {
return projetsCombo.getValeur();
}
}
/trunk/src/org/tela_botanica/client/vues/structure/StructureFormPersonne.java
18,6 → 18,7
import org.tela_botanica.client.modeles.ValeurListe;
import org.tela_botanica.client.modeles.aDonnee;
import org.tela_botanica.client.modeles.personne.Personne;
import org.tela_botanica.client.modeles.projet.Projet;
import org.tela_botanica.client.modeles.structure.StructureAPersonne;
import org.tela_botanica.client.modeles.structure.StructureAPersonneListe;
import org.tela_botanica.client.synchronisation.Sequenceur;
81,6 → 82,7
private ListStore<Personne> personneExistanteMagazin = null;
private ChampComboBoxRechercheTempsReelPaginable personneExistanteCombo = null;
private Button supprimerPersonnelBtn = null;
private ListStore<Projet> projetsMagazin = null;
private CellEditor fonctionEditor = null;
private List<Valeur> fonctionsListe = null;
515,6 → 517,11
personne.setIdStructure(getIdIdentification());
}
// Récupération de l'id du projet de la structure qui servira aussi pour les Personnes crées dans ce formulaire
if (personne.getIdPersonne().equals("") && formulaire.getValeurProjetCombo() != null) {
personne.setIdProjetPersonne(new Projet(formulaire.getValeurProjet()).getId());
}
// Gestion de la fonction
String fonction = personne.get("fonction");
if (fonction != null && !fonction.equals("")) {
684,7 → 691,7
}
private void rafraichirPersonneExistante(String nom) {
mediateur.selectionnerPersonneParNomComplet(this, nom+"%", null);
mediateur.selectionnerPersonneParNomComplet(this, null, nom+"%", null);
}
public void incrementerDecompteRafraichissementPersonnel() {
/trunk/src/org/tela_botanica/client/vues/structure/StructureDetailVue.java
8,6 → 8,7
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Information;
import org.tela_botanica.client.modeles.ValeurListe;
import org.tela_botanica.client.modeles.projet.ProjetListe;
import org.tela_botanica.client.modeles.structure.Structure;
import org.tela_botanica.client.modeles.structure.StructureAPersonne;
import org.tela_botanica.client.modeles.structure.StructureAPersonneListe;
144,6 → 145,7
enteteParams.set("ville", structure.getVille());
enteteParams.set("id", structure.getId());
enteteParams.set("guid", structure.getGuid());
enteteParams.set("projet", construireTxtProjet(structure.getIdProjet()));
String eHtml = Format.substitute(enteteTpl, enteteParams);
entete.getElement().setInnerHTML(eHtml);
459,7 → 461,7
enteteTpl =
"<div id='{css_id}'>"+
" <h1>{nom}</h1>"+
" <h2>{ville}<span class='{css_meta}'> <br /> {i18n_id}:{id} - {guid}</span></h2>" +
" <h2>{ville}<span class='{css_meta}'>{projet} <br /> {i18n_id}:{id} - {guid}</span></h2>" +
" " +
"</div>";
}
632,6 → 634,9
if (nouvellesDonnees instanceof Structure) {
structure = (Structure) nouvellesDonnees;
structureChargementOk = true;
} else if (nouvellesDonnees instanceof ProjetListe) {
projets = (ProjetListe) nouvellesDonnees;
projetsChargementOk = true;
} else if (nouvellesDonnees instanceof ValeurListe) {
ValeurListe listeValeursReceptionnee = (ValeurListe) nouvellesDonnees;
receptionerListeValeurs(listeValeursReceptionnee);
657,7 → 662,7
private boolean avoirDonneesChargees() {
boolean ok = false;
if (structureChargementOk && personnelChargementOk && ontologieChargementOk) {
if (projetsChargementOk && structureChargementOk && personnelChargementOk && ontologieChargementOk) {
ok = true;
}
return ok;
/trunk/src/org/tela_botanica/client/vues/structure/StructureForm.java
14,6 → 14,7
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.composants.pagination.ProxyProjets;
import org.tela_botanica.client.composants.pagination.ProxyStructureAPersonne;
import org.tela_botanica.client.composants.pagination.ProxyValeur;
import org.tela_botanica.client.images.Images;
28,6 → 29,8
import org.tela_botanica.client.modeles.collection.CollectionAPersonne;
import org.tela_botanica.client.modeles.personne.Personne;
import org.tela_botanica.client.modeles.personne.PersonneListe;
import org.tela_botanica.client.modeles.projet.Projet;
import org.tela_botanica.client.modeles.projet.ProjetListe;
import org.tela_botanica.client.modeles.structure.Structure;
import org.tela_botanica.client.modeles.structure.StructureAPersonne;
import org.tela_botanica.client.modeles.structure.StructureAPersonneListe;
485,4 → 488,12
public String getIdIdentification() {
return identification.getId();
}
public ModelData getValeurProjetCombo() {
return identificationOnglet.getValeurProjetCombo();
}
public ModelData getValeurProjet() {
return identificationOnglet.getValeurProjet();
}
}
/trunk/src/org/tela_botanica/client/vues/DetailVue.java
13,6 → 13,8
import org.tela_botanica.client.modeles.Valeur;
import org.tela_botanica.client.modeles.ValeurListe;
import org.tela_botanica.client.modeles.aDonnee;
import org.tela_botanica.client.modeles.projet.Projet;
import org.tela_botanica.client.modeles.projet.ProjetListe;
import org.tela_botanica.client.synchronisation.Sequenceur;
import org.tela_botanica.client.util.Debug;
import org.tela_botanica.client.util.UtilString;
36,6 → 38,9
protected boolean ontologieChargementOk = false;
private HashMap<Integer, String> ontologiesEnAttenteDeReception = null;
protected ProjetListe projets = null;
protected boolean projetsChargementOk = false;
protected String sautLigneTpl = null;
public DetailVue(Mediateur mediateurCourant) {
47,6 → 52,7
ontologie = new HashMap<String, Valeur>();
ontologieChargementOk = false;
ontologiesEnAttenteDeReception = new HashMap<Integer, String>();
chargerProjets();
setLayout(new FitLayout());
setBorders(false);
56,7 → 62,27
private void initialiserSautLigneTpl() {
sautLigneTpl = "<br />\n";
}
private void chargerProjets() {
mediateur.selectionnerProjet(this, null, null, false, null);
}
protected String construireTxtProjet(String idProjet) {
String chaineARetourner = idProjet;
if (projets != null) {
Projet projet = projets.get(idProjet);
if (projet != null) {
String nomDuProjet = projet.getNom();
if (!nomDuProjet.equals("")) {
chaineARetourner = nomDuProjet;
}
}
}
return chaineARetourner;
}
protected String construireTxtTruck(String chaineAAnalyser) {
return construireTxtTruck(chaineAAnalyser, true);
}
/trunk/src/org/tela_botanica/client/vues/projet/ProjetDetailVue.java
New file
0,0 → 1,306
package org.tela_botanica.client.vues.projet;
 
import org.tela_botanica.client.ComposantClass;
import org.tela_botanica.client.ComposantId;
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.ValeurListe;
import org.tela_botanica.client.modeles.projet.Projet;
import org.tela_botanica.client.modeles.projet.ProjetListe;
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.DetailVue;
 
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.util.Format;
import com.extjs.gxt.ui.client.util.Params;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Html;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.google.gwt.core.client.GWT;
 
public class ProjetDetailVue extends DetailVue implements Rafraichissable {
private String enteteTpl = null;
private String contenuTpl = null;
private String indexationTpl = null;
private ContentPanel panneauPrincipal = null;
private Html entete = null;
private Html contenu = null;
private final String listeValeurIndexationDureeId = "dureesIndexation";
private final int listeValeurIndexationDureeInt = 1072;
private final String listeValeurIndexationFrequenceId = "frequencesIndexation";
private final int listeValeurIndexationFrequenceInt = 1073;
private final String listeLanguesId = "langues";
private final int listeLanguesInt = 1071;
 
private Projet projet = null;
private boolean projetChargementOk = false;
private ValeurListe valeurListeIndexationDuree = null;
private boolean listeIndexationDureeChargee = false;
private ValeurListe valeurListeIndexationFrequence = null;
private boolean listeIndexationFrequenceChargee = false;
private ValeurListe valeurListeLangue = null;
private boolean listeLangueChargee = false;
private boolean displayUrl = true;
 
private Sequenceur sequenceur;
public ProjetDetailVue(Mediateur mediateurCourant, Sequenceur sequenceur) {
super(mediateurCourant);
this.sequenceur = sequenceur;
panneauPrincipal = new ContentPanel();
panneauPrincipal.setLayout(new FitLayout());
panneauPrincipal.setHeaderVisible(false);
panneauPrincipal.setBodyBorder(false);
panneauPrincipal.setScrollMode(Scroll.AUTO);
entete = new Html();
entete.setId(ComposantId.ZONE_DETAIL_ENTETE);
panneauPrincipal.setTopComponent(entete);
contenu = new Html();
panneauPrincipal.add(contenu);
add(panneauPrincipal);
mediateurCourant.obtenirListeValeurEtRafraichir(this, listeValeurIndexationDureeId, sequenceur);
mediateurCourant.obtenirListeValeurEtRafraichir(this, listeValeurIndexationFrequenceId, sequenceur);
mediateurCourant.obtenirListeValeurEtRafraichir(this, listeLanguesId, sequenceur);
}
 
private void initialiserTousLesTpl() {
initialiserEnteteHtmlTpl();
initialiserGeneralTpl();
initialiserIndexationTpl();
}
private void initialiserEnteteHtmlTpl() {
enteteTpl =
"<div id='{css_id}'>"+
" <h1>{projet}</h1>"+
" <h2>{abreviation} <span class='{css_meta}'>{projet} <br /> {i18n_id}:{id} - {guid}</span></h2>" +
"</div>";
}
private void initialiserGeneralTpl() {
contenuTpl =
"<div class='{css_corps}'>"+
" <div class='{css_fieldset}'>"+
" <h2>{i18n_titre_info_generale}</h2>"+
" <span class='{css_label}'>{i18n_nom} :</span> {nom}<br />"+
" <span class='{css_label}'>{i18n_abreviation} :</span> {abreviation}<br />"+
" <span class='{css_label}'>{i18n_resume} :</span> {resume}<br />"+
" <span class='{css_label}'>{i18n_description} :</span> {description}<br />";
if (projet.getUrl() != null && !UtilString.isEmpty(projet.getUrl()))
contenuTpl += " <span class='{css_label}'>{i18n_url} :</span> <a class='{css_lien_ext}' href='{url}' onclick='window.open(this.href); return false;'>{url}</a><br />";
contenuTpl +=
" </div>"+
" <div class='{css_fieldset}'>"+
" <h2>{i18n_titre_complement}</h2>"+
" <span class='{css_label}'>{i18n_mot_cles} :</span> {mot_cles}<br />"+
" <span class='{css_label}'>{i18n_citation} :</span> {citation}<br />"+
" <span class='{css_label}'>{i18n_licence} :</span> {licence}<br />"+
" <span class='{css_label}'>{i18n_langue} :</span> {langue}<br />"+
" </div>"+
" <hr class='{css_clear}'/>"+
" <div class='{css_fieldset}'>"+
" <h2>{i18n_titre_indexation}</h2>"+
" <span class='{css_label}'>{i18n_mark_public} :</span> {mark_public}<br />"+
" {indexation}"+
" </div>"+
"</div>";
}
private void initialiserIndexationTpl() {
indexationTpl =
" <span class='{css_label}'>{i18n_indexation_heure} :</span> {indexation_heure}<br />"+
" <span class='{css_label}'>{i18n_indexation_duree} :</span> {indexation_duree}<br />"+
" <span class='{css_label}'>{i18n_indexation_frequence} :</span> {indexation_frequence}<br />";
}
public void afficherDetail() {
if (projet != null) {
afficherEntete();
afficherDetailProjet();
};
layout();
}
private void afficherEntete() {
Params enteteParams = new Params();
enteteParams.set("css_id", ComposantId.ZONE_DETAIL_ENTETE);
enteteParams.set("css_meta", ComposantClass.META);
enteteParams.set("i18n_id", i18nC.id());
enteteParams.set("id", projet.getId());
enteteParams.set("guid", getGuid());
enteteParams.set("projet", construireTxtProjet(projet.getId()));
enteteParams.set("abreviation", projet.getAbreviation());
 
String eHtml = Format.substitute(enteteTpl, enteteParams);
entete.getElement().setInnerHTML(eHtml);
}
public String getGuid() {
String guid = "URN:tela-botanica.org:";
guid += "coel"+projet.getId()+":";
guid += "pro"+projet.getId();
return guid;
}
public void afficherDetailProjet() {
Params contenuParams = new Params();
contenuParams.set("i18n_titre_info_generale", i18nC.projetTitreInfoGenerale());
contenuParams.set("i18n_nom", i18nC.nom());
contenuParams.set("nom", projet.getNom());
contenuParams.set("i18n_abreviation", i18nC.projetAbreviation());
contenuParams.set("abreviation", projet.getAbreviation());
contenuParams.set("i18n_resume", i18nC.projetResume());
contenuParams.set("resume", projet.getResume());
contenuParams.set("i18n_description", i18nC.projetDescription());
contenuParams.set("description", projet.getDescription());
contenuParams.set("i18n_url", i18nC.projetUrl());
contenuParams.set("url", projet.getUrl());
contenuParams.set("i18n_titre_complement", i18nC.projetTitreComplement());
contenuParams.set("i18n_mot_cles", i18nC.projetMotsCles());
contenuParams.set("mot_cles", projet.getMotsCles());
contenuParams.set("i18n_citation", i18nC.projetCitation());
contenuParams.set("citation", projet.getCitation());
contenuParams.set("i18n_licence", i18nC.projetLicence());
contenuParams.set("licence", projet.getLicence());
contenuParams.set("i18n_langue", i18nC.projetLangue());
contenuParams.set("langue", obtenirValeurLangue(projet.getLangueId()));
contenuParams.set("i18n_titre_indexation", i18nC.projetTitreIndexation());
contenuParams.set("i18n_mark_public", i18nC.projetMarkPublic());
contenuParams.set("mark_public", obtenirValeurPublic(projet.getMarkPublic()));
contenuParams.set("indexation", creerIndexation());
String gHtml = formaterContenu(contenuTpl, contenuParams);
contenu.getElement().setInnerHTML(gHtml);
}
private String corrigerIndexationHeure(String heureMinuteSecondeEnBdd) {
String heureMinute = "";
if (!UtilString.isEmpty(heureMinuteSecondeEnBdd)) {
heureMinute = heureMinuteSecondeEnBdd.replaceAll(":00$", "");
}
return heureMinute;
}
private String creerIndexation() {
String html = "";
if (projet.getMarkPublic().equals("1")) {
Params indexationParams = new Params();
indexationParams.set("i18n_indexation_heure", i18nC.projetIndexationHeure());
indexationParams.set("indexation_heure", corrigerIndexationHeure(projet.getIndexationHeure()));
indexationParams.set("i18n_indexation_duree", i18nC.projetIndexationDuree());
indexationParams.set("indexation_duree", obtenirValeurIndexationDuree(projet.getIndexationDuree()));
indexationParams.set("i18n_indexation_frequence", i18nC.projetIndexationFrequence());
indexationParams.set("indexation_frequence", obtenirValeurIndexationFrequence(projet.getIndexationFreq()));
html = Format.substitute(indexationTpl, indexationParams);
}
return html;
}
public void rafraichir(Object nouvellesDonnees) {
if (nouvellesDonnees instanceof Projet) {
if (Mediateur.DEBUG) System.out.println("|| ProjetDetailVue > Réception d'un Projet");
projet = (Projet) nouvellesDonnees;
projetChargementOk = true;
initialiserTousLesTpl();
} else if (nouvellesDonnees instanceof ProjetListe) {
if (Mediateur.DEBUG) System.out.println("|| ProjetDetailVue > Réception d'une ProjetListe");
projets = (ProjetListe) nouvellesDonnees;
projetsChargementOk = true;
} else if(nouvellesDonnees instanceof ValeurListe) {
if (Mediateur.DEBUG) System.out.println("|| ProjetDetailVue > Réception d'une ValeurListe");
ValeurListe nValeurListe = (ValeurListe)nouvellesDonnees;
if (nValeurListe.getId() == listeValeurIndexationDureeInt) {
valeurListeIndexationDuree = (ValeurListe)nouvellesDonnees;
listeIndexationDureeChargee = true;
}
if (nValeurListe.getId() == listeValeurIndexationFrequenceInt) {
valeurListeIndexationFrequence = (ValeurListe)nouvellesDonnees;
listeIndexationFrequenceChargee = true;
}
if (nValeurListe.getId() == listeLanguesInt) {
valeurListeLangue = (ValeurListe)nouvellesDonnees;
listeLangueChargee = true;
}
} else {
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
}
if (avoirDonneesChargees()) {
afficherDetail();
}
}
private boolean avoirDonneesChargees() {
boolean ok = false;
if (projetsChargementOk && projetChargementOk && listeIndexationDureeChargee && listeIndexationFrequenceChargee && listeLangueChargee) {
ok = true;
}
return ok;
}
private String obtenirValeurIndexationDuree(String id) {
if (valeurListeIndexationDuree.get(id) != null) {
return valeurListeIndexationDuree.get(id).getNom();
}
return "";
}
private String obtenirValeurIndexationFrequence(String id) {
if (valeurListeIndexationFrequence.get(id) != null) {
return valeurListeIndexationFrequence.get(id).getNom();
}
return "";
}
private String obtenirValeurLangue(String id) {
if (valeurListeLangue.get(id) != null) {
return valeurListeLangue.get(id).getNom();
}
return "";
}
private String obtenirValeurPublic(String ouiNon) {
if (ouiNon.equals("1")) {
return i18nC.oui();
}
return i18nC.non();
}
}
Property changes:
Added: svn:mergeinfo
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/vues/projet/ProjetDetailVue.java:r1383-1511
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/vues/projet/ProjetDetailVue.java:r1136-1368
Merged /trunk/src/org/tela_botanica/client/vues/projet/ProjetDetailVue.java:r11-934,1209-1382
/trunk/src/org/tela_botanica/client/vues/projet/ProjetForm.java
New file
0,0 → 1,480
package org.tela_botanica.client.vues.projet;
 
import java.util.ArrayList;
 
import org.tela_botanica.client.ComposantClass;
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
import org.tela_botanica.client.composants.InfoLogger;
import org.tela_botanica.client.composants.pagination.ProxyValeur;
import org.tela_botanica.client.interfaces.Rafraichissable;
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.modeles.projet.Projet;
import org.tela_botanica.client.synchronisation.Sequenceur;
import org.tela_botanica.client.util.Debug;
import org.tela_botanica.client.util.Pattern;
import org.tela_botanica.client.util.UtilArray;
import org.tela_botanica.client.util.UtilString;
import org.tela_botanica.client.vues.Formulaire;
 
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.ModelType;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.widget.MessageBox;
import com.extjs.gxt.ui.client.widget.form.CheckBox;
import com.extjs.gxt.ui.client.widget.form.FieldSet;
import com.extjs.gxt.ui.client.widget.form.TextArea;
import com.extjs.gxt.ui.client.widget.form.TextField;
import com.extjs.gxt.ui.client.widget.layout.FlowLayout;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
 
public class ProjetForm extends Formulaire implements Rafraichissable {
private Projet projet;
private String listeValeurIndexationDureeId = "dureesIndexation";
private String listeValeurIndexationFrequenceId = "frequencesIndexation";
private String listeLanguesId = "langues";
private FieldSet generalitesFieldset = null;
private TextField<String> nomChp = null;
private TextField<String> abreviationChp = null;
private TextArea descriptionChp = null;
private TextArea resumeChp = null;
private TextField<String> urlChp = null;
private FieldSet complementFieldset = null;
private TextField<String> motsClesChp = null;
private TextField<String> citationChp = null;
private TextField<String> licenceChp = null;
private ChampComboBoxRechercheTempsReelPaginable langueChp = null;
private CheckBox markPublicChp = null;
private FieldSet indexationFieldset = null;
private TextField<String> indexationHeureChp = null;
private ChampComboBoxListeValeurs indexationDureeChp = null;
private ChampComboBoxListeValeurs indexationFrequenceChp = null;
 
private boolean formulaireValideOk = false;
private boolean projetValideOk = false;
private Sequenceur sequenceur = new Sequenceur();
 
public Rafraichissable vueExterneARafraichirApresValidation = null;
 
 
public ProjetForm(Mediateur mediateurCourrant, String projetId) {
initialiserProjetForm(mediateurCourrant, projetId);
}
 
public ProjetForm(Mediateur mediateurCourrant, String projetId, Rafraichissable vueARafraichirApresValidation) {
vueExterneARafraichirApresValidation = vueARafraichirApresValidation;
initialiserProjetForm(mediateurCourrant, projetId);
}
private void initialiserProjetForm(Mediateur mediateurCourant, String projetId) {
projet = new Projet();
projet.setId(projetId);
String modeDeCreation = (projet.getId().isEmpty() ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER);
initialiserFormulaire(mediateurCourant, modeDeCreation, MenuApplicationId.PROJET);
panneauFormulaire.setLayout(new FlowLayout());
panneauFormulaire.setScrollMode(Scroll.AUTO);
genererTitreFormulaire();
creerZoneGeneralites();
panneauFormulaire.add(generalitesFieldset);
creerZoneComplement();
panneauFormulaire.add(complementFieldset);
creerZoneIndexation();
panneauFormulaire.add(indexationFieldset);
creerTabIndex();
if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
mediateur.selectionnerProjet(this, projetId, null, false, null);
}
}
private void genererTitreFormulaire() {
String titre = i18nC.projetTitreFormAjout();
if (mode.equals(Formulaire.MODE_MODIFIER)) {
titre = i18nC.projetTitreFormModif();
if (projet != null) {
titre += " - "+i18nC.id()+": "+projet.getId();
}
}
panneauFormulaire.setHeadingHtml(titre);
}
private void creerZoneGeneralites() {
FormLayout layout = new FormLayout();
layout.setLabelWidth(100);
// Fieldset Infos Générales
generalitesFieldset = new FieldSet();
generalitesFieldset.setHeadingHtml(i18nC.projetTitreInfoGenerale());
generalitesFieldset.setCollapsible(true);
generalitesFieldset.setLayout(layout);
nomChp = new TextField<String>();
nomChp.setName("cpu");
nomChp.setFieldLabel(i18nC.projetNom());
nomChp.addStyleName(ComposantClass.OBLIGATOIRE);
nomChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
generalitesFieldset.add(nomChp, new FormData(450, 0));
abreviationChp = new TextField<String>();
abreviationChp.setFieldLabel(i18nC.projetAbreviation());
abreviationChp.addStyleName(ComposantClass.OBLIGATOIRE);
abreviationChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
generalitesFieldset.add(abreviationChp, new FormData(450, 0));
descriptionChp = new TextArea();
descriptionChp.setFieldLabel(i18nC.projetDescription());
descriptionChp.addStyleName(ComposantClass.OBLIGATOIRE);
descriptionChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
generalitesFieldset.add(descriptionChp, new FormData(450, 0));
resumeChp = new TextArea();
resumeChp.setFieldLabel(i18nC.projetResume());
resumeChp.addStyleName(ComposantClass.OBLIGATOIRE);
resumeChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
generalitesFieldset.add(resumeChp, new FormData(450, 0));
urlChp = new TextField<String>();
urlChp.setFieldLabel(i18nC.projetUrl());
generalitesFieldset.add(urlChp, new FormData(450, 0));
}
private void creerZoneComplement() {
FormLayout layout = new FormLayout();
layout.setLabelWidth(100);
// Fieldset Complément
complementFieldset = new FieldSet();
complementFieldset.setHeadingHtml(i18nC.projetTitreComplement());
complementFieldset.setCollapsible(true);
complementFieldset.setLayout(layout);
motsClesChp = new TextField<String>();
motsClesChp.setFieldLabel(i18nC.projetMotsCles());
complementFieldset.add(motsClesChp, new FormData(450, 0));
citationChp = new TextField<String>();
citationChp.setFieldLabel(i18nC.projetCitation());
complementFieldset.add(citationChp, new FormData(450, 0));
licenceChp = new TextField<String>();
licenceChp.setFieldLabel(i18nC.projetLicence());
complementFieldset.add(licenceChp, new FormData(450, 0));
ModelType modelTypesLangues = new ModelType();
modelTypesLangues.setRoot("valeurs");
modelTypesLangues.setTotalName("nbElements");
modelTypesLangues.addField("cmlv_nom");
modelTypesLangues.addField("cmlv_id_valeur");
modelTypesLangues.addField("cmlv_abreviation");
modelTypesLangues.addField("cmlv_description");
String displayNameLangues = "cmlv_nom";
String nomListeTypes = "langues";
ProxyValeur<ModelData> proxyLangues = new ProxyValeur<ModelData>(nomListeTypes, null);
langueChp = new ChampComboBoxRechercheTempsReelPaginable(proxyLangues, modelTypesLangues, displayNameLangues);
langueChp.setWidth(100,300);
langueChp.getCombo().setTabIndex(tabIndex++);
langueChp.getCombo().setFieldLabel(i18nC.projetLangue());
langueChp.getCombo().setForceSelection(true);
complementFieldset.add(langueChp, new FormData(300, 0));
markPublicChp = new CheckBox();
markPublicChp.setFieldLabel(i18nC.projetMarkPublic());
markPublicChp.addListener(Events.Change, new Listener<BaseEvent>() {
public void handleEvent(BaseEvent be) {
if (markPublicChp.getValue()) {
indexationFieldset.show();
} else {
indexationFieldset.hide();
}
}
});
complementFieldset.add(markPublicChp);
}
private void creerZoneIndexation() {
FormLayout layout = new FormLayout();
layout.setLabelWidth(100);
// Fieldset Indexation
indexationFieldset = new FieldSet();
indexationFieldset.setHeadingHtml(i18nC.projetTitreIndexation());
indexationFieldset.setCollapsible(true);
indexationFieldset.setLayout(layout);
indexationFieldset.hide();
indexationFieldset.addListener(Events.Hide, new Listener<BaseEvent>() {
public void handleEvent(BaseEvent be) {
indexationHeureChp.clear();
indexationFrequenceChp.clear();
indexationDureeChp.clear();
}
});
indexationHeureChp = new TextField<String>();
indexationHeureChp.setFieldLabel(i18nC.projetIndexationHeure());
indexationHeureChp.setToolTip(i18nC.projetMessageHeureMinute());
indexationFieldset.add(indexationHeureChp, new FormData(80, 0));
indexationFrequenceChp = new ChampComboBoxListeValeurs(i18nC.projetIndexationFrequence(), listeValeurIndexationFrequenceId);
indexationFieldset.add(indexationFrequenceChp, new FormData(120, 0));
indexationDureeChp = new ChampComboBoxListeValeurs(i18nC.projetIndexationDuree(), listeValeurIndexationDureeId);
indexationFieldset.add(indexationDureeChp, new FormData(80, 0));
}
private void creerTabIndex() {
nomChp.setTabIndex(1);
abreviationChp.setTabIndex(2);
descriptionChp.setTabIndex(3);
resumeChp.setTabIndex(4);
urlChp.setTabIndex(5);
motsClesChp.setTabIndex(6);
citationChp.setTabIndex(7);
licenceChp.setTabIndex(8);
langueChp.setTabIndex(9);
markPublicChp.setTabIndex(10);
indexationHeureChp.setTabIndex(11);
indexationFrequenceChp.setTabIndex(12);
indexationDureeChp.setTabIndex(13);
nomChp.focus();
}
 
public void rafraichir(Object nouvellesDonnees) {
if (nouvellesDonnees instanceof Information) {
Information info = (Information) nouvellesDonnees;
rafraichirInformation(info);
} else {
Debug.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()));
}
if (etreValide()) {
initialiserValidation();
repandreRafraichissement();
controlerFermeture();
}
}
 
private void rafraichirInformation(Information info) {
final String type = info.getType();
// Gestion des problèmes
if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
Debug.log("MESSAGES:\n"+info.getMessages().toString());
}
// Gestion des actions
if (type.equals("selection_projet")) {
if (info.getDonnee(0) != null) {
projet = (Projet) info.getDonnee(0);
}
peuplerFormulaire();
genererTitreFormulaire();
}
if (type.equals("ajout_projet") || type.equals("modif_projet")) {
if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
projetValideOk = true;
if(!type.equals("modif_projet")) {
String projetId = (String) info.getDonnee(0);
if (vueExterneARafraichirApresValidation != null) {
projet.setId(projetId);
}
}
controlerFermeture();
}
}
// Gestion des messages
if (type.equals("selection_projet")) {
InfoLogger.display(i18nC.projetTitreFormModif(), info.toString());
} else if (type.equals("modif_projet")) {
//InfoLogger.display(i18nC.projetTitreFormModif(), info.toString());
} else if (type.equals("ajout_projet")) {
if (info.getDonnee(0) != null && info.getDonnee(0) instanceof String) {
String projetId = (String) info.getDonnee(0);
InfoLogger.display(i18nC.projetTitreFormAjout(), "Le projet '"+projetId+"' a bien été ajouté");
} else {
InfoLogger.display(i18nC.projetTitreFormAjout(), info.toString(), true);
}
}
}
private Boolean etreValide() {
Boolean valide = false;
if (formulaireValideOk && projetValideOk) {
valide = true;
}
return valide;
}
private void initialiserValidation() {
formulaireValideOk = false;
projetValideOk = false;
}
private void repandreRafraichissement() {
if (vueExterneARafraichirApresValidation != null) {
String type = "projet_modifie";
if (mode.equals(Formulaire.MODE_AJOUTER)) {
type = "projet_ajoute";
}
Information info = new Information(type);
info.setDonnee(0, projet);
vueExterneARafraichirApresValidation.rafraichir(info);
}
}
public boolean soumettreFormulaire() {
formulaireValideOk = verifierFormulaire();
if (formulaireValideOk) {
Projet projetCollecte = collecterProjet();
if (projetCollecte != null) {
if (mode.equals(Formulaire.MODE_AJOUTER)) {
mediateur.ajouterProjet(this, projetCollecte);
} else if (mode.equals(Formulaire.MODE_MODIFIER)) {
mediateur.modifierProjet(this, projetCollecte);
}
}
}
if(formulaireValideOk && clicBoutonvalidation) {
fermerFormulaire();
}
return formulaireValideOk;
}
public boolean verifierFormulaire() {
boolean valide = true;
ArrayList<String> messages = new ArrayList<String>();
String titre = nomChp.getValue();
if (titre == null || titre.equals("")) {
messages.add(i18nC.projetMessageNom());
}
String abr = abreviationChp.getValue();
if (abr == null || abr.equals(i18nC.projetMessageAbreviation())) {
messages.add(i18nC.projetMessageAbreviation());
}
String desc = descriptionChp.getValue();
if (desc == null || desc.equals(i18nC.projetMessageDescription())) {
messages.add(i18nC.projetDescription());
}
String resume = resumeChp.getValue();
if (resume == null || resume.equals(i18nC.projetMessageResume())) {
messages.add(i18nC.projetMessageResume());
}
String uri = urlChp.getValue();
if (uri != null && ! uri.trim().isEmpty() && ! uri.matches(Pattern.url)) {
messages.add(i18nC.messageUrlNonValide());
}
if (markPublicChp.getValue()) {
String heure = indexationHeureChp.getValue();
if (!UtilString.isEmpty(heure) && !heure.matches(Pattern.heureMinute)) {
messages.add(i18nC.projetMessageHeureMinute());
}
}
if (messages.size() != 0) {
String[] tableauDeMessages = {};
tableauDeMessages = messages.toArray(tableauDeMessages);
MessageBox.alert(i18nC.erreurSaisieTitre(), UtilArray.implode(tableauDeMessages, "<br />"), null);
valide = false;
}
return valide;
}
private void peuplerFormulaire() {
nomChp.setValue(projet.getNom());
abreviationChp.setValue(projet.getAbreviation());
descriptionChp.setValue(projet.getDescription());
resumeChp.setValue(projet.getResume());
urlChp.setValue(projet.getUrl());
motsClesChp.setValue(projet.getMotsCles());
citationChp.setValue(projet.getCitation());
licenceChp.setValue(projet.getLicence());
if (projet.getLangueId().matches("[0-9]+")) {
langueChp.getCombo().setValue(langueChp.getStore().findModel("cmlv_id_valeur", projet.getLangueId()));
} else {
langueChp.getCombo().setRawValue(projet.getLangueId());
}
if (projet.getMarkPublic().equals("1")) {
markPublicChp.setValue(true);
String[] heureTab = projet.getIndexationHeure().split(":");
if (heureTab.length > 1) {
String heure = heureTab[0]+":"+heureTab[1];
if (heure.matches(Pattern.heureMinute)) {
indexationHeureChp.setValue(heure);
}
}
indexationFrequenceChp.peupler(projet.getIndexationFreq());
indexationDureeChp.peupler(projet.getIndexationDuree());
} else {
markPublicChp.setValue(false);
}
doLayout(true);
}
private Projet collecterProjet() {
Projet projetCollecte = (Projet) projet.cloner(new Projet());
projetCollecte.setNom(nomChp.getValue());
projetCollecte.setAbreviation(abreviationChp.getValue());
projetCollecte.setDescription(descriptionChp.getValue());
projetCollecte.setResume(resumeChp.getValue());
projetCollecte.setUrl(urlChp.getValue());
projetCollecte.setMotsCles(motsClesChp.getValue());
projetCollecte.setCitation(citationChp.getValue());
projetCollecte.setLicence(licenceChp.getValue());
if (langueChp.getValeur() != null) {
Valeur valeur = new Valeur(langueChp.getValeur());
projetCollecte.setLangue(valeur.getId());
} else {
projetCollecte.setLangue("");
}
String markPublic = (markPublicChp.getValue()) ? "1" : "0";
projetCollecte.setMarkPublic(markPublic);
projetCollecte.setIndexationHeure(indexationHeureChp.getValue());
projetCollecte.setIndexationFreq(indexationFrequenceChp.getValeur());
projetCollecte.setIndexationDuree(indexationDureeChp.getValeur());
 
Projet projetARetourner = null;
if (!projetCollecte.comparer(projet)) {
projetARetourner = projet = projetCollecte;
}
return projetARetourner;
}
}
Property changes:
Added: svn:mergeinfo
Merged /trunk/src/org/tela_botanica/client/vues/projet/ProjetForm.java:r11-934,1209-1382
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/vues/projet/ProjetForm.java:r1383-1511
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/vues/projet/ProjetForm.java:r1136-1368
/trunk/src/org/tela_botanica/client/vues/projet/ProjetVue.java
New file
0,0 → 1,73
package org.tela_botanica.client.vues.projet;
 
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Information;
import org.tela_botanica.client.modeles.ValeurListe;
import org.tela_botanica.client.modeles.projet.Projet;
import org.tela_botanica.client.modeles.projet.ProjetListe;
import org.tela_botanica.client.synchronisation.Sequenceur;
import org.tela_botanica.client.util.Debug;
 
import com.extjs.gxt.ui.client.Style.LayoutRegion;
import com.extjs.gxt.ui.client.util.Margins;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.layout.BorderLayout;
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData;
import com.google.gwt.core.client.GWT;
 
public class ProjetVue extends LayoutContainer implements Rafraichissable {
 
private ProjetListeVue panneauProjetListe;
private ProjetDetailVue panneauProjetDetail;
private Mediateur mediateur = null;
private Sequenceur sequenceur = new Sequenceur();
 
public ProjetVue(Mediateur mediateurCourant) {
super();
mediateur = mediateurCourant;
BorderLayout layout = new BorderLayout();
layout.setEnableState(false);
setLayout(layout);
 
panneauProjetListe = new ProjetListeVue(mediateur);
this.add(panneauProjetListe, new BorderLayoutData(LayoutRegion.CENTER));
 
panneauProjetDetail = new ProjetDetailVue(mediateur, sequenceur);
BorderLayoutData southData = new BorderLayoutData(LayoutRegion.SOUTH, .5f, 200, 1000);
southData.setSplit(true);
southData.setMargins(new Margins(5, 0, 0, 0));
this.add(panneauProjetDetail, southData);
}
 
public void rafraichir(Object nouvellesDonnees) {
if (nouvellesDonnees instanceof Projet) {
//panneauProjetDetail.rafraichir((Projet) nouvellesDonnees);
sequenceur.enfilerRafraichissement(panneauProjetDetail, (Projet) nouvellesDonnees);
} else if (nouvellesDonnees instanceof ProjetListe) {
panneauProjetListe.rafraichir((ProjetListe) nouvellesDonnees);
} else if (nouvellesDonnees instanceof Information) {
Information info = (Information) nouvellesDonnees;
// Affichage des éventuels messages de déboguage ou d'alerte
if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
GWT.log(info.getMessages().toString(), null);
}
// Traitement en fonction des types d'information
if (info.getType().equals("liste_projet")) {
GWT.log("Une liste de projets a été reçue", null);
panneauProjetListe.rafraichir((ProjetListe) info.getDonnee(0));
} else {
panneauProjetListe.rafraichir(info);
}
} else if (nouvellesDonnees instanceof ValeurListe) {
panneauProjetDetail.rafraichir(nouvellesDonnees);
} else {
if (nouvellesDonnees != null) {
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
}
}
layout();
}
 
}
Property changes:
Added: svn:mergeinfo
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/vues/projet/ProjetVue.java:r1136-1368
Merged /trunk/src/org/tela_botanica/client/vues/projet/ProjetVue.java:r11-934,1209-1382
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/vues/projet/ProjetVue.java:r1383-1511
/trunk/src/org/tela_botanica/client/vues/projet/ProjetListeVue.java
New file
0,0 → 1,279
package org.tela_botanica.client.vues.projet;
 
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
 
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.RegistreId;
import org.tela_botanica.client.composants.ChampFiltreRecherche;
import org.tela_botanica.client.composants.InfoLogger;
import org.tela_botanica.client.i18n.Constantes;
import org.tela_botanica.client.images.Images;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Information;
import org.tela_botanica.client.modeles.Utilisateur;
import org.tela_botanica.client.modeles.projet.Projet;
import org.tela_botanica.client.modeles.projet.ProjetListe;
import org.tela_botanica.client.modeles.publication.Publication;
import org.tela_botanica.client.modeles.structure.StructureListe;
import org.tela_botanica.client.util.Debug;
import org.tela_botanica.client.util.UtilString;
import org.tela_botanica.client.vues.BarrePaginationVue;
 
import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.Style.SortDir;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.ButtonEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.event.SelectionChangedEvent;
import com.extjs.gxt.ui.client.event.SelectionChangedListener;
import com.extjs.gxt.ui.client.event.SelectionListener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.store.StoreSorter;
import com.extjs.gxt.ui.client.widget.ContentPanel;
import com.extjs.gxt.ui.client.widget.Info;
import com.extjs.gxt.ui.client.widget.button.Button;
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig;
import com.extjs.gxt.ui.client.widget.grid.ColumnModel;
import com.extjs.gxt.ui.client.widget.grid.Grid;
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel;
import com.extjs.gxt.ui.client.widget.layout.FitLayout;
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Window;
 
public class ProjetListeVue extends ContentPanel implements Rafraichissable {
 
private Mediateur mediateur = null;
private Constantes i18nC = null;
 
private Grid<Projet> grille = null;
private ListStore<Projet> store = null;
private ColumnModel modeleDesColonnes = null;
private ChampFiltreRecherche champFiltreRecherche = null;
private BarrePaginationVue pagination = null;
private Button ajouter;
private Button modifier;
private Button supprimer;
private int indexElementSelectionne = 0;
private Projet projetSelectionne = null;
public ProjetListeVue(Mediateur mediateurCourant) {
super();
mediateur = mediateurCourant;
i18nC = Mediateur.i18nC;
setLayout(new FitLayout());
setHeadingHtml("Projets");
ToolBar toolBar = new ToolBar();
ajouter = new Button(i18nC.ajouter());
ajouter.setIcon(Images.ICONES.ajouter());
ajouter.addSelectionListener(new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent be) {
mediateur.clicAjouterProjet();
}
});
ajouter.setToolTip(i18nC.indicationCreerUneFiche()+" "+i18nC.projetSingulier());
toolBar.add(ajouter);
 
modifier = new Button(i18nC.modifier());
modifier.setIcon(Images.ICONES.formModifier());
modifier.addSelectionListener(new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent be) {
mediateur.clicModifierProjet(grille.getSelectionModel().getSelectedItems());
indexElementSelectionne = store.indexOf(grille.getSelectionModel().getSelectedItem());
}
});
modifier.setToolTip(i18nC.indicationModifierUneFiche());
toolBar.add(modifier);
supprimer = new Button(i18nC.supprimer());
supprimer.setIcon(Images.ICONES.supprimer());
supprimer.addSelectionListener(new SelectionListener<ButtonEvent>() {
public void componentSelected(ButtonEvent be) {
mediateur.clicSupprimerProjet(grille.getSelectionModel().getSelectedItems());
}
});
supprimer.setToolTip(i18nC.indicationSupprimerUneFiche());
toolBar.add(supprimer);
 
setTopComponent(toolBar);
 
List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>();
// ATTENTION : les noms des colonnes doivent correspondre aux noms variables de la classe utilisée dans la liste
colonnes.add(new ColumnConfig("id_projet", i18nC.id(), 20));
colonnes.add(new ColumnConfig("nom", i18nC.nom(), 200));
colonnes.add(new ColumnConfig("abreviation", i18nC.projetAbreviation(), 200));
colonnes.add(new ColumnConfig("resume", i18nC.projetResume(), 300));
colonnes.add(new ColumnConfig("url", i18nC.projetUrl(), 200));
colonnes.add(new ColumnConfig("mot_cles", i18nC.projetMotsCles(), 280));
 
modeleDesColonnes = new ColumnModel(colonnes);
 
GridSelectionModel<Projet> modeleDeSelection = new GridSelectionModel<Projet>();
modeleDeSelection.addSelectionChangedListener(new SelectionChangedListener<Projet>() {
public void selectionChanged(SelectionChangedEvent<Projet> event) {
projetSelectionne = (Projet) event.getSelectedItem();
clicListe(projetSelectionne);
}
});
store = new ListStore<Projet>();
Comparator<Object> compStp = new Comparator<Object>() {
@Override
public int compare(Object o1, Object o2) {
return comparerNaturellementChampProjet(o1,o2);
}
};
StoreSorter<Projet> stp = new StoreSorter<Projet>(compStp);
store.setStoreSorter(stp);
store.sort("id_projet", SortDir.ASC);
grille = new Grid<Projet>(store, modeleDesColonnes);
grille.setWidth("100%");
grille.setAutoExpandColumn("nom");
grille.getView().setAutoFill(true);
grille.getView().setForceFit(true);
grille.setSelectionModel(modeleDeSelection);
grille.addListener(Events.ViewReady, new Listener<BaseEvent>() {
public void handleEvent(BaseEvent be) {
grille.getSelectionModel().select(0, false);
}
});
grille.addListener(Events.OnDoubleClick, new Listener<BaseEvent>(){
public void handleEvent(BaseEvent be) {
modifier.fireEvent(Events.Select);
}
});
add(grille);
ProjetListe projetListe = new ProjetListe();
champFiltreRecherche = new ChampFiltreRecherche(mediateurCourant, toolBar, projetListe);
// Définition de la barre de pagination
pagination = new BarrePaginationVue(projetListe, mediateur, champFiltreRecherche);
setBottomComponent(pagination);
}
private int comparerNaturellementChampProjet(Object o1, Object o2) {
int compare = 0;
String s1 = (String)o1;
String s2 = (String)o2;
try {
Integer i1 = Integer.parseInt(s1);
Integer i2 = Integer.parseInt(s2);
compare = i1.compareTo(i2);
} catch (NumberFormatException e) {
compare = s1.compareTo(s2);
}
return compare;
}
public ListStore<Projet> getStore() {
return store;
}
 
private void clicListe(Projet projet) {
mediateur.clicListeProjet(projet);
}
 
private void gererEtatActivationBouton() {
int nbreElementDuMagazin = store.getCount();
ajouter.enable();
if (nbreElementDuMagazin <= 0) {
supprimer.disable();
modifier.disable();
} else if (nbreElementDuMagazin > 0) {
modifier.enable();
if (mediateur.getUtilisateur().isIdentifie()) {
supprimer.enable();
}
}
}
public void rafraichir(Object nouvellesDonnees) {
if (nouvellesDonnees instanceof ProjetListe) {
ProjetListe projets = (ProjetListe) nouvellesDonnees;
champFiltreRecherche.setListePaginable(projets);
pagination.setlistePaginable(projets);
pagination.rafraichir(projets.getPageTable());
if (projets != null) {
List<Projet> projetsListe = projets.toList();
store.removeAll();
if (mediateur.getProjetId() != null) {
String projetIdSelectionne = mediateur.getProjetId();
Iterator<Projet> it = projetsListe.iterator();
while (it.hasNext()) {
Projet projetCourant = it.next();
if (projetCourant.getId().equals(projetIdSelectionne)) {
store.add(projetCourant);
}
}
} else {
store.add(projetsListe);
}
mediateur.actualiserPanneauCentral();
}
} else if (nouvellesDonnees instanceof Information) {
Information info = (Information) nouvellesDonnees;
if (info.getType().equals("maj_utilisateur")) {
gererEtatActivationBouton();
} else if (info.getType().equals("projet_modifie")) {
if(projetSelectionne != null) {
store.remove(indexElementSelectionne);
projetSelectionne = null;
}
Projet projetModifie = (Projet)info.getDonnee(0);
// au cas ou le bouton appliquer aurait été cliqué avant de valider
store.remove(projetModifie);
store.insert(projetModifie, indexElementSelectionne);
 
projetSelectionne = projetModifie;
int indexElementSelectionne = store.indexOf(projetSelectionne);
grille.getSelectionModel().select(indexElementSelectionne, false);
grille.getView().focusRow(indexElementSelectionne);
clicListe(projetModifie);
} else if (info.getType().equals("suppression_projet")) {
String message = info.toString();
if (info.getDonnee(0) != null) {
message = (String) info.getDonnee(0);
}
String idsNonSuppr = info.getDonnee(1).toString();
if (!UtilString.isEmpty(idsNonSuppr)) {
message = "Les projets " + idsNonSuppr + " n'ont pas été supprimés car ils sont liés à d'autres éléments";
}
InfoLogger.display(i18nC.projetTitreSuppression(), message, true);
supprimerProjetsSelectionnees(Arrays.asList(idsNonSuppr.split(",")));
gererEtatActivationBouton();
}
} else {
Debug.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()));
}
layout();
}
 
public void supprimerProjetsSelectionnees(List<String> idsNonSuppr) {
List<Projet> selPub = grille.getSelectionModel().getSelectedItems();
for (Iterator<Projet> it = selPub.iterator(); it.hasNext();) {
Projet projetCourant = it.next();
if (!idsNonSuppr.contains(projetCourant.getId().toString())) {
grille.getStore().remove(projetCourant);
}
}
//Mettre à jour les filtres
mediateur.mettreFiltreAJour(grille.getStore().getModels());
layout(true);
}
}
Property changes:
Added: svn:mergeinfo
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/vues/projet/ProjetListeVue.java:r1136-1368
Merged /trunk/src/org/tela_botanica/client/vues/projet/ProjetListeVue.java:r11-934,1209-1382
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/vues/projet/ProjetListeVue.java:r1383-1511
/trunk/src/org/tela_botanica/client/vues/projet
New file
Property changes:
Added: svn:mergeinfo
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/vues/projet:r1136-1291
Merged /trunk/src/org/tela_botanica/client/vues/projet:r11-934,1209-1382
Merged /branches/v1.1-aramon/src/org/tela_botanica/client/vues/projet:r1383-1511
/trunk/src/org/tela_botanica/client/vues/commentaire/CommentaireDetailVue.java
6,6 → 6,7
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.ValeurListe;
import org.tela_botanica.client.modeles.commentaire.Commentaire;
import org.tela_botanica.client.modeles.projet.ProjetListe;
import org.tela_botanica.client.vues.DetailVue;
 
import com.extjs.gxt.ui.client.Style.Scroll;
59,7 → 60,7
enteteTpl =
"<div id='{css_id}'>"+
" <h1>{titre}</h1>"+
" <h2>{collection}<span class='{css_meta}'><br /> {i18n_id}:{id} - {guid}</span></h2>" +
" <h2>{collection}<span class='{css_meta}'>{projet} <br /> {i18n_id}:{id} - {guid}</span></h2>" +
"</div>";
}
98,6 → 99,7
enteteParams.set("titre", commentaire.getTitre());
enteteParams.set("id", commentaire.getId());
enteteParams.set("guid", getGuid());
enteteParams.set("projet", construireTxtProjet(commentaire.getIdProjet()));
String eHtml = Format.substitute(enteteTpl, enteteParams);
entete.getElement().setInnerHTML(eHtml);
105,6 → 107,7
public String getGuid() {
String guid = "URN:tela-botanica.org:";
guid += "coel"+commentaire.getIdProjet()+":";
guid += "com"+commentaire.getId();
return guid;
}
132,6 → 135,9
if (nouvellesDonnees instanceof Commentaire) {
commentaire = (Commentaire) nouvellesDonnees;
commentaireChargementOk = true;
} else if (nouvellesDonnees instanceof ProjetListe) {
projets = (ProjetListe) nouvellesDonnees;
projetsChargementOk = true;
} else if (nouvellesDonnees instanceof ValeurListe) {
ValeurListe listeValeursReceptionnee = (ValeurListe) nouvellesDonnees;
receptionerListeValeurs(listeValeursReceptionnee);
146,7 → 152,7
private boolean avoirDonneesChargees() {
boolean ok = false;
if (commentaireChargementOk) {
if (projetsChargementOk && commentaireChargementOk) {
ok = true;
}
return ok;
/trunk/src/org/tela_botanica/client/vues/commentaire/CommentaireForm.java
7,10 → 7,12
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
import org.tela_botanica.client.composants.ChampSliderPourcentage;
import org.tela_botanica.client.composants.InfoLogger;
import org.tela_botanica.client.composants.pagination.ProxyProjets;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Information;
import org.tela_botanica.client.modeles.MenuApplicationId;
import org.tela_botanica.client.modeles.commentaire.Commentaire;
import org.tela_botanica.client.modeles.projet.Projet;
import org.tela_botanica.client.synchronisation.Sequenceur;
import org.tela_botanica.client.util.Debug;
import org.tela_botanica.client.util.UtilArray;
35,6 → 37,7
private Commentaire commentaire;
 
private ChampComboBoxRechercheTempsReelPaginable projetsCombo = null;
private TextField<String> titreChp;
private TextArea texteChp;
private ChampSliderPourcentage ponderationChp;
84,7 → 87,46
}
private void creerChamps() {
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>(null);
projetsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyProjets, modelTypeProjets, displayNameProjets);
projetsCombo.setWidth(100, 550);
projetsCombo.getCombo().setTabIndex(tabIndex++);
projetsCombo.getCombo().setFieldLabel(i18nC.projetChamp());
projetsCombo.getCombo().setEmptyText(i18nC.txtListeProjetDefaut());
projetsCombo.getCombo().setForceSelection(true);
projetsCombo.getCombo().setEditable(false);
projetsCombo.getCombo().setAllowBlank(false);
projetsCombo.getCombo().setValidator(new Validator() {
public String validate(Field<?> champ, String valeurAValider) {
String retour = null;
if (UtilString.isEmpty(valeurAValider)
|| projetsCombo.getStore().findModel("cpr_nom", valeurAValider) == null) {
champ.setValue(null);
retour = i18nC.selectionnerValeur();
}
if(retour == null) {
projetsCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE_OK);
projetsCombo.getCombo().removeStyleName(ComposantClass.OBLIGATOIRE);
} else {
projetsCombo.getCombo().removeStyleName(ComposantClass.OBLIGATOIRE_OK);
projetsCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE);
}
return retour;
}
});
projetsCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE);
panneauFormulaire.add(projetsCombo, new FormData(450, 0));
titreChp = new TextField<String>();
titreChp.setFieldLabel(i18nC.commentaireTitre());
titreChp.setAllowBlank(false);
128,6 → 170,34
genererTitreFormulaire();
}
private String getValeurComboProjets() {
String valeur = "";
if (projetsCombo.getCombo().getValue() != null && projetsCombo.getCombo().isValid()) {
Projet projet = new Projet (projetsCombo.getValeur());
valeur = projet.getId();
}
return valeur;
}
private void setValeurComboProjets() {
if (mode.equals(Formulaire.MODE_MODIFIER)) {
if (projetsCombo.getCombo().getStore() != null
&& commentaire != null
&& commentaire.getIdProjet() != null
&& !UtilString.isEmpty(commentaire.getIdProjet())) {
projetsCombo.chargerValeurInitiale(commentaire.getIdProjet(), "cpr_id_projet");
} else {
projetsCombo.getCombo().setValue(null);
}
} else if (mode.equals(Formulaire.MODE_AJOUTER)) {
if (projetsCombo.getCombo().getStore() != null) {
projetsCombo.chargerValeurInitiale(mediateur.getProjetId(), "cpr_id_projet");
} else {
projetsCombo.getCombo().setValue(null);
}
}
}
private void rafraichirInformation(Information info) {
// Gestion des messages d'erreur
if (info.getMessages() != null && !info.getMessages().toString().equals("[]")) {
215,6 → 285,12
messages.add(i18nC.commentaireMessageTitre());
}
if (UtilString.isEmpty(getValeurComboProjets())) {
String selectionDe = i18nC.articleUn()+" "+i18nC.projetSingulier();
String pour = i18nC.articleLa()+" "+i18nC.commentaireSingulier();
messages.add(i18nM.selectionObligatoire(selectionDe, pour));
}
if (messages.size() != 0) {
String[] tableauDeMessages = {};
tableauDeMessages = messages.toArray(tableauDeMessages);
225,6 → 301,7
}
private void peuplerFormulaire() {
setValeurComboProjets();
titreChp.setValue(commentaire.getTitre());
texteChp.setValue(commentaire.getTexte());
ponderationChp.peupler(commentaire.getPonderation());
235,6 → 312,8
private Commentaire collecterCommentaire() {
Commentaire commentaireCollectee = (Commentaire) commentaire.cloner(new Commentaire());
commentaireCollectee.setIdProjet(getValeurComboProjets());
String titre = titreChp.getValue();
commentaireCollectee.setTitre(titre);
/trunk/src/org/tela_botanica/client/vues/MenuVue.java
40,6 → 40,7
menuStore = new TreeStore<Menu>();
Menu accueilMenu = new Menu(i18nC.menuAccueil(), MenuApplicationId.ACCUEIL);
Menu projetMenu = new Menu(i18nC.menuProjet(), MenuApplicationId.PROJET);
Menu menuInstitution = new Menu(i18nC.menuStructure(), MenuApplicationId.STRUCTURE);
Menu menuCollections = new Menu(i18nC.menuCollection(), MenuApplicationId.COLLECTION);
Menu menuPersonnes = new Menu(i18nC.menuPersonne(), MenuApplicationId.PERSONNE);
48,6 → 49,7
menuStore.add(accueilMenu, false);
menuStore.add(accueilMenu, projetMenu, true);
menuStore.add(accueilMenu, menuInstitution, true);
menuStore.add(accueilMenu, menuCollections, true);
menuStore.add(accueilMenu, menuPersonnes, true);