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 09:22:46 UTC

[isis] branch master updated: ISIS-2883: site-map: reflect the menu and section structure from menubar layout

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 0964aca  ISIS-2883: site-map: reflect the menu and section structure from menubar layout
0964aca is described below

commit 0964acac81c8a0bf6f7118cbfb784fb11b504f70
Author: Andi Huber <ah...@apache.org>
AuthorDate: Tue Nov 9 10:22:38 2021 +0100

    ISIS-2883: site-map: reflect the menu and section structure from
    menubar layout
---
 .../sitemap/SitemapServiceDefault.java             | 26 +++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 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 96fed28..8d4584c 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
@@ -27,10 +27,13 @@ import org.springframework.stereotype.Service;
 
 import org.apache.isis.applib.annotation.PriorityPrecedence;
 import org.apache.isis.applib.layout.grid.Grid;
+import org.apache.isis.applib.layout.menubars.bootstrap3.BS3MenuBars;
 import org.apache.isis.applib.services.grid.GridService;
 import org.apache.isis.applib.services.layout.Style;
 import org.apache.isis.applib.services.menu.MenuBarsService;
 import org.apache.isis.applib.services.sitemap.SitemapService;
+import org.apache.isis.commons.internal.base._NullSafe;
+import org.apache.isis.commons.internal.base._Strings;
 import org.apache.isis.core.metamodel.facets.object.grid.GridFacet;
 import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
 
@@ -54,12 +57,26 @@ public class SitemapServiceDefault implements SitemapService {
 
         val adoc = new StringBuilder();
         adoc.append(String.format("= %s\n\n", title));
+        adoc.append(":sectnums:\n\n");
 
         val menuBars = menuBarsService.menuBars(MenuBarsService.Type.DEFAULT);
-        menuBars.visit(actionLayout->{
-            //TODO structor by sections
-            adoc.append(String.format("== %s\n\n", actionLayout.getId()));
-        });
+
+        menuBars.visit(BS3MenuBars.VisitorAdapter.visitingMenus(menu->{
+            val menuName = _Strings.isNotEmpty(menu.getNamed())
+                ? menu.getNamed()
+                : "Unnamed Menu";
+
+            adoc.append(String.format("== %s\n\n", menuName));
+
+            _NullSafe.stream(menu.getSections())
+            .forEach(menuSection->{
+                val sectionName = _Strings.isNotEmpty(menuSection.getNamed())
+                        ? menuSection.getNamed()
+                        : "Unnamed Section";
+                adoc.append(String.format("=== %s\n\n", sectionName));
+            });
+
+        }));
 
         return adoc.toString();
     }
@@ -94,5 +111,4 @@ public class SitemapServiceDefault implements SitemapService {
         throw new IllegalArgumentException("unsupported style");
     }
 
-
 }