On 20/04/2011 19:01, Kevin Meyer - KMZ wrote:
Right.. My grief is that I have a list of domain objects:
final List<Tag> tagList = wizard.getTags();
and no obvious way to create a EntityCollectionModel from it. I'm
guessing that I should be using the original ObjectAdapter instead of
just doing the following:
ObjectAdapter objectAdapter = getModelObject();
Object object = objectAdapter.getObject();
ToDoWizard wizard = (ToDoWizard) object;
Hmm... I'd have expected instead that the EntityCollectionModel would
already be created by the owning form, and all you need to do is make
your new widget's ComponentFactory available available to do the rendering.
In a little more detail... the
EntityCollectionModel.createdParented(EntityModel, OneToManyAssociation)
is the method that needs to be called. You can see that this is called
by the two forms that we currently have that render object properties...
EntityPropertiesAndOrCollectionsPanel.PropCollForm and also
EntityTabbedPanel. But in both cases they are going to delegate to the
ComponentFactoryRegistry to get a ComponentFactory to render the model.
You should therefore:
a) create a ComponentFactory, similar to [1]
b) register that ComponentFactory, typically by adding to
META-INF/services [2]
[1]
http://incubator.apache.org/isis/viewer/wicket/docbkx/html/guide/apas03.html#sec.ClaimWizardComponentFactory
[2]
http://incubator.apache.org/isis/viewer/wicket/docbkx/html/guide/ch06.html
Let me know if that helps.
Cheers
Dan