Ahh so the value of the AjaxEditableLabel (that is retunred by
AjaxEditableLabel.getModelObject())
is the input for the label and textfield?
Igor made it implement that. But i guess we encountered now a corner case
where you really don't want it to
unwrap it again. What kind of model do the textfield and label get exactly?
You really just want the one
of the AjaxEditableLabel (the exact one)?
It is by the way not IInheritableModel that is causing the problem for you
but assignable.
Because i guess you are getting the model from the ajaxeditablelabel and
then call setModel() on the textfield and label?
Then IAssignable is bothering you..
So the question is if you do this:
Form form = new Form(compoundmodel);
TextField field1 = TextField(form);
TextField field2 = TextField(form,field2.getModel());
what is it that you really want? I think now you just really want a copy of
the model of field1.
So field2 its model object is the same as field1.getModelObject()
That is what you are saying in that code.
And because of IAssignable this will not be the case.
So i think we should remove it yes.
**
johan
On 10/12/06, Matej Knopp <[EMAIL PROTECTED]> wrote:
The recent change to models broke AjaxEditableLabel.
The reason is that model, obtained thorugh AjaxEditableLabel.getModel()
is used as model for label (and textfield).
If you set a CompoundPropertyModel to labels' parent, the model returned
by AjaxEditableLabel.getModel() implements IInheritableModel . So the
label and textfield try to get property 'label' and 'editor' from the
bean (which is of course not there).
The workaround is to make
AjaxEditableLabel.getParentModel()
like this:
final IModel<T> m = getModel();
// we are going to use the model for label and text field
// so we have to wrap it to a modal that does not implement
// IInheritableModel, otherwise it would fail
return new IModel<T>()
{
private static final long serialVersionUID = 0L;
public void detach()
{
m.detach();
}
public T getObject()
{
return m.getObject();
}
public void setObject(T object)
{
m.setObject(object);
}
};
The question is, whether this is correct?
-Matej