wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Grigorov <mgrigo...@apache.org>
Subject Re: validation in form component panels in RefreshingView
Date Thu, 22 Jan 2015 13:41:36 GMT
Hi,

On Thu, Jan 22, 2015 at 3:16 PM, lucast <lucastoledo@hotmail.com> wrote:

> Thank you, Martin,
>
> I have used ReuseIfModelsEqualStrategy and the validation message side of
> it
> work but now I have a different problem.
>
> When I navigate away from the form panel, update the list of objects and
> navigate back to the FormComponentPanel that holds the RefreshingView, only
> one item from the list gets displayed.
>
> I use a ListModel to pass the list of objects to the FormComponentPanel.
>
> When used for the first time, the RefreshingView calls getItemModels() and
> populateItem(), but after updating the ListModel, RefreshingView only calls
> getItemModels() and *not* populateItem().
>
> Would you happen to know why that is?
>
> If I use DefaultItemReuseStrategy.getInstance() then  getItemModels() and
> populateItem() get called every time. But that just takes me back to square
> 1.
>
> I'm not sure if this is relevant. ReuseIfModelsEqualStrategy documentation
> states that " the model and not the model object needs to implement the
> Object.equals(Object) and Object.hashCode() methods".
>
> I'm terribly sorry but I'm not sure completely understand that statement.
> Would that be something to do with the RefreshingView not displaying all
> items in the list model.
>

This says that your model object has to have proper impls of #equals() and
#hashCode() methods. Just like when you put instances of this class in
HashMap.

I guess this will solve your problem.


>
> On trying to interpret that statement, on RefreshingView.getItemModels(), I
> return an anonymous class that extends ModelIteratorAdapter. And on
> ModelIteratorAdapter.model, I return an custom Model with extends Model<My
> Application Object>. It is there that I implement hashcode and equals. But
> the problem still persists.
>
> I hope I'm not making things more confusing by writing extensively, but I
> just wanted to put it out there, in case there was something simple and
> small that I am missing.
>
> Thanks in advance,
> Lucas
>
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/validation-in-form-component-panels-in-RefreshingView-tp4669068p4669081.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message