Thank that helps.
The component usually deals with how to render/display model data.
Thus not the component is the right place to keep the city and
detailed weather data, rather an appropriate model object.
My dream solution would be if I could create the Panel instance in the
Session and reuse the same instance on different Pages. However I think
this is not possible, is it?
I don't think this is suitable approach. See below for more details
I still think this would be the most 'natural' approach for components
which do not depend on a specific Page. You could also attach a Model to
them and I guess it would save resources to have just one shared instance.
However I see that this falls out of the straight easy way of Wicket (for
which I like Wicket).
My next solution is to declare a shared model holding the selected town.
That's how I would do it
custom session: yes, very easy in Wicket. Just subclass it and provide
your type safe getter and setter. However, you are right, you can
simply plug and play the component. A pnp component would have to use
a non-type safe approach. IMO it isn't that worse, because it would
all be encpasulated in a single (your) component and the app-author
wouldn't have to be concerned at all.
you are free to develop a nameing convention to store and access
information in wickets session object and thus to prevent accidental
changes. We currently do nt provide it (as far as I know).
So I'd have a (public) method saveModel(String someKey, IModel model) on
the Session and override detacheModel() on the Panels. Is detacheModel()
only called when the whole Session is transferred? I do not have a use
case but just for curiosity how would you handle the case where there is
an instance specific model and a shared model?
--
Christian Essl
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 1GB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
-------------------------------------------------------
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_id=7477&alloc_id=16492&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user