The component creation:
fc = new CheckBoxMultipleChoice(
"services",
new CompoundPropertyModel(vseModel),
new VendorSurveyServicesListingModel(vseService)
);
vseModel is a model holding an object that is lazily loaded from
hibernate. It has a member "getServices()" that returns a set of
VendorSurveyService objects.
VendorSurveyServicesListingModel is a model that returns a list of all
possible VendorSurveyServie objects.
I expected that the CheckBoxMultipleChoice component would get its value
by asking the CompoundPropertyModel, which would get the object out of
vseModel, then find the value of the getServices() method.
However, I get a casting exception because it actually gets the value of
the nested model, vseModel. In Component's getModelObject() method:
final IModel model = getModel();
if (model != null)
{
// 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
return getRootModel(model).getObject(null);
}
// Get model value for this component
return model.getObject(this);
}
else
{
return null;
}
getFlag(FLAG_HAS_ROOT_MODEL) returns true. What is this? What does it
mean? How do I get Component to use the CompoundPropertyModel as I
expected?
Thanks,
--
Philip A. Chapman
Desktop and Web Application Development:
Java, .NET, PostgreSQL, MySQL, MSSQL
Linux, Windows 2000, Windows XP
signature.asc
Description: This is a digitally signed message part
