You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2021/11/09 15:41:17 UTC

[isis] branch master updated: ISIS-2883: site-map: fix collections; also show action descriptions

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/isis.git


The following commit(s) were added to refs/heads/master by this push:
     new 2d051f9  ISIS-2883: site-map: fix collections; also show action descriptions
2d051f9 is described below

commit 2d051f93ee29e747c336277895322ef019cc6aff
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue Nov 9 16:41:08 2021 +0100

    ISIS-2883: site-map: fix collections; also show action descriptions
---
 .../sitemap/SitemapServiceDefault.java             | 38 +++++++++++++++-------
 1 file changed, 27 insertions(+), 11 deletions(-)

diff --git a/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/sitemap/SitemapServiceDefault.java b/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/sitemap/SitemapServiceDefault.java
index a77da98..8695edf 100644
--- a/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/sitemap/SitemapServiceDefault.java
+++ b/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/sitemap/SitemapServiceDefault.java
@@ -109,36 +109,52 @@ public class SitemapServiceDefault implements SitemapService {
 
                     val groupStack = new Stack<String>();
                     groupStack.push("Top-Bar");
+                    final Runnable flushGroupStack = ()->{
+                        if(!groupStack.isEmpty()){
+                            adoc.append(String.format("===== %s\n\n", groupStack.pop()));
+                        }
+                    };
 
                     val grid = toGrid(actionElementType.getCorrespondingClass(), Style.CURRENT);
                     grid.visit(new Grid.VisitorAdapter() {
                         @Override public void visit(final ActionLayoutData actionLayoutData) {
                             actionElementType.getAction(actionLayoutData.getId(), ActionType.USER)
                             .ifPresent(action->{
-                                if(!groupStack.isEmpty()){
-                                    adoc.append(String.format("===== %s\n\n", groupStack.pop()));
-                                }
-                                adoc.append(String.format("* [ ] Action `%s`\n\n", action.getCanonicalFriendlyName()));
+                                flushGroupStack.run();
+                                val describedAs = action.getCanonicalDescription()
+                                    .map(desc->String.format("_%s_", desc))
+                                    .orElse("");
+                                adoc.append(String.format("* [ ] Action `%s` %s\n\n",
+                                        action.getCanonicalFriendlyName(),
+                                        describedAs));
                             });
                         }
                         @Override public void visit(final PropertyLayoutData propertyLayoutData) {
                             actionElementType.getProperty(propertyLayoutData.getId())
                             .ifPresent(property->{
-                                if(!groupStack.isEmpty()){
-                                    adoc.append(String.format("===== %s\n\n", groupStack.pop()));
-                                }
-                                adoc.append(String.format("* [ ] Property `%s`\n\n", property.getCanonicalFriendlyName()));
+                                flushGroupStack.run();
+                                val describedAs = property.getCanonicalDescription()
+                                        .map(desc->String.format("_%s_", desc))
+                                        .orElse("");
+                                adoc.append(String.format("* [ ] Property `%s` %s\n\n",
+                                        property.getCanonicalFriendlyName(),
+                                        describedAs));
                             });
                         }
                         @Override public void visit(final CollectionLayoutData collectionLayoutData) {
-                            actionElementType.getProperty(collectionLayoutData.getId())
+                            actionElementType.getCollection(collectionLayoutData.getId())
                             .ifPresent(collection->{
                                 groupStack.clear();
-                                adoc.append(String.format("Collection %s\n\n", collection.getCanonicalFriendlyName()));
+                                adoc.append(String.format("===== Collection %s\n\n", collection.getCanonicalFriendlyName()));
+                                collection.getCanonicalDescription()
+                                .ifPresent(describedAs->{
+                                    adoc.append(String.format("_%s_\n\n", describedAs));
+                                });
+                                //FIXME[ISIS-2883] break down into element type as well
                             });
                         }
                         @Override public void visit(final FieldSet fieldSet) {
-                            if(_NullSafe.isEmpty(fieldSet.getActions())) {
+                            if(_NullSafe.isEmpty(fieldSet.getProperties())) {
                                 return;
                             }
                             groupStack.clear();