This bug is easy to work around, but it affects how you code at a very low/basic level. When is the next maintenace release scheduled? /Anders

Johan Compagner wrote:
ok i think i have fixed it. Must check it out but now you can do
setModelObject on youre root component:

if (!getComparator().compareValue(this, object))
{
modelChanging();

if (getFlag(FLAG_HAS_ROOT_MODEL))
{
getRootModel(model).setObject(null, object);
}
else
{
model.setObject(this, object);
}
modelChanged();
}
return this;

johan


On 11/23/05, Johan Compagner <[EMAIL PROTECTED]> wrote:

That is a bug.
for example Component.getModelObject() does this:

// If this component has the root model for a compound model
if (getFlag(FLAG_HAS_ROOT_MODEL))
{
// we need to return the root model and not a property of the
// model
Object result = getRootModel(model);
if ((result instanceof IModel))
{
result = ((IModel)result).getObject(null);
}
return result;
}

// Get model value for this component
return model.getObject(this);

and setModelObject()

modelChanging();
model.setObject(this, object);
modelChanged();

Thats wrong. It should be the same kind of check for that setObject()
And call it will null if it is the root model of itself instead of giving
"this" with the call.

johan

On 11/22/05, Christian Essl <[EMAIL PROTECTED]> wrote:

On Tue, 22 Nov 2005 16:10:23 +0100, Anders Peterson
<[EMAIL PROTECTED]> wrote:


Hi,

There are a couple of things I don't understand.

1) I have a form using a CompoundPropertyModel with a HashMap as the
initial model object. When I later (after having made a choice in a
DropDownChoice) call

this.getForm().setModelObject(aNewModelObject);

nothing in the gui is updated. Typically I have components declared

like

tmpForm.add(new TextField(ID_SPAN));

that I'd like to have updated.


Component.setModelObject (Object obj) does call IModel.setObject
(this,obj).
The CompountPropertyModel than takes the id of the component and
interprets it as a bean expression into the underlying Object (or in
case
the the CoumpoundPropertyModel wraps another model the Object from the
wrapped model).

So in your case:
==>form.setModelObject(aNew)==>CompoundPropModel.setObject(form,aNew)==>
map.put(form.getId(),aNew);

There are a few solutions (and others):
1.) keep the underlying map in an instance variable und access it (in
case
you do not use
detachable things).
2.) use form.getModel().setObject(null,new Map())

--
http://ojalgo.org/

Mathematics, Linear Algebra and Optimisation with Java


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.  Get Certified Today
Register for a JBoss Training Course.  Free Certification Exam
for All Training Attendees Through End of 2005. For more info visit:
http://ads.osdn.com/?ad_id=7628&alloc_id=16845&op=click
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to