[
https://issues.apache.org/jira/browse/ISIS-2253?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17008395#comment-17008395
]
Andi Huber commented on ISIS-2253:
----------------------------------
The choices or autoComplete defines the set of values available for the
parameter. Either one or the other is required. In the case of associatedWith,
we get the set of values from the corresponding table, so my thinking was that
it corresponds to an implicit choices.
For default, that is just a convenience to automatically populate the
parameter with some value or values.
Obviously, the defaults should be a subset of the choices.
the defaults facet is just used to populate the prompt, but the user can then
modify them before clicking ok.
Let me try to flesh out what's in my head a bit more.
For the metamodel, we would need a new FacetFactory, something like
ActionParameterChoicesInferredFromAssociatedWithFacetFactory
This would install an ActionParameterChoicesFacet on the appropriate actions
that are associated with a collection.
The implementation of this facet - to obtain the list of choices - would be to
invoke the collection.get(target).
Now I'm about to contradict myself re: defaults - sorry about this.
So, we would also want to install an ActionParameterDefaultsFacet.
The implementation of this facet - to obtain the list of selected items -
would be to query the collection for the selected checkboxes.
In writing this, I realize that I'm using "collection" in two different ways.
For the choices, this is just a regular OneToManyAssociation
For the defaults, this needs to be some representation which is implemented by
the Wicket viewer, ie the selected choices.
Perhaps the easiest implementation is for the wicket viewer to provide that as
its contribution to the programming model.
Lastly, we need some sort of hint for the wicket viewer to know to render the
toggle boxes.
The @Action(associateWith=...) results in a facet on the action, but we
probably also want a facet on the OneToManyAssociation.
Again, perhaps that "reverse link" could be a facet that's actually part of
the Wicket viewer component.
Andi Huber 7:41 PM
I feel, that we need some model of the selection subset that shall be used as
default for the prompt, which is currently only implemented with the wicket
viewer.
Dan Haywood 7:43 PM
yeah, I think that's right.
And other viewers would need to implement something similar also.
Andi Huber 7:43 PM
I mean this selection model should be available along-side the
action/property/collection/... models somehow.
(meta-model module)
Dan Haywood 7:44 PM
Yes, correct.
The metamodel models only model the current state. But the Wicket viewer (in
its "model" module) has its own models that have pending values.
Right now those are specific to Wicket, eg they are also all serializable, but
they could in theory be more general purpose.
I wouldn't want to overgeneralize yet, though, I think that would be premature.
> Actions fail MM Validation when associated
> ------------------------------------------
>
> Key: ISIS-2253
> URL: https://issues.apache.org/jira/browse/ISIS-2253
> Project: Isis
> Issue Type: Bug
> Components: Core, Core: Viewer: Wicket
> Reporter: Andi Huber
> Assignee: Andi Huber
> Priority: Major
> Fix For: 2.0.0
>
>
> In fact, this is a case of two wrongs not quite making a right. There's a
> nasty hack in that it is the Wicket viewer that knows how to populate the
> choices for the parameter, and it does this without looking for an
> autoComplete or choices facet ; it just picks up the checked items of the
> associated collection.
> The short term solution to fix DemoApp is just to update that metamodel
> validator to also take into account any AssociatedWithFacet.
> The long term "correct" solution is a new facet factory that will derive a
> ChoicesFacet from the AssociatedWithFacet, and then to remove the special
> case logic from the Wicket viewer.
> That would then make the validator correct as it is now written.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)