Am 29.01.14 09:31, schrieb Martin Grigorov:
Hi,

On Wed, Jan 29, 2014 at 9:15 AM, Michael Mosmann <mich...@mosmann.de> wrote:

Hi,

As one might know I did some refactoring in this direction. What we can
expect is some trouble with defaultModel in Component. There are different
kind of ways to solve this, but it will come with cost.
- remove default model from component
- make component generic
- make some bigger changes to it

Yes, I also imagine bigger API changes to accomplish this.
yes.. think we can not avoid this..
Both the old discussion [1] and Martijn suggest to change Label to use read
only model.
I see several problems with this:

- I won't be able to push new object into the Label's model.
Usually one needs readonly model, like ResourceModel, but there are cases
when you need to do: label.setModelObject("new")
I see some trouble in changing components model values from "outside" .. I saw a lot of code where someone did this with more complex components/models without the component itself knowing this.

But I understand the value of this shortcut.

- o.a.w.Component as the base class for all components doesn't know what
type of model the specialization will need, so it's signature will have to
use a base model class. What is the base for IReadableModel and
IWriteableModel ?!
I think there is only ReadOnlyModel and Model .. because a Model you only can write into us very unusual.. If we model it this way: IModel -> IWriteableModel + IReadonlyModel then Component<T,M extends IReadonlyModel<T>> is valid, because other Components Extend it to f.I. Form<T> extends Component<T,IModel<T>>

This is how I think about it, which is only valid in my head until some code proves that I did not miss something.

- currently IModel is also IDetachable
I am not sure that lambda's in Java 8 will work here unless we remove
IDetachable from the base imodel interface and add it to each
implementation.
Yes.. and Models without Detach are useless. I see no obvious solution with a good benefit/cost ratio.

Next steps:
- finish my serialization visualization tool (1-2 weeks (hope so))
- install java8 on my laptop (1 day .. (hope so.. no idea))
- explore some refactorings and rumtime behavior with the current wicket branch and java8

Michael

Reply via email to