You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Leszek Gawron <lg...@apache.org> on 2007/09/11 13:53:27 UTC
Model question
Assuming eventModel is loadable detachable model sould I implement some
marker interfaces in the following model?
> private static class SystemWarningEventImagePathModel extends AbstractReadOnlyModel {
> private IModel eventModel;
>
> public SystemWarningEventImagePathModel( IModel eventModel ) {
> this.eventModel = eventModel;
> }
>
> @Override
> public Object getObject() {
> SystemWarningEvent event = (SystemWarningEvent) eventModel.getObject();
> return event.isReadFlag() ? "img/mobile/event_read.png" : "img/mobile/event_new.png";
> }
> }
There are a number to take into account: IWrapModel, IChainingModel.
Please advise.
--
Leszek Gawron
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Model question
Posted by Martijn Dashorst <ma...@gmail.com>.
Nothing directly. The only thing you should do is propagate the
'detach' method to your nested eventModel. The chaining model is
merely interesting for consumers of your model, so they can get to the
embedded model using a specified API.
>From chapter 5 "Understanding Models" of Wicket in Action (the custom
models part where the quote comes from may become an appendix though):
"To summarize, when you want to chain models, be sure to propagate the
detach call to the chained models. This way the whole chain will be
detached. If your custom model is part of a public API, your clients
will most likely thank you when you implement the IChainingModel
interface, providing them access to the inner model."
The IWrapModel is used for marking models that have been wrapped using
IComponentAssignedModel or IComponentInheritedModel.
Martijn
On 9/11/07, Leszek Gawron <lg...@apache.org> wrote:
> Assuming eventModel is loadable detachable model sould I implement some
> marker interfaces in the following model?
>
> > private static class SystemWarningEventImagePathModel extends AbstractReadOnlyModel {
> > private IModel eventModel;
> >
> > public SystemWarningEventImagePathModel( IModel eventModel ) {
> > this.eventModel = eventModel;
> > }
> >
> > @Override
> > public Object getObject() {
> > SystemWarningEvent event = (SystemWarningEvent) eventModel.getObject();
> > return event.isReadFlag() ? "img/mobile/event_read.png" : "img/mobile/event_new.png";
> > }
> > }
>
>
> There are a number to take into account: IWrapModel, IChainingModel.
> Please advise.
>
> --
> Leszek Gawron
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
--
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-beta3 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta3/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org