[ 
https://issues.apache.org/jira/browse/ISIS-1151?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14543679#comment-14543679
 ] 

Dan Haywood commented on ISIS-1151:
-----------------------------------

metamodel stuff:

* new DefaultViewFacet interface, extend from SingleStringValueFacet  (base on 
DescribedAsFacet, that looks similar)
** new DefaultViewFacetOnCollectionFromLayoutProperties implementation  (base 
on DescribedAsFacetOnCollectionFromLayoutProperties)
** new DefaultViewFacetFromCollectionLayoutAnnotation implementation  (base on 
DescribedAsFacetForCollectionLayoutAnnotation)
* org.apache.isis.applib.annotation.CollectionLayout annotation
* 
org.apache.isis.core.metamodel.facets.collections.layout.CollectionLayoutFacetFactory
* LayoutMetadataReaderFromJson
** new DefaultViewFacetRepr (cf DescribedAsFacetRepr)
* CollectionLayoutFacetRepr

devutils module addon:
* might need to change to write out the json (though I suspect it's part of 
layoutmetadatareader so will get it from above)

wicket viewer:
* CollectionContentsMultipleViewsPanel
** from EntityCollectionModel, can obtain the corresponding 
OneToManyAssociation (if parented)... this is where the facet will live.
** instead of defaulting to 0 (first view, see [1] below), should look for the 
view whose name is that of the facet)
* looking in a bit more detail, it might actually be easier to put the logic in 
the CollectionSelectorHelper, eg at [2]  (this is the code that tries to honour 
any hints in the URL, and so already knows how to handle strings; try selecting 
a particular view, then alt+] to copy the URL; paste that URL in the another 
tab and you'll that the view is preserved.

{code}
if(entityCollectionModel.isParented()) {
   final OneToManyAssociation collection =
        entityCollectionModel.getCollectionMemento().getCollection();
    DefaultViewFacet dvf = collection.getFacet(DefaultViewFacet.class);
    ///
}

{code}

[1] 
https://github.com/apache/isis/blob/d84c66090ec9b603b695527936892ade53a2cb3b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collectioncontents/multiple/CollectionContentsMultipleViewsPanel.java#L95

[2] 
https://github.com/apache/isis/blob/d84c66090ec9b603b695527936892ade53a2cb3b/core/viewer-wicket/ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/collection/selector/CollectionSelectorHelper.java#L118


> Allow the default view of a collection to be set
> ------------------------------------------------
>
>                 Key: ISIS-1151
>                 URL: https://issues.apache.org/jira/browse/ISIS-1151
>             Project: Isis
>          Issue Type: Improvement
>            Reporter: Sander Ginn
>            Assignee: Dan Haywood
>
> Currently a collection defaults to the table view. I'd like to be able to set 
> a different view (e.g. the calendar) to default. Perhaps via 
> @CollectionLayout? 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to