You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Martin Grigorov (JIRA)" <ji...@apache.org> on 2014/03/24 09:37:54 UTC
[jira] [Resolved] (WICKET-5538) When using
Component.setDefaultModel, only detach the previous model if the new one is
different
[ https://issues.apache.org/jira/browse/WICKET-5538?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Martin Grigorov resolved WICKET-5538.
-------------------------------------
Resolution: Fixed
Fix Version/s: 6.15.0
7.0.0
> When using Component.setDefaultModel, only detach the previous model if the new one is different
> ------------------------------------------------------------------------------------------------
>
> Key: WICKET-5538
> URL: https://issues.apache.org/jira/browse/WICKET-5538
> Project: Wicket
> Issue Type: Improvement
> Components: wicket
> Reporter: Guillaume Smet
> Assignee: Martin Grigorov
> Priority: Minor
> Fix For: 7.0.0, 6.15.0
>
> Attachments: WICKET-5538.diff
>
>
> From my post on the list:
> {quote}
> Hi,
> I don't see the point of detaching the prevModel if the model is not changing.
> I was thinking about changing the logic of Component.setDefaultModel like that:
> public Component setDefaultModel(final IModel<?> model)
> {
> IModel<?> prevModel = getModelImpl();
> IModel<?> wrappedModel = prevModel;
> if (prevModel instanceof IWrapModel)
> {
> wrappedModel = ((IWrapModel<?>)prevModel).getWrappedModel();
> }
> // Change model
> if (wrappedModel != model)
> {
> // Detach current model only if we really change the model
> if (prevModel != null)
> {
> prevModel.detach();
> }
> modelChanging();
> setModelImpl(wrap(model));
> modelChanged();
> }
> return this;
> }
> Note that it's something that hurts us a lot in a particular pattern
> we have here. We change the default model in onConfigure and every
> time we do it it's detached even if it's the exact same model.
> We could add a check in our code but I'm thinking it could be better
> to do it in Wicket directly.
> Thoughts?
> {quote}
--
This message was sent by Atlassian JIRA
(v6.2#6252)