You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Michael Mikhulya (JIRA)" <ji...@apache.org> on 2009/07/13 14:51:15 UTC

[jira] Commented: (WICKET-27) Make LoadableDetachableModel writable

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

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

Igor, I need exactly the same functionality that is requested in this bug.
And I'm going to implement it in the same way you suggested.
Of course I would like to push my implementation upstream.

Please reopen the bug and assign it to me, I will attach a patch in one day after it.



> 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.