Line 1... |
Line 1... |
1 |
package org.tela_botanica.client.vues.collection;
|
1 |
package org.tela_botanica.client.vues.collection;
|
Line -... |
Line 2... |
- |
|
2 |
|
- |
|
3 |
import java.util.HashMap;
|
- |
|
4 |
import java.util.Iterator;
|
2 |
|
5 |
|
3 |
import org.tela_botanica.client.Mediateur;
|
6 |
import org.tela_botanica.client.Mediateur;
|
4 |
import org.tela_botanica.client.composants.ChampCaseACocher;
|
7 |
import org.tela_botanica.client.composants.ChampCaseACocher;
|
5 |
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
|
8 |
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
|
6 |
import org.tela_botanica.client.composants.ChampSliderPourcentage;
|
9 |
import org.tela_botanica.client.composants.ChampSliderPourcentage;
|
7 |
import org.tela_botanica.client.composants.ConteneurMultiChamps;
|
10 |
import org.tela_botanica.client.composants.ConteneurMultiChamps;
|
8 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
11 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
- |
|
12 |
import org.tela_botanica.client.modeles.aDonnee;
|
- |
|
13 |
import org.tela_botanica.client.modeles.collection.Collection;
|
- |
|
14 |
import org.tela_botanica.client.modeles.collection.CollectionBotanique;
|
- |
|
15 |
import org.tela_botanica.client.util.Debug;
|
- |
|
16 |
import org.tela_botanica.client.util.Pattern;
|
- |
|
17 |
import org.tela_botanica.client.util.UtilDate;
|
9 |
import org.tela_botanica.client.modeles.ValeurListe;
|
18 |
import org.tela_botanica.client.util.UtilString;
|
10 |
import org.tela_botanica.client.vues.Formulaire;
|
19 |
import org.tela_botanica.client.vues.Formulaire;
|
Line 11... |
Line 20... |
11 |
import org.tela_botanica.client.vues.FormulaireOnglet;
|
20 |
import org.tela_botanica.client.vues.FormulaireOnglet;
|
12 |
|
21 |
|
13 |
import com.extjs.gxt.ui.client.util.Margins;
|
22 |
import com.extjs.gxt.ui.client.util.Margins;
|
14 |
import com.extjs.gxt.ui.client.widget.Text;
|
23 |
import com.extjs.gxt.ui.client.widget.Text;
|
15 |
import com.extjs.gxt.ui.client.widget.form.DateField;
|
24 |
import com.extjs.gxt.ui.client.widget.form.DateField;
|
16 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
25 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
17 |
import com.extjs.gxt.ui.client.widget.form.TextArea;
|
26 |
import com.extjs.gxt.ui.client.widget.form.TextArea;
|
18 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
- |
|
Line 19... |
Line 27... |
19 |
import com.extjs.gxt.ui.client.widget.layout.HBoxLayoutData;
|
27 |
import com.extjs.gxt.ui.client.widget.layout.FormData;
|
Line -... |
Line 28... |
- |
|
28 |
import com.extjs.gxt.ui.client.widget.layout.HBoxLayoutData;
|
- |
|
29 |
|
- |
|
30 |
public class CollectionFormContenu extends FormulaireOnglet implements Rafraichissable {
|
- |
|
31 |
|
- |
|
32 |
private Collection collection = null;
|
20 |
import com.google.gwt.core.client.GWT;
|
33 |
private CollectionBotanique collectionBotanique = null;
|
21 |
|
34 |
private Collection collectionCollectee = null;
|
22 |
public class CollectionFormContenu extends FormulaireOnglet implements Rafraichissable {
|
35 |
private CollectionBotanique collectionBotaniqueCollectee = null;
|
23 |
|
36 |
|
24 |
private ChampCaseACocher natureChp = null;
|
37 |
private ChampCaseACocher natureChp = null;
|
Line 170... |
Line 183... |
170 |
etiquetteFieldSet.add(etiquetteAnnotationChp, new FormData(550, 0));
|
183 |
etiquetteFieldSet.add(etiquetteAnnotationChp, new FormData(550, 0));
|
Line 171... |
Line 184... |
171 |
|
184 |
|
172 |
add(etiquetteFieldSet);
|
185 |
add(etiquetteFieldSet);
|
Line -... |
Line 186... |
- |
|
186 |
}
|
- |
|
187 |
|
- |
|
188 |
private String collecterEtiquetteRenseignement() {
|
- |
|
189 |
String renseignement = "";
|
- |
|
190 |
renseignement += creerTypeValeur("AT", auteurTitrePourcentChp.getValeur());
|
- |
|
191 |
renseignement += creerTypeValeur("F", famillePourcentChp.getValeur());
|
- |
|
192 |
renseignement += creerTypeValeur("G", genrePourcentChp.getValeur());
|
- |
|
193 |
renseignement += creerTypeValeur("SP", spPourcentChp.getValeur());
|
- |
|
194 |
renseignement += creerTypeValeur("ASP", auteurSpPourcentChp.getValeur());
|
- |
|
195 |
renseignement += creerTypeValeur("L", localitePourcentChp.getValeur());
|
- |
|
196 |
renseignement += creerTypeValeur("D", datePourcentChp.getValeur());
|
- |
|
197 |
renseignement = renseignement.replaceFirst(aDonnee.SEPARATEUR_VALEURS+"$", "");
|
- |
|
198 |
return renseignement;
|
- |
|
199 |
}
|
- |
|
200 |
|
- |
|
201 |
private String creerTypeValeur(String type, String valeur) {
|
- |
|
202 |
String retour = "";
|
- |
|
203 |
if (!UtilString.isEmpty(valeur)) {
|
- |
|
204 |
retour = type+aDonnee.SEPARATEUR_TYPE_VALEUR+valeur+aDonnee.SEPARATEUR_VALEURS;
|
- |
|
205 |
}
|
- |
|
206 |
return retour;
|
- |
|
207 |
}
|
- |
|
208 |
|
- |
|
209 |
private void peuplerEtiquetteRenseignement(String valeurTruk) {
|
- |
|
210 |
HashMap<String,String> infos = parserEtiquetteRenseignement(valeurTruk);
|
- |
|
211 |
if (infos != null) {
|
- |
|
212 |
Iterator<String> it = infos.keySet().iterator();
|
- |
|
213 |
while (it.hasNext()) {
|
- |
|
214 |
String cle = it.next();
|
- |
|
215 |
if (cle.equals("AT")) {
|
- |
|
216 |
auteurTitrePourcentChp.peupler(infos.get(cle));
|
- |
|
217 |
} else if (cle.equals("F")) {
|
- |
|
218 |
famillePourcentChp.peupler(infos.get(cle));
|
- |
|
219 |
} else if (cle.equals("G")) {
|
- |
|
220 |
genrePourcentChp.peupler(infos.get(cle));
|
- |
|
221 |
} else if (cle.equals("SP")) {
|
- |
|
222 |
spPourcentChp.peupler(infos.get(cle));
|
- |
|
223 |
} else if (cle.equals("ASP")) {
|
- |
|
224 |
auteurSpPourcentChp.peupler(infos.get(cle));
|
- |
|
225 |
} else if (cle.equals("L")) {
|
- |
|
226 |
localitePourcentChp.peupler(infos.get(cle));
|
- |
|
227 |
} else if (cle.equals("D")) {
|
- |
|
228 |
genrePourcentChp.peupler(infos.get(cle));
|
- |
|
229 |
}
|
- |
|
230 |
}
|
- |
|
231 |
}
|
- |
|
232 |
}
|
- |
|
233 |
|
- |
|
234 |
private HashMap<String,String> parserEtiquetteRenseignement(String valeurTruk) {
|
- |
|
235 |
HashMap<String,String> infos = null;
|
- |
|
236 |
if (!UtilString.isEmpty(valeurTruk)) {
|
- |
|
237 |
infos = new HashMap<String,String>();
|
- |
|
238 |
String[] pourcentages = valeurTruk.split(Pattern.quote(aDonnee.SEPARATEUR_VALEURS));
|
- |
|
239 |
for (int i = 0; i < pourcentages.length; i++) {
|
- |
|
240 |
String[] pourcentageIdValeur = pourcentages[i].split(Pattern.quote(aDonnee.SEPARATEUR_TYPE_VALEUR));
|
- |
|
241 |
String id = pourcentageIdValeur[0];
|
- |
|
242 |
String valeur = pourcentageIdValeur[1];
|
- |
|
243 |
infos.put(id, valeur);
|
- |
|
244 |
}
|
- |
|
245 |
}
|
- |
|
246 |
return infos;
|
173 |
}
|
247 |
}
|
174 |
|
248 |
|
175 |
private void creerFieldsetIntegration() {
|
249 |
private void creerFieldsetIntegration() {
|
176 |
FieldSet integrationFieldSet = new FieldSet();
|
250 |
FieldSet integrationFieldSet = new FieldSet();
|
177 |
integrationFieldSet.setHeading("Collections intégrées");
|
251 |
integrationFieldSet.setHeading("Collections intégrées");
|
Line 188... |
Line 262... |
188 |
integrationFieldSet.add(infoIntegration);
|
262 |
integrationFieldSet.add(infoIntegration);
|
Line 189... |
Line 263... |
189 |
|
263 |
|
190 |
add(integrationFieldSet);
|
264 |
add(integrationFieldSet);
|
Line 191... |
Line 265... |
191 |
}
|
265 |
}
|
- |
|
266 |
|
192 |
|
267 |
public void peupler() {
|
193 |
public void rafraichir(Object nouvellesDonnees) {
|
268 |
initialiserCollection();
|
194 |
if (nouvellesDonnees instanceof ValeurListe) {
|
269 |
if (collectionBotanique != null) {
|
- |
|
270 |
natureChp.peupler(collectionBotaniqueCollectee.getNature());
|
- |
|
271 |
specialiteChp.setValue(collectionBotaniqueCollectee.getSpecialite());
|
- |
|
272 |
|
- |
|
273 |
periodeConstitutionChp.peupler(collectionCollectee.getPeriodeConstitution());
|
- |
|
274 |
dateDebutChp.setValue(UtilString.formaterEnDate(collectionBotaniqueCollectee.getRecolteDateDebut()));
|
- |
|
275 |
dateDebutCombo.peupler(collectionBotaniqueCollectee.getRecolteDateDebutType());
|
195 |
ValeurListe listeValeurs = (ValeurListe) nouvellesDonnees;
|
276 |
dateFinChp.setValue(UtilString.formaterEnDate(collectionBotaniqueCollectee.getRecolteDateFin()));
|
- |
|
277 |
dateFinCombo.peupler(collectionBotaniqueCollectee.getRecolteDateFinType());
|
196 |
rafraichirValeurListe(listeValeurs);
|
278 |
|
- |
|
279 |
etatClassementCombo.peupler(collectionBotaniqueCollectee.getClassementEtat());
|
- |
|
280 |
annotationClassementChp.setValue(collectionBotaniqueCollectee.getClassementAnnotation());
|
- |
|
281 |
|
- |
|
282 |
peuplerEtiquetteRenseignement(collectionBotaniqueCollectee.getEtiquetteRenseignement());
|
- |
|
283 |
precisionLocaliteCombo.peupler(collectionBotaniqueCollectee.getPrecisionLocalite());
|
- |
|
284 |
precisionDateCombo.peupler(collectionBotaniqueCollectee.getPrecisionDate());
|
- |
|
285 |
etiquetteAnnotationChp.setValue(collectionBotaniqueCollectee.getAnnotationsDiverses());
|
- |
|
286 |
|
197 |
} else {
|
287 |
integreCollectionCombo.peupler(collectionBotaniqueCollectee.getCollectionIntegre());
|
198 |
GWT.log(Mediateur.i18nM.erreurRafraichir(nouvellesDonnees.getClass(), this.getClass()), null);
|
288 |
infoIntegreCollectionCombo.peupler(collectionBotaniqueCollectee.getCollectionIntegreInfo());
|
Line -... |
Line 289... |
- |
|
289 |
}
|
- |
|
290 |
}
|
- |
|
291 |
|
199 |
}
|
292 |
public void collecter() {
|
200 |
}
|
293 |
initialiserCollection();
|
- |
|
294 |
if (etreAccede()) {
|
- |
|
295 |
collectionBotaniqueCollectee.setNature(natureChp.getValeur());
|
- |
|
296 |
collectionBotaniqueCollectee.setSpecialite(specialiteChp.getValue());
|
- |
|
297 |
|
- |
|
298 |
collectionCollectee.setPeriodeConstitution(periodeConstitutionChp.getValeur());
|
- |
|
299 |
collectionBotaniqueCollectee.setRecolteDateDebut(UtilDate.formaterEnString(dateDebutChp.getValue()));
|
Line -... |
Line 300... |
- |
|
300 |
collectionBotaniqueCollectee.setRecolteDateDebutType(dateDebutCombo.getValeur());
|
- |
|
301 |
collectionBotaniqueCollectee.setRecolteDateFin(UtilDate.formaterEnString(dateFinChp.getValue()));
|
- |
|
302 |
collectionBotaniqueCollectee.setRecolteDateFinType(dateFinCombo.getValeur());
|
- |
|
303 |
|
- |
|
304 |
collectionBotaniqueCollectee.setClassementEtat(etatClassementCombo.getValeur());
|
- |
|
305 |
collectionBotaniqueCollectee.setClassementAnnotation(annotationClassementChp.getValue());
|
- |
|
306 |
|
- |
|
307 |
collectionBotaniqueCollectee.setEtiquetteRenseignement(collecterEtiquetteRenseignement());
|
- |
|
308 |
collectionBotaniqueCollectee.setPrecisionLocalite(precisionLocaliteCombo.getValeur());
|
- |
|
309 |
collectionBotaniqueCollectee.setPrecisionDate(precisionDateCombo.getValeur());
|
201 |
|
310 |
collectionBotaniqueCollectee.setAnnotationsDiverses(etiquetteAnnotationChp.getValue());
|
- |
|
311 |
|
- |
|
312 |
collectionBotaniqueCollectee.setCollectionIntegre(integreCollectionCombo.getValeur());
|
- |
|
313 |
collectionBotaniqueCollectee.setCollectionIntegreInfo(infoIntegreCollectionCombo.getValeur());
|
- |
|
314 |
}
|
- |
|
315 |
}
|
- |
|
316 |
|
- |
|
317 |
private void initialiserCollection() {
|
- |
|
318 |
collection = ((CollectionForm) formulaire).collection;
|
- |
|
319 |
if (collection != null) {
|
- |
|
320 |
collectionBotanique = collection.getBotanique();
|
202 |
private void rafraichirValeurListe(ValeurListe listeValeurs) {
|
321 |
}
|
203 |
if (listeValeurs.getId().equals(config.getListeId(""))) {
|
322 |
|
204 |
|
323 |
collectionCollectee = ((CollectionForm) formulaire).collectionCollectee;
|
- |
|
324 |
if (collectionCollectee != null) {
|
- |
|
325 |
collectionBotaniqueCollectee = collectionCollectee.getBotanique();
|
- |
|
326 |
}
|
- |
|
327 |
}
|
205 |
} else {
|
328 |
|
206 |
GWT.log("Gestion de la liste "+listeValeurs.getId()+" non implémenté!", null);
|
329 |
public void rafraichir(Object nouvellesDonnees) {
|