you are not using the compound property model properly. assign the compound property model to the parent of the fc and have the fc's model be null- that is how they are meant to be used. what you want can be accomplished with a propertymodel:

fc = new CheckBoxMultipleChoice(
                "services",
                new PropertyModel(vseModel, "services"),
                new VendorSurveyServicesListingModel(vseService)        );

-Igor
 

On 3/27/06, Philip A. Chapman <[EMAIL PROTECTED]> wrote:
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


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQBEKBcVAdpynRSGw3URAhTvAKCCjqGTBCYjq2lpRUIXfWawzkZT4QCcDNKU
qjFRsRwekuBwziHzmT27enI=
=sm0h
-----END PGP SIGNATURE-----



Reply via email to