Hi , I am evaluating FormComponentPanel .
I looked into the document , it seems setConvertedInput() is the proper way
.
I use another method , which skips the setConvertedInput() , I don't know if
it is suggested :
Here is the code :
public class TimePanel extends FormComponentPanel
{
private Time time;
public TimePanel(String id , Time time )
{
super(id);
this.time = time;
add(new CheckBox("beforeChrist" , new PropertyModel(time ,
"beforeChrist")));
add(new TextField("year" , new PropertyModel(time , "year")));
add(new TextField("month" , new PropertyModel(time , "month")));
add(new TextField("day" , new PropertyModel(time , "day")));
add(new TextField("hour" , new PropertyModel(time , "hour")));
add(new TextField("minute" , new PropertyModel(time , "minute")));
add(new TextField("second" , new PropertyModel(time , "second")));
}
}
I embed this TimePanel to a form :
Time time = new Time(); //my custom Time class
add(new TimePanel("timePanel" , time));
add(new Button("button")
{
@Override
public void onSubmit()
{
System.out.println("time = " + time);
}
});
It works .
It seems by this way , I can skip implementing setConvertedInput() , right ?
Is there any drawback ?
Is this a suggested way ?