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

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

commit 2d0d80f6ac4a89cc0d7fbd7e456ed329bba4eb2a
Author: danhaywood <[email protected]>
AuthorDate: Tue Apr 4 07:47:42 2023 +0100

    CAUSEWAY-2485: completes @DomainObjectLayout#bookmarking
---
 .../bookmarking/DomainObjectLayoutBookmarking.java | 25 ++++++++--------------
 .../DomainObjectLayoutBookmarkingChild.java        | 10 ++++++++-
 ...ainObjectLayoutBookmarkingPage-description.adoc | 18 ++++++++++++++--
 .../DomainObjectLayoutBookmarkingSeeding.java      |  2 +-
 .../DomainObjectLayoutBookmarking_addChildren.java |  1 -
 ...bjectLayoutBookmarkingChildJpa-description.adoc |  6 ++++--
 ...mainObjectLayoutBookmarkingJpa-description.adoc | 13 +++++++++--
 7 files changed, 50 insertions(+), 25 deletions(-)

diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarking.java
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarking.java
index 7e0c1fbb0b..d01a6dcabe 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarking.java
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarking.java
@@ -21,26 +21,27 @@ package 
demoapp.dom.domain.objects.DomainObjectLayout.bookmarking;
 import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
 import demoapp.dom._infra.values.ValueHolder;
 import demoapp.dom.types.Samples;
-import lombok.val;
 
-import java.util.List;
 import java.util.Set;
-import java.util.stream.Collectors;
 
 import javax.inject.Inject;
 
-import org.apache.causeway.applib.annotation.Action;
 import org.apache.causeway.applib.annotation.BookmarkPolicy;
 import org.apache.causeway.applib.annotation.DomainObjectLayout;
-import org.apache.causeway.applib.annotation.SemanticsOf;
 
+//tag::class[]
 @DomainObjectLayout(
         bookmarking = BookmarkPolicy.AS_ROOT        // <.>
 )
 public abstract class DomainObjectLayoutBookmarking
+//end::class[]
         implements
         HasAsciiDocDescription,
-        ValueHolder<String> {
+        ValueHolder<String>
+//tag::class[]
+{
+    // ...
+//end::class[]
 
     public String title() {
         return value();
@@ -56,16 +57,8 @@ public abstract class DomainObjectLayoutBookmarking
 
     public abstract void addChild(String value);
 
-    @Action
-    public DomainObjectLayoutBookmarking addChildren(int number) {
-        val strings = samples.stream().collect(Collectors.toList());
-        for (int i = 0; i < number; i++) {
-            addChild(strings.get(i));
-        }
-        return this;
-    }
-
     public abstract Set<? extends DomainObjectLayoutBookmarkingChild> 
getChildren();
 
-    @Inject Samples<String> samples;
+//tag::class[]
 }
+//end::class[]
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingChild.java
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingChild.java
index ab6f12e8df..e0b3f64efb 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingChild.java
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingChild.java
@@ -24,13 +24,19 @@ import demoapp.dom._infra.values.ValueHolder;
 import org.apache.causeway.applib.annotation.BookmarkPolicy;
 import org.apache.causeway.applib.annotation.DomainObjectLayout;
 
+//tag::class[]
 @DomainObjectLayout(
         bookmarking = BookmarkPolicy.AS_CHILD    // <.>
 )
 public abstract class DomainObjectLayoutBookmarkingChild
+//end::class[]
         implements
         HasAsciiDocDescription,
-        ValueHolder<String> {
+        ValueHolder<String>
+//tag::class[]
+{
+    // ...
+//end::class[]
 
     public String title() {
         return value();
@@ -43,4 +49,6 @@ public abstract class DomainObjectLayoutBookmarkingChild
 
     public abstract String getName();
     public abstract void setName(String value);
+//tag::class[]
 }
+//end::class[]
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage-description.adoc
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage-description.adoc
index 53b9120b54..7c1250959e 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage-description.adoc
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingPage-description.adoc
@@ -1,5 +1,19 @@
 :Notice: Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements. See the NOTICE file distributed with this work 
for additional information regarding copyright ownership. The ASF licenses this 
file to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance with the License. You may obtain a copy of 
the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by 
applicable law or ag [...]
 
-The `bookmarking` attribute governs whether (and how) this domain object can 
be bookmarked in the UI. 
-The UI has a top left positioned dropdown panel (Bookmark Panel) to show links 
to recently visited objects.
+Moving the mouse over to the top-left of the page will bring down a set of 
bookmarks.
+If an object is rendered and the 
link:https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/annotation/DomainObjectLayout.html#bookmarking[@DomainObjectLayout#bookmarking]
 is set appropriately, then a link to it will be added automatically to the 
bookmark list, so that the end-user can easily navigate back to the page later 
on in their session.
 
+To make this set of bookmarks more useful, the set of bookmarks can be 
organised into a tree.
+An object annotated as a 
link:https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/annotation/BookmarkPolicy.html#as_root[root]
 bookmark will always be added.
+However an object annotated as a 
link:https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/annotation/BookmarkPolicy.html#as_child[child]
 bookmark will only be added if its parent object is also bookmarked.
+
+=== How this demo works
+
+On the left hand side is a collection of objects.
+These are all annotated as root bookmarks.
+Navigate into any of them and a bookmark should be added to the bookmark list.
+
+In addition, these "parent" objects have an action "addChildren".
+Call this action and a set of objects will be added.
+These children objects are annotated to use "child" bookmarks.
+Navigate into any child object and their bookmark should be added at the 
correct place.
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingSeeding.java
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingSeeding.java
index c8dcfcea3b..dcf5ad1c9e 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingSeeding.java
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarkingSeeding.java
@@ -20,10 +20,10 @@ package 
demoapp.dom.domain.objects.DomainObjectLayout.bookmarking;
 
 import demoapp.dom._infra.seed.SeedServiceAbstract;
 import demoapp.dom._infra.values.ValueHolderRepository;
-import demoapp.dom.types.Samples;
 
 import javax.inject.Inject;
 
+import org.apache.causeway.applib.services.xactn.TransactionService;
 import org.springframework.stereotype.Service;
 
 @Service
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarking_addChildren.java
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarking_addChildren.java
index ec4170aefa..3931d19068 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarking_addChildren.java
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/DomainObjectLayoutBookmarking_addChildren.java
@@ -52,6 +52,5 @@ public class DomainObjectLayoutBookmarking_addChildren {
         return 3;
     }
 
-
     @Inject Samples<String> samples;
 }
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingChildJpa-description.adoc
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingChildJpa-description.adoc
index ffbf0ae9a9..19d333221d 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingChildJpa-description.adoc
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingChildJpa-description.adoc
@@ -1,7 +1,9 @@
 :Notice: Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements. See the NOTICE file distributed with this work 
for additional information regarding copyright ownership. The ASF licenses this 
file to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance with the License. You may obtain a copy of 
the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by 
applicable law or ag [...]
 
+This object is annotated with a "child" bookmarking policy, meaning that a 
link to it will be added to the bookmark panel, but grouped under its parent 
object's link.
+
 [source,java,indent=0]
 ----
-include::DomainObjectLayoutBookmarkingJpa.java[tags=class]
+include::../DomainObjectLayoutBookmarkingChild.java[tags=class]
 ----
-<.>
+<.> uses child bookmark policy
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingJpa-description.adoc
 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingJpa-description.adoc
index ffbf0ae9a9..94e16d0133 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingJpa-description.adoc
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/bookmarking/jpa/DomainObjectLayoutBookmarkingJpa-description.adoc
@@ -1,7 +1,16 @@
 :Notice: Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license agreements. See the NOTICE file distributed with this work 
for additional information regarding copyright ownership. The ASF licenses this 
file to you under the Apache License, Version 2.0 (the "License"); you may not 
use this file except in compliance with the License. You may obtain a copy of 
the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by 
applicable law or ag [...]
 
+This object is annotated with a "root" bookmarking policy, meaning that it 
will always be shown in the bookmark panel.
+
 [source,java,indent=0]
 ----
-include::DomainObjectLayoutBookmarkingJpa.java[tags=class]
+include::../DomainObjectLayoutBookmarking.java[tags=class]
 ----
-<.>
+<.> uses root bookmark policy
+
+
+=== How this demo works
+
+Use the "addChildren" action to add some children, and navigate into them.
+
+Their bookmarks should be grouped under this parent's bookmark.

Reply via email to