at the moment i did send this email, i though i can do it a bit better and
have a drop in replacement for the rest.
See ComponentModel i just checked in, if you know a better name place rename
it...

I think i will also try to make a attachable one so that the move from 1.2to
1.3 is a bit better.

johan (that shouldn't forget to alter the wiki migration guide)

On 7/27/07, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
>
> go for it
>
> -igor
>
>
> On 7/27/07, Johan Compagner <[EMAIL PROTECTED]> wrote:
> >
> > Any objections against this change:
> >
> >     protected final IModel getInnermostModel(final IModel model)
> >     {
> >         IModel nested = model;
> >         while (nested != null && nested instanceof IWrapModel)
> >         {
> >             final IModel next = ((IWrapModel)nested).getWrappedModel();
> >             if (nested == next)
> >             {
> >                 throw new WicketRuntimeException("Model for " + nested +
> "
> > is self-referential");
> >             }
> >             nested = next;
> >         }
> >         return nested;
> >     }
> >
> > to
> >
> >     protected final IModel getInnermostModel(final IModel model)
> >     {
> >         IModel nested = model;
> >         while (nested != null && nested instanceof IWrapModel)
> >         {
> >             final IModel next = ((IWrapModel)nested).getWrappedModel();
> >             if (nested == next)
> >             {
> >                 // found it is a IAssignableModel that wraps itself.
> >                 return nested;
> >             }
> >             nested = next;
> >         }
> >         return nested;
> >     }
> >
> > because i have a lot of places where i know the model instance will be
> > used
> > only once,
> > so in a 1 -> 1 relationship with the component. But it needs the
> > component.
> > Then it is much easier to have a base Model that is both assignable and
> > iwrapmodel and that
> > stores the component in itself. Ofcourse i can fix by introducing
> another
> > layer and generation
> > a few more methods. But are we really wanting the above nested check?
> >
> > johan
> >
>

Reply via email to