/trunk/src/org/tela_botanica/client/interfaces |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/interfaces:r1292-1328 |
/trunk/src/org/tela_botanica/client/Modele.java |
---|
4,6 → 4,7 |
import java.util.Iterator; |
import java.util.List; |
import org.tela_botanica.client.configuration.Configuration; |
import org.tela_botanica.client.interfaces.Rafraichissable; |
import org.tela_botanica.client.modeles.Utilisateur; |
import org.tela_botanica.client.modeles.UtilisateurAsyncDao; |
124,8 → 125,13 |
public void selectionnerProjet(Rafraichissable vueARafraichir, String projetId, String nom, int start, int nbElements, Integer seqId) { |
ProjetAsyncDao pADAO = new ProjetAsyncDao(vueARafraichir); |
pADAO.selectionner(projetId, nom, start, nbElements, seqId); |
pADAO.selectionner(false, projetId, nom, start, nbElements, seqId); |
} |
public void selectionnerProjet(Rafraichissable vueARafraichir, String recherche, int start, int nbElements, Integer seqId) { |
ProjetAsyncDao pADAO = new ProjetAsyncDao(vueARafraichir); |
pADAO.selectionner(true, null, recherche, start, nbElements, seqId); |
} |
public void ajouterProjet(Rafraichissable vueARafraichir, Projet projetCollecte) { |
ProjetAsyncDao pADAO = new ProjetAsyncDao(vueARafraichir); |
144,9 → 150,15 |
public void selectionnerStructure(Rafraichissable vueARafraichir, String projetId, String structureId, String nomStructure, int start, int nbElements, Integer seqId) { |
// 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, seqId); |
sDao.selectionner(false, projetId, structureId, nomStructure, start, nbElements, seqId); |
} |
public void selectionnerStructure(Rafraichissable vueARafraichir, String recherche, int start, int nbElements, Integer seqId) { |
// 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, seqId); |
} |
/** Lance la creation d'une Structure |
* @param vueARafraichir la vue demandant a être rafraichie |
* @param structure les données de la structure |
198,9 → 210,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); |
294,8 → 311,13 |
public void selectionnerPersonne(Rafraichissable vueARafraichir, String personneId, String projetId, String nomComplet, int start, int nbElements, Integer seqId) { |
PersonneAsyncDao pDao = new PersonneAsyncDao(vueARafraichir); |
pDao.selectionner(personneId, projetId, nomComplet, start, nbElements, seqId); |
pDao.selectionner(false, personneId, projetId, nomComplet, start, nbElements, seqId); |
} |
public void selectionnerPersonne(Rafraichissable vueARafraichir, String recherche, int start, int nbElements, Integer seqId) { |
PersonneAsyncDao pDao = new PersonneAsyncDao(vueARafraichir); |
pDao.selectionner(true, null, null, recherche, start, nbElements, seqId); |
} |
public void supprimerPersonne(Rafraichissable vueARafraichir, String idPersonneSepareParVirgule) { |
PersonneAsyncDao personneDao = new PersonneAsyncDao(vueARafraichir); |
/trunk/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); |
} |
} |
Property changes: |
Added: svn:mergeinfo |
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/composants/HashMapComposants.java:r1136-1328 |
/trunk/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(); |
/trunk/src/org/tela_botanica/client/composants/ChampMultiValeursPaginable.java |
---|
318,7 → 318,7 |
String valeurChamp = ""; |
if (champValeurEstComboBox) { |
if (champValeurComboBox.getValeur() != null) { |
valeurChamp = champValeurComboBox.getValeur().getNom(); |
valeurChamp = (new Valeur(champValeurComboBox.getValeur())).getNom(); |
} |
} else { |
valeurChamp = champValeurTxt.getValue(); |
326,7 → 326,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)) { |
/trunk/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(), null); |
} |
@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); |
} |
} |
} |
/trunk/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(), null); |
} |
@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); |
} |
} |
} |
/trunk/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); |
} |
} |
} |
/trunk/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 |
-----------------*/ |
} |
/trunk/src/org/tela_botanica/client/modeles/collection/CollectionACommentaireAsyncDao.java |
---|
32,7 → 32,7 |
String[] parametres = {collectionId}; |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres); |
Debug.log(rb.getUrl()); |
rb.envoyerRequete(null, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
/trunk/src/org/tela_botanica/client/modeles/collection/CollectionAPersonneAsyncDao.java |
---|
30,7 → 30,7 |
String[] parametres = {collectionId, roleId}; |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres); |
Debug.log(rb.getUrl()); |
rb.envoyerRequete(null, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
81,7 → 81,7 |
final JsonRestRequestBuilder rb = UtilDAO.construireRequetePost(SERVICE_NOM, parametres); |
String postDonneesEncodees = construirePost(personnes.getIdCollection(), personnes); |
Debug.log(rb.getUrl()); |
rb.envoyerRequete(postDonneesEncodees, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
/trunk/src/org/tela_botanica/client/modeles/collection/CollectionAPublicationAsyncDao.java |
---|
30,7 → 30,7 |
String[] parametres = {collectionId}; |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres); |
Debug.log(rb.getUrl()); |
rb.envoyerRequete(null, new JsonRestRequestCallback() { |
@Override |
public void surReponse(JSONValue responseValue) { |
/trunk/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 { |
23,6 → 24,12 |
} |
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); |
} |
/trunk/src/org/tela_botanica/client/modeles/collection/CollectionAsyncDao.java |
---|
31,51 → 31,98 |
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) { |
/trunk/src/org/tela_botanica/client/modeles/structure/StructureAPersonne.java |
---|
307,4 → 307,11 |
public String afficherSpecialite() { |
return getChaineDenormaliseUnique("specialite"); |
} |
} |
public String getDeces() { |
return renvoyerValeurCorrecte("ce_deces"); |
} |
public void setDeces(String etat) { |
set("ce_deces", etat); |
} |
} |
/trunk/src/org/tela_botanica/client/modeles/structure/StructureAPersonneAsyncDao.java |
---|
139,6 → 139,7 |
"&cp_truk_telephone=" + URL.encodeComponent(personnel.getTelephone()) + |
"&cp_truk_courriel=" + URL.encodeComponent(personnel.getCourriel()) + |
"&cp_ce_truk_specialite=" + URL.encodeComponent(personnel.getSpecialite()) + |
"&cp_ce_deces=" + URL.encodeComponent(personnel.getDeces()) + |
""; |
return postDonnees; |
} |
/trunk/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(); |
/trunk/src/org/tela_botanica/client/modeles/structure/StructureAsyncDao.java |
---|
29,75 → 29,125 |
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, final Integer seqId) { |
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, final Integer seqId) { |
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)); |
restrictions.put("orderby", "cs_ville"); |
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); |
/** 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); |
if (seqId != null) { |
Reponse reponseRequete = new Reponse(info, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else |
vueARafraichir.rafraichir(info); |
/** ENVOI DE LA REQUETE **/ |
rb.envoyerRequete(null, new JsonRestRequestCallback() |
{ |
/** RECEPTION DE LA REPONSE **/ |
public void surReponse(JSONValue responseValue) |
{ |
if (seqId != null) { |
Reponse reponseRequete = new Reponse(responseValue, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
/** 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 **/ |
else vueARafraichir.rafraichir(responseValue); |
} |
}); |
} |
/** GESTION DE LA REQUETE dans le cas d'une liste NON paginée progressive **/ |
else { |
/** DEFINITION DU TUPLE DE DEPART **/ |
restrictions.put("start", String.valueOf(start*nbElements)); |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions); |
rb.envoyerRequete(null, new JsonRestRequestCallback() { |
public void surReponse(JSONValue responseValue) { |
if (responseValue != null) { |
} 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); |
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); |
if (seqId != null) { |
Reponse reponseRequete = new Reponse(info, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else 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); |
if (seqId != null) { |
Reponse reponseRequete = new Reponse(info, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else vueARafraichir.rafraichir(info); |
} |
} else { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un objet ou un talbeau JSON et vaut : "+responseValue.toString(), null); |
} |
structures.setTaillePage(nbElements); |
structures.setPageCourante(pageCourante); |
info.setDonnee(0, structures); |
if (seqId != null) { |
Reponse reponseRequete = new Reponse(info, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} 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); |
} |
else |
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); |
} |
} 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) { |
String postDonneesEncodees = construirePost(null, str, conservation, valorisation); |
/trunk/src/org/tela_botanica/client/modeles/ValeurListeAsyncDao.java |
---|
21,12 → 21,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) { |
36,45 → 34,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, final Integer seqId) { |
/** 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, seqId); |
} |
/** 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) { |
if (vueARafraichir instanceof Sequenceur) { |
vueARafraichir = (Sequenceur) vueARafraichir; |
Reponse reponse = new Reponse(ontologieCache.get(id), seqId); |
vueARafraichir.rafraichir(reponse); |
} else { |
vueARafraichir.rafraichir(ontologieCache.get(id)); |
} |
} |
} |
} |
public void obtenirListe(Integer cle, Integer seqId) { |
selectionner("id", cle, null, null, false, null, -1, -1, seqId); |
92,12 → 51,52 |
selectionner(type, cle, abv, idValeur, false, null, -1, -1, seqId); |
} |
/**************************************************************************************************** |
** 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, final Integer seqId) { |
// 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 { |
104,9 → 103,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)+"%"; |
114,10 → 113,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)); |
124,15 → 124,21 |
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) |
{ |
{ |
if (vueARafraichir instanceof Sequenceur) { |
Reponse reponse = new Reponse(responseValue, seqId); |
vueARafraichir.rafraichir(reponse); |
/** 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 **/ |
} else { |
vueARafraichir.rafraichir(responseValue); |
} |
139,44 → 145,44 |
} |
}); |
} |
/** 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) |
{ |
//On est à la derniere page, on peu rafraichir |
if (vueARafraichir instanceof Sequenceur) { |
Reponse reponse = new Reponse(ontologieCache.get(cleParentPourCache), seqId); |
vueARafraichir.rafraichir(reponse); |
} else { |
vueARafraichir.rafraichir(ontologieCache.get(cleParentPourCache)); |
} |
} |
else |
{ |
/** 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)); |
} |
/** 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(); |
194,7 → 200,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 **/ |
222,4 → 228,56 |
} |
} |
} |
/******************************************************************************************************** |
* 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, final Integer seqId) { |
/** 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, seqId); |
} |
/** 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) { |
if (vueARafraichir instanceof Sequenceur) { |
vueARafraichir = (Sequenceur) vueARafraichir; |
Reponse reponse = new Reponse(ontologieCache.get(id), seqId); |
vueARafraichir.rafraichir(reponse); |
} else { |
vueARafraichir.rafraichir(ontologieCache.get(id)); |
} |
} |
} |
} |
} |
/trunk/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; |
/trunk/src/org/tela_botanica/client/modeles/projet/ProjetAsyncDao.java |
---|
29,60 → 29,105 |
vueARafraichir = vueARafraichirCourrante; |
utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId(); |
} |
public void selectionner(final String projetId, final String nom, final int pageCourante, final int nbElements, final Integer seqId) { |
/** |
* @param paginationProgressive : définit le mode de consultation de la base de données |
* - True : la consultation des données est progressive, ce qui signifie que la liste est chargée (paginée) au |
* fur et à mesure de la consultation des données par l'utilisateur. |
* - False : la consultation des données est classique : un seul appel à la base de données est effectué, le retour |
* est renvoyé à l'appelant |
* // FIXME : si la taille de la liste est supérieure à la limite du JREST (150), ce deuxieme mode ne fonctionne pas |
*/ |
public void selectionner(final boolean paginationProgressive, final String projetId, final String nomProjet, final int start, final int nbElements, final Integer seqId) { |
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); |
} |
projets.setTaillePage(nbElements); |
projets.setPageCourante(pageCourante); |
JSONObject responseObject = responseValue.isObject(); |
if (seqId != null) { |
Reponse retourRequete = new Reponse(projets, seqId); |
vueARafraichir.rafraichir(retourRequete); |
if (responseObject != null) { |
// Si la réponse est un tableau, alors c'est une liste de projets qui a été retournée |
if (responseObject.get("projets").isArray() != null) { |
JSONArray reponse = responseObject.get("projets").isArray(); |
ProjetListe projets; |
projets = new ProjetListe(reponse, responseObject.get("nbElements").isNumber(), vueARafraichir); |
projets.setTaillePage(nbElements); |
projets.setPageCourante(start); |
if (seqId != null) { |
Reponse retourRequete = new Reponse(projets, seqId); |
vueARafraichir.rafraichir(retourRequete); |
} else { |
vueARafraichir.rafraichir(projets); |
} |
// Si la réponse est un objet, alors c'est un unique projet qui a été retourné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 { |
vueARafraichir.rafraichir(projets); |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un objet ou un tableau 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 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) { |
/trunk/src/org/tela_botanica/client/modeles/commentaire/Commentaire.java |
---|
4,6 → 4,7 |
import org.tela_botanica.client.modeles.aDonnee; |
import org.tela_botanica.client.modeles.collection.Collection; |
import org.tela_botanica.client.modeles.collection.CollectionACommentaire; |
import org.tela_botanica.client.util.Debug; |
import com.google.gwt.json.client.JSONObject; |
28,7 → 29,9 |
public void initialiserCommentaire(JSONObject commentaire, boolean chargerCollectionACommentaire) { |
initialiserModele(commentaire); |
collection = new Collection(commentaire); |
if (chargerCollectionACommentaire) { |
collectionACommentaire = new CollectionACommentaire(commentaire); |
} else { |
/trunk/src/org/tela_botanica/client/modeles/commentaire/CommentaireListe.java |
---|
5,6 → 5,7 |
import org.tela_botanica.client.interfaces.ListePaginable; |
import org.tela_botanica.client.interfaces.Rafraichissable; |
import org.tela_botanica.client.modeles.aDonneeListe; |
import org.tela_botanica.client.util.UtilString; |
import com.extjs.gxt.ui.client.Registry; |
import com.google.gwt.i18n.client.Dictionary; |
53,11 → 54,18 |
private void initialiserCommentaireListe(JSONArray ListeDeCommentaires) { |
boolean chargerCollectionACommentaire = true; |
final int taillemax = ListeDeCommentaires.size(); |
for (int i = 0; i < taillemax; i++) { |
JSONObject commentaireCourant = ListeDeCommentaires.get(i).isObject() ; |
if (commentaireCourant != null) { |
Commentaire commentaire = new Commentaire(commentaireCourant, chargerCollectionACommentaire); |
this.put(commentaire.getId(), commentaire); |
if (!UtilString.isEmpty(commentaire.getCollectionACommentaire().getId())) { |
this.put(commentaire.getCollectionACommentaire().getId(), commentaire); |
} |
else { |
this.put(commentaire.getId(), commentaire); |
} |
} |
} |
} |
/trunk/src/org/tela_botanica/client/modeles/commentaire/CommentaireAsyncDao.java |
---|
8,7 → 8,6 |
import org.tela_botanica.client.http.JsonRestRequestCallback; |
import org.tela_botanica.client.interfaces.Rafraichissable; |
import org.tela_botanica.client.modeles.Information; |
import org.tela_botanica.client.modeles.structure.StructureListe; |
import org.tela_botanica.client.util.UtilDAO; |
import com.extjs.gxt.ui.client.Registry; |
37,6 → 36,8 |
restrictions.put("limit", String.valueOf(nbElements)); |
} |
restrictions.put("orderby", "ccac_id_collection DESC"); |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions); |
rb.envoyerRequete(null, new JsonRestRequestCallback() { |
@Override |
44,6 → 45,7 |
if (responseValue != null) { |
// Si la requête est un succès, réception d'un objet ou d'un tableau |
JSONArray responseArray = responseValue.isArray(); |
if (responseArray.get(1).isObject() != null) { |
final JSONObject reponse = responseArray.get(1).isObject(); |
// Transformation du tableau JSON réponse en ListeInstitution |
51,7 → 53,7 |
// et on met à jour le demandeur des données |
vueARafraichir.rafraichir(commentaire); |
} else if (responseValue.isArray() != null) { |
final JSONArray reponse = responseValue.isArray(); |
final JSONArray reponse = responseValue.isArray(); |
CommentaireListe commentaires; |
if (reponse.get(1).isObject() != null) { |
commentaires = new CommentaireListe(reponse.get(1).isArray()); |
/trunk/src/org/tela_botanica/client/modeles/publication/Publication.java |
---|
69,18 → 69,6 |
this.set("fmt_auteur", auteurFormate); |
} |
// FIXME : |
// NE SERT A RIEN ! |
// Author : Cyprien |
// Action : Cette fonction retourne l'objet de la publication (=ce dont parle la publication) |
// le résultat est une chaine de caractères représentant le nom d'une collection |
// ou d'une personne |
public String getObjetDeLaPublication(){ |
String objetDeLaPublication = ""; |
return objetDeLaPublication; |
} |
public String getCollection() { |
return renvoyerValeurCorrecte("collection"); |
} |
/trunk/src/org/tela_botanica/client/modeles/UtilisateurAsyncDao.java |
---|
161,8 → 161,8 |
public void surReponse(JSONValue responseValue) { |
if (responseValue.isArray() != null) { |
final JSONArray reponse = responseValue.isArray(); |
if (reponse.get(1).isString() != null) { |
String licenceAcceptee = reponse.get(1).isString().stringValue(); |
if (reponse.get(0).isString() != null) { |
String licenceAcceptee = reponse.get(0).isString().stringValue(); |
Information info = new Information("maj_licence"); |
info.setDonnee(0, licenceAcceptee); |
vueARafraichir.rafraichir(info); |
/trunk/src/org/tela_botanica/client/modeles/Valeur.java |
---|
46,7 → 46,7 |
this.set("abreviation", abr); |
this.set("description", description); |
} |
public Valeur(ModelData model) |
{ |
this.set("id_valeur", model.get("cmlv_id_valeur")); |
54,7 → 54,7 |
this.set("abreviation", model.get("cmlv_abreviation")); |
this.set("description", model.get("cmlv_description")); |
} |
@Override |
protected String getPrefixe() { |
return PREFIXE; |
/trunk/src/org/tela_botanica/client/modeles/personne/Personne.java |
---|
218,14 → 218,51 |
return dateNaiss; |
} |
public String getDateSouple(String date) { |
String valeurDate = date; |
String jour = ""; |
String mois = ""; |
String annee = ""; |
// pas de date dans la BD |
if (UtilString.isEmpty(valeurDate) || valeurDate.equals("0000-00-00")) { |
valeurDate = ""; |
// YYYY |
} else if (valeurDate.endsWith("00-00")) { |
valeurDate = valeurDate.substring(0, 4); |
if (valeurDate.matches("\\d{4}")) { |
jour = ""; |
mois = ""; |
annee = valeurDate.substring(0,4); |
valeurDate = annee; |
} |
// YYYY-MM |
} else if (valeurDate.endsWith("-00")) { |
valeurDate = valeurDate.substring(0, 7); |
if (valeurDate.matches("\\d{4}-\\d{2}")) { |
jour = ""; |
mois = valeurDate.substring(5,7); |
annee = valeurDate.substring(0,4); |
valeurDate = mois+"/"+annee; |
} |
} |
// YYYY-MM-DD |
else if (valeurDate.matches("\\d{4}-\\d{2}-\\d{2}")) { |
Date objetDate = DateTimeFormat.getFormat("yyyy-MM-dd").parse(valeurDate); |
DateTimeFormat fmt = DateTimeFormat.getFormat("dd/MM/yyyy"); |
valeurDate = fmt.format(objetDate); |
} |
return valeurDate; |
} |
public String getAnneeOuDateNaiss() { |
String valeurDateNaissance = get("naissance_date"); |
if (!UtilString.isEmpty(valeurDateNaissance) && valeurDateNaissance.endsWith("00-00")) { |
valeurDateNaissance = valeurDateNaissance.substring(0, 4); |
} else if (UtilString.isEmpty(valeurDateNaissance) && valeurDateNaissance.equals("0000-00-00")) { |
valeurDateNaissance = ""; |
} |
return valeurDateNaissance; |
String valeurDateNaissance = get("naissance_date"); |
return getDateSouple(valeurDateNaissance); |
} |
public void setNaissanceDate(Date naissanceDate) { |
259,13 → 296,8 |
} |
public String getAnneeOuDateDeces() { |
String valeurDateDeces = get("deces_date"); |
if (!UtilString.isEmpty(valeurDateDeces) && valeurDateDeces.endsWith("00-00")) { |
valeurDateDeces = valeurDateDeces.substring(0, 4); |
} else if (UtilString.isEmpty(valeurDateDeces) && valeurDateDeces.equals("0000-00-00")) { |
valeurDateDeces = ""; |
} |
return valeurDateDeces; |
String valeurDateDeces = get("deces_date"); |
return getDateSouple(valeurDateDeces); |
} |
public void setDeces(String deces) { |
/trunk/src/org/tela_botanica/client/modeles/personne/PersonneAsyncDao.java |
---|
15,6 → 15,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,51 → 27,88 |
public PersonneAsyncDao(Rafraichissable vue) { |
vueARafraichir = vue; |
utilisateurId = ((Mediateur) Registry.get(RegistreId.MEDIATEUR)).getUtilisateurId(); |
} |
} |
/** |
* @param paginationProgressive : définit le mode de consultation de la base de données |
* - True : la consultation des données est progressive, ce qui signifie que la liste est chargée (paginée) au |
* fur et à mesure de la consultation des données par l'utilisateur. |
* - False : la consultation des données est classique : un seul appel à la base de données est effectué, le retour |
* est renvoyé à l'appelant |
* // FIXME : si la taille de la liste est supérieure à la limite du JREST (150), ce deuxieme mode ne fonctionne pas |
*/ |
public void selectionner(final boolean paginationProgressive, String personneId, String projetId, String nomComplet, final int start, final int nbElements, final Integer seqId) { |
public void selectionner(String personneId, String projetId, String nomComplet, final int pageCourante, final int nbElements, final Integer seqId) { |
String[] parametres = {personneId, projetId, nomComplet}; |
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 |
if (seqId != null) { |
Reponse reponseRequete = new Reponse(info, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
} |
else { |
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 |
if (seqId != null) { |
Reponse reponseRequete = new Reponse(info, seqId); |
vueARafraichir.rafraichir(reponseRequete); |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un tableau JSON et vaut : "+responseValue.toString(), null); |
} |
else { |
vueARafraichir.rafraichir(info); |
} |
} else { |
GWT.log(rb.getUrl()+"\n\tLa réponse n'est pas un tableau JSON et vaut : "+responseValue.toString(), null); |
} |
} |
}); |
}); |
} |
} |
public void ajouter(Personne personne) { |
/trunk/src/org/tela_botanica/client/modeles/Utilisateur.java |
---|
149,7 → 149,7 |
* @return boolean |
*/ |
public boolean isIdentifie() { |
if (get("identifie").equals(true) && getLicence().equals("1")) { |
if (get("identifie").equals(true)) { |
return true; |
} else { |
return false; |
159,7 → 159,15 |
public void setIdentification(Boolean bool) { |
set("identifie", bool); |
} |
public boolean avoirLicenceAcceptee() { |
if (getLicence().equals("1")) { |
return true; |
} else { |
return false; |
} |
} |
// LICENCE ACCEPTÉE |
public void setLicence(String licence) { |
this.set("licenceAcceptee", licence); |
/trunk/src/org/tela_botanica/client/modeles |
---|
Property changes: |
Modified: svn:mergeinfo |
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/modeles:r1292-1328 |
/trunk/src/org/tela_botanica/client/Mediateur.java |
---|
75,11 → 75,13 |
import com.extjs.gxt.ui.client.util.Margins; |
import com.extjs.gxt.ui.client.widget.Component; |
import com.extjs.gxt.ui.client.widget.Dialog; |
import com.extjs.gxt.ui.client.widget.Info; |
import com.extjs.gxt.ui.client.widget.MessageBox; |
import com.extjs.gxt.ui.client.widget.Viewport; |
import com.extjs.gxt.ui.client.widget.button.Button; |
import com.extjs.gxt.ui.client.widget.layout.BorderLayout; |
import com.extjs.gxt.ui.client.widget.layout.BorderLayoutData; |
import com.gargoylesoftware.htmlunit.AlertHandler; |
import com.google.gwt.core.client.GWT; |
import com.google.gwt.i18n.client.Dictionary; |
import com.google.gwt.user.client.Window; |
494,6 → 496,34 |
afficherFormProjet(null); |
} |
/**************************************************************************************************** |
/** 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, Integer seqId) { |
modele.selectionnerProjet(vueARafraichir, recherche, start, nbElements, seqId); |
} |
public void selectionnerProjet(Rafraichissable vueARafraichir, String projetId, Sequenceur sequenceur) { |
Integer seqId = null; |
if (sequenceur!=null) { |
635,6 → 665,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, Integer seqId) { |
modele.selectionnerStructure(vueARafraichir, recherche, start, nbElements, seqId); |
} |
public void selectionnerStructure(Rafraichissable vueARafraichir, String structureId, Sequenceur sequenceur) { |
Integer seqId = null; |
805,6 → 863,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); |
} |
1023,6 → 1109,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, Integer seqId) { |
modele.selectionnerProjet(vueARafraichir, recherche, start, nbElements, seqId); |
} |
public void selectionnerPersonne(Rafraichissable vueARafraichir, Personne personne, String projetId, Sequenceur sequenceur) { |
selectionnerPersonne(vueARafraichir, personne, projetId, 0, nbElements); |
} |
/trunk/src/org/tela_botanica/client/util |
---|
Property changes: |
Added: svn:mergeinfo |
Merged /branches/v1.0-syrah/src/org/tela_botanica/client/util:r1136-1328 |
/trunk/src/org/tela_botanica/client/i18n/Constantes.properties |
---|
190,7 → 190,7 |
fonction = Fonction |
courrielPrincipal = Courriel principal |
statut = Statut |
tpsTravail = Temps de travail |
tpsTravail = Travail hebdo (%) |
specialite = Spécialité principale |
boolContact = Contact ? |
292,7 → 292,7 |
collectionTraitementDetail = Traitement |
collectionTraitementPoisonDetail = Empoisonnement |
collectionTraitementInsecteDetail = Pesticide |
collectionTraitementInsecteDetail = Désinsectisation |
collectionEtatGeneralDetail = État général |
degradationSpecimenDetail = Causes de dégradation des spécimens |
/trunk/src/org/tela_botanica/client/vues/collection/CollectionFormPersonne.java |
---|
341,10 → 341,7 |
if ((relationCollectionPersonne.get("_etat_").equals("") || !relationCollectionPersonne.get("_etat_").equals(aDonnee.ETAT_AJOUTE)) |
&& relationCollectionPersonne.getId() != null |
&& !relationCollectionPersonne.getId().equals("")) { |
Debug.log("Nbre personnes supprimées avant:"+personnesSupprimees.size()); |
personnesSupprimees.put("id"+idGenere++, relationCollectionPersonne); |
GWT.log("Personne supprimées : "+relationCollectionPersonne.getPersonne().getId()+" "+relationCollectionPersonne.getPersonne().getPrenom()+" "+relationCollectionPersonne.getPersonne().getNom(), null); |
Debug.log("Nbre personnes supprimées :"+personnesSupprimees.size()); |
} |
// Suppression de l'enregistrement de la grille |
367,7 → 364,6 |
storeGrille.addListener(Store.Update, new Listener<StoreEvent<CollectionAPersonne>>() { |
public void handleEvent(StoreEvent<CollectionAPersonne> ce) { |
if (ce.getRecord().isModified("_role_") && !ce.getModel().get("_etat_").equals(aDonnee.ETAT_AJOUTE)) { |
Debug.log("id role modifié"); |
ce.getModel().set("_etat_", aDonnee.ETAT_MODIFIE); |
} |
} |
422,7 → 418,6 |
public Object preProcessValue(Object valeur) { |
Valeur retour = null; |
if (valeur != null ) { |
Debug.log(valeur.toString()); |
if (typeRelationCombo.getStore().findModel("nom", valeur.toString()) != null) { |
retour = typeRelationCombo.getStore().findModel("nom", valeur.toString()); |
} else if (typeRelationCombo.getStore().findModel("abr", valeur.toString()) != null) { |
604,18 → 599,14 |
if (relationCollectionPersonne.get("_etat_").equals(aDonnee.ETAT_MODIFIE)) { |
// Comme il est impossible de modifier les relations nous supprimons l'ancien enregistrement et ajoutons un nouveau avec le nouveau id_role |
personnesSupprimees.put("id"+idGenere++, relationCollectionPersonne); |
Debug.log("AVANT:"+relationCollectionPersonne.getIdRole()); |
CollectionAPersonne relationAAjouter = (CollectionAPersonne) relationCollectionPersonne.cloner(new CollectionAPersonne()); |
corrigerChampsGrille(relationAAjouter);// Nous modifions l'id_role |
Debug.log("APRES:"+relationAAjouter.getIdRole()); |
personnesAjoutees.put("id"+idGenere++, relationAAjouter); |
GWT.log("Personne modifiées : "+relationAAjouter.getPersonne().getPrenom()+" "+relationAAjouter.getPersonne().getNom(), null); |
} |
if (relationCollectionPersonne.get("_etat_").equals(aDonnee.ETAT_AJOUTE)) { |
corrigerChampsGrille(relationCollectionPersonne);// Nous modifions l'id_role |
personnesAjoutees.put("id"+idGenere++, relationCollectionPersonne); |
GWT.log("Personne ajoutées : "+relationCollectionPersonne.getPersonne().getPrenom()+" "+relationCollectionPersonne.getPersonne().getNom(), null); |
} |
// Initialisation de la grille |
relationCollectionPersonne.set("_etat_", ""); |
649,7 → 640,6 |
// Suppression des relations StructureAPersonne |
if (personnesSupprimees.size() != 0) { |
mediateur.supprimerCollectionAPersonne(this, personnesSupprimees); |
Debug.log("Nbre personnes supprimées :"+personnesSupprimees.size()); |
} |
} |
} |
/trunk/src/org/tela_botanica/client/vues/collection/CollectionFormPublication.java |
---|
323,10 → 323,7 |
if ((publicationLiee.get("_etat_").equals("") || !publicationLiee.get("_etat_").equals(aDonnee.ETAT_AJOUTE)) |
&& publicationLiee.getId() != null |
&& !publicationLiee.getId().equals("")) { |
Debug.log("Nbre publications supprimées avant:"+publicationsSupprimees.size()); |
publicationsSupprimees.put("id"+idGenere++, publicationLiee); |
GWT.log("Publications supprimée : "+publicationLiee.getPublication().getId()+" "+publicationLiee.getPublication().getNomComplet(), null); |
Debug.log("Nbre publications supprimées :"+publicationsSupprimees.size()); |
} |
// Suppression de l'enregistrement de la grille |
507,11 → 504,9 |
CollectionAPublication relationAAjouter = (CollectionAPublication) publicationLiee.cloner(new CollectionAPublication()); |
publicationsAjoutees.put("id"+idGenere++, relationAAjouter); |
Debug.log(publicationLiee.toString()); |
} |
if (publicationLiee.get("_etat_").equals(aDonnee.ETAT_AJOUTE)) { |
publicationsAjoutees.put("id"+idGenere++, publicationLiee); |
Debug.log(publicationLiee.toString()); |
} |
// Initialisation de la grille |
publicationLiee.set("_etat_", ""); |
529,12 → 524,10 |
// Ajout des relations CollectionAPublication |
if (publicationsAjoutees.size() != 0) { |
mediateur.ajouterCollectionAPublication(this, collection.getId(), publicationsAjoutees); |
Debug.log("Nbre publications ajoutées :"+publicationsAjoutees.size()); |
} |
// Suppression des relations CollectionAPublication |
if (publicationsSupprimees.size() != 0) { |
mediateur.supprimerCollectionAPublication(this, publicationsSupprimees); |
Debug.log("Nbre publications supprimées :"+publicationsSupprimees.size()); |
} |
} |
} |
/trunk/src/org/tela_botanica/client/vues/collection/CollectionFormGeneral.java |
---|
6,8 → 6,14 |
import org.tela_botanica.client.Mediateur; |
import org.tela_botanica.client.composants.ChampCaseACocher; |
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs; |
import org.tela_botanica.client.composants.ChampComboBoxRechercheTempsReelPaginable; |
import org.tela_botanica.client.composants.ChampMultiValeurs; |
import org.tela_botanica.client.composants.ChampMultiValeursMultiTypesPaginable; |
import org.tela_botanica.client.composants.ConteneurMultiChamps; |
import org.tela_botanica.client.composants.pagination.ProxyCollections; |
import org.tela_botanica.client.composants.pagination.ProxyProjets; |
import org.tela_botanica.client.composants.pagination.ProxyStructures; |
import org.tela_botanica.client.composants.pagination.ProxyValeur; |
import org.tela_botanica.client.interfaces.Rafraichissable; |
import org.tela_botanica.client.modeles.ValeurListe; |
import org.tela_botanica.client.modeles.collection.Collection; |
20,6 → 26,8 |
import org.tela_botanica.client.vues.Formulaire; |
import org.tela_botanica.client.vues.FormulaireOnglet; |
import com.extjs.gxt.ui.client.data.ModelData; |
import com.extjs.gxt.ui.client.data.ModelType; |
import com.extjs.gxt.ui.client.event.BaseEvent; |
import com.extjs.gxt.ui.client.event.Events; |
import com.extjs.gxt.ui.client.event.Listener; |
47,9 → 55,9 |
private HiddenField<String> idCollectionChp = null; |
private ComboBox<Projet> projetsCombo = null; |
private ComboBox<Structure> structuresCombo = null; |
private ComboBox<Collection> collectionsCombo = null; |
private ChampComboBoxRechercheTempsReelPaginable projetsCombo = null; |
private ChampComboBoxRechercheTempsReelPaginable structuresCombo = null; |
private ChampComboBoxRechercheTempsReelPaginable collectionsCombo = null; |
private ChampCaseACocher periodeConstitutionChp = null; |
private ChampComboBoxListeValeurs groupementPrincipeCombo = null; |
103,17 → 111,34 |
liaisonFieldSet.setCollapsible(true); |
liaisonFieldSet.setLayout(Formulaire.creerFormLayout(largeurLabelDefaut, alignementLabelDefaut)); |
projetsCombo = new ComboBox<Projet>(); |
projetsCombo.setTabIndex(tabIndex++); |
projetsCombo.setFieldLabel(i18nC.projetChamp()); |
projetsCombo.setDisplayField("nom"); |
projetsCombo.setForceSelection(true); |
projetsCombo.setValidator(new Validator() { |
/*********************************/ |
/** Champ Projets **/ |
/*********************************/ |
ModelType modelTypeProjets = new ModelType(); |
modelTypeProjets.setRoot("projets"); |
modelTypeProjets.setTotalName("nbElements"); |
modelTypeProjets.addField("cpr_nom"); |
modelTypeProjets.addField("cpr_id_projet"); |
String displayNameProjets = "cpr_nom"; |
ProxyProjets<ModelData> proxyProjets = new ProxyProjets<ModelData>(); |
projetsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyProjets, modelTypeProjets, displayNameProjets); |
projetsCombo.setWidth(250, 600); |
projetsCombo.getCombo().setTabIndex(tabIndex++); |
projetsCombo.getCombo().setFieldLabel(i18nC.projetChamp()); |
projetsCombo.getCombo().setForceSelection(true); |
projetsCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE); |
projetsCombo.getCombo().addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire()); |
projetsCombo.getCombo().setValidator(new Validator() { |
public String validate(Field<?> field, String value) { |
String retour = null; |
if (field.getRawValue().equals("")) { |
field.setValue(null); |
} else if (projetsCombo.getStore().findModel("nom", field.getRawValue()) == null) { |
} else if (projetsCombo.getStore().findModel("cpr_nom", field.getRawValue()) == null) { |
String contenuBrut = field.getRawValue(); |
field.setValue(null); |
field.setRawValue(contenuBrut); |
122,24 → 147,37 |
return retour; |
} |
}); |
projetsCombo.setTriggerAction(TriggerAction.ALL); |
projetsCombo.setStore(new ListStore<Projet>()); |
projetsCombo.addStyleName(ComposantClass.OBLIGATOIRE); |
projetsCombo.addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire()); |
liaisonFieldSet.add(projetsCombo, new FormData(450, 0)); |
mediateur.selectionnerProjet(this, null, null); |
liaisonFieldSet.add(projetsCombo, new FormData(600, 0)); |
structuresCombo = new ComboBox<Structure>(); |
structuresCombo.setTabIndex(tabIndex++); |
structuresCombo.setFieldLabel(i18nC.lienStructureCollection()); |
structuresCombo.setDisplayField("nom"); |
structuresCombo.setForceSelection(true); |
structuresCombo.setValidator(new Validator() { |
/*************************************/ |
/** Champ Structures **/ |
/*************************************/ |
ModelType modelTypeStructures = new ModelType(); |
modelTypeStructures.setRoot("structures"); |
modelTypeStructures.setTotalName("nbElements"); |
modelTypeStructures.addField("cs_nom"); |
modelTypeStructures.addField("cs_id_structure"); |
String displayNameStructures = "cs_nom"; |
ProxyStructures<ModelData> proxyStructures = new ProxyStructures<ModelData>(); |
structuresCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyStructures, modelTypeStructures, displayNameStructures); |
structuresCombo.setWidth(250, 600); |
structuresCombo.getCombo().setTabIndex(tabIndex++); |
structuresCombo.getCombo().setFieldLabel(i18nC.lienStructureCollection()); |
structuresCombo.getCombo().setForceSelection(true); |
structuresCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE); |
structuresCombo.getCombo().addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire()); |
structuresCombo.getCombo().setValidator(new Validator() { |
public String validate(Field<?> field, String value) { |
String retour = null; |
if (field.getRawValue().equals("")) { |
field.setValue(null); |
} else if (structuresCombo.getStore().findModel("nom", field.getRawValue()) == null) { |
} else if (structuresCombo.getStore().findModel("cs_nom", field.getRawValue()) == null) { |
String contenuBrut = field.getRawValue(); |
field.setValue(null); |
field.setRawValue(contenuBrut); |
148,22 → 186,37 |
return retour; |
} |
}); |
structuresCombo.setTriggerAction(TriggerAction.ALL); |
structuresCombo.setStore(new ListStore<Structure>()); |
liaisonFieldSet.add(structuresCombo, new FormData(450, 0)); |
mediateur.selectionnerStructureParProjet(this, null); |
liaisonFieldSet.add(structuresCombo, new FormData(600, 0)); |
collectionsCombo = new ComboBox<Collection>(); |
collectionsCombo.setTabIndex(tabIndex++); |
collectionsCombo.setFieldLabel(i18nC.lienMereCollection()); |
collectionsCombo.setDisplayField("nom"); |
collectionsCombo.setForceSelection(true); |
collectionsCombo.setValidator(new Validator() { |
/*************************************/ |
/** Champ Collections **/ |
/*************************************/ |
ModelType modelTypeCollections = new ModelType(); |
modelTypeCollections.setRoot("collections"); |
modelTypeCollections.setTotalName("nbElements"); |
modelTypeCollections.addField("cc_nom"); |
modelTypeCollections.addField("cc_id_collection"); |
String displayNameCollections = "cc_nom"; |
ProxyCollections<ModelData> proxyCollections = new ProxyCollections<ModelData>(); |
collectionsCombo = new ChampComboBoxRechercheTempsReelPaginable(proxyCollections, modelTypeCollections, displayNameCollections); |
collectionsCombo.setWidth(250, 600); |
collectionsCombo.getCombo().setTabIndex(tabIndex++); |
collectionsCombo.getCombo().setFieldLabel(i18nC.lienMereCollection()); |
collectionsCombo.getCombo().setForceSelection(true); |
collectionsCombo.getCombo().addStyleName(ComposantClass.OBLIGATOIRE); |
collectionsCombo.getCombo().addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire()); |
collectionsCombo.getCombo().setValidator(new Validator() { |
public String validate(Field<?> field, String value) { |
String retour = null; |
if (field.getRawValue().equals("")) { |
field.setValue(null); |
} else if (collectionsCombo.getStore().findModel("nom", field.getRawValue()) == null) { |
} else if (collectionsCombo.getStore().findModel("cc_nom", field.getRawValue()) == null) { |
String contenuBrut = field.getRawValue(); |
field.setValue(null); |
field.setRawValue(contenuBrut); |
172,10 → 225,8 |
return retour; |
} |
}); |
collectionsCombo.setTriggerAction(TriggerAction.ALL); |
collectionsCombo.setStore(new ListStore<Collection>()); |
liaisonFieldSet.add(collectionsCombo, new FormData(450, 0)); |
mediateur.selectionnerCollectionParProjet(this, null); |
liaisonFieldSet.add(collectionsCombo, new FormData(600, 0)); |
this.add(liaisonFieldSet); |
} |
318,7 → 369,7 |
public ArrayList<String> verifier() { |
ArrayList<String> messages = new ArrayList<String>(); |
if (projetsCombo.getValue() == null || !projetsCombo.isValid()) { |
if (projetsCombo.getCombo().getValue() == null || !projetsCombo.getCombo().isValid()) { |
messages.add(i18nM.selectionObligatoire(i18nC.articleUn()+" "+i18nC.projetSingulier(), i18nC.articleLa()+" "+i18nC.collectionSingulier())); |
} |
return messages; |
359,57 → 410,48 |
private String getValeurComboProjets() { |
String valeur = ""; |
if (projetsCombo.getValue() != null) { |
valeur = projetsCombo.getValue().getId(); |
if (projetsCombo.getCombo().getValue() != null) { |
Projet projet = new Projet(projetsCombo.getValeur()); |
valeur = projet.getId(); |
} |
return valeur; |
} |
private void setValeurComboProjets() { |
if (projetsCombo.getStore() != null && collection != null) { |
projetsCombo.setValue(projetsCombo.getStore().findModel("id_projet", collection.getIdProjet())); |
projetsCombo.getCombo().setValue(projetsCombo.getStore().findModel("cpr_id_projet", collection.getIdProjet())); |
} |
} |
private String getValeurComboStructures() { |
String valeur = ""; |
if (structuresCombo.getValue() != null) { |
valeur = structuresCombo.getValue().getId(); |
if (structuresCombo.getCombo().getValue() != null) { |
Structure structure = new Structure(structuresCombo.getValeur()); |
valeur = structure.getId(); |
} |
return valeur; |
} |
private void setValeurComboStructures() { |
if (structuresCombo.getStore() != null && collection != null) { |
structuresCombo.setValue(structuresCombo.getStore().findModel("id_structure", collection.getIdStructure())); |
structuresCombo.getCombo().setValue(structuresCombo.getStore().findModel("cs_id_structure", collection.getIdStructure())); |
} |
} |
private String getValeurComboCollections() { |
String valeur = ""; |
if (collectionsCombo.getValue() != null) { |
valeur = collectionsCombo.getValue().getId(); |
if (collectionsCombo.getCombo().getValue() != null) { |
Collection collection = new Collection(collectionsCombo.getValeur()); |
valeur = collection.getId(); |
} |
return valeur; |
} |
private void setValeurComboCollections() { |
if (collectionsCombo.getStore() != null && collection != null) { |
collectionsCombo.setValue(collectionsCombo.getStore().findModel("id_collection", collection.getCollectionMereId())); |
if (collectionsCombo.getCombo().getStore() != null && collection != null) { |
collectionsCombo.getCombo().setValue(collectionsCombo.getStore().findModel("id_collection", collection.getCollectionMereId())); |
} |
} |
public void rafraichir(Object nouvellesDonnees) { |
if (nouvellesDonnees instanceof ProjetListe) { |
ProjetListe projets = (ProjetListe) nouvellesDonnees; |
Formulaire.rafraichirComboBox(projets, projetsCombo); |
setValeurComboProjets(); |
} else if (nouvellesDonnees instanceof StructureListe) { |
StructureListe structures = (StructureListe) nouvellesDonnees; |
Formulaire.rafraichirComboBox(structures, structuresCombo); |
setValeurComboStructures(); |
} else if (nouvellesDonnees instanceof CollectionListe) { |
CollectionListe collections = (CollectionListe) nouvellesDonnees; |
Formulaire.rafraichirComboBox(collections, collectionsCombo); |
setValeurComboCollections(); |
} else if (nouvellesDonnees instanceof ValeurListe) { |
if (nouvellesDonnees instanceof ValeurListe) { |
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees; |
rafraichirValeurListe(listeValeurs); |
} else { |
/trunk/src/org/tela_botanica/client/vues/collection/CollectionDetailVue.java |
---|
1010,7 → 1010,8 |
} else { |
etiquetteRenseignements += i18nC.inconnue(); |
} |
etiquetteRenseignements += ": "+infos.get(cle)+"%,"; |
if (it.hasNext()) etiquetteRenseignements += ": "+infos.get(cle)+"%, "; |
else etiquetteRenseignements += ": "+infos.get(cle)+"%."; |
} |
} |
String precisionLocalite = construireTxtListeOntologie(collectionBotanique.getPrecisionLocalite()); |
/trunk/src/org/tela_botanica/client/vues/collection/CollectionForm.java |
---|
305,11 → 305,14 |
} |
public boolean soumettreFormulaire() { |
// Vérification de la validité des champs du formulaire |
boolean formulaireValide = verifierFormulaire(); |
if (formulaireValide) { |
// Collecte des données du formulaire |
Collection collectionAEnregistrer = collecterCollection(); |
if (mode.equals(MODE_AJOUTER)) { |
mediateur.ajouterCollection(this, collectionAEnregistrer); |
} else if (mode.equals(MODE_MODIFIER)) { |
356,7 → 359,7 |
collectionCollectee.setNom(nomChp.getValue()); |
collectionCollectee.setTypeNcd(typesCollectionCombo.getValue().getId()); |
} |
private void collecterOnglets() { |
generalOnglet.collecter(); |
personneOnglet.collecter(); |
366,7 → 369,7 |
inventaireOnglet.collecter(); |
commentaireOnglet.collecter(); |
} |
public boolean verifierFormulaire() { |
ArrayList<String> messages = new ArrayList<String>(); |
/trunk/src/org/tela_botanica/client/vues/collection/CollectionFormCommentaire.java |
---|
338,10 → 338,7 |
if ((relationCollectionACommentaire.get("_etat_").equals("") || !relationCollectionACommentaire.get("_etat_").equals(aDonnee.ETAT_AJOUTE)) |
&& relationCollectionACommentaire.getId() != null |
&& !relationCollectionACommentaire.getId().equals("")) { |
Debug.log("Nbre commentaires supprimées avant:"+commentairesSupprimes.size()); |
commentairesSupprimes.put("id"+idGenere++, relationCollectionACommentaire); |
Debug.log("Commentaires supprimées : "+relationCollectionACommentaire.getCommentaire().getId()); |
Debug.log("Nbre commentaires supprimées :"+commentairesSupprimes.size()); |
} |
// Suppression de l'enregistrement de la grille |
364,7 → 361,6 |
storeGrille.addListener(Store.Update, new Listener<StoreEvent<CollectionACommentaire>>() { |
public void handleEvent(StoreEvent<CollectionACommentaire> ce) { |
if (ce.getRecord().isModified("_type_") && !ce.getModel().get("_etat_").equals(aDonnee.ETAT_AJOUTE)) { |
Debug.log("id type modifié : "+ce.getModel().get("_type_")); |
ce.getModel().set("_etat_", aDonnee.ETAT_MODIFIE); |
} |
} |
424,7 → 420,6 |
if (getField().getRawValue() != null ) { |
retour = getField().getRawValue(); |
} |
Debug.log("Post : "+retour); |
return retour; |
} |
}; |
432,11 → 427,9 |
GridCellRenderer<CollectionACommentaire> typeRendu = new GridCellRenderer<CollectionACommentaire>() { |
public String render(CollectionACommentaire model, String property, ColumnData config, int rowIndex, int colIndex, ListStore<CollectionACommentaire> store, Grid<CollectionACommentaire> grid) { |
String type = model.get("_type_"); |
Debug.log("Initialisation type origine :"+type); |
if (typeCombo.getStore() != null && type != null && (type.matches("[0-9]+") || type.contains(aDonnee.SEPARATEUR_VALEURS))) { |
type = typeCombo.formaterIdentifiantsEnTexte(type); |
model.set("_type_", type); |
Debug.log("Initialisation :"+type); |
} |
return type; |
} |
577,12 → 570,10 |
if (relationCollectionACommentaire.get("_etat_").equals(aDonnee.ETAT_MODIFIE)) { |
corrigerChampsGrille(relationCollectionACommentaire);// Nous modifions l'id_type |
commentairesModifies.put("id"+idGenere++, relationCollectionACommentaire); |
Debug.log("Commentaires modifiés : "+relationCollectionACommentaire.getCommentaire().getTitre()); |
} |
if (relationCollectionACommentaire.get("_etat_").equals(aDonnee.ETAT_AJOUTE)) { |
corrigerChampsGrille(relationCollectionACommentaire);// Nous modifions l'id_type |
commentairesAjoutes.put("id"+idGenere++, relationCollectionACommentaire); |
Debug.log("Commentaires ajoutés : "+relationCollectionACommentaire.getCommentaire().getTitre()); |
} |
// Initialisation de la grille |
relationCollectionACommentaire.set("_etat_", ""); |
/trunk/src/org/tela_botanica/client/vues/collection/CollectionFormInventaire.java |
---|
28,7 → 28,6 |
private ChampCaseACocher digitalInventaireChp = null; |
private ChampSliderPourcentage pourcentDigitalInventaireChp = null; |
private ChampComboBoxListeValeurs etatInventaireCombo = null; |
//DELETEME private TextArea typeDonneeInventaireChp = null; |
public CollectionFormInventaire(Formulaire formulaireCourrant) { |
initialiserOnglet(formulaireCourrant); |
64,13 → 63,6 |
etatInventaireCombo = new ChampComboBoxListeValeurs(i18nC.etatInventaireCollection(), "inventaireEtat", tabIndex++); |
etatInventaireCombo.setTabIndex(tabIndex++); |
add(etatInventaireCombo, new FormData(300, 0)); |
/*DELETEME |
typeDonneeInventaireChp = new TextArea(); |
typeDonneeInventaireChp.setTabIndex(tabIndex++); |
typeDonneeInventaireChp.setFieldLabel(i18nC.typeDonneeInventaireCollection()); |
add(typeDonneeInventaireChp, new FormData(550, 0));*/ |
} |
public void peupler() { |
83,7 → 75,6 |
digitalInventaireChp.peupler(collectionBotanique.getInventaireDigital()); |
pourcentDigitalInventaireChp.peupler(collectionBotanique.getInventaireDigitalPourcent()); |
etatInventaireCombo.peupler(collectionBotanique.getInventaireEtat()); |
//DELETEME typeDonneeInventaireChp.setValue(collectionBotanique.getInventaireDonneesTypes()); |
} |
} |
97,7 → 88,6 |
collectionBotaniqueCollectee.setInventaireDigital(digitalInventaireChp.getValeur()); |
collectionBotaniqueCollectee.setInventaireDigitalPourcent(pourcentDigitalInventaireChp.getValeur()); |
collectionBotaniqueCollectee.setInventaireEtat(etatInventaireCombo.getValeur()); |
//DELETEME collectionBotaniqueCollectee.setInventaireDonneesTypes(typeDonneeInventaireChp.getValue()); |
} |
} |
/trunk/src/org/tela_botanica/client/vues/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; |
36,6 → 39,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; |
73,6 → 78,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; |
132,7 → 138,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; |
219,7 → 225,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; |
329,8 → 335,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."); |
} |
654,8 → 660,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); |
708,10 → 714,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()); |
743,7 → 749,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)) { |
750,7 → 756,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()) { |
801,9 → 807,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()); |
1082,8 → 1088,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 |
1141,8 → 1147,11 |
String specialite = personne.get("specialite"); |
personne.setSpecialite(specialite); |
// On met à faux le décès |
personne.setDeces(Personne.ETRE_VIVANT); |
// Ajout de la personne dans la liste correspondant à son état (ajouté ou modifié) |
if (personne.get("etat") != null && personne.get("etat").equals(StructureAPersonne.ETAT_AJOUTE)) {// Une personne ajoutée |
if (personne.get("etat") != null && personne.get("etat").equals(StructureAPersonne.ETAT_AJOUTE)) { // Une personne ajoutée |
personnelAjoute.put(""+i, personne); |
} else {// Une personne modifiée |
personnelModifie.put(personne.getId(), personne); |
1381,7 → 1390,7 |
column.setEditor(statutEditor); |
configs.add(column); |
column = new ColumnConfig("travail", "Temps travail", 100); |
column = new ColumnConfig("travail", "Travail hebdo (%)", 100); |
column.setNumberFormat(NumberFormat.getFormat("##")); |
NumberField tpsWChp = new NumberField(); |
tpsWChp.setFormat(NumberFormat.getFormat("##")); |
1519,9 → 1528,11 |
StructureAPersonne structureAPersonne = ce.getModel(); |
String etat = structureAPersonne.get("etat"); |
if (!etat.equals(aDonnee.ETAT_AJOUTE) && !UtilString.isEmpty(structureAPersonne.getId())) { |
if (etat!=null && !etat.equals(aDonnee.ETAT_AJOUTE) && structureAPersonne!=null && !UtilString.isEmpty(structureAPersonne.getId())) { |
System.out.println("modifier"); |
ce.getModel().set("etat", aDonnee.ETAT_MODIFIE); |
} else { |
System.out.println("ajoute"); |
} |
} |
}); |
1563,19 → 1574,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, sequenceur); |
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 |
1750,13 → 1764,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"); |
1784,31 → 1799,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", sequenceur); |
magazinRegion = new ListStore<Valeur>(); |
comboRegion = new ComboBox<Valeur>(); |
1911,7 → 1930,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(""); |
}-*/; |
2030,9 → 2049,6 |
} else if (nouvellesDonnees instanceof ValeurListe) { |
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees; |
rafraichirValeurListe(listeValeurs); |
} else if (nouvellesDonnees instanceof ProjetListe) { |
ProjetListe projets = (ProjetListe) nouvellesDonnees; |
rafraichirProjetListe(projets); |
} else { |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null); |
} |
2153,11 → 2169,6 |
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,13 → 2250,6 |
} |
} |
private void rafraichirProjetListe(ProjetListe projets) { |
List<Projet> liste = projets.toList(); |
projetsMagazin.removeAll(); |
projetsMagazin.add(liste); |
projetsCombo.setStore(projetsMagazin); |
} |
private void testerLancementRafraichirPersonnel() { |
decompteRafraichissementPersonnel--; |
/trunk/src/org/tela_botanica/client/vues/DetailVue.java |
---|
256,7 → 256,7 |
// VALEUR AVEC TYPE |
// Type : AUTRE |
String valeurTypeAutre = aDonnee.TYPE_AUTRE+aDonnee.SEPARATEUR_TYPE_VALEUR; |
if (valeur.matches("^"+valeurTypeAutre+".+$")) { |
if (valeur.matches("^"+valeurTypeAutre+".*$")) { |
String txtAutre = valeur.replaceFirst("^"+valeurTypeAutre, ""); |
if (!txtAutre.equals("")) { |
autres.add(txtAutre); |
/trunk/src/org/tela_botanica/client/vues/projet/ProjetDetailVue.java |
---|
140,7 → 140,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); |
} |
/trunk/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,26 |
licenceChp.setFieldLabel(i18nC.projetLicence()); |
complementFieldset.add(licenceChp, new FormData(450, 0)); |
langueChp = new ChampComboBoxListeValeurs(i18nC.projetLangue(), listeLanguesId); |
complementFieldset.add(langueChp, new FormData(200, 0)); |
ModelType modelTypesLangues = new ModelType(); |
modelTypesLangues.setRoot("valeurs"); |
modelTypesLangues.setTotalName("nbElements"); |
modelTypesLangues.addField("cmlv_nom"); |
modelTypesLangues.addField("cmlv_id_valeur"); |
modelTypesLangues.addField("cmlv_abreviation"); |
modelTypesLangues.addField("cmlv_description"); |
String displayNameLangues = "cmlv_nom"; |
String nomListeTypes = "langues"; |
ProxyValeur<ModelData> proxyLangues = new ProxyValeur<ModelData>(nomListeTypes); |
langueChp = new ChampComboBoxRechercheTempsReelPaginable(proxyLangues, modelTypesLangues, displayNameLangues); |
langueChp.setWidth(100,300); |
langueChp.getCombo().setTabIndex(tabIndex++); |
langueChp.getCombo().setFieldLabel(i18nC.projetLangue()); |
langueChp.getCombo().setForceSelection(true); |
complementFieldset.add(langueChp, new FormData(300, 0)); |
markPublicChp = new CheckBox(); |
markPublicChp.setFieldLabel(i18nC.projetMarkPublic()); |
markPublicChp.addListener(Events.Change, new Listener<BaseEvent>() { |
391,7 → 413,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 → 448,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); |
/trunk/src/org/tela_botanica/client/vues/commentaire/CommentaireListeVue.java |
---|
34,6 → 34,7 |
import com.extjs.gxt.ui.client.event.SelectionListener; |
import com.extjs.gxt.ui.client.store.GroupingStore; |
import com.extjs.gxt.ui.client.store.ListStore; |
import com.extjs.gxt.ui.client.util.Util; |
import com.extjs.gxt.ui.client.widget.ContentPanel; |
import com.extjs.gxt.ui.client.widget.Info; |
import com.extjs.gxt.ui.client.widget.button.Button; |
116,7 → 117,7 |
// Gestion de la grille |
List<ColumnConfig> colonnes = new ArrayList<ColumnConfig>(); |
// ATTENTION : les noms des colonnes doivent correspondre aux noms variables de la classe utilisée dans la liste |
colonnes.add(new ColumnConfig("_collection_nom_", i18nC.commentaireCollection(), 150)); |
colonnes.add(new ColumnConfig("_collection_nom_", i18nC.commentaireCollection(), 150)); |
colonnes.add(creerColonneType()); |
colonnes.add(new ColumnConfig("_titre_", i18nC.commentaireTitre(), 150)); |
colonnes.add(new ColumnConfig("_ponderation_", i18nC.commentairePonderation(), 30)); |
144,7 → 145,9 |
public String render(GroupColumnData data) { |
String f = modeleDesColonnes.getColumnById(data.field).getHeader(); |
String l = data.models.size() == 1 ? i18nC.commentaireSingulier() : i18nC.commentairePluriel(); |
return f + ": " + data.group + " (" + data.models.size() + " " + l + ")"; |
if (Util.isEmptyString(data.group)) return f + ": aucune (" + data.models.size() + " " + l + ")"; |
else return f + ": " + data.group + " (" + data.models.size() + " " + l + ")"; |
} |
}); |
176,11 → 179,14 |
// FIXME : créer une classe Ontologie qui mixe le code ci-dessous et tout ce qui concerne l'ontologie dans DetailVue |
String type = ""; |
String[] valeurs = model.getCollectionACommentaire().getType().split(aDonnee.SEPARATEUR_VALEURS); |
int nbreValeurs = valeurs.length; |
int indexAvtDernier = nbreValeurs - 1; |
if (nbreValeurs > 0) { |
for (int i = 0; i < nbreValeurs; i++) { |
String valeur = valeurs[i]; |
if (valeur.matches("^[0-9]+$")) { |
if (valeur.equals("0")) { |
valeur = ""; |
198,6 → 204,7 |
} |
} |
} |
model.set("_type_", type); |
return type; |
} |
293,6 → 300,7 |
private void chargerListe() { |
if (commentaires != null) { |
List<Commentaire> liste = commentaires.toList(); |
store.removeAll(); |
store.add(liste); |
/trunk/src/org/tela_botanica/client/vues/commentaire/CommentaireDetailVue.java |
---|
9,6 → 9,7 |
import org.tela_botanica.client.modeles.projet.ProjetListe; |
import org.tela_botanica.client.vues.DetailVue; |
import com.extjs.gxt.ui.client.Style.Scroll; |
import com.extjs.gxt.ui.client.util.Format; |
import com.extjs.gxt.ui.client.util.Params; |
import com.extjs.gxt.ui.client.widget.ContentPanel; |
38,6 → 39,7 |
panneauPrincipal.setLayout(new FitLayout()); |
panneauPrincipal.setHeaderVisible(false); |
panneauPrincipal.setBodyBorder(false); |
panneauPrincipal.setScrollMode(Scroll.AUTO); |
entete = new Html(); |
entete.setId(ComposantId.ZONE_DETAIL_ENTETE); |
/trunk/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, 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())); |
} |
} |
} |
207,7 → 216,6 |
private Boolean etreValide() { |
Boolean valide = false; |
Debug.log("formulaire"+formulaireValideOk+" - Commentaire :"+commentaireValideOk); |
if (formulaireValideOk && commentaireValideOk) { |
valide = true; |
} |
/trunk/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); |
} |
/trunk/src/org/tela_botanica/client/vues/publication/PublicationForm.java |
---|
6,11 → 6,15 |
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; |
import org.tela_botanica.client.modeles.MenuApplicationId; |
import org.tela_botanica.client.modeles.Valeur; |
import org.tela_botanica.client.modeles.aDonnee; |
import org.tela_botanica.client.modeles.personne.Personne; |
import org.tela_botanica.client.modeles.personne.PersonneListe; |
22,6 → 26,7 |
import org.tela_botanica.client.modeles.structure.Structure; |
import org.tela_botanica.client.modeles.structure.StructureListe; |
import org.tela_botanica.client.synchronisation.Sequenceur; |
import org.tela_botanica.client.util.Debug; |
import org.tela_botanica.client.util.Pattern; |
import org.tela_botanica.client.util.UtilArray; |
import org.tela_botanica.client.util.UtilString; |
32,6 → 37,9 |
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; |
42,6 → 50,8 |
import com.extjs.gxt.ui.client.store.ListStore; |
import com.extjs.gxt.ui.client.store.Store; |
import com.extjs.gxt.ui.client.store.StoreEvent; |
import com.extjs.gxt.ui.client.widget.ContentPanel; |
import com.extjs.gxt.ui.client.widget.HorizontalPanel; |
import com.extjs.gxt.ui.client.widget.Info; |
import com.extjs.gxt.ui.client.widget.LayoutContainer; |
import com.extjs.gxt.ui.client.widget.MessageBox; |
55,10 → 65,16 |
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.grid.CellEditor; |
import com.extjs.gxt.ui.client.widget.grid.ColumnConfig; |
import com.extjs.gxt.ui.client.widget.grid.ColumnData; |
import com.extjs.gxt.ui.client.widget.grid.ColumnModel; |
import com.extjs.gxt.ui.client.widget.grid.EditorGrid; |
import com.extjs.gxt.ui.client.widget.grid.Grid; |
import com.extjs.gxt.ui.client.widget.grid.GridCellRenderer; |
import com.extjs.gxt.ui.client.widget.grid.GridSelectionModel; |
import com.extjs.gxt.ui.client.widget.grid.RowExpander; |
import com.extjs.gxt.ui.client.widget.grid.RowNumberer; |
import com.extjs.gxt.ui.client.widget.layout.FitLayout; |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout; |
import com.extjs.gxt.ui.client.widget.layout.FormData; |
77,12 → 93,12 |
private Publication publication; |
// Relatives aux auteurs |
private LayoutContainer auteursFieldset = null; |
private PersonneListe auteursInitialListe = null; |
private PersonneListe auteursAjoutes = null; |
private PersonneListe auteursSupprimes = null; |
private ComboBox<Projet> projetsCombo = null; |
private ContentPanel auteursFieldset = null; |
private ChampComboBoxRechercheTempsReelPaginable projetsCombo = null; |
private ArrayList<ComboBox<Personne>> auteurComboboxListe = null; |
private ListStore<Personne> auteursStorePartage = null; |
92,7 → 108,7 |
private TextField<String> uriChp = null; |
private FieldSet editionFieldset = null; |
private ComboBox<Structure> editeurCombobox = null; |
private ChampComboBoxRechercheTempsReelPaginable editeurCombobox = null; |
private TextField<String> datePublicationChp = null; |
private TextField<String> tomeChp = null; |
private TextField<String> fasciculeChp = null; |
468,8 → 484,10 |
private void creerZoneAuteurs() { |
// Fieldset Auteur |
auteursFieldset = new LayoutContainer(new FitLayout()); |
auteursFieldset = new ContentPanel(); |
auteursFieldset.setLayout(new FitLayout()); |
auteursFieldset.setHeading("Auteurs"); |
auteurComboboxListe = new ArrayList<ComboBox<Personne>>(0); |
mediateur.clicObtenirListeAuteurs(this); |
479,7 → 497,7 |
private void creerChampsAuteur() { |
auteursFieldset.removeAll(); |
barreOutils = creerBarreOutilsGrille(); |
panneauFormulaire.setTopComponent(barreOutils); |
auteursFieldset.setTopComponent(barreOutils); |
grille = creerGrille(); |
auteursFieldset.add(grille); |
auteursFieldset.layout(); |
513,18 → 531,30 |
generalitesFieldset.setHeading("Informations générales"); |
generalitesFieldset.setCollapsible(true); |
generalitesFieldset.setLayout(layout); |
ModelType modelTypeProjets = new ModelType(); |
modelTypeProjets.setRoot("projets"); |
modelTypeProjets.setTotalName("nbElements"); |
modelTypeProjets.addField("cpr_nom"); |
modelTypeProjets.addField("cpr_id_projet"); |
projetsCombo = new ComboBox<Projet>(); |
projetsCombo.setTabIndex(tabIndex++); |
projetsCombo.setFieldLabel(i18nC.projetChamp()); |
projetsCombo.setDisplayField("nom"); |
projetsCombo.setForceSelection(true); |
projetsCombo.setValidator(new Validator() { |
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); |
532,13 → 562,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, null); |
}); |
generalitesFieldset.add(projetsCombo, new FormData(600, 0)); |
titreChp = new TextField<String>(); |
titreChp.setName("cpu"); |
566,17 → 591,30 |
editionFieldset.setCollapsible(true); |
editionFieldset.setLayout(layout); |
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); |
/*****************************************************/ |
/** Champ 'Editeur de la publication' **/ |
/*****************************************************/ |
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>(); |
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); |
585,14 → 623,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)"); |
604,17 → 651,10 |
// Si on a reçu les details d'une publication |
publication = (Publication) nouvellesDonnees; |
//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); |
} |
638,11 → 678,6 |
} |
} |
private void rafraichirListeEditeurs(StructureListe editeurs) { |
editeurCombobox.getStore().removeAll(); |
editeurCombobox.getStore().add((List<Structure>) editeurs.toList()); |
} |
private void rafraichirListeAuteurs(PublicationAPersonneListe auteurs) { |
Iterator<String> it = auteurs.keySet().iterator(); |
while (it.hasNext()) { |
834,9 → 869,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()); |
} |
} |
858,11 → 893,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); |
888,10 → 924,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; |
} |
981,17 → 1018,19 |
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() { |
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())); |
} |
} |
} |
/trunk/src/org/tela_botanica/client/vues/EnteteVue.java |
---|
78,7 → 78,6 |
barreBoutons.add(feedbackBouton); |
barreBoutons.add(applisBouton); |
add(getTitre(), new RowData(.20, 1)); |
add(barreBoutons, new RowData(.8, 1)); |
/trunk/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; |
242,23 → 245,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, sequenceur); |
left.add(fsProjet); |
871,6 → 879,8 |
if (info.getDonnee(0) != null) { |
personneSelectionnee.setId(info.getDonnee(0).toString()); |
GWT.log("Ajout de la personne " + personneSelectionnee.getId(), null); |
this.personne = personneSelectionnee; |
this.personneId = personneSelectionnee.getId(); |
InfoLogger.display("Enregistrement", "La personne a été ajoutée (id: " + personneSelectionnee.getId() + ")"); |
repandreRafraichissement(); |
if (clicBoutonvalidation) { |
901,6 → 911,9 |
mettreAJourPersonne(personne); |
this.personne = personne; |
this.personneId = personne.getId(); |
nouvellesDonnees = null; |
} else { |
InfoLogger.display("messages", info.getMessages().toString()); |
988,10 → 1001,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 → 1202,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()); |
} |
1254,41 → 1266,21 |
} |
personneSelectionnee.setFmtNomComplet(strPrefixe, strSuffixe); |
//Verifier que la date est soit JJ/MM/AAAA soit AAAA |
/** NAISSANCE **/ |
String valeurDateNaissance = (String) hmIdentite.getTextField("tfDateNaissance").getValue(); |
if (!UtilString.isEmpty(valeurDateNaissance)) { |
if (valeurDateNaissance.matches("\\d{2}/\\d{2}/\\d{4}")) { |
Date naissanceDate = DateTimeFormat.getFormat("dd/MM/yyyy").parse(valeurDateNaissance); |
personneSelectionnee.setNaissanceDate(naissanceDate); |
} else if (valeurDateNaissance.matches("\\d{4}")) { |
personneSelectionnee.set("naissance_date", valeurDateNaissance + "-00-00"); |
} else { |
lstMessageErreur.add("La date de naissance n'est pas au format jj/mm/AAAA ou AAAA."); |
} |
} |
traiterDate("naissance", valeurDateNaissance, personneSelectionnee, lstMessageErreur); |
/** DECES **/ |
Radio rbEstDecedee = hmIdentite.getRadio("rbEstDecedee"); |
if (rbEstDecedee.getValue() == true) { |
if (rbEstDecedee.getValue() == true) { |
// date |
String valeurDateDeces = (String) hmIdentite.getTextField("tfDateDeces").getValue(); |
traiterDate("décès", valeurDateDeces, personneSelectionnee, lstMessageErreur); |
// lieu |
String decesLieu = (String) hmIdentite.getTextField("tfLieuDeces").getValue(); |
//Verifier que la date est soit JJ/MM/AAAA soit AAAA |
Date dateDeces = null; |
String valeurDateDeces = (String) hmIdentite.getTextField("tfDateDeces").getValue(); |
if (!UtilString.isEmpty(valeurDateDeces)) { |
if (valeurDateDeces.matches("\\d{2}/\\d{2}/\\d{4}")) { |
dateDeces = DateTimeFormat.getFormat("dd/MM/yyyy").parse(valeurDateDeces); |
personneSelectionnee.setDeces(dateDeces, decesLieu); |
} else if (valeurDateDeces.matches("\\d{4}")) { |
personneSelectionnee.set("deces_date", valeurDateDeces + "-00-00"); |
personneSelectionnee.setDecesLieu(decesLieu); |
} else { |
lstMessageErreur.add("La date de deces n'est pas au format jj/mm/AAAA ou AAAA."); |
} |
} |
} else { |
personneSelectionnee.setDecesLieu(decesLieu); |
} else { |
personneSelectionnee.setNonDecedee(); |
} |
1333,4 → 1325,75 |
return success; |
} |
private void traiterDate(String typeDate, String date, Personne personneSelectionnee, LinkedList<String> lstMessageErreur) { |
String valeurDate = date; |
if (!UtilString.isEmpty(valeurDate)){ |
String jour = ""; |
String mois = ""; |
String annee = ""; |
/** JJ/MM/AAAA **/ |
if (valeurDate.matches("\\d{2}/\\d{2}/\\d{4}")) { |
jour = valeurDate.substring(0,2); |
mois = valeurDate.substring(3,5); |
annee = valeurDate.substring(6,10); |
String dateComplete = annee+"-"+mois+"-"+jour; |
if (jour == "00" || mois == "00" || annee == "0000") { |
lstMessageErreur.add("La date de "+typeDate+" n'est pas au format JJ/MM/AAAA ou MM/AAAA ou AAAA."); |
} |
else { |
if (typeDate=="naissance") { |
Date naissanceDate = DateTimeFormat.getFormat("dd/MM/yyyy").parse(valeurDate); |
personneSelectionnee.setNaissanceDate(naissanceDate); |
} else if (typeDate=="décès") { |
Date decesDate = DateTimeFormat.getFormat("dd/MM/yyyy").parse(valeurDate); |
personneSelectionnee.setDecesDate(decesDate); |
} |
} |
/** MM/AAAA **/ |
} else if (valeurDate.matches("\\d{2}/\\d{4}")) { |
jour = "00"; |
mois = valeurDate.substring(0,2); |
annee = valeurDate.substring(3,7); |
String dateComplete = annee+"-"+mois+"-"+jour; |
if (mois == "00" || annee == "0000") { |
lstMessageErreur.add("La date de "+typeDate+" n'est pas au format JJ/MM/AAAA ou MM/AAAA ou AAAA."); |
} |
else { |
if (typeDate=="naissance") personneSelectionnee.set("naissance_date", dateComplete); |
else if (typeDate=="décès") { |
personneSelectionnee.set("deces_date", dateComplete); |
personneSelectionnee.set("ce_deces", personneSelectionnee.ETRE_DECEDE); |
} |
} |
} |
/** AAAA **/ |
else if (valeurDate.matches("\\d{4}")) { |
if (valeurDate == "0000") { |
lstMessageErreur.add("La date de "+typeDate+" n'est pas au format JJ/MM/AAAA ou MM/AAAA ou AAAA."); |
} |
else { |
if (typeDate=="naissance") personneSelectionnee.set("naissance_date", valeurDate + "-00-00"); |
else if (typeDate=="décès") { |
personneSelectionnee.set("deces_date", valeurDate + "-00-00"); |
personneSelectionnee.set("ce_deces", personneSelectionnee.ETRE_DECEDE); |
} |
} |
} else { |
lstMessageErreur.add("La date de "+typeDate+" n'est pas au format JJ/MM/AAAA ou MM/AAAA ou AAAA."); |
} |
} |
} |
public Personne getPersonne() { |
return this.personne; |
} |
public String getPersonneId() { |
return this.personneId; |
} |
} |