Hi, On Thu, 22 Aug 2013 11:21:41 +0300, you wrote: >On Thu, Aug 22, 2013 at 11:08 AM, Emond Papegaaij < >[email protected]> wrote: snip >> The mismatch is in the fact that the PageParameters object is stored with >> the page while it resembles the parameters the page was created with. If >> a page changes (for example, by updating its model object), the >> PageParameters no longer match with the state of the page. That's why I'd >> rather not store them in the page at all but recreate them when needed. >> > >I don't see why Page's parameters should be related 1:1 to page's model. >The parameters are just the data that has been provided for the page >construction. Nothing more. >Later they could be used for url generation or not. >The page may use some of the parameters to create its model or not. > snip
I can see Martijn's point, and if one defines this as a convention, as it already is, then no more confusion. But I think it is a good concept to generate PageParameters from the state of the page. It would be good practice. I already use public static methods MyPage#createParameters(MyEntity something) which encapsulates this so my page instance would just call the static method with the parameters from the state of the page. So how could this be enforced? The framework could insist on overriding such a method if it detects a PageParameters constructor. Unfortunately that constructor is abused at the moment. See WICKET-5069. It would not be performant so caching would be needed. Perhaps update the instance var pageparameters with the result of a getPageParameters() call on modelChanged()? Kind Regards, Bernard
