21,13 → 21,12 |
import org.tela_botanica.client.modeles.Valeur; |
import org.tela_botanica.client.modeles.ValeurListe; |
|
|
import com.extjs.gxt.ui.client.Registry; |
import com.extjs.gxt.ui.client.Style.HorizontalAlignment; |
import com.extjs.gxt.ui.client.Style.Scroll; |
import com.extjs.gxt.ui.client.binding.FieldBinding; |
|
import com.extjs.gxt.ui.client.binding.FormBinding; |
import com.extjs.gxt.ui.client.binding.SimpleComboBoxFieldBinding; |
|
import com.extjs.gxt.ui.client.event.ComponentEvent; |
import com.extjs.gxt.ui.client.event.KeyListener; |
import com.extjs.gxt.ui.client.event.SelectionChangedEvent; |
34,10 → 33,10 |
import com.extjs.gxt.ui.client.event.SelectionChangedListener; |
import com.extjs.gxt.ui.client.event.SelectionListener; |
import com.extjs.gxt.ui.client.store.ListStore; |
import com.extjs.gxt.ui.client.widget.ContentPanel; |
import com.extjs.gxt.ui.client.widget.LayoutContainer; |
import com.extjs.gxt.ui.client.widget.MessageBox; |
|
import com.extjs.gxt.ui.client.widget.Info; |
import com.extjs.gxt.ui.client.widget.TabItem; |
import com.extjs.gxt.ui.client.widget.TabPanel; |
import com.extjs.gxt.ui.client.widget.Text; |
51,23 → 50,18 |
import com.extjs.gxt.ui.client.widget.form.FormPanel; |
import com.extjs.gxt.ui.client.widget.form.HiddenField; |
import com.extjs.gxt.ui.client.widget.form.LabelField; |
import com.extjs.gxt.ui.client.widget.form.SimpleComboBox; |
import com.extjs.gxt.ui.client.widget.form.TextArea; |
import com.extjs.gxt.ui.client.widget.form.TextField; |
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign; |
import com.extjs.gxt.ui.client.widget.layout.ColumnData; |
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout; |
import com.extjs.gxt.ui.client.widget.layout.FitLayout; |
import com.extjs.gxt.ui.client.widget.layout.FlowLayout; |
import com.extjs.gxt.ui.client.widget.layout.FormData; |
import com.extjs.gxt.ui.client.widget.layout.FormLayout; |
import com.extjs.gxt.ui.client.widget.layout.RowLayout; |
import com.extjs.gxt.ui.client.widget.layout.TableData; |
import com.extjs.gxt.ui.client.widget.layout.TableLayout; |
import com.extjs.gxt.ui.client.widget.toolbar.TextToolItem; |
import com.extjs.gxt.ui.client.widget.toolbar.ToolBar; |
import com.google.gwt.core.client.GWT; |
import com.google.gwt.i18n.client.DateTimeFormat; |
import com.google.gwt.user.client.Window; |
import com.google.gwt.user.client.ui.Widget; |
|
|
101,16 → 95,11 |
* |
* */ |
public FormPersonneVue() { |
initialiserComposants(null); |
initialiserComposants(); |
} |
|
public FormPersonneVue(Personne personne) { |
public void initialiserComposants() { |
|
initialiserComposants(personne); |
} |
|
public void initialiserComposants(Personne personne) { |
|
personneSelectionnee = new Personne(); |
personneSauvegarde = new Personne(); |
|
137,7 → 126,6 |
|
layout(); |
|
rafraichir(personne); |
binderPersonne(personneSelectionnee); |
|
} |
159,7 → 147,7 |
setCollapsible(false); |
setHeading("Ajouter une personne"); |
setButtonAlign(HorizontalAlignment.CENTER); |
setLayout(new FormLayout()); |
setLayout(new FitLayout()); |
setBodyBorder(false); |
setBorders(false); |
|
175,7 → 163,6 |
public void initialiserOnglets() { |
//TabPanel |
TabPanel formulaireOnglets = new TabPanel(); |
formulaireOnglets.setBodyBorder(true); |
|
|
//Tab 1 : identite |
184,6 → 171,7 |
tiIdentite.setScrollMode(Scroll.AUTO); |
formulaireOnglets.add(tiIdentite); |
|
|
hmIdentite.put("tiIdentite", tiIdentite); |
|
|
291,6 → 279,7 |
|
TextField<String> tfNomAutre = new TextField(); |
tfNomAutre.setFieldLabel("Autres noms"); |
tfNomAutre.setName("truk_nom_autre"); |
|
fsNoms.add(tfNomAutre); |
hmIdentite.put("tfNomAutre", tfNomAutre); |
518,6 → 507,10 |
LayoutContainer lcUrl = new LayoutContainer(new ColumnLayout()); |
hmIdentite.put("lcUrl", lcUrl); |
|
HiddenField<String> hfUrl = new HiddenField<String>(); |
hmIdentite.put("hfUrl", hfUrl); |
add(hfUrl); |
|
TextField tfUrl = new TextField(); |
tfUrl.setValue("http://"); |
|
567,19 → 560,23 |
fsAutresInfos.setLayout(formLayout); |
|
|
//Civilité |
ListStore<Valeur> storeSexe = new ListStore<Valeur>(); |
ComboBox<Valeur> cbSexe = new ComboBox<Valeur>(); |
cbSexe.setStore(storeSexe); |
cbSexe.setFieldLabel("Sexe"); |
cbSexe.setDisplayField("nom"); |
cbSexe.setEmptyText("Choisissez le sexe:"); |
formLayout = new FormLayout(); |
formLayout.setLabelAlign(LabelAlign.TOP); |
LayoutContainer lcAutreInformations1 = new LayoutContainer(formLayout); |
|
//Civilité |
ListStore<Valeur> storeSexe = new ListStore<Valeur>(); |
ComboBox<Valeur> cbSexe = new ComboBox<Valeur>(); |
cbSexe.setStore(storeSexe); |
cbSexe.setFieldLabel("Sexe"); |
cbSexe.setDisplayField("nom"); |
cbSexe.setEmptyText("Choisissez le sexe:"); |
|
lcAutreInformations1.add(cbSexe, fd100); |
hmIdentite.put("cbSexe", cbSexe); |
|
mediateur.obtenirListeValeurEtRafraichir(this, "sexe"); |
|
fsAutresInfos.add(cbSexe, fd100); |
hmIdentite.put("cbSexe", cbSexe); |
|
mediateur.obtenirListeValeurEtRafraichir(this, "sexe"); |
|
//Description |
TextArea taDescription = new TextArea(); |
taDescription.setEmptyText("Saisissez une description"); |
586,17 → 583,69 |
taDescription.setFieldLabel("Description"); |
taDescription.setWidth("100%"); |
taDescription.setName("description"); |
fsAutresInfos.add(taDescription, fd100); |
|
lcAutreInformations1.add(taDescription, fd100); |
hmIdentite.put("taDescription", taDescription); |
|
fsAutresInfos.add(lcAutreInformations1); |
|
// Logo |
LayoutContainer lcAutreInformations2 = new LayoutContainer(); |
hmIdentite.put("lcAutreInformations2", lcAutreInformations2); |
|
LabelField lfUrlLogo = new LabelField(); |
lfUrlLogo.setText("<b>Logo:</b>"); |
lcAutreInformations2.add(lfUrlLogo); |
|
LayoutContainer lcUrlLogo = new LayoutContainer(new ColumnLayout()); |
hmIdentite.put("lcUrlLogo", lcUrlLogo); |
|
TextField tfUrlLogo = new TextField(); |
tfUrlLogo.setValue("http://"); |
|
HiddenField<String> hfUrlLogo = new HiddenField<String>(); |
hmIdentite.put("hfUrlLogo", hfUrlLogo); |
|
lcUrlLogo.add(tfUrlLogo, new ColumnData(0.8)); |
hmIdentite.put("tfUrlLogo", tfUrlLogo); |
|
IconButton ibAjouterUrlLogo = new IconButton(ComposantClass.ICONE_AJOUTER); |
ibAjouterUrlLogo.addSelectionListener(new SelectionListener<ComponentEvent>() { |
|
public void componentSelected(ComponentEvent ce) { |
|
TextField<String> tfUrlLogo = (TextField) hmIdentite.get("tfUrlLogo"); |
String strUrl = tfUrlLogo.getValue(); |
|
if ((strUrl == null)||(strUrl.trim().equals("http://"))||(strUrl.trim().equals(""))) { |
MessageBox.alert("Erreur de saisie", "Vous devez saisir un URL", null); |
} else if(hmIdentite.get("url-" + strUrl) != null) { |
MessageBox.alert("Erreur de saisie", "L'url est déjà présente dans la liste.", null); |
} else { |
tfUrlLogo.setValue(""); |
if (!strUrl.matches("[a-z]{3,}://[a-z0-9-]+.[.a-z0-9-]+(?::[0-9]*)?")) { |
MessageBox.alert("Erreur de saisie", "L'adresse n'est pas au bon format (ex: http://www.domain.com)", null); |
} else if (strUrl.length()>255){ |
MessageBox.alert("Erreur de saisie", "L'adresse ne peut dépasser 255 caractères", null); |
} else { |
ajouterUrlLogo(strUrl); |
} |
|
} |
|
} |
}); |
|
lcUrlLogo.add(ibAjouterUrlLogo, new ColumnData(0.15)); |
lcAutreInformations2.add(lcUrlLogo); |
|
fsAutresInfos.add(lcAutreInformations2); |
|
TextArea taLogo = new TextArea(); |
taLogo.setFieldLabel("Logos"); |
taLogo.setWidth("100%"); |
taLogo.setEmptyText("Saisissez les adresses des logos séparées par un saut de ligne"); |
fsAutresInfos.add(taLogo, fd100); |
//fsAutresInfos.add(taLogo, fd100); |
|
hmIdentite.put("taLogo", taLogo); |
|
811,6 → 860,9 |
* -------------------------------------------------------------------------------------- |
*/ |
public void rafraichir(Object nouvellesDonnees) { |
|
|
|
if (nouvellesDonnees instanceof ValeurListe){ |
|
|
856,188 → 908,198 |
|
} else if (nouvellesDonnees instanceof Information) { |
|
|
Information info = (Information) nouvellesDonnees; |
|
if (info.getDonnee(0) instanceof PersonneListe) { |
|
Collection colPersonneListe = ((PersonneListe) info.getDonnee(0)).values(); |
Iterator itPersonneListe = colPersonneListe.iterator(); |
Personne personne = (Personne) itPersonneListe.next(); |
if (info.getType().equals("ajout_personne")) { |
|
personneSauvegarde = new Personne(); |
personneSauvegarde = (Personne) personne.cloner(personneSauvegarde); |
personneSelectionnee.set("id_personne", info.toString()); |
GWT.log("Ajout de la personne " + personneSelectionnee.getId(), null); |
|
Info.display("Enregistrement", "Les modifications apportées à la personne " + personneSelectionnee.getId() + " ont été enregistrées"); |
//Passer en mode modifier |
|
|
binderPersonne(personne); |
//Mise à jour de la personne |
//Personne personne = (Personne) nouvellesDonnees; |
|
|
|
//Prefixe |
String prefixe = personne.get("ce_truk_prefix"); |
ComboBox<Valeur> cbPrefixe = (ComboBox<Valeur>) hmIdentite.get("cbPrefixe"); |
|
|
String prefixeCourant = personne.get("ce_truk_prefix"); |
if (cbPrefixe.getStore().findModel("id_valeur", prefixeCourant) != null) { |
cbPrefixe.setValue(cbPrefixe.getStore().findModel("id_valeur", prefixeCourant)); |
} else { |
cbPrefixe.setRawValue(prefixeCourant); |
} |
|
|
((TextField) hmIdentite.get("tfPrenom")).setValue(personne.get("prenom")); |
((TextField) hmIdentite.get("tfNom")).setValue(personne.get("nom")); |
|
//Suffixe |
String suffixe = personne.get("ce_truk_suffixe"); |
ComboBox<Valeur> cbSuffixe = (ComboBox<Valeur>) hmIdentite.get("cbSuffixe"); |
|
String suffixeCourant = personne.get("ce_truk_suffix"); |
if (cbSuffixe.getStore().findModel("id_valeur", suffixeCourant) != null) { |
cbSuffixe.setValue(cbSuffixe.getStore().findModel("id_valeur", suffixeCourant)); |
} else { |
cbSuffixe.setRawValue(suffixeCourant); |
} |
|
((TextField) hmIdentite.get("tfNomAutre")).setValue(personne.get("truk_nom_autre")); |
((TextField) hmIdentite.get("tfAbreviation")).setValue(personne.get("abreviation")); |
((TextField) hmIdentite.get("tfAbreviationAutre")).setValue(personne.get("truk_abreviation_autre")); |
|
|
(((DateField) hmIdentite.get("dfDateNaissance"))).setValue(personne.getDate("naissance_date")); |
((TextField) hmIdentite.get("tfLieuNaissance")).setValue(personne.get("naissance_lieu")); |
|
(((DateField) hmIdentite.get("dfDateDeces"))).setValue(personne.getDate("deces_date")); |
((TextField) hmIdentite.get("tfLieuDeces")).setValue(personne.get("deces_lieu")); |
|
// Telephone |
HashMap<String, String> hmTelephone = (HashMap<String, String>) personne.getChaineDenormaliseAsMapOrList("truk_telephone"); |
if (hmTelephone!=null) { |
} else if (info.getType().equals("suppression_personne")) { |
GWT.log(info.toString(), null); |
Info.display("lk", info.getMessages().toString()); |
} else if (info.getDonnee(0) instanceof PersonneListe) { |
|
|
Collection colPersonneListe = ((PersonneListe) info.getDonnee(0)).values(); |
Iterator itPersonneListe = colPersonneListe.iterator(); |
Personne personne = (Personne) itPersonneListe.next(); |
|
personneSauvegarde = new Personne(); |
personneSauvegarde = (Personne) personne.cloner(personneSauvegarde); |
|
ListStore storeTelephone = ((ComboBox) hmIdentite.get("cbTelephone")).getStore(); |
List lstModelsTelephone = storeTelephone.getModels(); |
Iterator<Valeur> itStore = lstModelsTelephone.iterator(); |
HashMap<String, String> hmTel = new HashMap(); |
while (itStore.hasNext()) { |
Valeur v = itStore.next(); |
hmTel.put(v.getAbreviation(), v.getNom()); |
binderPersonne(personne); |
//Mise à jour de la personne |
//Personne personne = (Personne) nouvellesDonnees; |
|
|
|
//Prefixe |
String prefixe = personne.get("ce_truk_prefix"); |
ComboBox<Valeur> cbPrefixe = (ComboBox<Valeur>) hmIdentite.get("cbPrefixe"); |
|
|
String prefixeCourant = personne.get("ce_truk_prefix"); |
if (cbPrefixe.getStore().findModel("id_valeur", prefixeCourant) != null) { |
cbPrefixe.setValue(cbPrefixe.getStore().findModel("id_valeur", prefixeCourant)); |
} else { |
cbPrefixe.setRawValue(prefixeCourant); |
} |
|
|
Collection<String> colTelephone = hmTelephone.keySet(); |
Iterator<String> itTelephone = colTelephone.iterator(); |
|
while (itTelephone.hasNext()) { |
String strTypeTelephone = itTelephone.next(); |
String strTelephone = hmTelephone.get(strTypeTelephone); |
String idTel = hmTel.get(strTypeTelephone); |
if (idTel == null) { |
idTel = strTypeTelephone; |
((TextField) hmIdentite.get("tfPrenom")).setValue(personne.get("prenom")); |
((TextField) hmIdentite.get("tfNom")).setValue(personne.get("nom")); |
|
//Suffixe |
String suffixe = personne.get("ce_truk_suffixe"); |
ComboBox<Valeur> cbSuffixe = (ComboBox<Valeur>) hmIdentite.get("cbSuffixe"); |
|
String suffixeCourant = personne.get("ce_truk_suffix"); |
if (cbSuffixe.getStore().findModel("id_valeur", suffixeCourant) != null) { |
cbSuffixe.setValue(cbSuffixe.getStore().findModel("id_valeur", suffixeCourant)); |
} else { |
cbSuffixe.setRawValue(suffixeCourant); |
} |
|
((TextField) hmIdentite.get("tfNomAutre")).setValue(personne.get("truk_nom_autre")); |
((TextField) hmIdentite.get("tfAbreviation")).setValue(personne.get("abreviation")); |
((TextField) hmIdentite.get("tfAbreviationAutre")).setValue(personne.get("truk_abreviation_autre")); |
|
|
(((DateField) hmIdentite.get("dfDateNaissance"))).setValue(personne.getDate("naissance_date")); |
((TextField) hmIdentite.get("tfLieuNaissance")).setValue(personne.get("naissance_lieu")); |
|
(((DateField) hmIdentite.get("dfDateDeces"))).setValue(personne.getDate("deces_date")); |
((TextField) hmIdentite.get("tfLieuDeces")).setValue(personne.get("deces_lieu")); |
|
// Telephone |
HashMap<String, String> hmTelephone = (HashMap<String, String>) personne.getChaineDenormaliseAsMapOrList("truk_telephone"); |
if (hmTelephone!=null) { |
|
|
ListStore storeTelephone = ((ComboBox) hmIdentite.get("cbTelephone")).getStore(); |
List lstModelsTelephone = storeTelephone.getModels(); |
Iterator<Valeur> itStore = lstModelsTelephone.iterator(); |
HashMap<String, String> hmTel = new HashMap(); |
while (itStore.hasNext()) { |
Valeur v = itStore.next(); |
hmTel.put(v.getAbreviation(), v.getNom()); |
} |
|
ajouterTelephone(strTelephone, idTel, strTypeTelephone); |
|
Collection<String> colTelephone = hmTelephone.keySet(); |
Iterator<String> itTelephone = colTelephone.iterator(); |
|
while (itTelephone.hasNext()) { |
String strTypeTelephone = itTelephone.next(); |
String strTelephone = hmTelephone.get(strTypeTelephone); |
String idTel = hmTel.get(strTypeTelephone); |
if (idTel == null) { |
idTel = strTypeTelephone; |
} |
|
ajouterTelephone(strTelephone, idTel, strTypeTelephone); |
} |
} |
} |
|
//Courriel |
LinkedList<String> lCourriels = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_courriel"); |
Iterator<String> itCourriels = lCourriels.iterator(); |
|
while (itCourriels.hasNext()) { |
String strEmail = itCourriels.next(); |
ajouterCourriel(strEmail); |
} |
|
// Sites |
LinkedList<String> lUrl = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_url"); |
Iterator<String> itUrl = lUrl.iterator(); |
|
|
while (itUrl.hasNext()) { |
String strUrl = itUrl.next(); |
ajouterUrl(strUrl); |
} |
|
// Sexe |
String strSexe = personne.get("ce_sexe"); |
ComboBox<Valeur> cbSexe = (ComboBox<Valeur>) hmIdentite.get("cbSexe"); |
|
|
//FIXME : le lien avec la bdd ne peut pas se faire |
if (cbSexe.getStore().findModel("abreviation", strSexe) != null) { |
cbSexe.setValue(cbSexe.getStore().findModel("abreviation", strSexe)); |
} else { |
cbSexe.setRawValue(strSexe); |
} |
|
((TextArea) hmIdentite.get("taDescription")).setRawValue((String) personne.get("description")); |
|
// Logos |
TextArea taLogo = (TextArea) hmIdentite.get("taLogo"); |
LinkedList<String> lLogo = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_logo"); |
Iterator<String> itLogo = lLogo.iterator(); |
|
String strValeurLogo = ""; |
while (itLogo.hasNext()) { |
strValeurLogo += itLogo.next() + "\n"; |
} |
|
if (!strValeurLogo.trim().equals("")) { |
taLogo.setRawValue(strValeurLogo); |
} |
|
|
/*-------------------------------------------------- |
Adresse |
---------------------------------------------------*/ |
|
// Adresse |
((TextField<String>) hmAdresse.get("tfAdresse1")).setValue((String) personne.get("adresse_01")); |
|
// Complément |
((TextField<String>) hmAdresse.get("tfAdresse2")).setValue((String) personne.get("adresse_02")); |
|
//Boite postale |
((TextField<String>) hmAdresse.get("tfBoitePostale")).setValue((String) personne.get("bp")); |
|
//Pays |
String strPays = personne.get("pays"); |
ComboBox<Valeur> cbPays = (ComboBox<Valeur>) hmAdresse.get("cbPays"); |
|
|
if (cbPays.getStore().findModel("nom", strPays) != null) { |
cbPays.setValue(cbPays.getStore().findModel("nom", strPays)); |
} else { |
cbPays.setRawValue(strPays); |
} |
|
|
//Région |
String strRegion = personne.get("region"); |
if ((strRegion!=null)&&(!strRegion.equals(""))) { |
ComboBox<Valeur> cbRegion = (ComboBox<Valeur>) hmAdresse.get("cbRegion"); |
cbRegion.setVisible(true); |
|
if (cbRegion.getStore().findModel("nom", strRegion) != null) { |
cbRegion.setValue(cbRegion.getStore().findModel("nom", strRegion)); |
//Courriel |
LinkedList<String> lCourriels = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_courriel"); |
Iterator<String> itCourriels = lCourriels.iterator(); |
|
while (itCourriels.hasNext()) { |
String strEmail = itCourriels.next(); |
ajouterCourriel(strEmail); |
} |
|
// Sites |
LinkedList<String> lUrl = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_url"); |
Iterator<String> itUrl = lUrl.iterator(); |
|
|
while (itUrl.hasNext()) { |
String strUrl = itUrl.next(); |
ajouterUrl(strUrl); |
} |
|
// Sexe |
String strSexe = personne.get("ce_sexe"); |
ComboBox<Valeur> cbSexe = (ComboBox<Valeur>) hmIdentite.get("cbSexe"); |
|
|
//FIXME : le lien avec la bdd ne peut pas se faire |
if (cbSexe.getStore().findModel("abreviation", strSexe) != null) { |
cbSexe.setValue(cbSexe.getStore().findModel("abreviation", strSexe)); |
} else { |
cbRegion.setRawValue(strRegion); |
cbSexe.setRawValue(strSexe); |
} |
|
((TextArea) hmIdentite.get("taDescription")).setRawValue((String) personne.get("description")); |
|
// Logos |
TextArea taLogo = (TextArea) hmIdentite.get("taLogo"); |
LinkedList<String> lLogo = (LinkedList<String>) personne.getChaineDenormaliseAsMapOrList("truk_logo"); |
Iterator<String> itLogo = lLogo.iterator(); |
|
String strValeurLogo = ""; |
while (itLogo.hasNext()) { |
strValeurLogo += itLogo.next() + "\n"; |
} |
|
if (!strValeurLogo.trim().equals("")) { |
taLogo.setRawValue(strValeurLogo); |
} |
|
|
/*-------------------------------------------------- |
Adresse |
---------------------------------------------------*/ |
|
// Adresse |
((TextField<String>) hmAdresse.get("tfAdresse1")).setValue((String) personne.get("adresse_01")); |
|
// Complément |
((TextField<String>) hmAdresse.get("tfAdresse2")).setValue((String) personne.get("adresse_02")); |
|
//Boite postale |
((TextField<String>) hmAdresse.get("tfBoitePostale")).setValue((String) personne.get("bp")); |
|
//Pays |
String strPays = personne.get("pays"); |
ComboBox<Valeur> cbPays = (ComboBox<Valeur>) hmAdresse.get("cbPays"); |
|
|
if (cbPays.getStore().findModel("nom", strPays) != null) { |
cbPays.setValue(cbPays.getStore().findModel("nom", strPays)); |
} else { |
cbPays.setRawValue(strPays); |
} |
|
|
//Région |
String strRegion = personne.get("region"); |
if ((strRegion!=null)&&(!strRegion.equals(""))) { |
ComboBox<Valeur> cbRegion = (ComboBox<Valeur>) hmAdresse.get("cbRegion"); |
cbRegion.setVisible(true); |
|
if (cbRegion.getStore().findModel("nom", strRegion) != null) { |
cbRegion.setValue(cbRegion.getStore().findModel("nom", strRegion)); |
} else { |
cbRegion.setRawValue(strRegion); |
} |
} |
|
//Cp |
((TextField) hmAdresse.get("tfCodePostal")).setValue(personne.get("code_postal")); |
|
//Ville |
((TextField) hmAdresse.get("tfVille")).setValue(personne.get("ville")); |
|
|
} else { |
Info.display("messages", info.getMessages().toString()); |
} |
|
//Cp |
((TextField) hmAdresse.get("tfCodePostal")).setValue(personne.get("code_postal")); |
|
//Ville |
((TextField) hmAdresse.get("tfVille")).setValue(personne.get("ville")); |
|
|
} |
} |
|
if (nouvellesDonnees == null) |
1270,6 → 1332,12 |
|
lcUrlContainer.remove(lcUrl); |
|
|
HiddenField<String> hfUrl = (HiddenField<String>) hmIdentite.get("hfUrl"); |
String strValeurUrl = hfUrl.getValue(); |
strValeurUrl = strValeurUrl.replace(strUrl, ""); |
hfUrl.setValue(strValeurUrl); |
|
} |
}); |
|
1276,6 → 1344,15 |
lcUrl.add(ibSupprimerUrl, new ColumnData(0.15)); |
lcUrlContainer.add(lcUrl); |
|
HiddenField<String> hfUrl = (HiddenField<String>) hmIdentite.get("hfUrl"); |
String strValeurUrl = hfUrl.getValue(); |
if (strValeurUrl == null) { |
strValeurUrl = ""; |
} |
|
strValeurUrl += strUrl + ";;"; |
hfUrl.setValue(strValeurUrl); |
|
layout(); |
|
|
1282,6 → 1359,64 |
|
} |
|
public void ajouterUrlLogo(String strUrl) { |
|
LayoutContainer lcUrlContainer = (LayoutContainer) hmIdentite.get("lcAutreInformations2"); |
|
LayoutContainer lcUrl = new LayoutContainer(); |
lcUrl.setLayout(new ColumnLayout()); |
hmIdentite.put("lc-" + strUrl, lcUrl); |
|
|
Text tUrl = new Text(strUrl); |
hmIdentite.put("url-"+strUrl, tUrl); |
|
lcUrl.add(tUrl, new ColumnData(0.8)); |
|
IconButton ibSupprimerUrl = new IconButton(ComposantClass.ICONE_SUPPRIMER); |
ibSupprimerUrl.setId(strUrl); |
ibSupprimerUrl.addSelectionListener(new SelectionListener<ComponentEvent>() { |
|
public void componentSelected(ComponentEvent ce) { |
|
//Suppression url |
String strUrl = ce.component.getId(); |
LayoutContainer lcUrl = (LayoutContainer) hmIdentite.get("lc-" + strUrl); |
LayoutContainer lcUrlContainer = (LayoutContainer) hmIdentite.get("lcAutreInformations2"); |
|
lcUrlContainer.remove(lcUrl); |
|
|
HiddenField<String> hfUrlLogo = (HiddenField<String>) hmIdentite.get("hfUrlLogo"); |
String strValeurUrl = hfUrlLogo.getValue(); |
strValeurUrl = strUrl.replace(strUrl, ""); |
|
hfUrlLogo.setValue(strValeurUrl); |
|
} |
}); |
|
lcUrl.add(ibSupprimerUrl, new ColumnData(0.15)); |
lcUrlContainer.add(lcUrl); |
|
HiddenField<String> hfUrlLogo = (HiddenField<String>) hmIdentite.get("hfUrlLogo"); |
String strValeurUrl = hfUrlLogo.getValue(); |
if (strValeurUrl == null) { |
strValeurUrl = ""; |
} |
|
strValeurUrl += strUrl + ";;"; |
|
hfUrlLogo.setValue(strValeurUrl); |
|
|
|
layout(); |
|
|
|
} |
|
public void reinitialiser() { |
|
mediateur.afficherPopinChargement(); |
1340,10 → 1475,29 |
|
personneSelectionnee.set("truk_courriel", ((HiddenField<String>) hmIdentite.get("hfHiddenCourriel")).getValue()); |
|
strValeur = personneSelectionnee.get("truk_prefix") |
|
//Pour le nom complet, on enregistre dans la bdd la valeur du prefixe/suffixe et non l'id |
String strPrefixe = ""; |
combo = (ComboBox) hmIdentite.get("cbPrefixe"); |
valeur = (Valeur) combo.getValue(); |
if (valeur != null) { |
strPrefixe = valeur.getNom(); |
} else { |
strPrefixe = combo.getRawValue(); |
} |
|
String strSuffixe = ""; |
combo = (ComboBox) hmIdentite.get("cbSuffixe"); |
valeur = (Valeur) combo.getValue(); |
if (valeur != null) { |
strSuffixe = valeur.getNom(); |
} else { |
strSuffixe = combo.getRawValue(); |
} |
strValeur = strPrefixe |
+ " " + personneSelectionnee.get("prenom") |
+ " " + personneSelectionnee.get("nom") |
+ " " + personneSelectionnee.get("truk_suffix"); |
+ " " + strSuffixe; |
|
personneSelectionnee.set("fmt_nom_complet", strValeur); |
|
1358,15 → 1512,25 |
|
personneSelectionnee.set("truk_telephone", ((HiddenField<String>) hmIdentite.get("hfTelephone")).getValue()); |
|
String logoUrls = ((HiddenField<String>) hmIdentite.get("hfUrlLogo")).getValue(); |
if (logoUrls == null) { |
logoUrls = ""; |
} |
personneSelectionnee.set("truk_logo", logoUrls); |
|
System.out.println(personneSelectionnee); |
personneSelectionnee.set("truk_url", ((HiddenField) hmIdentite.get("hfUrl")).getValue()); |
|
//tel |
//fax |
//logo |
//url |
|
|
//if (lstMessageErreur.size() < 0) { |
mediateur.enregistrerPersonne(this, personneSelectionnee); |
/*} else { |
String strMessagesErreur = ""; |
Iterator<String> itMessagesErreur = lstMessageErreur.iterator(); |
while (itMessagesErreur.hasNext()) { |
strMessagesErreur += " - " + itMessagesErreur.next() +" \n"; |
} |
|
MessageBox.alert("Erreurs", "Les erreurs suivantes ont été commises : \n" + strMessagesErreur, null); |
}*/ |
} |
|
private String obtenirValeurCombo(String strComboName) { |