21,6 → 21,7 |
import org.tela_botanica.client.modeles.Valeur; |
import org.tela_botanica.client.modeles.ValeurListe; |
|
import com.extjs.gxt.ui.client.Events; |
import com.extjs.gxt.ui.client.Registry; |
import com.extjs.gxt.ui.client.Style.HorizontalAlignment; |
import com.extjs.gxt.ui.client.Style.Scroll; |
29,6 → 30,7 |
|
import com.extjs.gxt.ui.client.event.ComponentEvent; |
import com.extjs.gxt.ui.client.event.KeyListener; |
import com.extjs.gxt.ui.client.event.Listener; |
import com.extjs.gxt.ui.client.event.SelectionChangedEvent; |
import com.extjs.gxt.ui.client.event.SelectionChangedListener; |
import com.extjs.gxt.ui.client.event.SelectionListener; |
50,6 → 52,8 |
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.Radio; |
import com.extjs.gxt.ui.client.widget.form.RadioGroup; |
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.layout.ColumnData; |
62,14 → 66,12 |
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.RadioButton; |
import com.google.gwt.user.client.ui.Widget; |
|
public class PersonneForm extends FormPanel implements Rafraichissable { |
|
|
|
public class PersonneForm extends FormPanel implements Rafraichissable { |
|
|
/*-------------------------------------------------------------------------------------- |
* VARIABLES |
* ------------------------------------------------------------------------------------- |
80,7 → 82,6 |
private Configuration config = (Configuration) Registry.get(RegistreId.CONFIG); |
private Personne personneSelectionnee, personneSauvegarde = null; |
|
|
private FormBinding binding = null; |
|
/*-------------------------------------------------------------------------------------- |
87,6 → 88,7 |
* CONSTRUCTEUR |
* ------------------------------------------------------------------------------------- |
*/ |
|
/** |
* Constructeur du panneau |
* |
118,7 → 120,6 |
ajouterBoutonReinitialiser(barreOutilsHaut); |
setTopComponent(barreOutilsHaut); |
|
|
initialiserOnglets(); |
|
creerComposantsIdentite(); |
127,10 → 128,8 |
layout(); |
|
binderPersonne(personneSelectionnee); |
|
} |
|
|
/*--------------------------------------------------------------------------------------- |
* SOUS-METHODES |
* -------------------------------------------------------------------------------------- |
142,7 → 141,6 |
* */ |
public void initialiserPanneau() { |
|
|
setIconStyle("icone-form-ajouter"); |
setCollapsible(false); |
setHeading("Ajouter une personne"); |
150,10 → 148,9 |
setLayout(new FitLayout()); |
setBodyBorder(false); |
setBorders(false); |
|
|
setPadding(0); |
setWidth("100%"); |
|
} |
|
/** |
164,21 → 161,19 |
//TabPanel |
TabPanel formulaireOnglets = new TabPanel(); |
|
|
//Tab 1 : identite |
tiIdentite = new TabItem("Identité"); |
tiIdentite.setLayout(new FormLayout()); |
tiIdentite.setScrollMode(Scroll.AUTO); |
|
formulaireOnglets.add(tiIdentite); |
|
|
hmIdentite.put("tiIdentite", tiIdentite); |
|
|
//Tab 2 : Adresse |
tiAdresses = new TabItem("Adresse"); |
tiAdresses.setLayout(new FormLayout()); |
tiAdresses.setScrollMode(Scroll.AUTO); |
|
formulaireOnglets.add(tiAdresses); |
|
//Tab 3 : Infos Naturalistes |
185,8 → 180,8 |
tiInfosNat = new TabItem("Informations Naturalistes"); |
tiInfosNat.setLayout(new FormLayout()); |
tiInfosNat.setScrollMode(Scroll.AUTO); |
|
formulaireOnglets.add(tiInfosNat); |
|
add(formulaireOnglets); |
} |
|
240,7 → 235,6 |
cbPrefixe.setEmptyText("Choisissez le préfixe:"); |
cbPrefixe.setFieldLabel("Prefix"); |
|
|
fsNoms.add(cbPrefixe); |
hmIdentite.put("cbPrefixe", cbPrefixe); |
|
262,7 → 256,6 |
fsNoms.add(tfNom); |
hmIdentite.put("tfNom", tfNom); |
|
|
//Suffixe |
ListStore<Valeur> storeSuffixe = new ListStore<Valeur>(); |
ComboBox<Valeur> cbSuffixe = new ComboBox<Valeur>(); |
276,7 → 269,6 |
|
mediateur.obtenirListeValeurEtRafraichir(this, "suffixes"); |
|
|
TextField<String> tfNomAutre = new TextField(); |
tfNomAutre.setFieldLabel("Autres noms"); |
tfNomAutre.setName("truk_nom_autre"); |
290,8 → 282,7 |
|
fsNoms.add(tfAbreviation); |
hmIdentite.put("tfAbreviation", tfAbreviation); |
|
|
|
//Abréviation autres |
TextField<String> tfAbreviationAutre = new TextField<String>(); |
tfAbreviationAutre.setFieldLabel("Autres Abrév."); |
305,7 → 296,6 |
formLayout = new FormLayout(); |
formLayout.setLabelAlign(LabelAlign.LEFT); |
|
|
FieldSet fsNaissance = new FieldSet(); |
fsNaissance.setHeading("Naissance"); |
fsNaissance.setLayout(formLayout); |
334,20 → 324,52 |
FieldSet fsDeces = new FieldSet(); |
fsDeces.setHeading("Décès"); |
fsDeces.setLayout(formLayout); |
|
|
Radio rbEstDecedee = new Radio(); |
rbEstDecedee.setBoxLabel("oui"); |
|
rbEstDecedee.addListener(Events.Change, new Listener<ComponentEvent>() { |
|
public void handleEvent(ComponentEvent be) { |
if(((Radio) be.component).getValue().equals(true)) { |
((DateField) hmIdentite.get("dfDateDeces")).setVisible(true); |
((TextField) hmIdentite.get("tfLieuDeces")).setVisible(true); |
} else { |
((DateField) hmIdentite.get("dfDateDeces")).setVisible(false); |
((TextField) hmIdentite.get("tfLieuDeces")).setVisible(false); |
} |
//afficherChampSupplementaire(((Radio) be.component)); |
} |
|
}); |
|
|
|
Radio rbNestPasDecedee = new Radio(); |
rbNestPasDecedee.setBoxLabel("non"); |
rbNestPasDecedee.setValue(true); |
|
RadioGroup rbgDeces = new RadioGroup(); |
rbgDeces.setFieldLabel("Est décédée"); |
rbgDeces.add(rbEstDecedee); |
rbgDeces.add(rbNestPasDecedee); |
|
fsDeces.add(rbgDeces); |
|
DateField dfDateDeces = new DateField(); |
dfDateDeces.getPropertyEditor().setFormat(DateTimeFormat.getFormat("dd/MM/yyyy")); |
dfDateDeces.setFormatValue(true); |
dfDateDeces.getMessages().setInvalidText("La valeur saisie n'est pas une date valide. La date doit être au format «jj/mm/aaaa»."); |
dfDateDeces.setFieldLabel("Date"); |
dfDateDeces.setVisible(false); |
|
fsDeces.add(dfDateDeces); |
hmIdentite.put("dfDateDeces", dfDateDeces); |
|
|
|
TextField<String> tfLieuDeces = new TextField(); |
tfLieuDeces.setFieldLabel("Lieu"); |
tfLieuDeces.setName("deces_lieu"); |
tfLieuDeces.setVisible(false); |
|
fsDeces.add(tfLieuDeces); |
hmIdentite.put("tfLieuDeces", tfLieuDeces); |
386,9 → 408,8 |
IconButton bAjouter = new IconButton(ComposantClass.ICONE_AJOUTER); |
bAjouter.addSelectionListener( |
new SelectionListener<ComponentEvent>() { |
|
public void componentSelected(ComponentEvent ce) { |
|
|
String strTelephone = ((TextField<String>) hmIdentite.get("tfTelephone")).getValue(); |
if ((strTelephone==null)||(strTelephone.trim().equals(""))) { |
MessageBox.alert("Erreur de saisie", "Vous devez saisir un numéro de téléphone", null); |
395,7 → 416,6 |
} else if (hmIdentite.get("tel-" + strTelephone) != null){ |
MessageBox.alert("Erreur de saisie", "Le numéro saisi est déjà présent dans la liste", null); |
} else { |
|
String strValeurTypeTel = ""; |
String idTel = ""; |
Valeur valeurTypeTel = ((ComboBox<Valeur>) hmIdentite.get("cbTelephone")).getValue(); |
407,8 → 427,7 |
strValeurTypeTel = ((ComboBox<Valeur>) hmIdentite.get("cbTelephone")).getRawValue(); |
idTel = strValeurTypeTel; |
} |
|
|
|
if (strValeurTypeTel.trim().equals("")) { |
MessageBox.alert("Erreur de saisie", "Vous devez saisir un type de téléphone", null); |
} else { |
427,7 → 446,6 |
|
fsContactTel.add(lcTelephone); |
|
|
FieldSet fsContact = new FieldSet(); |
fsContact.setHeading("Contact - Autres"); |
fsContact.setId("fsContact"); |
436,13 → 454,11 |
right.add(fsContact); |
hmIdentite.put("fsContact", fsContact); |
|
|
LabelField lfCourriel = new LabelField(); |
lfCourriel.setText("<b>Courriels:</b>"); |
|
fsContact.add(lfCourriel); |
|
|
LayoutContainer lcCourriel = new LayoutContainer(); |
lcCourriel.setLayout(new ColumnLayout()); |
|
452,13 → 468,9 |
HiddenField hfHiddenCourriel = new HiddenField(); |
hfHiddenCourriel.setId("tfHiddenCourriel"); |
hfHiddenCourriel.setValue(""); |
|
add(hfHiddenCourriel); |
hmIdentite.put("hfHiddenCourriel", hfHiddenCourriel); |
|
//tfHiddenCourriel.setVisible(true); |
|
|
|
hmIdentite.put("tfCourriel", tfCourriel); |
|
IconButton bAjouterCourriel = new IconButton(ComposantClass.ICONE_AJOUTER); |
468,7 → 480,6 |
public void componentSelected(ComponentEvent ce) { |
|
String strEmail = ((TextField<String>) hmIdentite.get("tfCourriel")).getValue(); |
|
if ((strEmail==null)||(strEmail.trim().equals(""))) { |
MessageBox.alert("Erreur de saisie", "Vous devez saisir une adresse", null); |
} else if (hmIdentite.get("email-" + strEmail) != null){ |