Subversion Repositories eFlore/Applications.coel

Rev

Rev 821 | Rev 850 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 821 Rev 829
Line 90... Line 90...
90
	//hmIdentite[...] référence par une chaine de caractère tous les composants de l'onglet Identite
90
	//hmIdentite[...] référence par une chaine de caractère tous les composants de l'onglet Identite
91
	private HashMap<String, Widget>hmIdentite = new HashMap<String, Widget>();
91
	private HashMap<String, Widget>hmIdentite = new HashMap<String, Widget>();
92
	private HashMap<String, Widget>hmAdresse = new HashMap<String, Widget>();
92
	private HashMap<String, Widget>hmAdresse = new HashMap<String, Widget>();
93
	private HashMap<String, Widget>hmInfosNat = new HashMap<String, Widget>();
93
	private HashMap<String, Widget>hmInfosNat = new HashMap<String, Widget>();
94
	private HashMap<String, Valeur> hmCbSelectionnee = new HashMap();
94
	private HashMap<String, Valeur> hmCbSelectionnee = new HashMap();
95
	private FormData fd100 = new FormData("1");
95
	private FormData fd100 = new FormData("95%");
Line 96... Line 96...
96
	
96
	
Line 97... Line 97...
97
	private Button enregistrer, enregistrerEtRevenir;
97
	private Button enregistrer, enregistrerEtRevenir;
98
	
98
	
Line 198... Line 198...
198
	
198
	
199
	public void creerComposantsIdentite()	{
199
	public void creerComposantsIdentite()	{
200
		// Gestion de l'affichage en colonnes : 3 Layout container : principal, gauche & droite
200
		// Gestion de l'affichage en colonnes : 3 Layout container : principal, gauche & droite
201
		LayoutContainer left = new LayoutContainer();
201
		LayoutContainer left = new LayoutContainer();
-
 
202
		left.setLayout(new FormLayout());
-
 
203
		left.setStyleAttribute("padding", "15px");
202
		left.setLayout(new FormLayout());
204
		
203
		LayoutContainer right = new LayoutContainer();
205
		LayoutContainer right = new LayoutContainer();
-
 
206
		right.setLayout(new FormLayout());
Line 204... Line 207...
204
		right.setLayout(new FormLayout());
207
		right.setStyleAttribute("padding", "15px");
Line 205... Line 208...
205
		
208
		
206
		LayoutContainer main = new LayoutContainer();
209
		LayoutContainer main = new LayoutContainer();
Line 346... Line 349...
346
		fsDeces.setHeading("Décès");
349
		fsDeces.setHeading("Décès");
347
		fsDeces.setLayout(formLayout); 
350
		fsDeces.setLayout(formLayout); 
Line 348... Line 351...
348
			
351
			
349
		Radio rbEstDecedee = new Radio();
352
		Radio rbEstDecedee = new Radio();
-
 
353
		rbEstDecedee.setBoxLabel("oui");
Line 350... Line 354...
350
		rbEstDecedee.setBoxLabel("oui");
354
		rbEstDecedee.setValueAttribute("1");
Line 351... Line 355...
351
	
355
	
352
		rbEstDecedee.addListener(Events.Change, new Listener<ComponentEvent>() {
356
		rbEstDecedee.addListener(Events.Change, new Listener<ComponentEvent>() {
353
						
357
						
354
			public void handleEvent(ComponentEvent be) {
358
			public void handleEvent(ComponentEvent be) {
355
				if(((Radio) be.getComponent()).getValue().equals(true))	{
359
				if(((Radio) be.getComponent()).getValue().equals(true))	{
356
					((DateField) hmIdentite.get("dfDateDeces")).setVisible(true);
360
					((DateField) hmIdentite.get("dfDateDeces")).setVisible(true);
-
 
361
					((TextField) hmIdentite.get("tfLieuDeces")).setVisible(true);
-
 
362
				} else	{
-
 
363
					DateField dfDateDeces = ((DateField) hmIdentite.get("dfDateDeces"));
357
					((TextField) hmIdentite.get("tfLieuDeces")).setVisible(true);
364
					dfDateDeces.setValue(null);
-
 
365
					dfDateDeces.setVisible(false);
-
 
366
					
358
				} else	{
367
					TextField tfLieuDeces = ((TextField) hmIdentite.get("tfLieuDeces"));
359
					((DateField) hmIdentite.get("dfDateDeces")).setVisible(false);
368
					tfLieuDeces.setValue(null);
360
					((TextField) hmIdentite.get("tfLieuDeces")).setVisible(false);
369
					tfLieuDeces.setVisible(false);
Line 361... Line 370...
361
				}
370
				}
Line 362... Line 371...
362
			}	
371
			}	
-
 
372
		});
363
		});
373
					
364
					
374
		hmIdentite.put("rbEstDecedee", rbEstDecedee);
Line 365... Line 375...
365
		hmIdentite.put("rbEstDecedee", rbEstDecedee);
375
		
366
		
376
		Radio rbNestPasDecedee = new Radio();
367
		Radio rbNestPasDecedee = new Radio();
377
		rbNestPasDecedee.setValueAttribute("0");
Line 368... Line 378...
368
		rbNestPasDecedee.setBoxLabel("non");
378
		rbNestPasDecedee.setBoxLabel("non");
369
		rbNestPasDecedee.setValue(true);
379
		rbNestPasDecedee.setValue(true);
370
		
380
		
371
		Radio rbDecesInconnu = new Radio();
381
	/*	Radio rbDecesInconnu = new Radio();
Line 877... Line 887...
877
		
887
		
878
		
888
		
Line -... Line 889...
-
 
889
		(((DateField) hmIdentite.get("dfDateNaissance"))).setValue(personne.getDate("naissance_date"));
879
		(((DateField) hmIdentite.get("dfDateNaissance"))).setValue(personne.getDate("naissance_date"));
890
		((TextField) hmIdentite.get("tfLieuNaissance")).setValue(personne.get("naissance_lieu"));
880
		((TextField) hmIdentite.get("tfLieuNaissance")).setValue(personne.get("naissance_lieu"));
891
		
-
 
892
		if (personne.estDecedee())	{
-
 
893
			(((DateField) hmIdentite.get("dfDateDeces"))).setValue(personne.getDate("deces_date"));
-
 
894
			((TextField) hmIdentite.get("tfLieuDeces")).setValue(personne.get("deces_lieu"));
-
 
895
			Radio rbEstDecede = (Radio) hmIdentite.get("rbEstDecedee");
Line 881... Line 896...
881
		
896
			rbEstDecede.setValue(true);
Line 882... Line 897...
882
		(((DateField) hmIdentite.get("dfDateDeces"))).setValue(personne.getDate("deces_date"));
897
			
883
		((TextField) hmIdentite.get("tfLieuDeces")).setValue(personne.get("deces_lieu"));
898
		}
Line 884... Line 899...
884
		
899
		
Line 1001... Line 1016...
1001
		binding = new FormBinding(this);
1016
		binding = new FormBinding(this);
Line 1002... Line 1017...
1002
		
1017
		
1003
		personneSelectionnee = personne;
1018
		personneSelectionnee = personne;
1004
		binding.autoBind();
1019
		binding.autoBind();
1005
		binding.bind(personneSelectionnee);
-
 
1006
		
1020
		binding.bind(personneSelectionnee);
1007
		layout();
1021
		layout();
Line 1008... Line 1022...
1008
	}
1022
	}
1009
 
1023
 
Line 1083... Line 1097...
1083
		DateField dfDateNaissance = (DateField) hmIdentite.get("dfDateNaissance");
1097
		DateField dfDateNaissance = (DateField) hmIdentite.get("dfDateNaissance");
1084
		Date naissanceDate = dfDateNaissance.getValue();
1098
		Date naissanceDate = dfDateNaissance.getValue();
1085
		personneSelectionnee.setNaissanceDate(naissanceDate);
1099
		personneSelectionnee.setNaissanceDate(naissanceDate);
Line 1086... Line 1100...
1086
		
1100
		
1087
		Radio rbEstDecedee = (Radio) hmIdentite.get("rbEstDecedee");
1101
		Radio rbEstDecedee = (Radio) hmIdentite.get("rbEstDecedee");
1088
		if (rbEstDecedee.getValue().equals(true))	{
-
 
1089
			
1102
		if (rbEstDecedee.getValue() == true)	{
1090
			DateField dfDecesDate = (DateField) hmIdentite.get("dfDateDeces");
1103
			DateField dfDecesDate = (DateField) hmIdentite.get("dfDateDeces");
1091
			Date decesDate = dfDecesDate.getValue();
-
 
1092
			if (decesDate == null)	{
1104
			String decesLieu = ((TextField<String>) hmIdentite.get("tfLieuDeces")).getValue();
1093
				decesDate = new Date();
1105
			personneSelectionnee.setDeces(dfDecesDate.getValue(), decesLieu);
1094
			}
1106
		}	else	{
1095
			personneSelectionnee.setDecesDate(decesDate);
-
 
1096
			personneSelectionnee.set("deces_lieu", ((TextField<String>) hmIdentite.get("tfLieuDeces")).getValue());
1107
			personneSelectionnee.setNonDecedee();			
Line 1097... Line -...
1097
		}
-
 
1098
		
-
 
1099
		personneSelectionnee.setDecesDate(new Date());
1108
		}
1100
		
1109
		
Line 1101... Line 1110...
1101
		strValeur = obtenirValeurCombo("cbPays");
1110
		strValeur = obtenirValeurCombo("cbPays");
1102
		personneSelectionnee.set("ce_truk_pays", strValeur);
1111
		personneSelectionnee.set("ce_truk_pays", strValeur);
Line 1116... Line 1125...
1116
		personneSelectionnee.set("truk_recolte", recolte);
1125
		personneSelectionnee.set("truk_recolte", recolte);
Line 1117... Line 1126...
1117
		
1126
		
1118
		String specialite = ((ChampMultiValeurs) hmInfosNat.get("specialite")).getValeurs();
1127
		String specialite = ((ChampMultiValeurs) hmInfosNat.get("specialite")).getValeurs();
Line -... Line 1128...
-
 
1128
		personneSelectionnee.set("ce_truk_specialite", specialite);
1119
		personneSelectionnee.set("ce_truk_specialite", specialite);
1129
		
1120
		
1130
		
1121
		if (lstMessageErreur.size() == 0)	{
1131
		if (lstMessageErreur.size() == 0)	{
1122
			mediateur.enregistrerPersonne(this, personneSelectionnee);
1132
			mediateur.enregistrerPersonne(this, personneSelectionnee);
1123
			success = true;
1133
			success = true;
Line 1131... Line 1141...
1131
			
1141
			
1132
 			MessageBox.alert("Erreurs", "Les erreurs suivantes ont été commises : \n" + strMessagesErreur, null);
1142
 			MessageBox.alert("Erreurs", "Les erreurs suivantes ont été commises : \n" + strMessagesErreur, null);
1133
 			success = false;
1143
 			success = false;
Line -... Line 1144...
-
 
1144
		}
-
 
1145
		
1134
		}
1146
		
1135
		
1147
		
Line 1136... Line 1148...
1136
		return success;
1148
		return success;
1137
	}
1149
	}
Line 1142... Line 1154...
1142
		
1154
		
1143
		ComboBox combo = (ComboBox) hmIdentite.get(strComboName);
1155
		ComboBox combo = (ComboBox) hmIdentite.get(strComboName);
1144
		if (combo == null)	{
1156
		if (combo == null)	{
1145
			combo = (ComboBox) hmAdresse.get(strComboName);
1157
			combo = (ComboBox) hmAdresse.get(strComboName);
-
 
1158
		}
-
 
1159
		strValeur = combo.getRawValue();
-
 
1160
		valeur = (Valeur) combo.getStore().findModel(strValeur);
-
 
1161
		if (valeur != null)	{
-
 
1162
			strValeur = valeur.getId();
-
 
1163
		}
1146
		}
1164
		
1147
		if (combo.getValue()!=null)	{
1165
		/*if (combo.getValue()!=null)	{
1148
			valeur = (Valeur) combo.getValue();
1166
			valeur = (Valeur) combo.getValue();
1149
			strValeur = valeur.getId();
1167
			strValeur = valeur.getId();
1150
		} else {
1168
		} else {
1151
			strValeur = combo.getRawValue();
1169
			strValeur = combo.getRawValue();
Line 1152... Line 1170...
1152
		}
1170
		}*/
1153
		
1171
		
1154
		return strValeur;
1172
		return strValeur;