You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2018/02/01 16:03:38 UTC
[isis] 01/02: ISIS-1854: uses the name taken from the layout.xml.
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a commit to branch maint-1.16.1
in repository https://gitbox.apache.org/repos/asf/isis.git
commit cd65d4985c4f03381e09ee91ecf9007c7c522d96
Author: Dan Haywood <da...@haywood-associates.co.uk>
AuthorDate: Thu Feb 1 15:51:09 2018 +0000
ISIS-1854: uses the name taken from the layout.xml.
also filters out the list of services when building the XML to avoid any that have NatureOfService is DOMAIN
---
.../menubars/bootstrap3/MenuBarsServiceBS3.java | 32 ++++++++++++++++++++--
.../actionmenu/serviceactions/CssMenuItem.java | 6 ++--
2 files changed, 31 insertions(+), 7 deletions(-)
diff --git a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/menubars/bootstrap3/MenuBarsServiceBS3.java b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/menubars/bootstrap3/MenuBarsServiceBS3.java
index 0aea26c..b01b430 100644
--- a/core/runtime/src/main/java/org/apache/isis/core/runtime/services/menubars/bootstrap3/MenuBarsServiceBS3.java
+++ b/core/runtime/src/main/java/org/apache/isis/core/runtime/services/menubars/bootstrap3/MenuBarsServiceBS3.java
@@ -184,9 +184,35 @@ public class MenuBarsServiceBS3 implements MenuBarsService {
final List<ObjectAdapter> serviceAdapters =
isisSessionFactory.getCurrentSession().getPersistenceSession().getServices();
- append(serviceAdapters, menuBars.getPrimary(), DomainServiceLayout.MenuBar.PRIMARY);
- append(serviceAdapters, menuBars.getSecondary(), DomainServiceLayout.MenuBar.SECONDARY);
- append(serviceAdapters, menuBars.getTertiary(), DomainServiceLayout.MenuBar.TERTIARY);
+ final List<ObjectAdapter> visibleServiceAdapters =
+ FluentIterable.from(
+ serviceAdapters)
+ .filter(new Predicate<ObjectAdapter>() {
+ @Override public boolean apply(final ObjectAdapter objectAdapter) {
+ if (objectAdapter == null) {
+ return false;
+ }
+ if (objectAdapter.getSpecification() == null) {
+ return false;
+ }
+ final ObjectSpecification spec = objectAdapter.getSpecification();
+ if (spec.isHidden()) {
+ // however, this isn't the same as HiddenObjectFacet, so doesn't filter out
+ // services that have an imperative hidden() method.
+ return false;
+ }
+ final DomainServiceFacet facet = spec.getFacet(DomainServiceFacet.class);
+ if (facet == null) {
+ return true;
+ }
+ final NatureOfService natureOfService = facet.getNatureOfService();
+ return natureOfService == null || natureOfService != NatureOfService.DOMAIN;
+ }
+ }).toList();
+
+ append(visibleServiceAdapters, menuBars.getPrimary(), DomainServiceLayout.MenuBar.PRIMARY);
+ append(visibleServiceAdapters, menuBars.getSecondary(), DomainServiceLayout.MenuBar.SECONDARY);
+ append(visibleServiceAdapters, menuBars.getTertiary(), DomainServiceLayout.MenuBar.TERTIARY);
menuBars.setTnsAndSchemaLocation(tnsAndSchemaLocation());
diff --git a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/CssMenuItem.java b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/CssMenuItem.java
index a79dcbc..877b4ea 100644
--- a/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/CssMenuItem.java
+++ b/core/viewer-wicket-ui/src/main/java/org/apache/isis/viewer/wicket/ui/components/actionmenu/serviceactions/CssMenuItem.java
@@ -382,9 +382,9 @@ class CssMenuItem implements Serializable {
}
final AbstractLink link = linkAndLabel.getLink();
- final String actionLabel = linkAndLabel.getLabel();
+ final String actionLabel = serviceAndAction.serviceName != null ? serviceAndAction.serviceName : linkAndLabel.getLabel();
- Builder builder = newSubMenuItem(actionLabel)
+ return newSubMenuItem(actionLabel)
.link(link)
.describedAs(descriptionIfAny)
.enabled(reasonDisabledIfAny)
@@ -398,8 +398,6 @@ class CssMenuItem implements Serializable {
.withCssClass(ObjectAction.Util.cssClassFor(objectAction, serviceAdapter))
.withCssClassFa(ObjectAction.Util.cssClassFaFor(objectAction))
.withCssClassFaPosition(ObjectAction.Util.cssClassFaPositionFor(objectAction));
-
- return builder;
}
// //////////////////////////////////////////////////////////////
--
To stop receiving notification emails like this one, please contact
danhaywood@apache.org.