i should always be able to simply call .detach() on any model and
expect it to be detached no matter how it was wrapped, etc
-igor
On Nov 13, 2007 2:24 PM, Johan Compagner <[EMAIL PROTECTED]> wrote:
> Hi,
>
> now in Component.detachModel we do this:
>
>
> // also detach the wrapped model of a component assigned wrap (not
>
> // inherited)
>
> *if* (model *instanceof* IWrapModel && !getFlag(*FLAG_INHERITABLE_MODEL*))
>
> {
>
> ((IWrapModel)model).getWrappedModel().detach();
>
> }
>
> should we really do that there? Because there are quite al lot of places
> where we have models stored in properties that we call this.myModel =
> wrap(model) on.
>
> and all or most of those places dont do what the normal model detach will do
> and that is calling also detach on the wrapped model.
>
> Now the question is should we do that anywhere so remove the code in
> detachModel() and just expect that users will also implement detach
> correctly?
>
> We dont even do that in the current code base so i need to fix that. Also
> then AbstractWrapModel can't have then an empty detach implementation
> because
>
> then people could easily miss it..
>
> What we also can do is introduce a protected final detachModel(IModel) so
> the "opposite" of protected final wrap(IModel) that doest the above check
>
> and call that one on all the places we now have internal IModel fields.
>
> johan
>