}
private void createComponents()
{
this.add(new RequiredTextField("username", new PropertyModel(this, "username")).setLabel(new Model("Code Usager")));
this.add(HomePage.link("cancel", WelcomePanel.class, null));
final PasswordTextField txtPassword = new PasswordTextField("password", new PropertyModel(this.password, "newPassword"));
txtPassword.setLabel(new Model("Mot de passe"));
txtPassword.setResetPassword(false);
this.add(txtPassword);
final PasswordTextField confirmPassword = new PasswordTextField("confirmpassword", new PropertyModel(this.password, "confirmPassword"));
confirmPassword.setLabel(new Model("Confirmation du mot de passe"));
confirmPassword.setResetPassword(false);
this.add(confirmPassword);
this.add(new EqualPasswordInputValidator(txtPassword, confirmPassword));
this.add(new RequiredTextField("nom", new PropertyModel(this.personne, "nom")).setLabel(new Model("Nom")));
this.add(new RequiredTextField("prenom", new PropertyModel(this.personne, "prenom")).setLabel(new Model("Prenom")));
this.add(new RequiredTextField("adresse", new PropertyModel(this.personne, "adresse")).setLabel(new Model("Adresse")));
this.add(new RequiredTextField("ville", new PropertyModel(this.personne, "ville")).setLabel(new Model("Ville")));
final ProvincesDropDownChoice province = new ProvincesDropDownChoice("province", new PropertyModel(this.personne, "province"));
province.setLabel(new Model("Province"));
this.add(province);
this.add(new PaysDropDownChoice("pays", new PropertyModel(this.personne, "pays")){
private static final long serialVersionUID = -2426618314309535060L;
@Override
protected boolean wantOnSelectionChangedNotifications() {
return true;
}
@Override
protected void onSelectionChanged(final Object newSelection) {
final String pays = (String) newSelection;
if(pays == "Canada"){
province.clearInput();
province.setRequired(true);
province.setCanada();
province.setEnabled(true);
}
else if(pays == "Etats-Unis"){
province.clearInput();
province.setRequired(true);
province.setUSA();
province.setEnabled(true);
}
else{
province.clearInput();
province.setEnabled(false);
province.setRequired(false);
}
}
}
.setLabel(new Model("Pays")).setRequired(true));
this.add(new RequiredTextField("codePostal", new PropertyModel(this.personne, "codePostal")).setLabel(new Model("Code postal")));
this.add(new RequiredTextField("telephone", new PropertyModel(this.personne, "telephone"), Telephone.class)
{
/**
*
*/
private static final long serialVersionUID = -1622892079642695231L;
@Override
public IConverter getConverter()
{
return new MaskConverter("###-###-####", Telephone.class);
}
}.setLabel(new Model("Telephone")));
this.add(new SexeDropDownChoice("sexe", new PropertyModel(this.personne, "sexe")).setLabel(new Model("Sexe")).setRequired(true));
this.add(new AnneesDropDownChoice("annees", new PropertyModel(this.dateNaissance, "annee")).setLabel(new Model("Annees")).setRequired(true));
this.add(new MoisDropDownChoice("mois", new PropertyModel(this.dateNaissance, "mois")).setLabel(new Model("Mois")).setRequired(true));
this.add(new JoursDropDownChoice("jours", new PropertyModel(this.dateNaissance, "jour")).setLabel(new Model("Jours")).setRequired(true));
final RequiredTextField courriel = new RequiredTextField("courriel", new PropertyModel(this.personne, "courriel"));
courriel.setLabel(new Model("Courriel")).setRequired(true);
courriel.add(EmailAddressPatternValidator.getInstance());
this.add(courriel);
final PaysDropDownChoice nationalite = new PaysDropDownChoice("nationalite", new PropertyModel(this.personne, "nationalite"));
nationalite.setLabel(new Model("Nationalite"));
this.add(nationalite);
this.add(new Button("enregistrer")
{