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 2020/06/20 06:38:52 UTC
[isis] branch master updated: ISIS-2376: properly disables actions,
that are not applicable for the current mode selected
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 5ef90cd ISIS-2376: properly disables actions, that are not applicable for the current mode selected
5ef90cd is described below
commit 5ef90cd68c8f767e6e6df06935d20bd4dc208cb4
Author: Andi Huber <ah...@apache.org>
AuthorDate: Sat Jun 20 08:38:34 2020 +0200
ISIS-2376: properly disables actions, that are not applicable for the
current mode selected
---
.../i18n/po/TranslationServicePoMenu.java | 28 +++++++++++++++-------
1 file changed, 20 insertions(+), 8 deletions(-)
diff --git a/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/i18n/po/TranslationServicePoMenu.java b/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/i18n/po/TranslationServicePoMenu.java
index ab277c0..3d4dc9f 100644
--- a/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/i18n/po/TranslationServicePoMenu.java
+++ b/core/runtimeservices/src/main/java/org/apache/isis/core/runtimeservices/i18n/po/TranslationServicePoMenu.java
@@ -40,6 +40,8 @@ import org.apache.isis.applib.value.Clob;
)
public class TranslationServicePoMenu {
+ @Inject private TranslationServicePo translationService;
+
public static abstract class ActionDomainEvent extends IsisModuleApplib.ActionDomainEvent<TranslationServicePoMenu> {}
// //////////////////////////////////////
@@ -83,9 +85,12 @@ public class TranslationServicePoMenu {
public void resetTranslationCache() {
translationService.clearCache();
}
- public boolean hideResetTranslationCache() {
- return translationService.getMode().isWrite();
+ public String disableResetTranslationCache() {
+ return !translationService.getMode().isRead()
+ ? notAvailableForCurrentMode()
+ : null;
}
+
// //////////////////////////////////////
@@ -103,8 +108,10 @@ public class TranslationServicePoMenu {
public void switchToReadingTranslations() {
translationService.toggleMode();
}
- public boolean hideSwitchToReadingTranslations() {
- return translationService.getMode().isRead();
+ public String disableSwitchToReadingTranslations() {
+ return !translationService.getMode().isWrite()
+ ? notAvailableForCurrentMode()
+ : null;
}
// //////////////////////////////////////
@@ -123,12 +130,17 @@ public class TranslationServicePoMenu {
public void switchToWritingTranslations() {
translationService.toggleMode();
}
- public boolean hideSwitchToWritingTranslations() {
- return translationService.getMode().isWrite();
+ public String disableSwitchToWritingTranslations() {
+ return !translationService.getMode().isRead()
+ ? notAvailableForCurrentMode()
+ : null;
}
- // //////////////////////////////////////
+ // -- HELPER
- @Inject private TranslationServicePo translationService;
+ private String notAvailableForCurrentMode() {
+ return String.format("Not available for Translation Mode '%s'.",
+ translationService.getMode().name().toLowerCase());
+ }
}