You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by da...@apache.org on 2023/04/10 10:25:32 UTC

[causeway] 04/15: CAUSEWAY-2485: wip for tableDecorator and ui events

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

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

commit 50b2737b849ec9be8760c1aa58d0127cb2fefbe5
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Thu Apr 6 08:57:26 2023 +0200

    CAUSEWAY-2485: wip for tableDecorator and ui events
---
 .../DomainObjectLayoutPagedPage-description.adoc   |  2 +-
 .../paged/DomainObjectLayoutPagedPage.layout.xml   |  4 +--
 .../tabledec/DomainObjectLayoutTableDecorator.java |  3 +-
 ...ObjectLayoutTableDecoratorPage-description.adoc | 41 ++++++++++++++++++++--
 .../DomainObjectLayoutTableDecoratorPage.java      | 27 +-------------
 ...DomainObjectLayoutTableDecoratorPage.layout.xml | 13 ++++++-
 ...TableDecoratorPage_actionReturningObjects.java} | 18 +++++-----
 ...mainObjectLayoutTableDecoratorPage_objects.java |  1 -
 .../jpa/DomainObjectLayoutTableDecoratorJpa.java   |  3 ++
 ...ObjectLayoutXxxUiEvent-alternative1.layout.xml} | 30 +++++++++++++++-
 ...ObjectLayoutXxxUiEvent-alternative2.layout.xml} | 30 +++++++++++++++-
 ... => DomainObjectLayoutXxxUiEvent-signature.svg} |  0
 .../xxxUiEvent/DomainObjectLayoutXxxUiEvent.java   | 20 ++++++++++-
 .../DomainObjectLayoutXxxUiEventPage.java          | 11 ------
 ...=> DomainObjectLayoutXxxUiEventSubscriber.java} | 12 +++----
 15 files changed, 150 insertions(+), 65 deletions(-)

diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/paged/DomainObjectLayoutPagedPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/paged/DomainObjectLayoutPagedPage-description.adoc
index 51a40a1ee5..e63e250d96 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/paged/DomainObjectLayoutPagedPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/paged/DomainObjectLayoutPagedPage-description.adoc
@@ -9,7 +9,7 @@ NOTE: for parented collections, the `paged` value can be overridden on a case-by
 
 === How this demo works
 
-The collection on the left hand side shows a set of objects that have been annotated with `paged` of 5.
+The collection on the left hand side shows a set of objects that have been annotated with `paged` of 5.`
 Accordingly, only 5 objects are shown per page.
 
 The associated action "actionReturningCollection" returns these same objects as a standalone collection.
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/paged/DomainObjectLayoutPagedPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/paged/DomainObjectLayoutPagedPage.layout.xml
index e164bae209..d1edee3f77 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/paged/DomainObjectLayoutPagedPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/paged/DomainObjectLayoutPagedPage.layout.xml
@@ -28,8 +28,8 @@
 		<bs3:col span="6">
 			<bs3:row>
 				<bs3:col span="12">
-			<cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
-		</bs3:col>
+				<cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+			</bs3:col>
 			</bs3:row>
 			<bs3:row>
 				<bs3:col span="12">
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecorator.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecorator.java
index a16b05894f..f80e313fea 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecorator.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecorator.java
@@ -22,10 +22,11 @@ import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
 import demoapp.dom._infra.values.ValueHolder;
 
 import org.apache.causeway.applib.annotation.DomainObjectLayout;
+import org.apache.causeway.applib.annotation.TableDecorator;
 
 //tag::class[]
 @DomainObjectLayout(
-        cssClassFa = "fa-user"             // <.>
+        tableDecorator = TableDecorator.DatatablesNet.class     // <.>
 )
 public abstract class DomainObjectLayoutTableDecorator
 //end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage-description.adoc
index 4b47b57133..675eec8734 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage-description.adoc
@@ -1,5 +1,40 @@
-`: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 a [...]
+: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 `tableDecorator` attribute allows to specify a custom client side table renderer.
+The link:https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/annotation/DomainObjectLayout.html#tabledecorator[@DomainObjectLayout#tableDecorator] attribute allows to specify a custom client side table renderer to be specified for when a collection of domain objects are shown in either a parented collection (belonging to an object) or a standalone collection (returned from an action).
+
+NOTE: for parented collections, the `tableDecorator` value can be overridden on a case-by-case basis using link:https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/annotation/CollectionLayout.html#tabledecorator[@CollectionLayout#tableDecorator].
+
+There is currently just one decorator available, for link:https://datatables.net/[datatables.net].
+If specified, the effect of `@DomainObjectLayout#paged` or `@CollectionLayout#paged` is ignored.
+
+=== How this demo works
+
+The collection on the left hand side shows a set of domain objects that have been annotated with `tableDecorator` of "datatables".
+
+The associated action "actionReturningCollection" returns these same objects as a standalone collection.
+Here again the `tableDecorator` value _is_ honoured.
+
+In terms of code:
+
+[source,java,indent=0]
+----
+include::DomainObjectLayoutTableDecorator.java[tags=class]
+----
+<.> provides the description.
+The viewer renders this in a tooltip.
+
+
+=== Related configuration property
+
+To set the global default for `tableDecorator`, use this configuration property:
+
+[source,yaml]
+.application.yaml
+----
+causeway:
+  applib:
+    annotation:
+      domain-object-layout:
+        table-decorator: org.apache.causeway.applib.annotation.TableDecorator.DatatablesNet
+----
 
-link:https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/annotation/DomainObjectLayout.html#tabledecorator[@DomainObjectLayout#tableDecorator]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage.java
index 68cbe7e0d6..7e9cb85459 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage.java
@@ -34,7 +34,7 @@ import org.apache.causeway.applib.annotation.*;
 @XmlRootElement(name = "root")
 @XmlType
 @XmlAccessorType(XmlAccessType.FIELD)
-@Named("demo.DomainObjectLayoutTableDecoratorVm")
+@Named("demo.DomainObjectLayoutTableDecoratorPage")
 @DomainObject(
         nature=Nature.VIEW_MODEL)
 @DomainObjectLayout(
@@ -44,30 +44,5 @@ public class DomainObjectLayoutTableDecoratorPage implements HasAsciiDocDescript
     @ObjectSupport public String title() {
         return "@DomainObjectLayout#tableDecorator";
     }
-
-    @Action
-    public List<DomainObjectLayoutTableDecoratorPage> standaloneTable() {
-        return getSamples();
-    }
-
-    @Collection
-    //@CollectionLayout(tableDecorator = TableDecorator.DatatablesNet.class) -> //TODO[CAUSEWAY-3311] see collection layout demo instead
-    private List<DomainObjectLayoutTableDecoratorPage> samples;
-    public List<DomainObjectLayoutTableDecoratorPage> getSamples() {
-        if(samples==null) {
-            samples = List.of(
-                    new DomainObjectLayoutTableDecoratorPage(),
-                    new DomainObjectLayoutTableDecoratorPage(),
-                    new DomainObjectLayoutTableDecoratorPage(),
-                    new DomainObjectLayoutTableDecoratorPage());
-        }
-        return samples;
-    }
-
-    @Property(optionality = Optionality.OPTIONAL)
-    @XmlElement(required = false)
-    @Getter @Setter
-    private String uuid = UUID.randomUUID().toString();
-
 }
 //end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage.layout.xml
index 49008db41e..027009706b 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage.layout.xml
@@ -26,7 +26,18 @@
 
 	<bs3:row>
 		<bs3:col span="6">
-			<cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+			<bs3:row>
+				<bs3:col span="12">
+					<cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+				</bs3:col>
+			</bs3:row>
+			<bs3:row>
+				<bs3:col span="12">
+					<cpt:collection id="objects">
+						<cpt:action id="actionReturningObjects"/>
+					</cpt:collection>
+				</bs3:col>
+			</bs3:row>
 		</bs3:col>
 		<bs3:col span="6">
 			<cpt:fieldSet name="Description" id="description" >
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage_objects.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage_actionReturningObjects.java
similarity index 59%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage_objects.java
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage_actionReturningObjects.java
index da6a3eb97e..bfe1887545 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage_objects.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage_actionReturningObjects.java
@@ -1,26 +1,24 @@
 package demoapp.dom.domain.objects.DomainObjectLayout.tabledec;
 
 import demoapp.dom._infra.values.ValueHolderRepository;
+import demoapp.dom.domain.objects.DomainObjectLayout.paged.DomainObjectLayoutPaged;
+import demoapp.dom.domain.objects.DomainObjectLayout.paged.DomainObjectLayoutPagedPage;
 import lombok.RequiredArgsConstructor;
-
-import java.util.List;
+import org.apache.causeway.applib.annotation.Action;
+import org.apache.causeway.applib.annotation.MemberSupport;
 
 import javax.inject.Inject;
+import java.util.List;
 
-import org.apache.causeway.applib.annotation.Collection;
-import org.apache.causeway.applib.annotation.CollectionLayout;
-import org.apache.causeway.applib.annotation.MemberSupport;
-
-@Collection()
-@CollectionLayout()
+@Action()
 @RequiredArgsConstructor
-public class DomainObjectLayoutTableDecoratorPage_objects {
+public class DomainObjectLayoutTableDecoratorPage_actionReturningObjects {
 
     @SuppressWarnings("unused")
     private final DomainObjectLayoutTableDecoratorPage page;
 
     @MemberSupport
-    public List<? extends DomainObjectLayoutTableDecorator> coll() {
+    public List<? extends DomainObjectLayoutTableDecorator> act() {
         return objectRepository.all();
     }
 
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage_objects.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage_objects.java
index da6a3eb97e..7e8c6a9ce4 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage_objects.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage_objects.java
@@ -12,7 +12,6 @@ import org.apache.causeway.applib.annotation.CollectionLayout;
 import org.apache.causeway.applib.annotation.MemberSupport;
 
 @Collection()
-@CollectionLayout()
 @RequiredArgsConstructor
 public class DomainObjectLayoutTableDecoratorPage_objects {
 
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/jpa/DomainObjectLayoutTableDecoratorJpa.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/jpa/DomainObjectLayoutTableDecoratorJpa.java
index 94b18bbb9d..ade0d8472e 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/jpa/DomainObjectLayoutTableDecoratorJpa.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/jpa/DomainObjectLayoutTableDecoratorJpa.java
@@ -27,7 +27,9 @@ import javax.inject.Named;
 import javax.persistence.*;
 
 import org.apache.causeway.applib.annotation.DomainObject;
+import org.apache.causeway.applib.annotation.DomainObjectLayout;
 import org.apache.causeway.applib.annotation.Nature;
+import org.apache.causeway.applib.annotation.TableDecorator;
 import org.apache.causeway.persistence.jpa.applib.integration.CausewayEntityListener;
 import org.springframework.context.annotation.Profile;
 
@@ -43,6 +45,7 @@ import org.springframework.context.annotation.Profile;
 //tag::class[]
 // ...
 @DomainObject(nature = Nature.ENTITY)
+@DomainObjectLayout(tableDecorator = TableDecorator.DatatablesNet.class)
 public class DomainObjectLayoutTableDecoratorJpa extends DomainObjectLayoutTableDecorator {
     // ...
 //end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEventPage-alternative2.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEvent-alternative1.layout.xml
similarity index 75%
rename from examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEventPage-alternative2.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEvent-alternative1.layout.xml
index 1161a7f340..26034dc31d 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEventPage-alternative2.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEvent-alternative1.layout.xml
@@ -26,7 +26,35 @@
 
 	<bs3:row>
 		<bs3:col span="6">
-			<cpt:fieldSet name="Alternative Layout selected via UI-Event" id="other" unreferencedProperties="true"/>
+			<bs3:tabGroup>
+				<bs3:tab name="Alternative Layout selected via Object-Support-Method">
+					<bs3:row>
+						<bs3:col span="12">
+							<cpt:fieldSet name="General" id="general" >
+								<cpt:property id="name"/>
+							</cpt:fieldSet>
+						</bs3:col>
+					</bs3:row>
+				</bs3:tab>
+				<bs3:tab name="Metadata">
+					<bs3:row>
+						<bs3:col span="12">
+							<cpt:fieldSet name="Metadata" id="metadata" >
+								<cpt:property id="id"/>
+								<cpt:property id="logicalTypeName"/>
+								<cpt:property id="version"/>
+							</cpt:fieldSet>
+						</bs3:col>
+					</bs3:row>
+				</bs3:tab>
+				<bs3:tab name="Other">
+					<bs3:row>
+						<bs3:col span="12">
+							<cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+						</bs3:col>
+					</bs3:row>
+				</bs3:tab>
+			</bs3:tabGroup>
 		</bs3:col>
 		<bs3:col span="6">
 			<cpt:fieldSet name="Description" id="description" >
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEventPage-alternative1.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEvent-alternative2.layout.xml
similarity index 76%
rename from examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEventPage-alternative1.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEvent-alternative2.layout.xml
index 0fdd3d80ab..0df2082dca 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEventPage-alternative1.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEvent-alternative2.layout.xml
@@ -26,7 +26,35 @@
 
 	<bs3:row>
 		<bs3:col span="6">
-			<cpt:fieldSet name="Alternative Layout selected via Object-Support-Method" id="other" unreferencedProperties="true"/>
+			<bs3:tabGroup>
+				<bs3:tab name="Alternative Layout selected via UI-Event">
+					<bs3:row>
+						<bs3:col span="12">
+							<cpt:fieldSet name="General" id="general" >
+								<cpt:property id="name"/>
+							</cpt:fieldSet>
+						</bs3:col>
+					</bs3:row>
+				</bs3:tab>
+				<bs3:tab name="Metadata">
+					<bs3:row>
+						<bs3:col span="12">
+							<cpt:fieldSet name="Metadata" id="metadata" >
+								<cpt:property id="id"/>
+								<cpt:property id="logicalTypeName"/>
+								<cpt:property id="version"/>
+							</cpt:fieldSet>
+						</bs3:col>
+					</bs3:row>
+				</bs3:tab>
+				<bs3:tab name="Other">
+					<bs3:row>
+						<bs3:col span="12">
+							<cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+						</bs3:col>
+					</bs3:row>
+				</bs3:tab>
+			</bs3:tabGroup>
 		</bs3:col>
 		<bs3:col span="6">
 			<cpt:fieldSet name="Description" id="description" >
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEventPage-signature.svg b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEvent-signature.svg
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEventPage-signature.svg
rename to examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEvent-signature.svg
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEvent.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEvent.java
index c3edbeee87..4e8baf902c 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEvent.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEvent.java
@@ -22,10 +22,17 @@ import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
 import demoapp.dom._infra.values.ValueHolder;
 
 import org.apache.causeway.applib.annotation.DomainObjectLayout;
+import org.apache.causeway.applib.events.ui.CssClassUiEvent;
+import org.apache.causeway.applib.events.ui.IconUiEvent;
+import org.apache.causeway.applib.events.ui.LayoutUiEvent;
+import org.apache.causeway.applib.events.ui.TitleUiEvent;
 
 //tag::class[]
 @DomainObjectLayout(
-        cssClassFa = "fa-user"             // <.>
+    titleUiEvent = DomainObjectLayoutXxxUiEvent.TitleEvent.class,               // <.>
+    iconUiEvent = DomainObjectLayoutXxxUiEvent.IconEvent.class,                 // <.>
+    cssClassUiEvent = DomainObjectLayoutXxxUiEvent.CssClassEvent.class,         // <.>
+    layoutUiEvent = DomainObjectLayoutXxxUiEvent.LayoutEvent.class              // <.>
 )
 public abstract class DomainObjectLayoutXxxUiEvent
 //end::class[]
@@ -34,6 +41,17 @@ public abstract class DomainObjectLayoutXxxUiEvent
         ValueHolder<String>
 //tag::class[]
 {
+
+    public static class TitleEvent                                              // <1>
+            extends TitleUiEvent<DomainObjectLayoutXxxUiEventPage> { }
+    public static class IconEvent                                               // <2>
+            extends IconUiEvent<DomainObjectLayoutXxxUiEvent> { }
+    public static class CssClassEvent                                           // <3>
+            extends CssClassUiEvent<DomainObjectLayoutXxxUiEvent> { }
+    public static class LayoutEvent                                             // <4>
+            extends LayoutUiEvent<DomainObjectLayoutXxxUiEvent> { }
+
+
     // ...
 //end::class[]
 
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEventPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEventPage.java
index 3d7b0ca72f..a2ba2b2d65 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEventPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEventPage.java
@@ -34,19 +34,8 @@ import org.apache.causeway.applib.annotation.*;
 @Named("demo.DomainObjectLayoutXxxUiEventVm")
 @DomainObject(
         nature=Nature.VIEW_MODEL)
-@DomainObjectLayout(
-        titleUiEvent = DomainObjectLayoutXxxUiEventPage.TitleUiEvent.class,
-        iconUiEvent = DomainObjectLayoutXxxUiEventPage.IconUiEvent.class,
-        cssClassUiEvent = DomainObjectLayoutXxxUiEventPage.CssClassUiEvent.class,
-        layoutUiEvent = DomainObjectLayoutXxxUiEventPage.LayoutUiEvent.class
-        )
 public class DomainObjectLayoutXxxUiEventPage implements HasAsciiDocDescription {
 
-    public static class TitleUiEvent extends org.apache.causeway.applib.events.ui.TitleUiEvent<DomainObjectLayoutXxxUiEventPage> { }
-    public static class IconUiEvent extends org.apache.causeway.applib.events.ui.IconUiEvent<DomainObjectLayoutXxxUiEventPage> { }
-    public static class CssClassUiEvent extends org.apache.causeway.applib.events.ui.CssClassUiEvent<DomainObjectLayoutXxxUiEventPage> { }
-    public static class LayoutUiEvent extends org.apache.causeway.applib.events.ui.LayoutUiEvent<DomainObjectLayoutXxxUiEventPage> { }
-
     @ObjectSupport public String title() {
         return "@DomainObjectLayout#xxxUiEvent (should be overwritten by ui-title-event-listener)";
     }
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEventService.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEventSubscriber.java
similarity index 80%
rename from examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEventService.java
rename to examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEventSubscriber.java
index a5fd7a3551..f2f7d7ec2e 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEventService.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/xxxUiEvent/DomainObjectLayoutXxxUiEventSubscriber.java
@@ -30,10 +30,10 @@ import org.springframework.stereotype.Service;
 @Service
 @Named("demo.DomainObjectLayoutXxxUiEventService")
 @Log4j2
-public class DomainObjectLayoutXxxUiEventService {
+public class DomainObjectLayoutXxxUiEventSubscriber {
 
     @EventListener
-    void onTitleUiEvent(final DomainObjectLayoutXxxUiEventPage.TitleUiEvent titleUiEvent) {
+    void onTitleUiEvent(final DomainObjectLayoutXxxUiEvent.TitleEvent titleUiEvent) {
         val in = titleUiEvent.getTitle();
         val out = "DomainObjectLayout-UiEvents";
         titleUiEvent.setTitle(out);
@@ -41,7 +41,7 @@ public class DomainObjectLayoutXxxUiEventService {
     }
 
     @EventListener
-    void onIconUiEvent(final DomainObjectLayoutXxxUiEventPage.IconUiEvent iconUiEvent) {
+    void onIconUiEvent(final DomainObjectLayoutXxxUiEvent.IconEvent iconUiEvent) {
         val in = iconUiEvent.getIconName();
         val out = "signature";
         iconUiEvent.setIconName(out);
@@ -49,15 +49,15 @@ public class DomainObjectLayoutXxxUiEventService {
     }
 
     @EventListener
-    void onCssClassUiEvent(final DomainObjectLayoutXxxUiEventPage.CssClassUiEvent cssClassUiEvent) {
+    void onCssClassUiEvent(final DomainObjectLayoutXxxUiEvent.CssClassEvent cssClassUiEvent) {
         val in = cssClassUiEvent.getCssClass();
-        val out = "bg-dark";
+        val out = "custom";
         cssClassUiEvent.setCssClass(out);
         log.info("cssClassUiEvent: {}->{}", in, out);
     }
 
     @EventListener
-    void onLayoutUiEvent(final DomainObjectLayoutXxxUiEventPage.LayoutUiEvent layoutUiEvent) {
+    void onLayoutUiEvent(final DomainObjectLayoutXxxUiEvent.LayoutEvent layoutUiEvent) {
         val in = layoutUiEvent.getLayout();
         val out = "alternative2";
         layoutUiEvent.setLayout(out);