[ 
https://issues.apache.org/jira/browse/WICKET-5312?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Martin Grigorov resolved WICKET-5312.
-------------------------------------

    Resolution: Won't Fix

You can have a helper class for such needs.
The proposed method looks strange to be in the Wicket API.

If you don't agree with me then please start a discussion in dev@ mailing list.
                
> Add detachModel(IModel<?> model) to Component
> ---------------------------------------------
>
>                 Key: WICKET-5312
>                 URL: https://issues.apache.org/jira/browse/WICKET-5312
>             Project: Wicket
>          Issue Type: Improvement
>          Components: wicket
>         Environment: Any
>            Reporter: Steve Lowery
>            Priority: Minor
>
> Can you add the following method (or something similar) to Component to avoid 
> a lot of boilerplate code when a Component has more than one model object?  
> We have many components that take more than one model object and we are 
> responsible for detaching all but the one passed into super.  If those others 
> are optional, we have to null check them before detaching.  Would be nice if 
> wicket did this for us...
> protected final void detachModel(IModel<?> model) {
>   if(model != null) {
>     model.detach();
>   }
> }
> Without a convenience method, our code looks like this...
> @Override
> protected void onDetach() {
>   if(modelOne != null) {
>     modelOne.detach();
>   }
>   if(modelTwo != null) {
>     modelTwo.detach();
>   }
>  ...
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to