Line 62... |
Line 62... |
62 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
62 |
import com.extjs.gxt.ui.client.widget.MessageBox;
|
Line 63... |
Line 63... |
63 |
|
63 |
|
64 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
64 |
import com.extjs.gxt.ui.client.widget.ContentPanel;
|
65 |
import org.tela_botanica.client.composants.InfoLogger;
|
65 |
import org.tela_botanica.client.composants.InfoLogger;
|
- |
|
66 |
import org.tela_botanica.client.composants.pagination.Proxy;
|
66 |
import org.tela_botanica.client.composants.pagination.Proxy;
|
67 |
import org.tela_botanica.client.composants.pagination.ProxyProjets;
|
67 |
import org.tela_botanica.client.composants.pagination.ProxyValeur;
|
68 |
import org.tela_botanica.client.composants.pagination.ProxyValeur;
|
Line 68... |
Line 69... |
68 |
import org.tela_botanica.client.composants.pagination.TransformateurJSONaModelData;
|
69 |
import org.tela_botanica.client.composants.pagination.TransformateurJSONaModelData;
|
69 |
|
70 |
|
Line 73... |
Line 74... |
73 |
|
74 |
|
74 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
75 |
import com.extjs.gxt.ui.client.widget.button.Button;
|
75 |
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
|
76 |
import com.extjs.gxt.ui.client.widget.button.ButtonBar;
|
76 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
77 |
import com.extjs.gxt.ui.client.widget.form.ComboBox;
|
- |
|
78 |
import com.extjs.gxt.ui.client.widget.form.DateField;
|
77 |
import com.extjs.gxt.ui.client.widget.form.DateField;
|
79 |
import com.extjs.gxt.ui.client.widget.form.Field;
|
78 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
80 |
import com.extjs.gxt.ui.client.widget.form.FieldSet;
|
79 |
import com.extjs.gxt.ui.client.widget.form.LabelField;
|
81 |
import com.extjs.gxt.ui.client.widget.form.LabelField;
|
80 |
import com.extjs.gxt.ui.client.widget.form.Radio;
|
82 |
import com.extjs.gxt.ui.client.widget.form.Radio;
|
81 |
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
|
83 |
import com.extjs.gxt.ui.client.widget.form.RadioGroup;
|
82 |
import com.extjs.gxt.ui.client.widget.form.TextArea;
|
84 |
import com.extjs.gxt.ui.client.widget.form.TextArea;
|
- |
|
85 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
83 |
import com.extjs.gxt.ui.client.widget.form.TextField;
|
86 |
import com.extjs.gxt.ui.client.widget.form.Validator;
|
84 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
87 |
import com.extjs.gxt.ui.client.widget.form.ComboBox.TriggerAction;
|
85 |
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
|
88 |
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
|
86 |
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
|
89 |
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
|
87 |
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
|
90 |
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
|
Line 240... |
Line 243... |
240 |
// Fieldset PROJET
|
243 |
// Fieldset PROJET
|
241 |
FieldSet fsProjet = new FieldSet();
|
244 |
FieldSet fsProjet = new FieldSet();
|
242 |
fsProjet.setHeading(i18nC.menuProjet());
|
245 |
fsProjet.setHeading(i18nC.menuProjet());
|
243 |
fsProjet.setLayout(new FormLayout());
|
246 |
fsProjet.setLayout(new FormLayout());
|
Line 244... |
Line 247... |
244 |
|
247 |
|
245 |
ListStore<Projet> storeProjets = new ListStore<Projet>();
|
248 |
ModelType modelTypeProjets = new ModelType();
|
246 |
ComboBox cbProjets = new ComboBox<Projet>();
|
249 |
modelTypeProjets.setRoot("projets");
|
247 |
cbProjets.setFieldLabel(i18nC.personneProjet()+ " :");
|
250 |
modelTypeProjets.setTotalName("nbElements");
|
248 |
cbProjets.setEmptyText(i18nC.txtListeProjetDefaut());
|
251 |
modelTypeProjets.addField("cpr_nom");
|
- |
|
252 |
modelTypeProjets.addField("cpr_id_projet");
|
249 |
cbProjets.setLabelSeparator("");
|
253 |
|
- |
|
254 |
String displayNameProjets = "cpr_nom";
|
- |
|
255 |
ProxyProjets<ModelData> proxyProjets = new ProxyProjets<ModelData>();
|
- |
|
256 |
|
250 |
cbProjets.setDisplayField("nom");
|
257 |
ChampComboBoxRechercheTempsReelPaginable cbProjets = new ChampComboBoxRechercheTempsReelPaginable(proxyProjets, modelTypeProjets, displayNameProjets);
|
251 |
cbProjets.setEditable(false);
|
258 |
cbProjets.setWidth(100, 600);
|
252 |
cbProjets.setTriggerAction(TriggerAction.ALL);
|
259 |
cbProjets.getCombo().setTabIndex(tabIndex++);
|
253 |
cbProjets.setStore(storeProjets);
|
260 |
cbProjets.getCombo().setFieldLabel(i18nC.personneProjet());
|
254 |
cbProjets.setAllowBlank(false);
|
261 |
cbProjets.getCombo().setEmptyText(i18nC.txtListeProjetDefaut());
|
255 |
cbProjets.addStyleName(ComposantClass.OBLIGATOIRE);
|
262 |
cbProjets.getCombo().addStyleName(ComposantClass.OBLIGATOIRE);
|
256 |
cbProjets.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
263 |
cbProjets.getCombo().addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
|
- |
|
264 |
cbProjets.getCombo().setAllowBlank(false);
|
Line 257... |
Line 265... |
257 |
fsProjet.add(cbProjets, new FormData(250, 0));
|
265 |
cbProjets.getCombo().setEditable(false);
|
Line 258... |
Line 266... |
258 |
|
266 |
|
Line 259... |
Line 267... |
259 |
hmIdentite.put("cbProjets", cbProjets);
|
267 |
fsProjet.add(cbProjets, new FormData(600, 0));
|
Line 260... |
Line 268... |
260 |
|
268 |
|
261 |
mediateur.selectionnerProjet(this, null, sequenceur);
|
269 |
hmIdentite.put("cbProjets", cbProjets);
|
Line 869... |
Line 877... |
869 |
Information info = (Information) nouvellesDonnees;
|
877 |
Information info = (Information) nouvellesDonnees;
|
870 |
if (info.getType().equals("ajout_personne")) {
|
878 |
if (info.getType().equals("ajout_personne")) {
|
871 |
if (info.getDonnee(0) != null) {
|
879 |
if (info.getDonnee(0) != null) {
|
872 |
personneSelectionnee.setId(info.getDonnee(0).toString());
|
880 |
personneSelectionnee.setId(info.getDonnee(0).toString());
|
873 |
GWT.log("Ajout de la personne " + personneSelectionnee.getId(), null);
|
881 |
GWT.log("Ajout de la personne " + personneSelectionnee.getId(), null);
|
- |
|
882 |
this.personne = personneSelectionnee;
|
- |
|
883 |
this.personneId = personneSelectionnee.getId();
|
874 |
InfoLogger.display("Enregistrement", "La personne a été ajoutée (id: " + personneSelectionnee.getId() + ")");
|
884 |
InfoLogger.display("Enregistrement", "La personne a été ajoutée (id: " + personneSelectionnee.getId() + ")");
|
875 |
repandreRafraichissement();
|
885 |
repandreRafraichissement();
|
876 |
if (clicBoutonvalidation) {
|
886 |
if (clicBoutonvalidation) {
|
877 |
mediateur.clicMenu(menuIdCourant);
|
887 |
mediateur.clicMenu(menuIdCourant);
|
878 |
}
|
888 |
}
|
Line 899... |
Line 909... |
899 |
|
909 |
|
Line 900... |
Line 910... |
900 |
binderPersonne(personne);
|
910 |
binderPersonne(personne);
|
Line -... |
Line 911... |
- |
|
911 |
|
- |
|
912 |
mettreAJourPersonne(personne);
|
- |
|
913 |
|
901 |
|
914 |
this.personne = personne;
|
902 |
mettreAJourPersonne(personne);
|
915 |
this.personneId = personne.getId();
|
903 |
|
916 |
|
904 |
nouvellesDonnees = null;
|
917 |
nouvellesDonnees = null;
|
905 |
} else {
|
918 |
} else {
|
Line 987... |
Line 1000... |
987 |
}
|
1000 |
}
|
Line 988... |
Line 1001... |
988 |
|
1001 |
|
Line 989... |
Line 1002... |
989 |
private void mettreAJourPersonne(Personne personne) {
|
1002 |
private void mettreAJourPersonne(Personne personne) {
|
990 |
|
- |
|
991 |
//Mise à jour de la personne
|
1003 |
|
992 |
//Personne personne = (Personne) nouvellesDonnees;
|
1004 |
//Mise à jour de la personne
|
Line 993... |
Line 1005... |
993 |
ComboBox cbProjets = hmIdentite.getComboBox("cbProjets");
|
1005 |
ChampComboBoxRechercheTempsReelPaginable cbProjets = hmIdentite.getComboBoxRechercheTempsReelPaginable("cbProjets");
|
994 |
cbProjets.setValue(cbProjets.getStore().findModel("id_projet", personne.get("ce_projet")));
|
1006 |
cbProjets.getCombo().setValue(cbProjets.getStore().findModel("cpr_id_projet", personne.get("ce_projet")));
|
995 |
|
1007 |
|
Line 1188... |
Line 1200... |
1188 |
|
1200 |
|
1189 |
public boolean verifierFormulaire() {
|
1201 |
public boolean verifierFormulaire() {
|
1190 |
boolean success = true;
|
1202 |
boolean success = true;
|
Line 1191... |
Line 1203... |
1191 |
LinkedList<String> lstMessageErreur = new LinkedList<String>();
|
1203 |
LinkedList<String> lstMessageErreur = new LinkedList<String>();
|
1192 |
|
- |
|
1193 |
ComboBox<Projet> cbProjets = hmIdentite.getComboBox("cbProjets");
|
1204 |
|
1194 |
Projet projet = cbProjets.getValue();
|
1205 |
ChampComboBoxRechercheTempsReelPaginable cbProjets = hmIdentite.getComboBoxRechercheTempsReelPaginable("cbProjets");
|
1195 |
if (projet == null) {
|
1206 |
if (cbProjets.getValeur() == null) {
|
- |
|
1207 |
lstMessageErreur.add("Le projet n'a pas été renseigné");
|
1196 |
lstMessageErreur.add("Le projet n'a pas été renseigné");
|
1208 |
} else {
|
1197 |
} else {
|
1209 |
Projet projet = new Projet(cbProjets.getValeur());
|
Line 1198... |
Line 1210... |
1198 |
personneSelectionnee.set("ce_projet", projet.getId());
|
1210 |
personneSelectionnee.set("ce_projet", projet.getId());
|
1199 |
}
|
1211 |
}
|
Line 1253... |
Line 1265... |
1253 |
strSuffixe = combo.getRawValue() +" ";
|
1265 |
strSuffixe = combo.getRawValue() +" ";
|
1254 |
}
|
1266 |
}
|
Line 1255... |
Line 1267... |
1255 |
|
1267 |
|
Line 1256... |
Line 1268... |
1256 |
personneSelectionnee.setFmtNomComplet(strPrefixe, strSuffixe);
|
1268 |
personneSelectionnee.setFmtNomComplet(strPrefixe, strSuffixe);
|
1257 |
|
1269 |
|
1258 |
//Verifier que la date est soit JJ/MM/AAAA soit AAAA
|
- |
|
1259 |
String valeurDateNaissance = (String) hmIdentite.getTextField("tfDateNaissance").getValue();
|
- |
|
1260 |
if (!UtilString.isEmpty(valeurDateNaissance)) {
|
- |
|
1261 |
if (valeurDateNaissance.matches("\\d{2}/\\d{2}/\\d{4}")) {
|
- |
|
1262 |
Date naissanceDate = DateTimeFormat.getFormat("dd/MM/yyyy").parse(valeurDateNaissance);
|
- |
|
1263 |
personneSelectionnee.setNaissanceDate(naissanceDate);
|
1270 |
/** NAISSANCE **/
|
1264 |
} else if (valeurDateNaissance.matches("\\d{4}")) {
|
- |
|
1265 |
personneSelectionnee.set("naissance_date", valeurDateNaissance + "-00-00");
|
- |
|
1266 |
} else {
|
- |
|
1267 |
lstMessageErreur.add("La date de naissance n'est pas au format jj/mm/AAAA ou AAAA.");
|
- |
|
Line -... |
Line 1271... |
- |
|
1271 |
String valeurDateNaissance = (String) hmIdentite.getTextField("tfDateNaissance").getValue();
|
1268 |
}
|
1272 |
traiterDate("naissance", valeurDateNaissance, personneSelectionnee, lstMessageErreur);
|
1269 |
}
|
1273 |
|
1270 |
|
- |
|
1271 |
Radio rbEstDecedee = hmIdentite.getRadio("rbEstDecedee");
|
- |
|
1272 |
if (rbEstDecedee.getValue() == true) {
|
- |
|
1273 |
|
- |
|
1274 |
String decesLieu = (String) hmIdentite.getTextField("tfLieuDeces").getValue();
|
1274 |
/** DECES **/
|
1275 |
|
1275 |
Radio rbEstDecedee = hmIdentite.getRadio("rbEstDecedee");
|
1276 |
//Verifier que la date est soit JJ/MM/AAAA soit AAAA
|
- |
|
1277 |
Date dateDeces = null;
|
- |
|
1278 |
String valeurDateDeces = (String) hmIdentite.getTextField("tfDateDeces").getValue();
|
- |
|
1279 |
if (!UtilString.isEmpty(valeurDateDeces)) {
|
1276 |
if (rbEstDecedee.getValue() == true) {
|
1280 |
if (valeurDateDeces.matches("\\d{2}/\\d{2}/\\d{4}")) {
|
1277 |
// date
|
1281 |
dateDeces = DateTimeFormat.getFormat("dd/MM/yyyy").parse(valeurDateDeces);
|
1278 |
String valeurDateDeces = (String) hmIdentite.getTextField("tfDateDeces").getValue();
|
1282 |
personneSelectionnee.setDeces(dateDeces, decesLieu);
|
1279 |
traiterDate("décès", valeurDateDeces, personneSelectionnee, lstMessageErreur);
|
1283 |
} else if (valeurDateDeces.matches("\\d{4}")) {
|
1280 |
// lieu
|
1284 |
personneSelectionnee.set("deces_date", valeurDateDeces + "-00-00");
|
- |
|
1285 |
personneSelectionnee.setDecesLieu(decesLieu);
|
- |
|
1286 |
} else {
|
- |
|
1287 |
lstMessageErreur.add("La date de deces n'est pas au format jj/mm/AAAA ou AAAA.");
|
- |
|
1288 |
}
|
- |
|
1289 |
}
|
1281 |
String decesLieu = (String) hmIdentite.getTextField("tfLieuDeces").getValue();
|
1290 |
|
1282 |
personneSelectionnee.setDecesLieu(decesLieu);
|
Line 1291... |
Line 1283... |
1291 |
} else {
|
1283 |
} else {
|
1292 |
personneSelectionnee.setNonDecedee();
|
1284 |
personneSelectionnee.setNonDecedee();
|
Line 1331... |
Line 1323... |
1331 |
success = false;
|
1323 |
success = false;
|
1332 |
}
|
1324 |
}
|
Line 1333... |
Line 1325... |
1333 |
|
1325 |
|
1334 |
return success;
|
1326 |
return success;
|
- |
|
1327 |
}
|
- |
|
1328 |
|
- |
|
1329 |
private void traiterDate(String typeDate, String date, Personne personneSelectionnee, LinkedList<String> lstMessageErreur) {
|
- |
|
1330 |
String valeurDate = date;
|
- |
|
1331 |
if (!UtilString.isEmpty(valeurDate)){
|
- |
|
1332 |
|
- |
|
1333 |
String jour = "";
|
- |
|
1334 |
String mois = "";
|
- |
|
1335 |
String annee = "";
|
- |
|
1336 |
|
- |
|
1337 |
/** JJ/MM/AAAA **/
|
- |
|
1338 |
if (valeurDate.matches("\\d{2}/\\d{2}/\\d{4}")) {
|
- |
|
1339 |
jour = valeurDate.substring(0,2);
|
- |
|
1340 |
mois = valeurDate.substring(3,5);
|
- |
|
1341 |
annee = valeurDate.substring(6,10);
|
- |
|
1342 |
String dateComplete = annee+"-"+mois+"-"+jour;
|
- |
|
1343 |
if (jour == "00" || mois == "00" || annee == "0000") {
|
- |
|
1344 |
lstMessageErreur.add("La date de "+typeDate+" n'est pas au format JJ/MM/AAAA ou MM/AAAA ou AAAA.");
|
- |
|
1345 |
}
|
- |
|
1346 |
else {
|
- |
|
1347 |
if (typeDate=="naissance") {
|
- |
|
1348 |
Date naissanceDate = DateTimeFormat.getFormat("dd/MM/yyyy").parse(valeurDate);
|
- |
|
1349 |
personneSelectionnee.setNaissanceDate(naissanceDate);
|
- |
|
1350 |
} else if (typeDate=="décès") {
|
- |
|
1351 |
Date decesDate = DateTimeFormat.getFormat("dd/MM/yyyy").parse(valeurDate);
|
- |
|
1352 |
personneSelectionnee.setDecesDate(decesDate);
|
- |
|
1353 |
}
|
- |
|
1354 |
}
|
- |
|
1355 |
|
- |
|
1356 |
/** MM/AAAA **/
|
- |
|
1357 |
} else if (valeurDate.matches("\\d{2}/\\d{4}")) {
|
- |
|
1358 |
jour = "00";
|
- |
|
1359 |
mois = valeurDate.substring(0,2);
|
- |
|
1360 |
annee = valeurDate.substring(3,7);
|
- |
|
1361 |
String dateComplete = annee+"-"+mois+"-"+jour;
|
- |
|
1362 |
if (mois == "00" || annee == "0000") {
|
- |
|
1363 |
lstMessageErreur.add("La date de "+typeDate+" n'est pas au format JJ/MM/AAAA ou MM/AAAA ou AAAA.");
|
- |
|
1364 |
}
|
- |
|
1365 |
else {
|
- |
|
1366 |
if (typeDate=="naissance") personneSelectionnee.set("naissance_date", dateComplete);
|
- |
|
1367 |
else if (typeDate=="décès") {
|
- |
|
1368 |
personneSelectionnee.set("deces_date", dateComplete);
|
- |
|
1369 |
personneSelectionnee.set("ce_deces", personneSelectionnee.ETRE_DECEDE);
|
- |
|
1370 |
}
|
- |
|
1371 |
}
|
- |
|
1372 |
}
|
- |
|
1373 |
|
- |
|
1374 |
/** AAAA **/
|
- |
|
1375 |
else if (valeurDate.matches("\\d{4}")) {
|
- |
|
1376 |
if (valeurDate == "0000") {
|
- |
|
1377 |
lstMessageErreur.add("La date de "+typeDate+" n'est pas au format JJ/MM/AAAA ou MM/AAAA ou AAAA.");
|
- |
|
1378 |
}
|
- |
|
1379 |
else {
|
- |
|
1380 |
if (typeDate=="naissance") personneSelectionnee.set("naissance_date", valeurDate + "-00-00");
|
- |
|
1381 |
else if (typeDate=="décès") {
|
- |
|
1382 |
personneSelectionnee.set("deces_date", valeurDate + "-00-00");
|
- |
|
1383 |
personneSelectionnee.set("ce_deces", personneSelectionnee.ETRE_DECEDE);
|
- |
|
1384 |
}
|
- |
|
1385 |
}
|
- |
|
1386 |
} else {
|
- |
|
1387 |
lstMessageErreur.add("La date de "+typeDate+" n'est pas au format JJ/MM/AAAA ou MM/AAAA ou AAAA.");
|
- |
|
1388 |
}
|
- |
|
1389 |
}
|
- |
|
1390 |
}
|
- |
|
1391 |
|
- |
|
1392 |
public Personne getPersonne() {
|
- |
|
1393 |
return this.personne;
|
- |
|
1394 |
}
|
- |
|
1395 |
|
- |
|
1396 |
public String getPersonneId() {
|
- |
|
1397 |
return this.personneId;
|
1335 |
}
|
1398 |
}
|