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/03/20 12:17:27 UTC
[isis] branch master updated: ISIS-2314: use same idiom as in
WebPageBase to fix this
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 e4d7d04 ISIS-2314: use same idiom as in WebPageBase to fix this
e4d7d04 is described below
commit e4d7d04fb48daf520372bc98aafadb45ffde11ad
Author: Andi Huber <ah...@apache.org>
AuthorDate: Fri Mar 20 13:17:02 2020 +0100
ISIS-2314: use same idiom as in WebPageBase to fix this
---
.../isis/applib/services/hint/HintStore.java | 1 -
.../viewer/wicket/model/util/ComponentHintKey.java | 23 +++++++++++++++-------
2 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/api/applib/src/main/java/org/apache/isis/applib/services/hint/HintStore.java b/api/applib/src/main/java/org/apache/isis/applib/services/hint/HintStore.java
index 4444ea4..36d5b98 100644
--- a/api/applib/src/main/java/org/apache/isis/applib/services/hint/HintStore.java
+++ b/api/applib/src/main/java/org/apache/isis/applib/services/hint/HintStore.java
@@ -20,7 +20,6 @@ package org.apache.isis.applib.services.hint;
import java.util.Set;
-import org.apache.isis.applib.annotation.Programmatic;
import org.apache.isis.applib.services.bookmark.Bookmark;
// tag::refguide[]
diff --git a/viewers/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/util/ComponentHintKey.java b/viewers/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/util/ComponentHintKey.java
index f1505be..4311d8b 100644
--- a/viewers/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/util/ComponentHintKey.java
+++ b/viewers/wicket/model/src/main/java/org/apache/isis/viewer/wicket/model/util/ComponentHintKey.java
@@ -27,17 +27,17 @@ import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.isis.applib.services.bookmark.Bookmark;
import org.apache.isis.applib.services.hint.HintStore;
-import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
import org.apache.isis.core.webapp.context.IsisWebAppCommonContext;
+import org.apache.isis.viewer.wicket.model.common.CommonContextUtils;
+import org.apache.isis.viewer.wicket.model.hints.UiHintContainer;
import lombok.AccessLevel;
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
+import lombok.AllArgsConstructor;
/**
* Scoped by the {@link Component component's path}.
*/
-@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
+@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class ComponentHintKey implements Serializable {
private static final long serialVersionUID = 1L;
@@ -54,7 +54,7 @@ public class ComponentHintKey implements Serializable {
return new ComponentHintKey(hintStore, null, null, null, fullKey);
}
- @Getter private final transient HintStore hintStore;
+ private transient HintStore hintStore;
private final Provider<Component> componentProvider;
private final Component component;
private final String keyName;
@@ -141,7 +141,16 @@ public class ComponentHintKey implements Serializable {
};
}
-
-
+ public HintStore getHintStore() {
+ return hintStore = computeIfAbsent(HintStore.class, hintStore);
+ }
+
+ // -- HELPER
+
+ private <X> X computeIfAbsent(Class<X> type, X existingIfAny) {
+ return existingIfAny!=null
+ ? existingIfAny
+ : CommonContextUtils.getCommonContext().lookupServiceElseFail(type);
+ }
}