Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-2364

CLONE -Make LoadableDetachableModel writable

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4-RC6
    • 1.4.4, 1.5-M1
    • wicket
    • None

    Description

      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.

      Attachments

        1. LoadableDetachableModel.java.patch
          1 kB
          Michael Mikhulya

        Issue Links

          Activity

            People

              ivaynberg Igor Vaynberg
              mihasik Michael Mikhulya
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: