So to summarize your idea it would be like this

class SingleSortState
  IChangeRecorder recorder;
  SortState(IChangeRecorder) {...}

  setPropertyState(...) {
      recorder.addChange( new Change() {...} )
   }

OrderByLink { onclick () { getState().setProperty(...); } }

this has the same net affect as

OrderByLink { onclick() { addstatechange(new Change() { ... clone(getState()); }); getState().setProperty(...); } }


Your way shifts a lot more responsibility into the model because it needs to know how to version itself, and most models in wicket need to do that to support the back button. That means you can no longer user your pojo models as wicket models. for example i can no longer reuse my Person pojo from the domain layer because it has no concept of versioning. am i totally off here? Thats the advantage of doing it on component side - your models can stay dumb pojos and the component takes care of versioning them by using the only fool-proof way it can - cloning.

-Igor


Reply via email to