Johan Compagner wrote:
On 9/10/07, Matthijs Wensveen <[EMAIL PROTECTED]> wrote:
Hi,
According to the javadoc Form.updateFormComponentModels should update
all the models of all FormComponents in a form (without validation
presumably?). This sets all the model objects to the convertedInput
no it updates the form component models where conversion and validation did
go alright.
Okay, so the difference with Form.process() is that process() does not
update at all when one of the FormComponents is invalid, and
updateFormComponentModels updates all that ARE valid, right? So that's
usually what you want (and what I want in this case). Thanks for making
this clear.
In Form.process() where this method is called, the form is validated
first, so conversion took place as a side effect of validation. There I
can see how it works. Maybe the javadoc of
Form.updateFormComponentModels should state that Form.validate should be
called first. Form.validate does state that: "This method is typically
called before updating any models." which is good.
value (in FormComponent.updateModel), unfortunately convertedInput is
only set after a call to validate(). This really makes
updateFormComponentModels useless as a protected method. If validation
It is only protected final if you want to do some of your own processing
see IFormSubmittingComponent.getDefaultFormProcessing()
is really mandatory (which I doubt), processInput should be the only
callable method as it validates first and then updates the model.
checking required, conversion and validation is mandatory before updating
models.
In any case, the call to convertInput() inside validate() strikes me as
odd (the wrong place to call such a method).
no not really, FormComponent.validate() is really all the validation that
can happen
first required validation, then conversion validation and then user
validation on the converted type
We could split up the methods again, like in Form.process()
which calls the above validate only. We could split that up in to
validateRequired(), validateConversion(), validateXX()
but what do we gain then?
Readability!
When a method is called validate() I expect it to validate, and validate
ONLY. Conversion of input is a side effect of validation.
Also, the javadoc of FormComponent.updateModel() states: ".. it expect
that the object is already converted through the convert() call", but
there is no convert() method in FormComponent.
thats then an error in the doc, there are some changes in that area so that
should be improved
make a jira issue for this.
Ehmokay. Do I really need to file a bug for this small documentation
bug? Done: https://issues.apache.org/jira/browse/WICKET-951
Maybe this is a consequence of the fact that wicket forces you to
subclass components so much. It's just too tempting to override so much
methods. I love wicket (I really do!) but I'd rather see wicket more
event listener oriented. This would also make it easier to listen to
events that are very deeply nested (fetch the component, register a
listener), which is almost impossible now
If you want listeners like swing then that is very easy for you to make
just extend link or what ever component or behavior you have once
and make the addXXXX/removeXXX and fireXXXX methods on them.
We have this also because it preserves memory, If you have to make an
(inner)class instance
and a link instance and attach those 2 each other that can consume much more
memory
then when just making a new class and have there one instance.
I'm not sure I see what you mean, but doesn't the (inner) class also
need instantiation, consuming just as much memory?
Thanks for clearing some things up for me.
Matthijs
--
Matthijs Wensveen
Func. Internet Integration
W http://www.func.nl
T +31 20 4230000
F +31 20 4223500
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]