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

CLONE -Make LoadableDetachableModel writable

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.4-RC6
    • Fix Version/s: 1.4.4, 1.5-M1
    • Component/s: wicket
    • Labels:
      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

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

                Dates

                • Created:
                  Updated:
                  Resolved: