> I'm trying to build a list which items can be collapsed (so there are > 2 possible ways to populate the ListItem). I also need the components > shown in the list to be stateful because I want to use a form with > input validation in one of the views. The components which will be > populated for the ListItem are implemented as two different Panel > classes. How can something like this be build with Wicket? > My main problem with using the ListView component is that the > component generation happens with every request (populateItem), so > these components are never stateful. I can fix this with putting the > components itself in the list model for the ListView so these get > generated only once, but this doesn't feel right. Also this makes > replacing one component instance very hard because a component can't > replace itself this way anymore...
You're right that ListItems are generated (populated) for each request, but the underlying model of ListView (a List) and thus the ListItems models (specific item of the List) stays the same. And the model is where you keep your state. And to solve your problem of 2 different panels, I'd suggest to use Component.setVisible(true/false). I works fine in such cases and IMO it does have the benefit that you html markup contains both panels, keeping you aware of what is going on. Juergen ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_idt77&alloc_id492&op=click _______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
