[ 
https://issues.apache.org/jira/browse/WICKET-27?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12730338#action_12730338
 ] 

Michael Mikhulya commented on WICKET-27:
----------------------------------------

It didn't take much time to implement this functionality.
So I have cloned this issue (see WICKET-2364) to ensure that my patch will be 
reviewed.

> Make LoadableDetachableModel writable
> -------------------------------------
>
>                 Key: WICKET-27
>                 URL: https://issues.apache.org/jira/browse/WICKET-27
>             Project: Wicket
>          Issue Type: Improvement
>            Reporter: Martijn Dashorst
>
> To keep it compatible with current usage:
> public final void setObject(Object obj) {
>     reload(obj);
>     tempModelObject = obj;
> }
> protected void reload(Object obj) {
>     throw new OperationNotSupportedException("Read only model");
> }
> Subclasses can now implement their own write logic. This is necessary for for 
> instance stand alone dropdownchoice components that need to store their 
> selection.
> e.g.
> MyPage {
>     IModel<SchoolYear> selectedSchoolYear;
>     public MyPage() {
>         selectedSchoolYear = new 
> HibernateModel<SchoolYear>(SchoolYear.current());
>         new SchoolYearDropDownChoice(this, "schoolyear", selectedSchoolYear);
>     }
> }
> If HibernateModel is not writeable then the selected SchoolYear instance 
> would end up in the session.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to