On 5/1/07, Eelco Hillenius <[EMAIL PROTECTED]> wrote:
> protected Object convertValue(String[] value) { > // we can ignore passed in value, but what we do instead is create an > object based on child components > LocalTime time=(LocalTime)timepicker.getconvertedinput(); > DateTime datetime=time.withDate > ((LocalDate)datepicker.getConvertedInput()); > return datetime; > } Yeah, this was the direction I've been thinking as well. What I didn't like about this is that the String[] argument is passed in - even though it can't be ignored it just doesn't look great, and like you say...
yep. the question is do we want to change the api? it is easy, that array comes from getInputAsArray(), no magic.
you have to do a bit of extra chicking still because validatation hasnt yet > passed on the date and time pickers, only coversion. this can be improved > imho. we can do conversion+validation sequentially in a single pass instead > of in multiple separate passes. it's only half way done. Imho, even would be even cooler if model updating would have been done for those kids as well, so that I don't have to know about converted input (imo an internal method) but can just get the model objects directly.
no no no. you cannot update the model unless you know the whole thing is valid! this is because you dont know how the models are constructed. there is no guarantee that formcomponentpanel will encapsulate the model somehow, it could just pass its own model to its children. and if we do what you propose that some parts of the root form model can get updated even though the form is not valid - a big no no. Which makes me think of something... what should we do if anything
fails (conversion, validation) for child components. You typically want to process siblings like we've always done for formcomponents that are not nested in other formcomponents, but I don't think we should visit deeper (go up the hierarchy as we traverse post order) for any of the steps (conversion, validation and updatemodel) when one of them fails. WDYT?
that is already done. formcomponent.isvalid() now checks its children as well, so if something inside fails ancestors are not checked.
i can probably make this change soon. Excellent! :)
done. -igor Eelco