Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 1326 → Rev 1327

/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/personne/PersonneAsyncDao.java
13,6 → 13,7
import com.extjs.gxt.ui.client.Registry;
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 PersonneAsyncDao {
26,43 → 27,80
utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId();
}
 
public void selectionner(String personneId, String projetId, String nomComplet, final int pageCourante, final int nbElements) {
String[] parametres = {personneId, projetId, nomComplet};
/**
* @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, String personneId, String projetId, String nomComplet, final int start, final int nbElements) {
 
String nom = (nomComplet == null) ? "%" : nomComplet+"%";
String[] parametres = {personneId, projetId, nom};
HashMap<String, String> restrictions = new HashMap<String, String>();
restrictions.put("start", String.valueOf(pageCourante*nbElements));
if (nbElements != -1) {
restrictions.put("limit", String.valueOf(nbElements));
}
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions);
rb.envoyerRequete(null, new JsonRestRequestCallback() {
@Override
public void surReponse(JSONValue responseValue) {
// Si la requête est un succès, réception d'un tableau
if (responseValue.isArray() != null) {
final JSONArray reponse = responseValue.isArray();
/** 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, parametres, 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 **/
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, parametres, restrictions);
rb.envoyerRequete(null, new JsonRestRequestCallback() {
@Override
public void surReponse(JSONValue responseValue) {
// Transformation du tableau JSON réponse en ListeInstitution
Information info = new Information("liste_personne");
PersonneListe personnes;
if (reponse.get(0).isArray() != null) {
personnes = new PersonneListe(reponse);
if (responseValue != null) {
JSONObject reponseObject = responseValue.isObject();
if (reponseObject.get("personnes").isArray() != null) {
JSONArray reponse = responseValue.isArray();
// Transformation du tableau JSON réponse en ListePersonne
Information info = new Information("liste_personne");
PersonneListe personnes;
personnes = new PersonneListe(reponseObject.get("personnes").isArray(), reponseObject.get("nbElements").isNumber(), vueARafraichir);
personnes.setTaillePage(nbElements);
personnes.setPageCourante(start);
info.setDonnee(0, personnes);
// et on met à jour le demandeur des données
vueARafraichir.rafraichir(info);
}
} else {
personnes = new PersonneListe(reponse.get(1).isArray(), reponse.get(0).isNumber(), vueARafraichir);
}
personnes.setTaillePage(nbElements);
personnes.setPageCourante(pageCourante);
info.setDonnee(0, personnes);
// et on met à jour le demandeur des données
vueARafraichir.rafraichir(info);
} else {
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un tableau JSON et vaut : "+responseValue.toString(), null);
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un tableau JSON et vaut : "+responseValue.toString(), null);
}
}
}
});
});
}
}
public void ajouter(Personne personne) {
/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/collection/Collection.java
6,6 → 6,7
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 Collection extends aDonnee {
22,6 → 23,12
public Collection() {
}
public Collection(ModelData model)
{
this.set("id_collection", model.get("cc_id_collection"));
this.set("nom", model.get("cc_nom"));
}
public Collection(JSONObject collection) {
initialiserModele(collection);
}
208,7 → 215,7
}
// TYPE NCD
public String getTypeNcd() {
public String getTypeNcd() {
return renvoyerValeurCorrecte("ce_type");
}
public void setTypeNcd(String typeNcd) {
/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/collection/CollectionAsyncDao.java
30,52 → 30,99
vueARafraichir = vueARafraichirCourrante;
utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId();
}
public void selectionner(final String projetId, final String collectionId, final String nomCollection, final int start, final int nbElements) {
 
/**
*
* @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 collectionId, final String nomCollection, final int start, final int nbElements) {
 
// Ajout des paramètres et données à selectionner dans l'URL
String[] parametres = {projetId, collectionId, nomCollection};
String nom = (nomCollection == null) ? "%" : nomCollection+"%";
String[] parametres = {projetId, collectionId, nom};
HashMap<String, String> restrictions = new HashMap<String, String>();
restrictions.put("start", String.valueOf(start*nbElements));
if (nbElements != -1) {
restrictions.put("limit", String.valueOf(nbElements));
}
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions);
rb.envoyerRequete(null, new JsonRestRequestCallback() {
@Override
public void surReponse(JSONValue responseValue) {
if (responseValue != null) {
// Si la requête est un succès, reception d'un objet ou d'un tableau
JSONArray responseArray = responseValue.isArray();
if (responseArray.get(1).isObject() != null) {
final JSONObject reponse = responseArray.get(1).isObject();
Collection collection = new Collection(reponse);
CollectionBotanique collectionBotanique = new CollectionBotanique(reponse);
collection.setBotanique(collectionBotanique);
Information info = new Information("selection_collection");
info.setDonnee(0, collection);
vueARafraichir.rafraichir(info);
} else if (responseValue.isArray() != null) {
final JSONArray reponse = responseArray.get(1).isArray();
CollectionListe collections = new CollectionListe(reponse, responseArray.get(0).isNumber(), vueARafraichir);
collections.setTaillePage(nbElements);
collections.setPageCourante(start);
vueARafraichir.rafraichir(collections);
 
/** 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, parametres, 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 **/
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, parametres, restrictions);
rb.envoyerRequete(null, new JsonRestRequestCallback() {
@Override
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 collections qui a été retournée
if (responseObject.get("collections").isArray() != null) {
final JSONArray reponse = responseObject.get("collections").isArray();
CollectionListe collections = new CollectionListe(reponse, responseObject.get("nbElements").isNumber(), vueARafraichir);
collections.setTaillePage(nbElements);
collections.setPageCourante(start);
vueARafraichir.rafraichir(collections);
// Si la réponse est un objet, alors c'est une unique collection qui a été retournée
} else if (responseObject.get("collections").isObject() != null) {
final JSONObject reponse = responseObject.get("collections").isObject();
Collection collection = new Collection(reponse);
CollectionBotanique collectionBotanique = new CollectionBotanique(reponse);
collection.setBotanique(collectionBotanique);
Information info = new Information("selection_collection");
info.setDonnee(0, collection);
vueARafraichir.rafraichir(info);
}
} else {
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un objet ou un talbeau JSON et vaut : "+responseValue.toString(), null);
}
} else {
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un objet ou un talbeau JSON et vaut : "+responseValue.toString(), null);
// Dans le cas, où nous demandons toutes les institutions et qu'il n'y en a pas, nous retournons un objet vide
if (collectionId == null) {
CollectionListe collections = new CollectionListe(0);
vueARafraichir.rafraichir(collections);
}
}
} else {
// Dans le cas, où nous demandons toutes les institutions et qu'il n'y en a pas, nous retournons un objet vide
if (collectionId == null) {
CollectionListe collections = new CollectionListe(0);
vueARafraichir.rafraichir(collections);
}
}
}
});
});
}
}
public void ajouter(Collection collection) {
/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/structure/StructureAsyncDao.java
10,6 → 10,7
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.util.Debug;
import org.tela_botanica.client.util.UtilDAO;
 
import com.extjs.gxt.ui.client.Registry;
28,60 → 29,107
public StructureAsyncDao(Rafraichissable vue) {
vueARafraichir = vue;
utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId();
GWT.log("ID utilisateur :"+utilisateurId, null);
}
public void selectionner(final String projetId, final String structureId, final String nomStructure, final int pageCourante, final int nbElements) {
String[] parametres = {projetId, structureId, nomStructure};
 
/**
*
* @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 structureId, final String nomStructure, final int start, final int nbElements) {
String nom = (nomStructure == null) ? "%" : nomStructure+"%";
String[] parametres = {projetId, structureId, nom};
HashMap<String, String> restrictions = new HashMap<String, String>();
restrictions.put("start", String.valueOf(pageCourante*nbElements));
if (nbElements != -1) {
restrictions.put("limit", String.valueOf(nbElements));
}
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions);
rb.envoyerRequete(null, new JsonRestRequestCallback() {
@Override
public void surReponse(JSONValue responseValue) {
if (responseValue != null) {
Information info = new Information("selection_structure");
// Si la requête est un succès, reception d'un objet ou d'un tableau
JSONArray responseArray = responseValue.isArray();
if (responseArray.get(1).isObject() != null) {
final JSONObject reponse = responseArray.get(1).isObject();
Structure structure = new Structure(reponse);
StructureConservation structureConservation = new StructureConservation(reponse);
StructureValorisation structureValorisation = new StructureValorisation(reponse);
info.setDonnee(0, structure);
info.setDonnee(1, structureConservation);
info.setDonnee(2, structureValorisation);
vueARafraichir.rafraichir(info);
} else if (responseArray.get(1).isArray() != null) {
final JSONArray reponse = responseValue.isArray();
StructureListe structures; // = new StructureListe(reponse);
if (reponse.get(1).isObject() != null) {
structures = new StructureListe(reponse.get(1).isArray());
} else {
structures = new StructureListe(reponse.get(1).isArray(), reponse.get(0).isNumber(), vueARafraichir);
/** 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, parametres, 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 **/
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, parametres, restrictions);
rb.envoyerRequete(null, new JsonRestRequestCallback() {
 
public void surReponse(JSONValue responseValue) {
if (responseValue != null) {
Information info = new Information("selection_structure");
JSONObject responseObject = responseValue.isObject();
if (responseObject != null) {
// Si la réponse est un tableau, alors c'est une liste de structure qui a été retournée
if (responseObject.get("structures").isArray() != null) {
JSONObject reponse = responseObject;
StructureListe structures;
structures = new StructureListe(reponse.get("structures").isArray(), reponse.get("nbElements").isNumber(), vueARafraichir);
structures.setTaillePage(nbElements);
structures.setPageCourante(start);
info.setDonnee(0, structures);
vueARafraichir.rafraichir(structures);
// Si la réponse est un objet, alors c'est une unique structure qui a été retournée
} else if (responseObject.get("structures").isObject() != null) {
JSONObject reponse = responseObject.get("structures").isObject();
Structure structure = new Structure(reponse);
StructureConservation structureConservation = new StructureConservation(reponse);
StructureValorisation structureValorisation = new StructureValorisation(reponse);
info.setDonnee(0, structure);
info.setDonnee(1, structureConservation);
info.setDonnee(2, structureValorisation);
vueARafraichir.rafraichir(info);
}
} else {
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un objet ou un talbeau JSON et vaut : "+responseValue.toString(), null);
}
structures.setTaillePage(nbElements);
structures.setPageCourante(pageCourante);
info.setDonnee(0, structures);
vueARafraichir.rafraichir(structures);
} else {
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un objet ou un talbeau JSON et vaut : "+responseValue.toString(), null);
if (structureId == null) {
// Dans le cas, où nous demandons toutes les institutions et qu'il n'y en a pas, nous retournons un objet vide
StructureListe structures = new StructureListe(0);
vueARafraichir.rafraichir(structures);
}
}
} else {
if (structureId == null) {
// Dans le cas, où nous demandons toutes les institutions et qu'il n'y en a pas, nous retournons un objet vide
StructureListe structures = new StructureListe(0);
vueARafraichir.rafraichir(structures);
}
}
}
});
});
}
}
public void ajouter(final Structure str, StructureConservation conservation, StructureValorisation valorisation) {
/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/structure/Structure.java
9,6 → 9,7
import org.tela_botanica.client.util.UtilString;
 
import com.extjs.gxt.ui.client.data.BaseModelData;
import com.extjs.gxt.ui.client.data.ModelData;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.json.client.JSONObject;
 
31,6 → 32,12
urls = new BaseModelData();
}
public Structure(ModelData model)
{
this.set("id_structure", model.get("cs_id_structure"));
this.set("nom", model.get("cs_nom"));
}
public Structure(JSONObject institution) {
// Constructions du tableau des urls interne
urls = new BaseModelData();
/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/ValeurListeAsyncDao.java
19,12 → 19,10
private static HashMap<String, Object> ontologieCache = new HashMap<String, Object>();
private static HashMap<String, HashMap<Integer, Object>> pagedOntologieCache = new HashMap<String, HashMap<Integer, Object>>();
private static final String SERVICE_NOM = "CoelValeurListe";
private Rafraichissable vueARafraichir = null;
private static ValeurListe tempListe = new ValeurListe();
private int cptPage = 0;
// FIXME : limiteJREST devrait être récupéré depuis un registre/dictionnaire
private int limiteJREST = 150;
 
public ValeurListeAsyncDao(Rafraichissable vueCourante) {
34,38 → 32,6
public static HashMap<String, Object> getOntologieCache() {
return ontologieCache;
}
 
public void chargerListe(boolean nextPage, String type, Integer cle, String abv, String idValeur, boolean pagination, String recherche, int start, int nbElements) {
/** Si nextpage est VRAI, alors cela signifie que la liste est plus grande
que la limite du JREST et l'on doit relancer une requete pour obtenir
la page suivante **/
if (nextPage) {
cptPage++;
selectionner(type, cle, abv, idValeur, pagination, recherche, cptPage*limiteJREST, limiteJREST);
}
/** Sinon cela signifie que le chargement de la liste est terminé et on peut
la mettre en cache et retourner la réponse au demandeur **/
else {
// on met en cache
String id = String.valueOf(cle);
String abreviationStr = "";
if (abv != null) {
abreviationStr = abv;
int indexPoint = abreviationStr.indexOf(".", 0);
abreviationStr = abreviationStr.substring(0, indexPoint);
id = id+abreviationStr;
}
// réinitialiser le compteur
cptPage = 0;
 
// et on met à jour le demandeur des données
if (ontologieCache.get(id) != null) {
vueARafraichir.rafraichir(ontologieCache.get(id));
}
}
}
public void obtenirListe(Integer cle) {
selectionner("id", cle, null, null, false, null, -1, -1);
81,15 → 47,54
public void selectionner(String type, Integer cle, String abv, String idValeur) {
selectionner(type, cle, abv, idValeur, false, null, -1, -1);
}
 
}
/****************************************************************************************************
** selectionner(final String type, final Integer cle, final String abv, final String idValeur, final boolean pagination, final String recherche, final int start, final int limit)
/****************************************************************************************************
* Action :
* --------
* Récupère un nombre défini de Valeurs en s'aidant du nom partiel ou complet d'une valeur.
* Cette méthode gère deux types de sélection de données :
* - la sélection en cache (ontologieCache) --> pagination = FALSE
* - la sélection "au fur et à mesure" --> pagination = TRUE
*
* Gestion du cache :
* ------------------
* - Le cache est utilisé si et seulement si 'pagination' est à FAUX car dans le cas où PAGINATION est
* à VRAI, les enregistrements sont chargés au fur et à mesure de la consultation des pages par
* l'utilisateur.
* - Si la taille de la liste chargée est supérieure au nombre maximum d'enregistrements retourné
* par le service JREST, alors on charge des blocs de valeurs jusqu'à ce que la totalité de la
* liste soit chargée.
*
* Description des paramètres :
* ----------------------------
* @param 'type' est un paramètre directement destiné au service JREST. Il permet de définir le type
* de requête SQL à exécuter.
* @param 'cle' est l'identifiant de la liste de valeurs à récupérer (cas d'un noeud dans l'arbre).
* @param 'abv' sert pour la liste des régions. Il représente l'abréviation du nom d'un pays. Ce
* paramètre est concaténé à la clé pour former une clé particulière dont on se sert pour
* stocker la liste en cache.
* @param 'idValeur' est l'identifiant de la valeur à récupérer (cas d'une feuille dans l'arbre).
* @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.
* @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.
*
*****************************************************************************************************/
public void selectionner(final String type, final Integer cle, final String abv, final String idValeur, final boolean pagination, final String recherche, final int start, final int limit) {
 
// La cleParent en Integer est insuffisante pour les liste valeurs comme Région qui on plusieurs sections sur leur liste
// (ex : on ne sélectionne que les régions FR.__ puis les régions ES.__ sur la liste 1078 ....
/**
* La cleParent en Integer est insuffisante pour les liste valeurs comme Région qui on plusieurs
* sections sur leur liste (ex : on ne sélectionne que les régions FR.__ puis les régions ES.__ sur la liste 1078 ....
**/
final String cleParentPourCache = cle + (abv == null ? "" : abv);
final String cleParent = cle+"";
/** GESTION DU PARAMETRE 'recherche' **/
String nom = "";
if ( (recherche == null) || (recherche.equals("")) ) nom = "";
else {
96,9 → 101,9
nom = recherche+"%";
}
 
/** GESTION DU PARAMETRE 'abréviation' **/
String abreviation = "";
String paramAbv = "";
if (type.equals("ab") || type.equals("abv")) {
int positionPoint = abv.indexOf(".");
if (positionPoint != -1) abreviation = abv.substring(0, positionPoint)+"%";
106,10 → 111,11
}
paramAbv = abreviation;
 
/** GESTION DES PARAMETRES à transmettre au JREST **/
String[] parametres = {type, cleParent, paramAbv, idValeur, nom};
 
HashMap<String, String> restrictions = new HashMap<String, String>();
 
/** GESTION DE LA REQUETE dans le cas d'une liste paginée **/
if (pagination) {
 
restrictions.put("limit", String.valueOf(limit));
116,48 → 122,59
restrictions.put("start", String.valueOf(start));
restrictions.put("orderby", "cmlv_nom");
/** CONSTRUCTION DE LA REQUETE **/
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions);
/** ENVOI DE LA REQUETE **/
rb.envoyerRequete(null, new JsonRestRequestCallback()
{
@Override
/** 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 **/
vueARafraichir.rafraichir(responseValue);
}
});
}
/** GESTION DE LA REQUETE dans le cas d'une liste NON paginée **/
else
{
/** si start est supérieur à zéro, alors cela signifie que l'on doit charger une nouvelle page **/
boolean nextPage = (start > 0);
if (nextPage)
{
/** définition des contraintes sur la requête SQL **/
if (nextPage) {
restrictions.put("start", String.valueOf(start));
restrictions.put("limit", String.valueOf(limit));
restrictions.put("orderby", "cmlv_nom");
}
else
{
else {
restrictions.put("orderby", "cmlv_nom");
}
// si l'on est pas dans un processus de récupération d'une liste
// et si le cache contient déjà la liste recherchée
if (ontologieCache.containsKey(cleParentPourCache) && !nextPage)
{
/** Si l'on est pas dans un processus de récupération d'une liste, alors si le cache contient déjà la liste recherchée **/
if (!nextPage && ontologieCache.containsKey(cleParentPourCache)) {
/** on retourne à la vue la liste contenue dans le cache **/
vueARafraichir.rafraichir(ontologieCache.get(cleParentPourCache));
}
else
{
}
/** Si l'on est en train de récupérer une liste (c-a-d que l'on est en train de charger des blocs de données afin de récupérer totalement une liste) **/
else {
/** CONSTRUCTION DE LA REQUETE **/
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions);
rb.envoyerRequete(null, new JsonRestRequestCallback()
{
@Override
public void surReponse(JSONValue responseValue)
{
if (responseValue.isObject() != null)
{
/** Récuperation des différents paramètres de la réponse JSON **/
/** ENVOI DE LA REQUETE **/
rb.envoyerRequete(null, new JsonRestRequestCallback() {
/** RECEPTION DE LA REPONSE **/
public void surReponse(JSONValue responseValue) {
/** Si la réponse n'est pas vide **/
if (responseValue.isObject() != null) {
/** Récupération des différents paramètres de la réponse JSON **/
final JSONObject reponse = responseValue.isObject();
JSONString listeId = reponse.get("id").isString();
JSONArray listeValeurs = reponse.get("valeurs").isArray();
175,7 → 192,7
abreviationStr = "";
}
 
/** si l'on a bien reçu une liste de valeurs **/
/** Si l'on a bien reçu une liste de valeurs **/
if (listeId != null)
{
/** Transformation du tableau JSON réponse en ValeurListe **/
203,4 → 220,50
}
}
}
/********************************************************************************************************
* Action :
* --------
* Clotûre le chargement d'une liste de valeurs si le chargement est terminé, ou lance le chargement
* du prochain bloc de données si la liste n'est pas chargée en totalité.
*
* Paramètres :
* ------------
* @param nextPage : est VRAI s'il faut faut continuer de charger la liste car elle n'est pas entièrement chargée et FAUX sinon
* @param Tous les autres paramètres sont les mêmes que pour la méthode 'selectionner'
*
*********************************************************************************************************/
public void chargerListe(boolean nextPage, String type, Integer cle, String abv, String idValeur, boolean pagination, String recherche, int start, int nbElements) {
/** Si nextpage est VRAI, alors cela signifie que l'on doit relancer une requete pour obtenir
la page suivante **/
if (nextPage) {
cptPage++;
selectionner(type, cle, abv, idValeur, pagination, recherche, cptPage*limiteJREST, limiteJREST);
}
/** Sinon cela signifie que le chargement de la liste est terminé et on peut
la mettre en cache et retourner la réponse au demandeur **/
else {
// recupération de l'idenfiant de la liste
String id = String.valueOf(cle);
// gestion de l'abréviation pour la liste des régions
String abreviationStr = "";
if (abv != null) {
abreviationStr = abv;
int indexPoint = abreviationStr.indexOf(".", 0);
abreviationStr = abreviationStr.substring(0, indexPoint);
id = id+abreviationStr;
}
// réinitialisation du compteur
cptPage = 0;
 
/** On retourne la liste à la vue **/
if (ontologieCache.get(id) != null) {
vueARafraichir.rafraichir(ontologieCache.get(id));
}
}
}
}
/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/projet/Projet.java
2,6 → 2,7
 
import org.tela_botanica.client.modeles.aDonnee;
 
import com.extjs.gxt.ui.client.data.ModelData;
import com.google.gwt.json.client.JSONObject;
 
public class Projet extends aDonnee {
17,6 → 18,12
initialiserModele(liste);
}
public Projet(ModelData model)
{
this.set("id_projet", model.get("cpr_id_projet"));
this.set("nom", model.get("cpr_nom"));
}
@Override
protected String getPrefixe() {
return PREFIXE;
/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/projet/ProjetAsyncDao.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.structure.StructureListe;
import org.tela_botanica.client.util.Debug;
import org.tela_botanica.client.util.UtilDAO;
 
import com.extjs.gxt.ui.client.Registry;
29,54 → 30,98
utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId();
}
public void selectionner(final String projetId, final String nom, final int pageCourante, final int nbElements) {
/**
* @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) {
String nom = (nomProjet == null) ? "%" : nomProjet+"%";
String[] param = {projetId, nom};
HashMap<String, String> restrictions = new HashMap<String, String>();
restrictions.put("start", String.valueOf(pageCourante*nbElements));
if (nbElements != -1) {
restrictions.put("limit", String.valueOf(nbElements));
}
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, param, restrictions);
rb.envoyerRequete(null, new JsonRestRequestCallback() {
@Override
public void surReponse(JSONValue responseValue) {
if (responseValue != null) {
// Si la requête est un succès, reception d'un objet ou d'un tableau
JSONArray responseArray = responseValue.isArray();
if (responseArray.get(1).isObject() != null) {
final JSONObject reponse = responseArray.get(1).isObject();
Projet projet = new Projet(reponse);
/** 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 **/
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) {
Information info = new Information("selection_projet");
info.setDonnee(0, projet);
vueARafraichir.rafraichir(info);
} else if (responseArray.get(1).isArray() != null) {
final JSONArray reponse = responseValue.isArray();
ProjetListe projets;
if (responseArray.get(1).isObject() != null) {
projets = new ProjetListe(reponse.get(1).isArray());
} else {
projets = new ProjetListe(reponse.get(1).isArray(), reponse.get(0).isNumber(), vueARafraichir);
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);
vueARafraichir.rafraichir(projets);
// Si la réponse est un objet, alors c'est un unique projet qui a été retournée
} 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);
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);
}
projets.setTaillePage(nbElements);
projets.setPageCourante(pageCourante);
vueARafraichir.rafraichir(projets);
} else {
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un objet ou un talbeau JSON et vaut : "+responseValue.toString(), null);
// 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);
vueARafraichir.rafraichir(projets);
}
}
} 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);
vueARafraichir.rafraichir(projets);
}
}
}
});
});
}
}
public void ajouter(Projet projet) {
/branches/v1.0-syrah/src/org/tela_botanica/client/Mediateur.java
490,6 → 490,34
public void selectionnerProjet(Rafraichissable vueARafraichir, String projetId, String nom, int start, int nbElements) {
modele.selectionnerProjet(vueARafraichir, projetId, nom, start, this.nbElements);
}
/****************************************************************************************************
/** selectionnerProjet(Rafraichissable vueARafraichir, String recherche, int start, int nbElements)
/****************************************************************************************************
* Action :
* --------
* - Récupère un nombre défini de projets en s'aidant du nom partiel ou complet du projet.
*
* Description des paramètres :
* ----------------------------
* - 'vueARafraichir' référence l'objet à mettre à jour après réception des données.
* - '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.
* - 'start' et 'nbElements' sont les paramètres indispensables à la pagination. 'start'
* est le paramètre qui décrit le numéro du tuple de départ et 'nbElements' le nombre
* d'éléments à collecter.
*
* Préconditions :
* ---------------
* - 'vueARafraichir' doit être non NULL et référencer un objet implémentant l'interface
* 'Rafraichissable'
* - 'recherche' doit être non NULL.
* - 'start' doit être supérieur ou égal à zéro. 'nbElements' doit être supérieur à zéro.
*
*****************************************************************************************************/
public void selectionnerProjet(Rafraichissable vueARafraichir, String recherche, int start, int nbElements) {
modele.selectionnerProjet(vueARafraichir, recherche, start, nbElements);
}
 
public void ajouterProjet(Rafraichissable vueARafraichir, Projet projetCollecte) {
modele.ajouterProjet(vueARafraichir, projetCollecte);
617,6 → 645,34
InfoLogger.display("Erreur", "Une erreur est survenue dans la méthode clicSupprimerStructure() du Médiateur.");
}
}
 
/****************************************************************************************************
/** selectionnerStructure(Rafraichissable vueARafraichir, String recherche, int start, int nbElements)
/****************************************************************************************************
* Action :
* --------
* - Récupère un nombre défini de structures en s'aidant du nom partiel ou complet de la structure.
*
* Description des paramètres :
* ----------------------------
* - 'vueARafraichir' référence l'objet à mettre à jour après réception des données.
* - 'recherche' est une chaîne de caractères représentant tout ou partie du nom d'une structure.
* Si la chaîne est vide, alors toutes les structures sont recherchées.
* - 'start' et 'nbElements' sont les paramètres indispensables à la pagination. 'start'
* est le paramètre qui décrit le numéro du tuple de départ et 'nbElements' le nombre
* d'éléments à collecter.
*
* Préconditions :
* ---------------
* - 'vueARafraichir' doit être non NULL et référencer un objet implémentant l'interface
* 'Rafraichissable'
* - 'recherche' doit être non NULL.
* - 'start' doit être supérieur ou égal à zéro. 'nbElements' doit être supérieur à zéro.
*
*****************************************************************************************************/
public void selectionnerStructure(Rafraichissable vueARafraichir, String recherche, int start, int nbElements) {
modele.selectionnerStructure(vueARafraichir, recherche, start, nbElements);
}
public void selectionnerStructure(Rafraichissable vueARafraichir, String structureId) {
modele.selectionnerStructure(vueARafraichir, getProjetId(), structureId, null, 0, nbElements);
775,6 → 831,34
modele.selectionnerCollection(vueARafraichir, projetId, null, null, 0, -1);
}
/****************************************************************************************************
/** selectionnerCollection(Rafraichissable vueARafraichir, String recherche, int start, int nbElements)
/****************************************************************************************************
* Action :
* --------
* - Récupère un nombre défini de collections en s'aidant du nom partiel ou complet de la collection.
*
* Description des paramètres :
* ----------------------------
* - 'vueARafraichir' référence l'objet à mettre à jour après réception des données.
* - 'recherche' est une chaîne de caractères représentant tout ou partie du nom d'une collection.
* Si la chaîne est vide, alors toutes les collections sont recherchées.
* - 'start' et 'nbElements' sont les paramètres indispensables à la pagination. 'start'
* est le paramètre qui décrit le numéro du tuple de départ et 'nbElements' le nombre
* d'éléments à collecter.
*
* Préconditions :
* ---------------
* - 'vueARafraichir' doit être non NULL et référencer un objet implémentant l'interface
* 'Rafraichissable'
* - 'recherche' doit être non NULL.
* - 'start' doit être supérieur ou égal à zéro. 'nbElements' doit être supérieur à zéro.
*
*****************************************************************************************************/
public void selectionnerCollection(Rafraichissable vueARafraichir, String recherche, int start, int nbElements) {
modele.selectionnerCollection(vueARafraichir, recherche, start, nbElements);
}
public void ajouterCollection(Rafraichissable vueARafraichir, Collection collection) {
modele.ajouterCollection(vueARafraichir, collection);
}
993,6 → 1077,34
}
}
 
/****************************************************************************************************
/** selectionnerPersonne(Rafraichissable vueARafraichir, String recherche, int start, int nbElements)
/****************************************************************************************************
* Action :
* --------
* - Récupère un nombre défini de personnes en s'aidant du nom partiel ou complet de la personne.
*
* Description des paramètres :
* ----------------------------
* - 'vueARafraichir' référence l'objet à mettre à jour après réception des données.
* - 'recherche' est une chaîne de caractères représentant tout ou partie du nom d'une personne.
* Si la chaîne est vide, alors toutes les personnes sont recherchées.
* - 'start' et 'nbElements' sont les paramètres indispensables à la pagination. 'start'
* est le paramètre qui décrit le numéro du tuple de départ et 'nbElements' le nombre
* d'éléments à collecter.
*
* Préconditions :
* ---------------
* - 'vueARafraichir' doit être non NULL et référencer un objet implémentant l'interface
* 'Rafraichissable'
* - 'recherche' doit être non NULL.
* - 'start' doit être supérieur ou égal à zéro. 'nbElements' doit être supérieur à zéro.
*
*****************************************************************************************************/
public void selectionnerPersonne(Rafraichissable vueARafraichir, String recherche, int start, int nbElements) {
modele.selectionnerProjet(vueARafraichir, recherche, start, nbElements);
}
public void selectionnerPersonne(Rafraichissable vueARafraichir, Personne personne, String projetId) {
selectionnerPersonne(vueARafraichir, personne, projetId, 0, nbElements);
}
/branches/v1.0-syrah/src/org/tela_botanica/client/vues/personne/PersonneForm.java
64,6 → 64,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 org.tela_botanica.client.composants.pagination.TransformateurJSONaModelData;
 
75,6 → 76,7
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
import com.extjs.gxt.ui.client.widget.form.ComboBox;
import com.extjs.gxt.ui.client.widget.form.DateField;
import com.extjs.gxt.ui.client.widget.form.Field;
import com.extjs.gxt.ui.client.widget.form.FieldSet;
import com.extjs.gxt.ui.client.widget.form.LabelField;
import com.extjs.gxt.ui.client.widget.form.Radio;
81,6 → 83,7
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
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.form.Validator;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
237,23 → 240,28
fsProjet.setHeading(i18nC.menuProjet());
fsProjet.setLayout(new FormLayout());
ListStore<Projet> storeProjets = new ListStore<Projet>();
ComboBox cbProjets = new ComboBox<Projet>();
cbProjets.setFieldLabel(i18nC.personneProjet()+ " :");
cbProjets.setEmptyText(i18nC.txtListeProjetDefaut());
cbProjets.setLabelSeparator("");
cbProjets.setDisplayField("nom");
cbProjets.setEditable(false);
cbProjets.setTriggerAction(TriggerAction.ALL);
cbProjets.setStore(storeProjets);
cbProjets.setAllowBlank(false);
cbProjets.addStyleName(ComposantClass.OBLIGATOIRE);
cbProjets.addListener(Events.Valid, creerEcouteurChampObligatoire());
fsProjet.add(cbProjets, new FormData(250, 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>();
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);
mediateur.selectionnerProjet(this, null);
left.add(fsProjet);
988,10 → 996,9
private void mettreAJourPersonne(Personne personne) {
//Mise à jour de la personne
//Personne personne = (Personne) nouvellesDonnees;
ComboBox cbProjets = hmIdentite.getComboBox("cbProjets");
cbProjets.setValue(cbProjets.getStore().findModel("id_projet", personne.get("ce_projet")));
//Mise à jour de la personne
ChampComboBoxRechercheTempsReelPaginable cbProjets = hmIdentite.getComboBoxRechercheTempsReelPaginable("cbProjets");
cbProjets.getCombo().setValue(cbProjets.getStore().findModel("cpr_id_projet", personne.get("ce_projet")));
//Prefixe
String prefixe = personne.get("ce_truk_prefix");
1190,11 → 1197,11
boolean success = true;
LinkedList<String> lstMessageErreur = new LinkedList<String>();
ComboBox<Projet> cbProjets = hmIdentite.getComboBox("cbProjets");
Projet projet = cbProjets.getValue();
if (projet == null) {
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());
}
/branches/v1.0-syrah/src/org/tela_botanica/client/vues/collection/CollectionFormGeneral.java
6,8 → 6,14
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.composants.ChampCaseACocher;
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
import org.tela_botanica.client.composants.ChampMultiValeurs;
import org.tela_botanica.client.composants.ChampMultiValeursMultiTypesPaginable;
import org.tela_botanica.client.composants.ConteneurMultiChamps;
import org.tela_botanica.client.composants.pagination.ProxyCollections;
import org.tela_botanica.client.composants.pagination.ProxyProjets;
import org.tela_botanica.client.composants.pagination.ProxyStructures;
import org.tela_botanica.client.composants.pagination.ProxyValeur;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.ValeurListe;
import org.tela_botanica.client.modeles.collection.Collection;
20,6 → 26,8
import org.tela_botanica.client.vues.Formulaire;
import org.tela_botanica.client.vues.FormulaireOnglet;
 
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.ModelType;
import com.extjs.gxt.ui.client.event.BaseEvent;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
47,9 → 55,9
 
private HiddenField<String> idCollectionChp = null;
private ComboBox<Projet> projetsCombo = null;
private ComboBox<Structure> structuresCombo = null;
private ComboBox<Collection> collectionsCombo = null;
private ChampComboBoxRechercheTempsReelPaginable projetsCombo = null;
private ChampComboBoxRechercheTempsReelPaginable structuresCombo = null;
private ChampComboBoxRechercheTempsReelPaginable collectionsCombo = null;
private ChampCaseACocher periodeConstitutionChp = null;
private ChampComboBoxListeValeurs groupementPrincipeCombo = null;
103,17 → 111,34
liaisonFieldSet.setCollapsible(true);
liaisonFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut));
projetsCombo = new ComboBox<Projet>();
projetsCombo.setTabIndex(tabIndex++);
projetsCombo.setFieldLabel(i18nC.projetChamp());
projetsCombo.setDisplayField("nom");
projetsCombo.setForceSelection(true);
projetsCombo.setValidator(new Validator() {
/*********************************/
/** Champ Projets **/
/*********************************/
ModelType modelTypeProjets = new ModelType();
modelTypeProjets.setRoot("projets");
modelTypeProjets.setTotalName("nbElements");
modelTypeProjets.addField("cpr_nom");
modelTypeProjets.addField("cpr_id_projet");
String displayNameProjets = "cpr_nom";
ProxyProjets<ModelData> proxyProjets = new ProxyProjets<ModelData>();
projetsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyProjets, modelTypeProjets, displayNameProjets);
projetsCombo.setWidth(250, 600);
projetsCombo.getCombo().setTabIndex(tabIndex++);
projetsCombo.getCombo().setFieldLabel(i18nC.projetChamp());
projetsCombo.getCombo().setForceSelection(true);
projetsCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE);
projetsCombo.getCombo().addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
projetsCombo.getCombo().setValidator(new Validator() {
public String validate(Field<?> field, String value) {
String retour = null;
if (field.getRawValue().equals("")) {
field.setValue(null);
} else if (projetsCombo.getStore().findModel("nom", field.getRawValue()) == null) {
} else if (projetsCombo.getStore().findModel("cpr_nom", field.getRawValue()) == null) {
String contenuBrut = field.getRawValue();
field.setValue(null);
field.setRawValue(contenuBrut);
122,24 → 147,37
return retour;
}
});
projetsCombo.setTriggerAction(TriggerAction.ALL);
projetsCombo.setStore(new ListStore<Projet>());
projetsCombo.addStyleName(ComposantClass.OBLIGATOIRE);
projetsCombo.addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
liaisonFieldSet.add(projetsCombo, new FormData(450, 0));
mediateur.selectionnerProjet(this, null);
 
liaisonFieldSet.add(projetsCombo, new FormData(600, 0));
structuresCombo = new ComboBox<Structure>();
structuresCombo.setTabIndex(tabIndex++);
structuresCombo.setFieldLabel(i18nC.lienStructureCollection());
structuresCombo.setDisplayField("nom");
structuresCombo.setForceSelection(true);
structuresCombo.setValidator(new Validator() {
/*************************************/
/** Champ Structures **/
/*************************************/
 
ModelType modelTypeStructures = new ModelType();
modelTypeStructures.setRoot("structures");
modelTypeStructures.setTotalName("nbElements");
modelTypeStructures.addField("cs_nom");
modelTypeStructures.addField("cs_id_structure");
String displayNameStructures = "cs_nom";
ProxyStructures<ModelData> proxyStructures = new ProxyStructures<ModelData>();
structuresCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyStructures, modelTypeStructures, displayNameStructures);
structuresCombo.setWidth(250, 600);
structuresCombo.getCombo().setTabIndex(tabIndex++);
structuresCombo.getCombo().setFieldLabel(i18nC.lienStructureCollection());
structuresCombo.getCombo().setForceSelection(true);
structuresCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE);
structuresCombo.getCombo().addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
structuresCombo.getCombo().setValidator(new Validator() {
public String validate(Field<?> field, String value) {
String retour = null;
if (field.getRawValue().equals("")) {
field.setValue(null);
} else if (structuresCombo.getStore().findModel("nom", field.getRawValue()) == null) {
} else if (structuresCombo.getStore().findModel("cs_nom", field.getRawValue()) == null) {
String contenuBrut = field.getRawValue();
field.setValue(null);
field.setRawValue(contenuBrut);
148,22 → 186,37
return retour;
}
});
structuresCombo.setTriggerAction(TriggerAction.ALL);
structuresCombo.setStore(new ListStore<Structure>());
liaisonFieldSet.add(structuresCombo, new FormData(450, 0));
mediateur.selectionnerStructureParProjet(this, null);
 
liaisonFieldSet.add(structuresCombo, new FormData(600, 0));
collectionsCombo = new ComboBox<Collection>();
collectionsCombo.setTabIndex(tabIndex++);
collectionsCombo.setFieldLabel(i18nC.lienMereCollection());
collectionsCombo.setDisplayField("nom");
collectionsCombo.setForceSelection(true);
collectionsCombo.setValidator(new Validator() {
/*************************************/
/** Champ Collections **/
/*************************************/
ModelType modelTypeCollections = new ModelType();
modelTypeCollections.setRoot("collections");
modelTypeCollections.setTotalName("nbElements");
modelTypeCollections.addField("cc_nom");
modelTypeCollections.addField("cc_id_collection");
String displayNameCollections = "cc_nom";
ProxyCollections<ModelData> proxyCollections = new ProxyCollections<ModelData>();
collectionsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyCollections, modelTypeCollections, displayNameCollections);
collectionsCombo.setWidth(250, 600);
collectionsCombo.getCombo().setTabIndex(tabIndex++);
collectionsCombo.getCombo().setFieldLabel(i18nC.lienMereCollection());
collectionsCombo.getCombo().setForceSelection(true);
collectionsCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE);
collectionsCombo.getCombo().addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
collectionsCombo.getCombo().setValidator(new Validator() {
public String validate(Field<?> field, String value) {
String retour = null;
if (field.getRawValue().equals("")) {
field.setValue(null);
} else if (collectionsCombo.getStore().findModel("nom", field.getRawValue()) == null) {
} else if (collectionsCombo.getStore().findModel("cc_nom", field.getRawValue()) == null) {
String contenuBrut = field.getRawValue();
field.setValue(null);
field.setRawValue(contenuBrut);
172,10 → 225,8
return retour;
}
});
collectionsCombo.setTriggerAction(TriggerAction.ALL);
collectionsCombo.setStore(new ListStore<Collection>());
liaisonFieldSet.add(collectionsCombo, new FormData(450, 0));
mediateur.selectionnerCollectionParProjet(this, null);
 
liaisonFieldSet.add(collectionsCombo, new FormData(600, 0));
this.add(liaisonFieldSet);
}
318,7 → 369,7
public ArrayList<String> verifier() {
ArrayList<String> messages = new ArrayList<String>();
if (projetsCombo.getValue() == null || !projetsCombo.isValid()) {
if (projetsCombo.getCombo().getValue() == null || !projetsCombo.getCombo().isValid()) {
messages.add(i18nM.selectionObligatoire(i18nC.articleUn()+" "+i18nC.projetSingulier(), i18nC.articleLa()+" "+i18nC.collectionSingulier()));
}
return messages;
359,57 → 410,48
private String getValeurComboProjets() {
String valeur = "";
if (projetsCombo.getValue() != null) {
valeur = projetsCombo.getValue().getId();
if (projetsCombo.getCombo().getValue() != null) {
Projet projet = new Projet(projetsCombo.getValeur());
valeur = projet.getId();
}
return valeur;
}
private void setValeurComboProjets() {
if (projetsCombo.getStore() != null && collection != null) {
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", collection.getIdProjet()));
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", collection.getIdProjet()));
}
}
private String getValeurComboStructures() {
String valeur = "";
if (structuresCombo.getValue() != null) {
valeur = structuresCombo.getValue().getId();
if (structuresCombo.getCombo().getValue() != null) {
Structure structure = new Structure(structuresCombo.getValeur());
valeur = structure.getId();
}
return valeur;
}
private void setValeurComboStructures() {
if (structuresCombo.getStore() != null && collection != null) {
structuresCombo.setValue(structuresCombo.getStore().findModel("id_structure", collection.getIdStructure()));
structuresCombo.getCombo().setValue(structuresCombo.getStore().findModel("cs_id_structure", collection.getIdStructure()));
}
}
private String getValeurComboCollections() {
String valeur = "";
if (collectionsCombo.getValue() != null) {
valeur = collectionsCombo.getValue().getId();
if (collectionsCombo.getCombo().getValue() != null) {
Collection collection = new Collection(collectionsCombo.getValeur());
valeur = collection.getId();
}
return valeur;
}
private void setValeurComboCollections() {
if (collectionsCombo.getStore() != null && collection != null) {
collectionsCombo.setValue(collectionsCombo.getStore().findModel("id_collection", collection.getCollectionMereId()));
if (collectionsCombo.getCombo().getStore() != null && collection != null) {
collectionsCombo.getCombo().setValue(collectionsCombo.getStore().findModel("id_collection", collection.getCollectionMereId()));
}
}
public void rafraichir(Object nouvellesDonnees) {
if (nouvellesDonnees instanceof ProjetListe) {
ProjetListe projets = (ProjetListe) nouvellesDonnees;
Formulaire.rafraichirComboBox(projets, projetsCombo);
setValeurComboProjets();
} else if (nouvellesDonnees instanceof StructureListe) {
StructureListe structures = (StructureListe) nouvellesDonnees;
Formulaire.rafraichirComboBox(structures, structuresCombo);
setValeurComboStructures();
} else if (nouvellesDonnees instanceof CollectionListe) {
CollectionListe collections = (CollectionListe) nouvellesDonnees;
Formulaire.rafraichirComboBox(collections, collectionsCombo);
setValeurComboCollections();
} else if (nouvellesDonnees instanceof ValeurListe) {
if (nouvellesDonnees instanceof ValeurListe) {
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
rafraichirValeurListe(listeValeurs);
} else {
/branches/v1.0-syrah/src/org/tela_botanica/client/vues/structure/StructureForm.java
8,7 → 8,10
import org.tela_botanica.client.ComposantClass;
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.RegistreId;
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
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.images.Images;
import org.tela_botanica.client.interfaces.Rafraichissable;
import org.tela_botanica.client.modeles.Information;
35,6 → 38,8
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.Events;
import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.event.BaseEvent;
72,6 → 77,7
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
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.form.Validator;
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
import com.extjs.gxt.ui.client.widget.grid.CellEditor;
131,7 → 137,7
private ListStore<Valeur> magazinRegion = null;
private ComboBox<Valeur> comboRegion = null;
private ListStore<Valeur> magazinPays = null;
private ComboBox<Valeur> comboPays = null;
private ChampComboBoxRechercheTempsReelPaginable comboPays = null;
private TextField<String> latitudeChp = null;
private TextField<String> longitudeChp = null;
private TextField<String> telChp = null;
218,7 → 224,7
private ComboBox<Personne> personneExistanteCombo = null;
private Button supprimerPersonnelBtn = null;
private ListStore<Projet> projetsMagazin = null;
private ComboBox<Projet> projetsCombo = null;
private ChampComboBoxRechercheTempsReelPaginable projetsCombo = null;
private CellEditor fonctionEditor = null;
private List<Valeur> fonctionsListe = null;
 
323,8 → 329,8
}
// Vérification des infos sur le projet de la structure
if ( (identificationOnglet.getData("acces").equals(true) && projetsCombo.getValue() == null) ||
(identificationOnglet.getData("acces").equals(true) && projetsCombo.getValue().equals("")) ||
if ( (identificationOnglet.getData("acces").equals(true) && projetsCombo.getCombo().getValue() == null) ||
(identificationOnglet.getData("acces").equals(true) && projetsCombo.getCombo().getValue().equals("")) ||
(identificationOnglet.getData("acces").equals(false) && identification.getIdProjet().equals(""))) {
messages.add("Veuillez sélectionner un projet pour l'institution.");
}
648,8 → 654,8
structureCollectee.setId(idStructureChp.getValue());
structureCollectee.setNom(nomStructureChp.getValue());
// Récupération de l'identifiant du projet
if (projetsCombo.getValue() != null) {
structureCollectee.setIdProjet(projetsCombo.getValue().getId());
if (projetsCombo.getCombo().getValue() != null) {
structureCollectee.setIdProjet(new Projet(projetsCombo.getValeur()).getId());
}
// Récupération de l'acronyme (= identifiant alternatif)
structureCollectee.setIdAlternatif(null);
702,10 → 708,10
structureCollectee.setRegion(strRegion);
structureCollectee.setPays(null);
if (comboPays.getValue() != null) {
structureCollectee.setPays(comboPays.getValue().getId());
} else if (comboPays.getRawValue() != "") {
structureCollectee.setPays(comboPays.getRawValue());
if (comboPays.getCombo().getValue() != null) {
structureCollectee.setPays(new Valeur(comboPays.getValeur()).getId());
} else if (comboPays.getCombo().getRawValue() != "") {
structureCollectee.setPays(comboPays.getCombo().getRawValue());
}
structureCollectee.setLatitude(latitudeChp.getValue());
structureCollectee.setLongitude(longitudeChp.getValue());
737,7 → 743,7
// Indication du projet sélectionné par défaut
String projetCourantId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getProjetId();
if (projetCourantId != null && !projetCourantId.equals("0")) {
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", projetCourantId));
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", projetCourantId));
}
}
if (mode.equals(MODE_MODIFIER) && identification != null && identificationOnglet.getData("acces").equals(false)) {
744,7 → 750,7
idStructureChp.setValue(identification.getId());
nomStructureChp.setValue(identification.getNom());
if (!identification.getIdProjet().equals("0")) {
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", identification.getIdProjet()));
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", identification.getIdProjet()));
}
if (!identification.getIdAlternatif().isEmpty()) {
795,9 → 801,9
mettreAJourRegion();
//(identification.getRegion());
if (identification.getPays().matches("^[0-9]+$")) {
comboPays.setValue(comboPays.getStore().findModel("id_valeur", identification.getPays()));
comboPays.getCombo().setValue(comboPays.getStore().findModel("cmlv_id_valeur", identification.getPays()));
} else {
comboPays.setRawValue(identification.getPays());
comboPays.getCombo().setRawValue(identification.getPays());
}
latitudeChp.setValue(identification.getLatitude());
longitudeChp.setValue(identification.getLongitude());
1075,8 → 1081,8
}
// 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("") && projetsCombo.getValue() != null) {
personne.setIdProjetPersonne(projetsCombo.getValue().getId());
if (personne.getIdPersonne().equals("") && projetsCombo.getCombo().getValue() != null) {
personne.setIdProjetPersonne(new Projet(projetsCombo.getValeur()).getId());
}
// Gestion de la fonction
1562,19 → 1568,22
nomStructureChp.addListener(Events.Valid, 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");
projetsMagazin = new ListStore<Projet>();
mediateur.selectionnerProjet(this, null);
projetsCombo = new ComboBox<Projet>();
projetsCombo.setTabIndex(tabIndex++);
projetsCombo.setFieldLabel("Projet");
projetsCombo.setLabelSeparator("");
projetsCombo.setDisplayField("nom");
projetsCombo.setEditable(false);
projetsCombo.setTriggerAction(TriggerAction.ALL);
projetsCombo.setStore(projetsMagazin);
projetsCombo.addStyleName(ComposantClass.OBLIGATOIRE);
projetsCombo.addListener(Events.Valid, creerEcouteurChampObligatoire());
String displayNameProjets = "cpr_nom";
ProxyProjets<ModelData> proxyProjets = new ProxyProjets<ModelData>();
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, 450);
fieldSetIdentite.add(projetsCombo, new FormData(450, 0));
// Création du sous-formulaire : Acronyme
1749,13 → 1758,14
// Fieldset ADRESSE
LayoutContainer principalFdAdresse = new LayoutContainer();
principalFdAdresse.setLayout(new ColumnLayout());
principalFdAdresse.setSize(600, -1);
principalFdAdresse.setSize(700, -1);
LayoutContainer gaucheFdAdresse = new LayoutContainer();
gaucheFdAdresse.setLayout(creerFormLayout(null, LabelAlign.LEFT));
LayoutContainer droiteFdAdresse = new LayoutContainer();
droiteFdAdresse.setLayout(creerFormLayout(null, LabelAlign.LEFT));
droiteFdAdresse.setLayout(creerFormLayout(100, LabelAlign.LEFT));
droiteFdAdresse.setWidth(300);
FieldSet fieldSetAdresse = new FieldSet();
fieldSetAdresse.setHeading("Adresse");
1783,31 → 1793,35
villeChp.setFieldLabel("Ville");
gaucheFdAdresse.add(villeChp, new FormData("95%"));
magazinPays = new ListStore<Valeur>();
comboPays = new ComboBox<Valeur>();
comboPays.setTabIndex(tabIndex++);
comboPays.setFieldLabel("Pays");
comboPays.setEmptyText("Sélectionner un pays...");
comboPays.setEditable(true);
comboPays.setLabelSeparator("");
comboPays.setDisplayField("nom");
comboPays.setTemplate(getTemplatePays());
comboPays.setTypeAhead(true);
comboPays.setTriggerAction(TriggerAction.ALL);
comboPays.setStore(magazinPays);
ModelType modelTypesPays = new ModelType();
modelTypesPays.setRoot("valeurs");
modelTypesPays.setTotalName("nbElements");
modelTypesPays.addField("cmlv_nom");
modelTypesPays.addField("cmlv_id_valeur");
modelTypesPays.addField("cmlv_abreviation");
modelTypesPays.addField("cmlv_description");
SelectionChangedListener<Valeur> selectionChange = new SelectionChangedListener<Valeur>() {
String displayNamePays = "cmlv_nom";
String nomListeTypes = "pays";
ProxyValeur<ModelData> proxyPays = new ProxyValeur<ModelData>(nomListeTypes);
comboPays = new ChampComboBoxRechercheTempsReelPaginable(proxyPays, modelTypesPays, displayNamePays);
comboPays.setWidth(100,300);
comboPays.getCombo().setTabIndex(tabIndex++);
comboPays.getCombo().setFieldLabel("Pays");
comboPays.getCombo().setForceSelection(true);
comboPays.getCombo().setTemplate(getTemplatePays());
SelectionChangedListener<ModelData> selectionChange = new SelectionChangedListener<ModelData>() {
public void selectionChanged(SelectionChangedEvent se) {
// Rafraichir avec le pays sélectionné
obtenirListeRegionParPays(((Valeur) se.getSelectedItem()).getAbreviation().toString());
comboRegion.clear();
obtenirListeRegionParPays((new Valeur(se.getSelectedItem())).getAbreviation().toString());
}
};
comboPays.getCombo().addSelectionChangedListener(selectionChange);
comboPays.addSelectionChangedListener(selectionChange);
droiteFdAdresse.add(comboPays, new FormData("95%"));
mediateur.obtenirListeValeurEtRafraichir(this, "pays");
magazinRegion = new ListStore<Valeur>();
comboRegion = new ComboBox<Valeur>();
1818,7 → 1832,6
comboRegion.setTypeAhead(true);
comboRegion.setTriggerAction(TriggerAction.ALL);
comboRegion.setStore(magazinRegion);
droiteFdAdresse.add(comboRegion, new FormData("95%"));
latitudeChp = new TextField<String>();
1910,7 → 1923,7
private native String getTemplatePays() /*-{
return [
'<tpl for=".">',
'<div class="x-combo-list-item">{nom} ({abreviation})</div>',
'<div class="x-combo-list-item">{cmlv_nom} ({cmlv_abreviation})</div>',
'</tpl>'
].join("");
}-*/;
2152,11 → 2165,12
fonctionsMagazin.add(liste);
fonctionsCombo.setStore(fonctionsMagazin);
}
/*
if (listeValeurs.getId().equals(config.getListeId("pays"))) {
magazinPays.removeAll();
magazinPays.add(liste);
comboPays.setStore(magazinPays);
}
}*/
if (listeValeurs.getId().equals(config.getListeId("region"))) {
magazinRegion.removeAll();
2239,10 → 2253,12
}
private void rafraichirProjetListe(ProjetListe projets) {
Debug.log("PASSE ICI");
/*
List<Projet> liste = projets.toList();
projetsMagazin.removeAll();
projetsMagazin.add(liste);
projetsCombo.setStore(projetsMagazin);
projetsCombo.setStore(projetsMagazin);*/
}
private void testerLancementRafraichirPersonnel() {
/branches/v1.0-syrah/src/org/tela_botanica/client/vues/projet/ProjetDetailVue.java
136,7 → 136,7
enteteParams.set("guid", getGuid());
enteteParams.set("projet", construireTxtProjet(projet.getId()));
enteteParams.set("abreviation", projet.getAbreviation());
GWT.log("entete généré", null);
 
String eHtml = Format.substitute(enteteTpl, enteteParams);
entete.getElement().setInnerHTML(eHtml);
}
/branches/v1.0-syrah/src/org/tela_botanica/client/vues/projet/ProjetForm.java
5,10 → 5,13
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.util.Debug;
import org.tela_botanica.client.util.Pattern;
17,6 → 20,8
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;
49,7 → 54,7
private TextField<String> motsClesChp = null;
private TextField<String> citationChp = null;
private TextField<String> licenceChp = null;
private ChampComboBoxListeValeurs langueChp = null;
private ChampComboBoxRechercheTempsReelPaginable langueChp = null;
private CheckBox markPublicChp = null;
private FieldSet indexationFieldset = null;
172,9 → 177,27
licenceChp.setFieldLabel(i18nC.projetLicence());
complementFieldset.add(licenceChp, new FormData(450, 0));
langueChp = new ChampComboBoxListeValeurs(i18nC.projetLangue(), listeLanguesId);
complementFieldset.add(langueChp, new FormData(200, 0));
//langueChp = new ChampComboBoxListeValeurs(i18nC.projetLangue(), listeLanguesId);
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);
langueChp = new ChampComboBoxRechercheTempsReelPaginable(proxyLangues, modelTypesLangues, displayNameLangues);
langueChp.setWidth(100,300);
langueChp.getCombo().setTabIndex(tabIndex++);
langueChp.getCombo().setFieldLabel("Pays");
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>() {
391,7 → 414,11
motsClesChp.setValue(projet.getMotsCles());
citationChp.setValue(projet.getCitation());
licenceChp.setValue(projet.getLicence());
langueChp.peupler(projet.getLangue());
if (projet.getLangue().matches("[0-9]+")) {
langueChp.getCombo().setValue(langueChp.getStore().findModel("cmlv_id_valeur", projet.getLangue()));
} else {
langueChp.getCombo().setRawValue(projet.getLangue());
}
if (projet.getMarkPublic().equals("1")) {
markPublicChp.setValue(true);
String[] heureTab = projet.getIndexationHeure().split(":");
422,7 → 449,13
projetCollecte.setMotsCles(motsClesChp.getValue());
projetCollecte.setCitation(citationChp.getValue());
projetCollecte.setLicence(licenceChp.getValue());
projetCollecte.setLangue(langueChp.getValeur());
if (langueChp.getValeur() != null) {
Debug.log("langueChp.getValeur()="+langueChp.getValeur());
Valeur valeur = new Valeur(langueChp.getValeur());
projetCollecte.setLangue(valeur.getId());
} else {
projetCollecte.setLangue("");
}
String markPublic = (markPublicChp.getValue()) ? "1" : "0";
projetCollecte.setMarkPublic(markPublic);
/branches/v1.0-syrah/src/org/tela_botanica/client/vues/commentaire/CommentaireForm.java
4,8 → 4,10
 
import org.tela_botanica.client.ComposantClass;
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
import org.tela_botanica.client.composants.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;
17,6 → 19,8
import org.tela_botanica.client.util.UtilString;
import org.tela_botanica.client.vues.Formulaire;
 
import com.extjs.gxt.ui.client.data.ModelData;
import com.extjs.gxt.ui.client.data.ModelType;
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.widget.Info;
36,7 → 40,7
private Commentaire commentaire;
 
private ComboBox<Projet> projetsCombo = null;
private ChampComboBoxRechercheTempsReelPaginable projetsCombo = null;
private TextField<String> titreChp;
private TextArea texteChp;
private ChampSliderPourcentage ponderationChp;
84,21 → 88,30
}
private void creerChamps() {
projetsCombo = new ComboBox<Projet>();
projetsCombo.setTabIndex(tabIndex++);
projetsCombo.setFieldLabel(i18nC.projetChamp());
projetsCombo.setDisplayField("nom");
projetsCombo.setTriggerAction(TriggerAction.ALL);
projetsCombo.setStore(new ListStore<Projet>());
projetsCombo.setEmptyText(i18nC.txtListeProjetDefaut());
projetsCombo.setEditable(false);
projetsCombo.setForceSelection(true);
projetsCombo.setAllowBlank(false);
projetsCombo.setValidator(new Validator() {
ModelType modelTypeProjets = new ModelType();
modelTypeProjets.setRoot("projets");
modelTypeProjets.setTotalName("nbElements");
modelTypeProjets.addField("cpr_nom");
modelTypeProjets.addField("cpr_id_projet");
String displayNameProjets = "cpr_nom";
ProxyProjets<ModelData> proxyProjets = new ProxyProjets<ModelData>();
projetsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyProjets, modelTypeProjets, displayNameProjets);
projetsCombo.setWidth(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().addStyleName(ComposantClass.OBLIGATOIRE);
projetsCombo.getCombo().setValidator(new Validator() {
public String validate(Field<?> champ, String valeurAValider) {
String retour = null;
if (UtilString.isEmpty(valeurAValider)
|| projetsCombo.getStore().findModel("nom", valeurAValider) == null) {
|| projetsCombo.getStore().findModel("cpr_nom", valeurAValider) == null) {
champ.setValue(null);
retour = i18nC.selectionnerValeur();
}
105,10 → 118,9
return retour;
}
});
projetsCombo.addStyleName(ComposantClass.OBLIGATOIRE);
projetsCombo.addListener(Events.Valid, creerEcouteurChampObligatoire());
projetsCombo.getCombo().addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
panneauFormulaire.add(projetsCombo, new FormData(450, 0));
mediateur.selectionnerProjet(this, null);
titreChp = new TextField<String>();
titreChp.setFieldLabel(i18nC.commentaireTitre());
134,10 → 146,6
if (nouvellesDonnees instanceof Commentaire) {
// Si on a reçu les details d'une publication
rafraichirCommentaire((Commentaire) nouvellesDonnees);
} else if (nouvellesDonnees instanceof ProjetListe) {
ProjetListe projets = (ProjetListe) nouvellesDonnees;
Formulaire.rafraichirComboBox(projets, projetsCombo);
setValeurComboProjets();
} else if (nouvellesDonnees instanceof Information) {
rafraichirInformation((Information) nouvellesDonnees);
} else {
159,8 → 167,9
private String getValeurComboProjets() {
String valeur = "";
if (projetsCombo.getValue() != null && projetsCombo.isValid()) {
valeur = projetsCombo.getValue().getId();
if (projetsCombo.getCombo().getValue() != null && projetsCombo.getCombo().isValid()) {
Projet projet = new Projet (projetsCombo.getValeur());
valeur = projet.getId();
}
return valeur;
}
167,9 → 176,9
private void setValeurComboProjets() {
if (projetsCombo.getStore() != null ) {
if (mode.equals(Formulaire.MODE_MODIFIER) && commentaire != null) {
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", commentaire.getIdProjet()));
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", commentaire.getIdProjet()));
} else if (mode.equals(Formulaire.MODE_AJOUTER)) {
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", mediateur.getProjetId()));
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", mediateur.getProjetId()));
}
}
}
/branches/v1.0-syrah/src/org/tela_botanica/client/vues/publication/PublicationDetailVue.java
96,7 → 96,7
enteteParams.set("id", publication.getId());
enteteParams.set("guid", getGuid());
enteteParams.set("projet", construireTxtProjet(publication.getIdProjet()));
GWT.log("entete généré", null);
 
String eHtml = Format.substitute(enteteTpl, enteteParams);
entete.getElement().setInnerHTML(eHtml);
}
142,7 → 142,6
} else if (nouvellesDonnees instanceof ProjetListe) {
projets = (ProjetListe) nouvellesDonnees;
projetsChargementOk = true;
GWT.log("projets recu", null);
} else {
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
}
/branches/v1.0-syrah/src/org/tela_botanica/client/vues/publication/PublicationForm.java
6,7 → 6,10
 
import org.tela_botanica.client.ComposantClass;
import org.tela_botanica.client.Mediateur;
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable;
import org.tela_botanica.client.composants.InfoLogger;
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;
import org.tela_botanica.client.modeles.Information;
34,6 → 37,8
import com.extjs.gxt.ui.client.Style.Scroll;
import com.extjs.gxt.ui.client.Style.SortDir;
import com.extjs.gxt.ui.client.core.XTemplate;
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.ButtonEvent;
import com.extjs.gxt.ui.client.event.ComponentEvent;
90,7 → 95,7
private PersonneListe auteursSupprimes = null;
private ContentPanel auteursFieldset = null;
private ComboBox<Projet> projetsCombo = null;
private ChampComboBoxRechercheTempsReelPaginable projetsCombo = null;
private ArrayList<ComboBox<Personne>> auteurComboboxListe = null;
private ListStore<Personne> auteursStorePartage = null;
private static boolean auteurStorePartageChargementOk = false;
101,7 → 106,7
private TextField<String> uriChp = null;
private FieldSet editionFieldset = null;
private ComboBox<Structure> editeurCombobox = null;
private ChampComboBoxRechercheTempsReelPaginable editeurCombobox = null;
private static boolean editeursOk = false;
private TextField<String> datePublicationChp = null;
private TextField<String> tomeChp = null;
578,18 → 583,31
generalitesFieldset.setHeading("Informations générales");
generalitesFieldset.setCollapsible(true);
generalitesFieldset.setLayout(layout);
 
projetsCombo = new ComboBox<Projet>();
projetsCombo.setTabIndex(tabIndex++);
projetsCombo.setFieldLabel(i18nC.projetChamp());
projetsCombo.setDisplayField("nom");
projetsCombo.setForceSelection(true);
projetsCombo.setValidator(new Validator() {
ModelType modelTypeProjets = new ModelType();
modelTypeProjets.setRoot("projets");
modelTypeProjets.setTotalName("nbElements");
modelTypeProjets.addField("cpr_nom");
modelTypeProjets.addField("cpr_id_projet");
String displayNameProjets = "cpr_nom";
ProxyProjets<ModelData> proxyProjets = new ProxyProjets<ModelData>();
projetsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyProjets, modelTypeProjets, displayNameProjets);
projetsCombo.setWidth(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("nom", field.getRawValue()) == null) {
} else if (projetsCombo.getStore().findModel("cpr_nom", field.getRawValue()) == null) {
String contenuBrut = field.getRawValue();
field.setValue(null);
field.setRawValue(contenuBrut);
597,13 → 615,8
}
return retour;
}
});
projetsCombo.setTriggerAction(TriggerAction.ALL);
projetsCombo.setStore(new ListStore<Projet>());
projetsCombo.addStyleName(ComposantClass.OBLIGATOIRE);
projetsCombo.addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
generalitesFieldset.add(projetsCombo, new FormData(450, 0));
mediateur.selectionnerProjet(this, null);
});
generalitesFieldset.add(projetsCombo, new FormData(600, 0));
titreChp = new TextField<String>();
titreChp.setName("cpu");
630,18 → 643,30
editionFieldset.setHeading("Édition");
editionFieldset.setCollapsible(true);
editionFieldset.setLayout(layout);
 
/*****************************************************/
/** Champ 'Editeur de la publication' **/
/*****************************************************/
ModelType modelTypeStructures = new ModelType();
modelTypeStructures.setRoot("structures");
modelTypeStructures.setTotalName("nbElements");
modelTypeStructures.addField("cs_nom");
modelTypeStructures.addField("cs_id_structure");
ListStore<Structure> editeurStore = new ListStore<Structure>();
editeurCombobox = new ComboBox<Structure>();
editeurCombobox.setEmptyText("Sélectionner un éditeur...");
editeurCombobox.setFieldLabel("Éditeur de la publication");
editeurCombobox.setDisplayField("nom");
editeurCombobox.setStore(editeurStore);
editeurCombobox.setEditable(true);
editeurCombobox.setTriggerAction(TriggerAction.ALL);
editionFieldset.add(editeurCombobox, new FormData(450, 0));
mediateur.clicObtenirListeEditeurs(this);
String displayNameStructures = "cs_nom";
ProxyStructures<ModelData> proxyStructures = new ProxyStructures<ModelData>();
editeurCombobox = new ChampComboBoxRechercheTempsReelPaginable(proxyStructures, modelTypeStructures, displayNameStructures);
editeurCombobox.setWidth(200, 600);
editeurCombobox.getCombo().setTabIndex(tabIndex++);
editeurCombobox.getCombo().setEmptyText("Sélectionner un éditeur...");
editeurCombobox.getCombo().setFieldLabel("Éditeur de la publication");
editeurCombobox.getCombo().setEditable(true);
editionFieldset.add(editeurCombobox, new FormData(600, 0));
/*********************************************/
/** Champ 'Date de publication' **/
/*********************************************/
datePublicationChp = new TextField<String>();
datePublicationChp.setMaxLength(4);
datePublicationChp.setMinLength(4);
650,14 → 675,23
datePublicationChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
editionFieldset.add(datePublicationChp, new FormData(40, 0));
/*****************************/
/** Champ '' **/
/*****************************/
tomeChp = new TextField<String>();
tomeChp.setFieldLabel("Série de la revue ou tome");
editionFieldset.add(tomeChp, new FormData(75, 0));
 
/*****************************/
/** Champ '' **/
/*****************************/
fasciculeChp = new TextField<String>();
fasciculeChp.setFieldLabel("Fascicule de la revue");
editionFieldset.add(fasciculeChp, new FormData(75, 0));
 
/*****************************/
/** Champ '' **/
/*****************************/
pagesChp = new TextField<String>();
pagesChp.setFieldLabel("Pages");
pagesChp.setToolTip("Fomat : NBRE ou NBRE-NBRE. ('NBRE' correspond à une suite de chiffres arabes ou romains ou à un point d'interrogation '?' dans le cas d'une donnée inconnue)");
668,17 → 702,10
if (nouvellesDonnees instanceof Publication) {
// Si on a reçu les details d'une publication
rafraichirPublication((Publication) nouvellesDonnees);
} else if (nouvellesDonnees instanceof StructureListe) {
// Si on a reçu une liste des editeurs
rafraichirListeEditeurs((StructureListe) nouvellesDonnees);
} else if (nouvellesDonnees instanceof PublicationAPersonneListe) {
rafraichirListeAuteurs((PublicationAPersonneListe) nouvellesDonnees);
} else if (nouvellesDonnees instanceof Information) {
rafraichirInformation((Information) nouvellesDonnees);
} else if (nouvellesDonnees instanceof ProjetListe) {
ProjetListe projets = (ProjetListe) nouvellesDonnees;
Formulaire.rafraichirComboBox(projets, projetsCombo);
setValeurComboProjets();
} else {
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
}
698,7 → 725,7
initialiserAffichageAuteurs();
}
if (etrePretAPeupler()) {
if (etrePretAPeupler()) {
peuplerFormulaire();
genererTitreFormulaire();
initialiserPeupler();
736,12 → 763,6
publication = publi;
}
private void rafraichirListeEditeurs(StructureListe editeurs) {
editeursOk = true;
editeurCombobox.getStore().removeAll();
editeurCombobox.getStore().add((List<Structure>) editeurs.toList());
}
private void rafraichirListeAuteurs(PublicationAPersonneListe auteurs) {
Iterator<String> it = auteurs.keySet().iterator();
while (it.hasNext()) {
1066,9 → 1087,9
pagesChp.setValue(publication.getPages());
if (publication.getEditeur().matches("^[0-9]+$")) {
editeurCombobox.setValue(editeurCombobox.getStore().findModel("id_structure", publication.getEditeur()));
editeurCombobox.getCombo().setValue(editeurCombobox.getStore().findModel("cs_id_structure", publication.getEditeur()));
} else {
editeurCombobox.setRawValue(publication.getEditeur());
editeurCombobox.getCombo().setRawValue(publication.getEditeur());
}
}
1090,11 → 1111,12
publicationCollectee.setUri(uri);
String editeur = "";
if (editeurCombobox.getValue() != null) {
editeur = editeurCombobox.getValue().getId();
publicationCollectee.setStructureEditeur(editeurCombobox.getValue());
} else if (editeurCombobox.getRawValue() != "") {
editeur = editeurCombobox.getRawValue();
if (editeurCombobox.getValeur() != null) {
Structure structure = new Structure(editeurCombobox.getValeur());
editeur = structure.getId();
publicationCollectee.setStructureEditeur(structure);
} else if (!UtilString.isEmpty(editeurCombobox.getCombo().getRawValue())) {
editeur = editeurCombobox.getCombo().getRawValue();
}
publicationCollectee.setEditeur(editeur);
1120,10 → 1142,11
private String construireIntituleEditeur() {
String editeur = "";
if (editeurCombobox.getValue() != null) {
editeur = editeurCombobox.getValue().getNom();
} else if (editeurCombobox.getRawValue() != "") {
editeur = editeurCombobox.getRawValue();
if (editeurCombobox.getValeur() != null) {
Structure structure = new Structure(editeurCombobox.getValeur());
editeur = structure.getNom();
} else if (!UtilString.isEmpty(editeurCombobox.getCombo().getRawValue())) {
editeur = editeurCombobox.getCombo().getRawValue();
}
return editeur;
}
1225,17 → 1248,20
private String getValeurComboProjets() {
String valeur = "";
if (projetsCombo.getValue() != null) {
valeur = projetsCombo.getValue().getId();
if (projetsCombo.getValeur() != null) {
Projet projet = new Projet(projetsCombo.getValeur());
valeur = projet.getId();
}
return valeur;
}
private void setValeurComboProjets() {
Debug.log("HELLO");
if (projetsCombo.getStore() != null ) {
Debug.log(projetsCombo.getStore().getModels().toArray().toString());
if (mode.equals(Formulaire.MODE_MODIFIER) && publication != null) {
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", publication.getIdProjet()));
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", publication.getIdProjet()));
} else if (mode.equals(Formulaire.MODE_AJOUTER)) {
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", mediateur.getProjetId()));
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", mediateur.getProjetId()));
}
}
}
/branches/v1.0-syrah/src/org/tela_botanica/client/Modele.java
117,8 → 117,13
public void selectionnerProjet(Rafraichissable vueARafraichir, String projetId, String nom, int start, int nbElements) {
ProjetAsyncDao pADAO = new ProjetAsyncDao(vueARafraichir);
pADAO.selectionner(projetId, nom, start, nbElements);
pADAO.selectionner(false, projetId, nom, start, nbElements);
}
public void selectionnerProjet(Rafraichissable vueARafraichir, String recherche, int start, int nbElements) {
ProjetAsyncDao pADAO = new ProjetAsyncDao(vueARafraichir);
pADAO.selectionner(true, null, recherche, start, nbElements);
}
 
public void ajouterProjet(Rafraichissable vueARafraichir, Projet projetCollecte) {
ProjetAsyncDao pADAO = new ProjetAsyncDao(vueARafraichir);
137,9 → 142,15
public void selectionnerStructure(Rafraichissable vueARafraichir, String projetId, String structureId, String nomStructure, int start, int nbElements) {
// Gestion des données des tables coel_structure, coel_structure_conservation et coel_structure_valorisation
StructureAsyncDao sDao = new StructureAsyncDao(vueARafraichir);
sDao.selectionner(projetId, structureId, nomStructure, start, nbElements);
sDao.selectionner(false, projetId, structureId, nomStructure, start, nbElements);
}
public void selectionnerStructure(Rafraichissable vueARafraichir, String recherche, int start, int nbElements) {
// Gestion des données des tables coel_structure, coel_structure_conservation et coel_structure_valorisation
StructureAsyncDao sDao = new StructureAsyncDao(vueARafraichir);
sDao.selectionner(true, null, null, recherche, start, nbElements);
}
/** Lance la creation d'une Structure
* @param vueARafraichir la vue demandant a être rafraichie
* @param structure les données de la structure
191,9 → 202,14
public void selectionnerCollection(Rafraichissable vueARafraichir, String projetId, String collectionId, String nom, int start, int nbElements) {
CollectionAsyncDao cDao = new CollectionAsyncDao(vueARafraichir);
cDao.selectionner(projetId, collectionId, nom, start, nbElements);
cDao.selectionner(false, projetId, collectionId, nom, start, nbElements);
}
public void selectionnerCollection(Rafraichissable vueARafraichir, String recherche, int start, int nbElements) {
CollectionAsyncDao cDao = new CollectionAsyncDao(vueARafraichir);
cDao.selectionner(true, null, null, recherche, start, nbElements);
}
public void ajouterCollection(Rafraichissable vueARafraichir, Collection collection) {
CollectionAsyncDao cDao = new CollectionAsyncDao(vueARafraichir);
cDao.ajouter(collection);
284,8 → 300,13
public void selectionnerPersonne(Rafraichissable vueARafraichir, String personneId, String projetId, String nomComplet, int start, int nbElements) {
PersonneAsyncDao pDao = new PersonneAsyncDao(vueARafraichir);
pDao.selectionner(personneId, projetId, nomComplet, start, nbElements);
pDao.selectionner(false, personneId, projetId, nomComplet, start, nbElements);
}
public void selectionnerPersonne(Rafraichissable vueARafraichir, String recherche, int start, int nbElements) {
PersonneAsyncDao pDao = new PersonneAsyncDao(vueARafraichir);
pDao.selectionner(true, null, null, recherche, start, nbElements);
}
 
public void supprimerPersonne(Rafraichissable vueARafraichir, String idPersonneSepareParVirgule) {
PersonneAsyncDao personneDao = new PersonneAsyncDao(vueARafraichir);
/branches/v1.0-syrah/src/org/tela_botanica/client/composants/ChampMultiValeursMultiTypesPaginable.java
149,7 → 149,7
if (champValeurEstComboBox && champValeurComboBox!=null && champValeurComboBox.getValeur()!=null) {
// FIXME
// je comprends pas la raison d'être de cette ligne
ajouterValeurAuRecapitulatif(champValeurComboBox.getValeur().getId(), id);
ajouterValeurAuRecapitulatif(((Valeur)(champValeurComboBox.getValeur())).getId(), id);
} else {
ajouterValeurAuRecapitulatif(texte, id);
}
233,7 → 233,7
String valeurChamp = "";
if (champValeurEstComboBox) {
if (champValeurComboBox.getValeur() != null) {
valeurChamp = champValeurComboBox.getValeur().getNom();
valeurChamp = ((Valeur)(champValeurComboBox.getValeur())).getNom();
}
} else {
valeurChamp = champValeurTxt.getValue();
249,7 → 249,7
} else {
String type = "";
String id = "";
Valeur valeur = champTypesComboBox.getValeur();
Valeur valeur = new Valeur(champValeurComboBox.getValeur());
 
if (valeur != null) {
type = valeur.getNom();
/branches/v1.0-syrah/src/org/tela_botanica/client/composants/ChampMultiValeursPaginable.java
308,7 → 308,7
champValeurTxt.setEmptyText("Valeur...");
colonneConteneur.add(champValeurTxt, colonneChampValeur);
}
 
/* Creation du bouton Ajouter */
ajouterBouton = new Button();
ajouterBouton.setWidth(largeurBouton);
319,7 → 319,7
String valeurChamp = "";
if (champValeurEstComboBox) {
if (champValeurComboBox.getValeur() != null) {
valeurChamp = champValeurComboBox.getValeur().getNom();
valeurChamp = (new Valeur(champValeurComboBox.getValeur())).getNom();
}
} else {
valeurChamp = champValeurTxt.getValue();
327,7 → 327,7
// validation de la valeur avant ajout
if ((valeurChamp == null) || valeurChamp.trim().equals("") || valeurChamp.trim().equals(valeurParDefaut)) {
MessageBox.alert(titreErreur, valeurVideMsg, null);
} else if (valeurs.get(valeurChamp) != null){
} else if (valeurs.get(valeurChamp) != null) {
MessageBox.alert(titreErreur, valeurIdentiqueMsg, null);
} else {
if (validationMasque != null && !valeurChamp.matches(validationMasque)) {
340,7 → 340,7
});
colonneBoutonAjouter = new ColumnData(largeurBouton);
colonneConteneur.add(ajouterBouton, colonneBoutonAjouter);
 
principalLayout.add(champRecapitulatif);
principalLayout.add(colonneConteneur);
add(principalLayout);
/branches/v1.0-syrah/src/org/tela_botanica/client/composants/pagination/ProxyCollections.java
New file
0,0 → 1,73
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.ValeurListe;
import org.tela_botanica.client.modeles.ValeurListeAsyncDao;
import org.tela_botanica.client.util.Debug;
 
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.JSONObject;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.user.client.rpc.AsyncCallback;
 
public class ProxyCollections<D> extends Proxy {
public ProxyCollections() {
super();
}
@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;
mediateur.selectionnerCollection(this, recherche, lc.getOffset(), lc.getLimit());
}
 
 
@Override
@SuppressWarnings("unchecked")
public void rafraichir(Object nouvellesDonnees) {
Debug.log("RAFRAICHIR ProxyCollections");
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);
}
}
 
}
/branches/v1.0-syrah/src/org/tela_botanica/client/composants/pagination/ProxyStructures.java
New file
0,0 → 1,73
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.ValeurListe;
import org.tela_botanica.client.modeles.ValeurListeAsyncDao;
import org.tela_botanica.client.util.Debug;
 
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.JSONObject;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.user.client.rpc.AsyncCallback;
 
public class ProxyStructures<D> extends Proxy {
public ProxyStructures() {
super();
}
@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;
mediateur.selectionnerStructure(this, recherche, lc.getOffset(), lc.getLimit());
}
 
 
@Override
@SuppressWarnings("unchecked")
public void rafraichir(Object nouvellesDonnees) {
Debug.log("RAFRAICHIR ProxyStructures");
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);
}
}
 
}
/branches/v1.0-syrah/src/org/tela_botanica/client/composants/pagination/ProxyProjets.java
New file
0,0 → 1,73
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.ValeurListe;
import org.tela_botanica.client.modeles.ValeurListeAsyncDao;
import org.tela_botanica.client.util.Debug;
 
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.JSONObject;
import com.google.gwt.json.client.JSONString;
import com.google.gwt.user.client.rpc.AsyncCallback;
 
public class ProxyProjets<D> extends Proxy {
public ProxyProjets() {
super();
}
@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;
mediateur.selectionnerProjet(this, recherche, lc.getOffset(), lc.getLimit());
}
 
 
@Override
@SuppressWarnings("unchecked")
public void rafraichir(Object nouvellesDonnees) {
Debug.log("RAFRAICHIR ProxyProjets");
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);
}
}
 
}
/branches/v1.0-syrah/src/org/tela_botanica/client/composants/ChampComboBoxRechercheTempsReelPaginable.java
1,6 → 1,7
package org.tela_botanica.client.composants;
 
import java.util.List;
import java.util.Map;
 
import org.tela_botanica.client.composants.pagination.ChargeurListe;
import org.tela_botanica.client.composants.pagination.Proxy;
12,10 → 13,15
import com.extjs.gxt.ui.client.event.Events;
import com.extjs.gxt.ui.client.event.Listener;
import com.extjs.gxt.ui.client.store.ListStore;
import com.extjs.gxt.ui.client.util.Size;
import com.extjs.gxt.ui.client.util.Util;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.VerticalPanel;
import com.extjs.gxt.ui.client.widget.form.ComboBox;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
 
import com.extjs.gxt.ui.client.data.BaseModelData;
import com.extjs.gxt.ui.client.data.BasePagingLoadConfig;
import com.extjs.gxt.ui.client.data.LoadEvent;
import com.extjs.gxt.ui.client.data.Loader;
32,8 → 38,6
private ListStore<ModelData> store = null;
private ComboBox<ModelData> combo = null;
 
private String recherche = "";
 
private Proxy<?> proxy = null;
private TransformateurJSONaModelData<PagingLoadResult<ModelData>> reader = null;
private ChargeurListe<PagingLoadResult<ModelData>> loader = null;
42,10 → 46,11
private int limit = 10;
private int largeur = 200;
 
private LayoutContainer lc = null;
private BasePagingLoadConfig plc = null;
private ModelType modeltype = null;
private String displayName = "";
 
private String recherche = "";
//-------------//
// METHODES //
108,10 → 113,10
});
VerticalPanel vp = new VerticalPanel();
vp.add(combo);
lc = new LayoutContainer();
lc.add(combo);
add(vp);
add(lc);
}
 
123,9 → 128,10
return this.combo;
}
public Valeur getValeur()
public ModelData getValeur()
{
return new Valeur(combo.getSelection().get(0));
if (!Util.isEmptyString(combo.getRawValue())) return combo.getSelection().get(0);
else return null;
}
public ListStore<?> getStore()
139,6 → 145,17
this.combo.setWidth(largeur);
}
public void setWidth(int tailleLabel, int largeurTotale)
{
this.largeur = largeurTotale;
// FIXME - problème avec la largeur de la combobox
this.combo.setWidth(largeurTotale - tailleLabel);
FormLayout fl = new FormLayout();
fl.setLabelWidth(tailleLabel);
this.lc.setSize(largeurTotale, 0);
this.lc.setLayout(fl);
}
/*-----------------------------
Gestion du contenu du champ
159,7 → 176,6
Méthode privées
-----------------*/
 
 
}
 
 
/branches/v1.0-syrah/src/org/tela_botanica/client/composants/HashMapComposants.java
65,4 → 65,8
public ComboBox getComboBox(String nom) {
return (ComboBox) get(nom);
}
public ChampComboBoxRechercheTempsReelPaginable getComboBoxRechercheTempsReelPaginable(String nom) {
return (ChampComboBoxRechercheTempsReelPaginable) get(nom);
}
}