You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@isis.apache.org by Erik de Hair <e....@pocos.nl> on 2016/05/04 15:37:34 UTC
Replacing Wicket page elements in 1.12.x
Hi,
In Apache Isis 1.11.x we replaced the collection contents component so
we could use another kind of repeating view [1] depending on the entity
type contained in a collection.
In 1.12.x it looks like the EntityCollectionPanel isn't created by a
(overrideable) factory anymore but is created by a direct call for the
constructor of the EntityCollectionPanel in the Col-class. To get the
same results as we had before, we now have to do something like this in
the buildGui()-method of Col (after copying the class to our webapp):
for(CollectionLayoutData collection : collections) {
finalString id = collectionRv.newChildId();
finalEntityModel entityModelWithHints = getModel().cloneWithLayoutMetadata(collection);
if(entityModelWithHints.getObject().getObject()instanceofSearchResultsPage) {
finalSearchResultsCollectionContentsPanel collectionPanel =newSearchResultsCollectionContentsPanel(id, entityModelWithHints);
collectionRv.add(collectionPanel);
}
else
{
finalEntityCollectionPanel collectionPanel =newEntityCollectionPanel(id, entityModelWithHints);
collectionRv.add(collectionPanel);
}
}
Is this the only way to do this (right now) or is there some more
dynamic way?
Thanks,
Erik
[1] https://imgur.com/KcQ2Qlo
Re: Replacing Wicket page elements in 1.12.x
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Erik,
I've raised and fixed ISIS-1446 [1] for this; will be in 1.13.0. If you
get the chance to test it out, that would be good. Note that the
ComponentType enum value is now ENTITY_COLLECTION (it was
ENTITY_COLLECTIONS in v1.11.x).
Thanks
Dan
[1] https://issues.apache.org/jira/browse/ISIS-1448
On 9 May 2016 at 09:33, Erik de Hair <e....@pocos.nl> wrote:
> Hi Dan,
>
> On 05/05/2016 09:19 AM, Dan Haywood wrote:
>
>> Hi Erik,
>>
>> I think that's an oversight... I can't thing of any particularly good
>> reason for this class not to use ComponentFactory.
>>
> Could you take a look at [1]? I expected some component factory method
> there. If it should be using a component factory there I will try to fix
> that. Otherwise, could you tell me why it is the way it is now?
>
>>
>> There is actually a new SPI you could use to patch this... provide a new
>> implementation of GridSystemService (subclassing the default BS3 impl and
>> using @DomainService (menuOrder="1") to ensure your patched version is
>> found before the default impl).
>>
> That sounds good. I'll take a look at that.
>
> Thanks,
> Erik
>
> [1]
> https://github.com/apache/isis/blob/master/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/col/Col.java#L277
>
Re: Replacing Wicket page elements in 1.12.x
Posted by Erik de Hair <e....@pocos.nl>.
Hi Dan,
On 05/05/2016 09:19 AM, Dan Haywood wrote:
> Hi Erik,
>
> I think that's an oversight... I can't thing of any particularly good
> reason for this class not to use ComponentFactory.
Could you take a look at [1]? I expected some component factory method
there. If it should be using a component factory there I will try to fix
that. Otherwise, could you tell me why it is the way it is now?
>
> There is actually a new SPI you could use to patch this... provide a new
> implementation of GridSystemService (subclassing the default BS3 impl and
> using @DomainService (menuOrder="1") to ensure your patched version is
> found before the default impl).
That sounds good. I'll take a look at that.
Thanks,
Erik
[1]
https://github.com/apache/isis/blob/master/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/layout/bs3/col/Col.java#L277
Re: Replacing Wicket page elements in 1.12.x
Posted by Dan Haywood <da...@haywood-associates.co.uk>.
Hi Erik,
I think that's an oversight... I can't thing of any particularly good
reason for this class not to use ComponentFactory.
There is actually a new SPI you could use to patch this... provide a new
implementation of GridSystemService (subclassing the default BS3 impl and
using @DomainService (menuOrder="1") to ensure your patched version is
found before the default impl).
Meanwhile, pull requests happily received...
Thx, Dan
On 4 May 2016 16:39, "Erik de Hair" <e....@pocos.nl> wrote:
Hi,
In Apache Isis 1.11.x we replaced the collection contents component so we
could use another kind of repeating view [1] depending on the entity type
contained in a collection.
In 1.12.x it looks like the EntityCollectionPanel isn't created by a
(overrideable) factory anymore but is created by a direct call for the
constructor of the EntityCollectionPanel in the Col-class. To get the same
results as we had before, we now have to do something like this in the
buildGui()-method of Col (after copying the class to our webapp):
for(CollectionLayoutData collection : collections) {
finalString id = collectionRv.newChildId();
finalEntityModel entityModelWithHints =
getModel().cloneWithLayoutMetadata(collection);
if(entityModelWithHints.getObject().getObject()instanceofSearchResultsPage)
{
finalSearchResultsCollectionContentsPanel collectionPanel
=newSearchResultsCollectionContentsPanel(id, entityModelWithHints);
collectionRv.add(collectionPanel);
}
else
{
finalEntityCollectionPanel collectionPanel
=newEntityCollectionPanel(id, entityModelWithHints);
collectionRv.add(collectionPanel);
}
}
Is this the only way to do this (right now) or is there some more dynamic
way?
Thanks,
Erik
[1] https://imgur.com/KcQ2Qlo