87,7 → 87,6 |
private TabItem tiIdentite, tiAdresses, tiInfosNat; |
private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG); |
private Personne personneSelectionnee, personneSauvegarde = null; |
protected String mode = ""; |
|
//hmIdentite[...] référence par une chaine de caractère tous les composants de l'onglet Identite |
private HashMap<String, Widget>hmIdentite = new HashMap<String, Widget>(); |
98,11 → 97,8 |
|
private Button enregistrer, enregistrerEtRevenir; |
|
public static final String MODE_AJOUTER = "AJOUT"; |
public static final String MODE_MODIFIER = "MODIF"; |
private Personne personne = null; |
private String personneId = null; |
|
private FormBinding binding = null; |
|
// CONSTRUCTEUR |
112,7 → 108,6 |
|
public PersonneForm(Mediateur mediateurCourrant, String personneId, Rafraichissable vueARafraichirApresValidation) { |
vueExterneARafraichirApresValidation = vueARafraichirApresValidation; |
personneId = (personneId == null ? "" : personneId); |
initialiserPersonneForm(mediateurCourrant, personneId); |
} |
|
121,7 → 116,7 |
personne.setId(personneIdCourrant); |
personneId = personneIdCourrant; |
|
String modeDeCreation = (personneId.isEmpty() ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER); |
String modeDeCreation = (UtilString.isEmpty(personneId) ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER); |
initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.PERSONNE); |
|
initialiserComposants(); |
744,20 → 739,24 |
} else if (nouvellesDonnees instanceof Information) { |
Information info = (Information) nouvellesDonnees; |
if (info.getType().equals("ajout_personne")) { |
GWT.log("Ajout de la personne " + personneSelectionnee.getId(), null); |
Info.display("Enregistrement", "La personne a été ajoutée (id: " + personneSelectionnee.getId() + ")"); |
|
if (clicBoutonvalidation) { |
mediateur.clicMenu(menuIdCourant); |
if (info.getDonnee(0) != null) { |
personneSelectionnee.setId(info.getDonnee(0).toString()); |
GWT.log("Ajout de la personne " + personneSelectionnee.getId(), null); |
Info.display("Enregistrement", "La personne a été ajoutée (id: " + personneSelectionnee.getId() + ")"); |
repandreRafraichissement(); |
if (clicBoutonvalidation) { |
mediateur.clicMenu(menuIdCourant); |
} |
} else { |
Info.display("Enregistrement", info.getMessages().toString()); |
} |
} else if (info.getType().equals("modification_personne")) { |
Info.display("Enregistrement", "Les modifications apportées à la personne " + personneSelectionnee.getId() + " ont été correctement enregistrées."); |
|
repandreRafraichissement(); |
if (clicBoutonvalidation) { |
mediateur.clicMenu(menuIdCourant); |
} |
} |
else if (info.getType().equals("maj_utilisateur")) { |
} else if (info.getType().equals("maj_utilisateur")) { |
gererEtatActivationBouton(); |
} else if (info.getDonnee(0) instanceof PersonneListe) { |
|
830,9 → 829,19 |
} |
} |
|
private void repandreRafraichissement() { |
if (vueExterneARafraichirApresValidation != null) { |
String type = "personne_modifiee"; |
if (mode.equals(Formulaire.MODE_AJOUTER)) { |
type = "personne_ajoutee"; |
} |
Information info = new Information(type); |
info.setDonnee(0, personneSelectionnee); |
vueExterneARafraichirApresValidation.rafraichir(info); |
} |
} |
|
private void mettreAJourPersonne(Personne personne) { |
|
|
//Mise à jour de la personne |
//Personne personne = (Personne) nouvellesDonnees; |
|
957,7 → 966,6 |
((ChampMultiValeursMultiTypes) hmInfosNat.get("recolte")).peupler(personne.getString("truk_recolte")); |
|
gererEtatActivationBouton(); |
|
} |
|
public void remplirCombobox(String idComboBox, List liste, String hashMapId) { |
993,7 → 1001,6 |
mettreAJourPersonne(personneSauvegarde); |
|
mediateur.masquerPopinChargement(); |
|
} |
|
public void binderPersonne(Personne personne) { |
1184,10 → 1191,9 |
} |
|
protected boolean verifierFormulaire() { |
boolean success = true; |
LinkedList<String> lstMessageErreur = new LinkedList<String>(); |
|
boolean success = false; |
LinkedList lstMessageErreur = new LinkedList<String>(); |
|
ComboBox<Projet> cbProjets = (ComboBox<Projet>) hmIdentite.get("cbProjets"); |
Projet projet = cbProjets.getValue(); |
if (projet == null) { |
1287,9 → 1293,7 |
personneSelectionnee.set("ce_truk_specialite", specialite); |
|
|
if (lstMessageErreur.size() == 0) { |
success = true; |
} else { |
if (lstMessageErreur.size() != 0) { |
String strMessagesErreur = "<span><br />"; |
Iterator<String> itMessagesErreur = lstMessageErreur.iterator(); |
while (itMessagesErreur.hasNext()) { |