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 > > My next solution is to declare a shared model holding the selected town. That's how I would do it > The app-author using the panel has than to declare it in a custom Session > and give it to each Panel instances on creation. However I am not realy > satisfied with this approach, because it makes the usage of the panel > harder, polutes the Session, the weather panel has to make an unsave cast > of the Session and it IMO breaks encapsulation. The app-author should not > be concerned with how the town is stored and shared between the insances > of the same class. 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. > > What I would need is some sort of (private) static session or static > application scoped model holder. Is there something like this in the api? > > I was looking for something on Component like > protected Serializable getSharedSessionModel(Class declaringCl) > protected void setSharedSessionModel(Class declaringCl,Serializable model) > 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). > where the Class paramter is needed that extending components do not > override the model of the parent. > > > I think such a thing could be useful for a number of different 'portlets' > like stock-tickers, shopping-baskets, mail-notification voting-boxes etc. > I hope that helps. 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
