1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
private SimpleDateFormat myDateFormat = new SimpleDateFormat("dd/MM/yyyy"); // Pas besoin de getter et setter pour cet attribut
private CoreSelectInputDate selectInputDate;
private CoreOutputText maDateOuputText;
public void setSelectInputDate(CoreSelectInputDate selectInputDate) {
this.selectInputDate = selectInputDate;
}
public CoreSelectInputDate getSelectInputDate() {
return selectInputDate;
}
public void setMaDateOuputText(CoreOutputText maDateOuputText) {
this.maDateOuputText = maDateOuputText;
}
public CoreOutputText getMaDateOuputText() {
return maDateOuputText;
}
public String selectTheDate() {
if (this.getSelectInputDate().getValue()!=null) { // Teste si l'utilisateur a bien saisie quelquechose dans le champ date
this.getMaDateOuputText().setValue(myDateFormat.format(this.getSelectInputDate().getValue()));
return switchBtwStep1AndStep2(); // me permet de redéfinir mon affichage une fois la date choisie
}else{ // Si l'utilisateur n'a pas entré de date
FacesContext fctx = FacesContext.getCurrentInstance();
FacesMessage fm =
new FacesMessage(FacesMessage.SEVERITY_INFO, "Please select a Date",
null);
fctx.addMessage("MyValueChangeListener", fm);
return null;
}
} |
Partager