77,6 → 77,7 |
private Mediateur mediateur = null; |
private Modele modele = null ; |
|
private String mode = "AJOUT"; |
private FormPanel structureFormPanneau; |
private int tabIndex = 100; |
|
159,7 → 160,7 |
structureFormPanneau.setFrame(true); |
structureFormPanneau.setIconStyle("icone-form-ajouter"); |
structureFormPanneau.setCollapsible(false); |
structureFormPanneau.setHeading(i18nC.titreAjoutFormStructurePanneau()); |
structureFormPanneau.setHeading(i18nC.titreAjoutFormStructurePanneau()); |
structureFormPanneau.setButtonAlign(HorizontalAlignment.CENTER); |
structureFormPanneau.setLayout(new FlowLayout()); |
|
213,17 → 214,19 |
|
private void soumettreFormulaire() { |
GWT.log("Soumission du formulaire", null); |
ajouterStructure(); |
|
Structure structure = collecterDonnees(); |
if (mode == "AJOUT") { |
mediateur.ajouterStructure(this, structure); |
} else if (mode == "MODIF") { |
mediateur.modifierStructure(this, structure); |
} |
} |
|
private void ajouterStructure() { |
private Structure collecterDonnees() { |
Structure structure = new Structure(); |
structure.setNom(nomStructureChp.getValue()); |
if (dateFondationChp.getValue() != null) { |
structure.setDateFondation(DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss").format(dateFondationChp.getValue())); |
} |
|
structure.setDateFondation(dateFondationChp.getValue()); |
|
structure.setAdresse(adrChp.getValue()); |
structure.setCodePostal(cpChp.getValue()); |
structure.setVille(villeChp.getValue()); |
235,9 → 238,25 |
structure.setCourriel(emailChp.getValue()); |
structure.setUrl(urlChp.getValue()); |
|
mediateur.ajouterStructure(this, structure); |
return structure; |
} |
|
private void peuplerFormulaire(Structure str) { |
nomStructureChp.setValue(str.getNom()); |
dateFondationChp.setValue(str.getDateFondation()); |
|
adrChp.setValue(str.getAdresse()); |
cpChp.setValue(str.getCodePostal()); |
villeChp.setValue(str.getVille()); |
regionChp.setValue(str.getRegion()); |
paysChp.setValue(str.getPays()); |
|
telChp.setValue(str.getTelephone()); |
faxChp.setValue(str.getFax()); |
emailChp.setValue(str.getCourriel()); |
urlChp.setValue(str.getUrl()); |
} |
|
private TabItem creerOngletValorisation() { |
valorisationOnglet = new TabItem(); |
valorisationOnglet.setText("Valorisation"); |
1083,9 → 1102,17 |
public void rafraichir(Object nouvelleDonnees) { |
if (nouvelleDonnees instanceof Information) { |
Information info = (Information) nouvelleDonnees; |
if (info.getMessages() != null) { |
GWT.log(info.getMessages().toString(), null); |
} |
if (info.getType().equals("ajout_structure")) { |
GWT.log(info.getMessages().toString(), null); |
Info.display("Ajout d'une Institution", info.toString()); |
} else if (info.getType().equals("selection_structure")) { |
Info.display("Modification d'une Institution", info.toString()); |
Structure str = (Structure) info.getDonnee(0); |
mode = "MODIF"; |
structureFormPanneau.setHeading(i18nC.titreModifFormStructurePanneau()); |
peuplerFormulaire(str); |
} |
} else if (nouvelleDonnees instanceof ValeurListe) { |
ValeurListe listeValeurs = (ValeurListe) nouvelleDonnees; |