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/05/01 16:21:15 UTC
[causeway] branch CAUSEWAY-2485 updated (cd7d34a462 -> 0a45d5550f)
This is an automated email from the ASF dual-hosted git repository.
danhaywood pushed a change to branch CAUSEWAY-2485
in repository https://gitbox.apache.org/repos/asf/causeway.git
from cd7d34a462 CAUSEWAY-2485: updates descriptoins is all
add 12cf68fc61 CAUSEWAY-3449: Update Apache Wicket 9.12.0 -> 9.13.0
add 52116b72ea Bump wicket-bootstrap.version from 6.0.2 to 6.0.3
add b9f831af93 Bump wicket-webjars from 3.0.6 to 3.0.7
add 8c35c4b247 Merge branch 'CAUSEWAY-2485'
new 6cf3bb26e3 CAUSEWAY-2485: fleshes out @CollectionLayout#cssClass
new e3ac5361a9 CAUSEWAY-2485: fleshes out @CollectionLayout#defaultView
new e4ac1994af CAUSEWAY-2485: fleshes out @CollectionLayout#describedAs and @CollectionLayout#hidden
new 782ff47921 CAUSEWAY-2485: fleshes out @CollectionLayout#describedAs and @CollectionLayout#named
new f874de4719 CAUSEWAY-2485: fleshes out @CollectionLayout#named and #paged
new 0f1e973878 CAUSEWAY-2485: fleshes out @CollectionLayout#sequence
new 58f43aa156 CAUSEWAY-2485: fleshes out @CollectionLayout#sortedBy
new 0a45d5550f CAUSEWAY-2485: updates @CollectionLayout#tableDecorator
The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
bom/pom.xml | 6 +-
.../ActionChoicesFromPage-description.adoc | 2 -
.../CollectionLayout/CollectionLayoutMenu.java | 93 ++++++++++++++++++---
.../CollectionLayoutCssClassPage-description.adoc | 53 ++++++++++--
.../cssClass/CollectionLayoutCssClassPage.java | 33 +++++---
.../CollectionLayoutCssClassPage.layout.xml | 12 ++-
...llectionLayoutCssClassChildVm-description.adoc} | 4 +-
.../CollectionLayoutCssClassChildVm.java} | 41 ++++-----
.../CollectionLayoutCssClassChildVm.layout.xml} | 0
...ollectionLayoutDefaultViewPage-description.adoc | 65 ++++++++++++--
.../CollectionLayoutDefaultViewPage.java | 46 +++++++---
.../CollectionLayoutDefaultViewPage.layout.xml | 11 +++
...ctionLayoutDefaultViewChildVm-description.adoc} | 4 +-
.../CollectionLayoutDefaultViewChildVm.java} | 41 ++++-----
.../CollectionLayoutDefaultViewChildVm.layout.xml} | 0
...ollectionLayoutDescribedAsPage-description.adoc | 34 +++++++-
.../CollectionLayoutDescribedAsPage.java | 35 ++++++--
.../CollectionLayoutDescribedAsPage.layout.xml | 12 +++
...ctionLayoutDescribedAsChildVm-description.adoc} | 4 +-
.../CollectionLayoutDescribedAsChildVm.java} | 53 +++++-------
.../CollectionLayoutDescribedAsChildVm.layout.xml} | 0
.../CollectionLayoutHiddenPage-description.adoc | 45 +++++++++-
.../hidden/CollectionLayoutHiddenPage.java | 45 ++++++++--
.../hidden/CollectionLayoutHiddenPage.layout.xml | 11 +++
...CollectionLayoutHiddenChildVm-description.adoc} | 4 +-
.../child/CollectionLayoutHiddenChildVm.java} | 41 ++++-----
.../CollectionLayoutHiddenChildVm.layout.xml} | 0
.../CollectionLayoutNamedPage-description.adoc | 36 +++++++-
.../named/CollectionLayoutNamedPage.java | 36 ++++++--
.../named/CollectionLayoutNamedPage.layout.xml | 12 +++
.../CollectionLayoutNamedChildVm-description.adoc} | 4 +-
.../child/CollectionLayoutNamedChildVm.java} | 41 ++++-----
.../child/CollectionLayoutNamedChildVm.layout.xml} | 0
.../CollectionLayoutPagedPage-description.adoc | 54 ++++++++++--
.../paged/CollectionLayoutPagedPage.java | 36 ++++++--
.../paged/CollectionLayoutPagedPage.layout.xml | 10 +++
.../CollectionLayoutPagedChildVm-description.adoc} | 4 +-
.../child/CollectionLayoutPagedChildVm.java} | 41 ++++-----
.../child/CollectionLayoutPagedChildVm.layout.xml} | 0
.../CollectionLayoutSequencePage-description.adoc | 66 ++++++++++++++-
.../sequence/CollectionLayoutSequencePage.java | 48 +++++++++--
.../CollectionLayoutSequencePage.layout.xml | 14 ++--
...llectionLayoutSequenceChildVm-description.adoc} | 4 +-
.../CollectionLayoutSequenceChildVm.java} | 53 +++++-------
.../CollectionLayoutSequenceChildVm.layout.xml} | 0
.../CollectionLayoutSortedByPage-description.adoc | 39 +++++++--
.../sortedBy/CollectionLayoutSortedByPage.java | 27 +++---
.../CollectionLayoutSortedByPage.layout.xml | 11 ++-
...SortedByComparator.java => NameComparator.java} | 27 +++---
...llectionLayoutSortedByChildVm-description.adoc} | 4 +-
.../CollectionLayoutSortedByChildVm.java} | 41 ++++-----
.../CollectionLayoutSortedByChildVm.layout.xml} | 15 +++-
...ectionLayoutTableDecoratorPage-description.adoc | 8 --
...ctionLayoutTableDecoratorPage-description.adoc} | 28 ++++---
.../CollectionLayoutTableDecoratorPage.java | 26 +++---
.../CollectionLayoutTableDecoratorPage.layout.xml | 9 ++
...onLayoutTableDecoratorChildVm-description.adoc} | 4 +-
.../CollectionLayoutTableDecoratorChildVm.java} | 41 ++++-----
...llectionLayoutTableDecoratorChildVm.layout.xml} | 0
.../DomainObjectLayoutPagedPage-description.adoc | 3 +-
...ObjectLayoutTableDecoratorPage-description.adoc | 14 ++--
.../PropertyLayout/PropertyLayoutMenu.java | 6 +-
.../PropertyLayoutCssClassPage-description.adoc | 8 +-
.../cssClass/PropertyLayoutCssClassPage.layout.xml | 4 +-
.../PropertyLayoutDescribedAsPage-description.adoc | 34 ++++----
.../PropertyLayoutHiddenPage-description.adoc | 2 +-
.../named/PropertyLayoutNamedPage-description.adoc | 24 +++---
.../named/PropertyLayoutNamedPage.java | 2 +-
.../demo/domain/src/main/resources/application.yml | 3 +
.../src/main/resources/static/css/application.css | 17 ++++
viewers/wicket/graceful/pom.xml | 8 +-
....jar.mangled => wicket-core-9.13.0.jar.mangled} | Bin 2387164 -> 2393559 bytes
....jar.mangled => wicket-util-9.13.0.jar.mangled} | Bin 382094 -> 382011 bytes
73 files changed, 1071 insertions(+), 488 deletions(-)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/{describedAs/CollectionLayoutDescribedAsPage-description.adoc => cssClass/child/CollectionLayoutCssClassChildVm-description.adoc} (85%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/{CollectionLayoutCssClassPage.java => child/CollectionLayoutCssClassChildVm.java} (64%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/{Collection/domainEvent/child/CollectionDomainEventChildVm.layout.xml => CollectionLayout/cssClass/child/CollectionLayoutCssClassChildVm.layout.xml} (100%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/{describedAs/CollectionLayoutDescribedAsPage-description.adoc => defaultView/child/CollectionLayoutDefaultViewChildVm-description.adoc} (85%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/{CollectionLayoutDefaultViewPage.java => child/CollectionLayoutDefaultViewChildVm.java} (63%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/{Collection/domainEvent/child/CollectionDomainEventChildVm.layout.xml => CollectionLayout/defaultView/child/CollectionLayoutDefaultViewChildVm.layout.xml} (100%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/{CollectionLayoutDescribedAsPage-description.adoc => child/CollectionLayoutDescribedAsChildVm-description.adoc} (85%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/{CollectionLayoutDescribedAsPage.java => child/CollectionLayoutDescribedAsChildVm.java} (54%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/{Collection/domainEvent/child/CollectionDomainEventChildVm.layout.xml => CollectionLayout/describedAs/child/CollectionLayoutDescribedAsChildVm.layout.xml} (100%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/{describedAs/CollectionLayoutDescribedAsPage-description.adoc => hidden/child/CollectionLayoutHiddenChildVm-description.adoc} (85%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/{paged/CollectionLayoutPagedPage.java => hidden/child/CollectionLayoutHiddenChildVm.java} (61%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/{Collection/domainEvent/child/CollectionDomainEventChildVm.layout.xml => CollectionLayout/hidden/child/CollectionLayoutHiddenChildVm.layout.xml} (100%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/{describedAs/CollectionLayoutDescribedAsPage-description.adoc => named/child/CollectionLayoutNamedChildVm-description.adoc} (85%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/{sequence/CollectionLayoutSequencePage.java => named/child/CollectionLayoutNamedChildVm.java} (61%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/{Collection/domainEvent/child/CollectionDomainEventChildVm.layout.xml => CollectionLayout/named/child/CollectionLayoutNamedChildVm.layout.xml} (100%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/{describedAs/CollectionLayoutDescribedAsPage-description.adoc => paged/child/CollectionLayoutPagedChildVm-description.adoc} (85%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/{sequence/CollectionLayoutSequencePage.java => paged/child/CollectionLayoutPagedChildVm.java} (61%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/{Collection/domainEvent/child/CollectionDomainEventChildVm.layout.xml => CollectionLayout/paged/child/CollectionLayoutPagedChildVm.layout.xml} (100%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/{describedAs/CollectionLayoutDescribedAsPage-description.adoc => sequence/child/CollectionLayoutSequenceChildVm-description.adoc} (85%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/{CollectionLayoutSequencePage.java => child/CollectionLayoutSequenceChildVm.java} (55%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/{Collection/domainEvent/child/CollectionDomainEventChildVm.layout.xml => CollectionLayout/sequence/child/CollectionLayoutSequenceChildVm.layout.xml} (100%)
rename examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/{CollectionLayoutSortedByComparator.java => NameComparator.java} (60%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/{describedAs/CollectionLayoutDescribedAsPage-description.adoc => sortedBy/child/CollectionLayoutSortedByChildVm-description.adoc} (85%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/{CollectionLayoutSortedByPage.java => child/CollectionLayoutSortedByChildVm.java} (63%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/{describedAs/CollectionLayoutDescribedAsPage.layout.xml => sortedBy/child/CollectionLayoutSortedByChildVm.layout.xml} (82%)
delete mode 100644 examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage-description.adoc
copy examples/demo/domain/src/main/java/demoapp/dom/domain/{objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage-description.adoc => collections/CollectionLayout/tabledec/CollectionLayoutTableDecoratorPage-description.adoc} (50%)
rename examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/{tableDecorator => tabledec}/CollectionLayoutTableDecoratorPage.java (74%)
rename examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/{tableDecorator => tabledec}/CollectionLayoutTableDecoratorPage.layout.xml (93%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/{describedAs/CollectionLayoutDescribedAsPage-description.adoc => tabledec/child/CollectionLayoutTableDecoratorChildVm-description.adoc} (85%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/{paged/CollectionLayoutPagedPage.java => tabledec/child/CollectionLayoutTableDecoratorChildVm.java} (61%)
copy examples/demo/domain/src/main/java/demoapp/dom/domain/collections/{Collection/domainEvent/child/CollectionDomainEventChildVm.layout.xml => CollectionLayout/tabledec/child/CollectionLayoutTableDecoratorChildVm.layout.xml} (100%)
rename viewers/wicket/graceful/src/test/resources/wicket-artifacts-no-module-info/{wicket-core-9.12.0.jar.mangled => wicket-core-9.13.0.jar.mangled} (86%)
rename viewers/wicket/graceful/src/test/resources/wicket-artifacts-no-module-info/{wicket-util-9.12.0.jar.mangled => wicket-util-9.13.0.jar.mangled} (93%)
[causeway] 06/08: CAUSEWAY-2485: fleshes out @CollectionLayout#sequence
Posted by da...@apache.org.
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 0f1e97387870df1b84db814926b5c8792307cf77
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Apr 30 18:44:16 2023 +0100
CAUSEWAY-2485: fleshes out @CollectionLayout#sequence
---
.../CollectionLayoutSequencePage-description.adoc | 66 ++++++++++++++++++++--
.../sequence/CollectionLayoutSequencePage.java | 4 +-
.../CollectionLayoutSequencePage.layout.xml | 15 ++---
3 files changed, 69 insertions(+), 16 deletions(-)
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage-description.adoc
index ffc288a8e4..19db87043a 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage-description.adoc
@@ -1,8 +1,66 @@
: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 `sequence` attribute ...
+WARNING: TODO - remove `sequence` attribute from `.layout.xml` - it doesn't really accomplish much.
-WARNING: TODO[CAUSEWAY-3311]
-The order of this member relative to other members in the same (layout) group, given in Dewey-decimal notation.
-An alternative is to use the Xxx.layout.xml file, where Xxx is the domain object name.
+The link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/DomainObjectLayout.html#sequence[@DomainObjectLayout#sequence] attribute provides a way to specify the order in which collections should be rendered in the user interface when their position has not been specified explicitly in the link:https://causeway.apache.org/userguide/2.0.0-RC1/fun/ui.html#by-example[.layout.xml] layout file.
+
+TIP: It's more common to just use link:https://causeway.apache.org/userguide/2.0.0-RC1/fun/ui.html#by-example[.layout.xml] to specify the positioning of collections in the UI, which means that the `sequence` attribute is little used in practice.
+
+== How this demo works
+
+This page object defines three collections, `children`, `moreChildren` and -- inevitably -- `yetMoreChildren`.
+However, none of these is referenced in the `.layout.xml` file, which means that they will all be rendered in the "unreferencedCollections" column.
+
+The `sequence` attribute determines the order in which they appear in that column.
+
+In terms of code:
+
+* the `.layout.xml` defines the "unreferencedCollections" to the left hand side:
++
+[source,xml,indent=0,tabsize=4]
+.CollectionLayoutSequencePage.layout.xml
+----
+<bs3:grid ...>
+ ...
+ <bs3:row>
+ <bs3:col span="6">
+ ...
+ <bs3:row>
+ <bs3:col span="12" unreferencedCollections="true"/>
+ </bs3:row>
+ </bs3:col>
+ <bs3:col span="6">
+ ...
+ </bs3:col>
+ </bs3:row>
+</bs3:grid>
+----
+
+* the three collections are annotated so that `moreChildren` is first, then `yetMoreChildren`, and finally `children`:
++
+ "1" < "1.5" < "2"
+
+** `children` has sequence of "2"
++
+[source,java,indent=0]
+----
+include::CollectionLayoutSequencePage.java[tags=children]
+----
+<.> sequence of "2"
+
+** `moreChildren` comes first, with a sequence of "1"
++
+[source,java,indent=0]
+----
+include::CollectionLayoutSequencePage.java[tags=more-children]
+----
+<.> sequence of "1"
+
+** `yetMoreChildren` is in between, with a sequence of "1.5"
++
+[source,java,indent=0]
+----
+include::CollectionLayoutSequencePage.java[tags=yet-more-children]
+----
+<.> sequence of "1.5"
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.java
index a746fc7388..b24c62c500 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.java
@@ -82,7 +82,9 @@ public class CollectionLayoutSequencePage implements HasAsciiDocDescription {
//tag::yet-more-children[]
@Collection()
- @CollectionLayout() // <.>
+ @CollectionLayout(
+ sequence = "1.5" // <.>
+ )
@XmlElementWrapper(name = "yetMoreChildren")
@XmlElement(name = "child")
@Getter @Setter
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.layout.xml
index 760d77407e..352adc5cbf 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.layout.xml
@@ -28,17 +28,13 @@
<bs3:col span="6">
<bs3:row>
<bs3:col span="12">
- <cpt:collection id="children"/>
- <cpt:collection id="moreChildren"/>
- <cpt:collection id="yetMoreChildren"/>
+ <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
</bs3:col>
</bs3:row>
<bs3:row>
- <bs3:col span="12">
- <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
- </bs3:col>
- </bs3:row>
- </bs3:col>
+ <bs3:col span="12" unreferencedCollections="true"/>
+ </bs3:row>
+ </bs3:col>
<bs3:col span="6">
<cpt:fieldSet name="Description" id="description" >
<cpt:action id="clearHints" position="PANEL" />
@@ -56,8 +52,5 @@
</cpt:fieldSet>
</bs3:col>
</bs3:row>
- <bs3:row>
- <bs3:col span="12" unreferencedCollections="true"/>
- </bs3:row>
</bs3:grid>
[causeway] 04/08: CAUSEWAY-2485: fleshes out @CollectionLayout#describedAs and @CollectionLayout#named
Posted by da...@apache.org.
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 782ff47921543fe02f0ed56f2410f93ae6587a82
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Apr 30 16:25:39 2023 +0100
CAUSEWAY-2485: fleshes out @CollectionLayout#describedAs and @CollectionLayout#named
---
.../hidden/CollectionLayoutHiddenPage.java | 2 +-
.../CollectionLayoutNamedPage-description.adoc | 36 +++++++++++++++++++---
.../named/CollectionLayoutNamedPage.java | 4 +--
.../named/CollectionLayoutNamedPage.layout.xml | 4 ++-
.../named/PropertyLayoutNamedPage-description.adoc | 24 ++++++---------
.../named/PropertyLayoutNamedPage.java | 2 +-
6 files changed, 49 insertions(+), 23 deletions(-)
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/CollectionLayoutHiddenPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/CollectionLayoutHiddenPage.java
index 5048ee68db..b8dc6c5ccf 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/CollectionLayoutHiddenPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/CollectionLayoutHiddenPage.java
@@ -88,7 +88,7 @@ public class CollectionLayoutHiddenPage implements HasAsciiDocDescription {
@XmlElement(name = "child")
@Getter @Setter
private List<CollectionLayoutHiddenChildVm> yetMoreChildren = new ArrayList<>();
-//end::more-children[]
+//end::yet-more-children[]
}
//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage-description.adoc
index 13ead9567c..c8b582ac6a 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage-description.adoc
@@ -1,7 +1,35 @@
: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 `named` attribute ...
+The name of a collection is used as the label of the field in the UI.
+Normally the name is inferred from the name of the corresponding field or getter method in code.
+This inferred name can be however be overridden using either the link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/CollectionLayout.html#named[@CollectionLayout#named] attribute, or using the link:https://causeway.apache.org/userguide/2.0.0-RC1/fun/ui.html#by-example[.layout.xml] layout file.
+
+This is useful for example if the desired name is a Java keyword (such as "package").
+
+
+== How this demo works
+
+This page object has two collections, and both has had their name explicitly specified using each of the two mechanisms.
+
+In terms of code:
+
+* the `children` property has its name specified using the `@CollectionLayout#named()` annotation:
++
+[source,java,indent=0]
+----
+include::CollectionLayoutNamedPage.java[tags=children]
+----
+<.> explicitly specifies the name of the collection
+
+* meanwhile, the `moreChildren` property has its name specified using the `Xxx.layout.xml` file:
++
+[source,xml,indent=0,tabsize=4]
+----
+<cpt:collection id="moreChildren">
+ <cpt:named>Named using layout.xml</cpt:named>
+</cpt:collection>
+----
++
+One advantage of the layout file over the annotation is that the layout file is dynamic: it can be modified and the changes reloaded in a running application.
+
-WARNING: TODO[CAUSEWAY-3311]
-Name of this collection (overriding the name derived from its name in code).
-A typical use case is if the desired name is a reserved Java keyword, such as default or package.
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.java
index cb23883730..20ad49e20c 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.java
@@ -62,7 +62,7 @@ public class CollectionLayoutNamedPage implements HasAsciiDocDescription {
//tag::children[]
@Collection()
@CollectionLayout(
- named = "Collection of child objects" // <.>
+ named = "Named using @CollectionLayout" // <.>
)
@XmlElementWrapper(name = "children")
@XmlElement(name = "child")
@@ -72,7 +72,7 @@ public class CollectionLayoutNamedPage implements HasAsciiDocDescription {
//tag::more-children[]
@Collection()
- @CollectionLayout() // <.>
+ @CollectionLayout() // <.>
@XmlElementWrapper(name = "moreChildren")
@XmlElement(name = "child")
@Getter @Setter
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml
index d7450c3c78..cd60f67ce5 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml
@@ -29,7 +29,9 @@
<bs3:row>
<bs3:col span="12">
<cpt:collection id="children"/>
- <cpt:collection id="moreChildren"/>
+ <cpt:collection id="moreChildren">
+ <cpt:named>Named using layout.xml</cpt:named>
+ </cpt:collection>
</bs3:col>
</bs3:row>
<bs3:row>
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage-description.adoc
index 63fe04444a..56081da820 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage-description.adoc
@@ -1,7 +1,7 @@
: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 name of a property or parameter is used as the label of the field in the UI.
-Normally the name is inferred from the name of the corresponding field or parameter in code.
+Normally the name is inferred from the name of the corresponding field (or getter method) or parameter in code.
This inferred name can be however be overridden using various mechanisms with an explicit value:
* for properties, the name can be specified using the link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/PropertyLayout.html#named[@PropertyLayout#named] attribute, or using the link:https://causeway.apache.org/userguide/2.0.0-RC1/fun/ui.html#by-example[.layout.xml] layout file.
@@ -13,11 +13,12 @@ This is useful for example if the desired name is a Java keyword (such as "defau
== How this demo works
-=== Annotated
+This page object has two properties, and both has had their name explicitly specified using each of the two mechanisms.
+The first also has an action whose parameter name has been explicitly set.
-The name can be specified explicitly using an annotation:
+In terms of code:
-* for properties, using `@PropertyLayout#named()`:
+* the `propertyUsingAnnotation` property, unsurprisingly, has its name specified using the `@PropertyLayout#named()` annotation:
+
[source,java,indent=0]
----
@@ -25,7 +26,7 @@ include::PropertyLayoutNamedPage.java[tags=annotation]
----
<.> explicitly specifies the name of the property
-* for parameters, using `@ParameterLayout#named()`:
+* the parameter of the action that updates it has _its_ parameter named using `@ParameterLayout#named()`:
+
[source,java,indent=0]
----
@@ -33,13 +34,9 @@ include::PropertyLayoutNamedPage_updateWithParameterLayout.java[tags=annotation]
----
<.> explicitly specifies the name of the parameter
-=== Layout File
+* meanwhile, the `propertyUsingLayout` property has its name specified using the `Xxx.layout.xml` file:
-The name can be specified using the `Xxx.layout.xml` file:
-
-WARNING: currently this does not work; link:https://issues.apache.org/jira/browse/CAUSEWAY-3443[CAUSEWAY-3443].
-
-* property definition:
+** the property's field is:
+
[source,java,indent=0]
----
@@ -47,7 +44,7 @@ include::PropertyLayoutNamedPage.java[tags=layout-file]
----
<.> `named` hint is _not_ present.
-* layout file snippet:
+** while its layout file snippet is:
+
[source,xml,indent=0,tabsize=4]
----
@@ -55,9 +52,8 @@ include::PropertyLayoutNamedPage.java[tags=layout-file]
<cpt:named>Named using layout.xml</cpt:named>
</cpt:property>
----
-// TODO: for some reason this doesn't include correctly in the app...
-//include::PropertyLayoutNamedPage.layout.xml[tags=layout-file]
++
One advantage of the layout file over the annotation is that the layout file is dynamic: it can be modified and the changes reloaded in a running application.
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage.java
index 30e120c134..6d090a6b88 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage.java
@@ -55,7 +55,7 @@ public class PropertyLayoutNamedPage implements HasAsciiDocDescription {
//tag::annotation[]
@Property(optionality = Optionality.OPTIONAL)
@PropertyLayout(
- named = "Named using @PropertyLayout"
+ named = "Named using @PropertyLayout" // <.>
)
@XmlElement(required = false)
@Getter @Setter
[causeway] 03/08: CAUSEWAY-2485: fleshes out @CollectionLayout#describedAs and @CollectionLayout#hidden
Posted by da...@apache.org.
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 e4ac1994af36ddb626526bf2cfb85b22075a817d
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Apr 30 16:09:24 2023 +0100
CAUSEWAY-2485: fleshes out @CollectionLayout#describedAs and @CollectionLayout#hidden
also scaffolds out remaining @CollectionLayout attribs
---
.../CollectionLayout/CollectionLayoutMenu.java | 58 ++++++++++++++++++----
...ollectionLayoutDescribedAsPage-description.adoc | 34 +++++++++++--
.../CollectionLayoutDescribedAsPage.java | 35 +++++++++----
.../CollectionLayoutDescribedAsPage.layout.xml | 12 +++++
...ctionLayoutDescribedAsChildVm-description.adoc} | 4 +-
.../CollectionLayoutDescribedAsChildVm.java} | 53 ++++++++------------
.../CollectionLayoutDescribedAsChildVm.layout.xml} | 15 ++++--
.../CollectionLayoutHiddenPage-description.adoc | 45 +++++++++++++++--
.../hidden/CollectionLayoutHiddenPage.java | 45 +++++++++++++----
.../hidden/CollectionLayoutHiddenPage.layout.xml | 11 ++++
...CollectionLayoutHiddenChildVm-description.adoc} | 4 +-
.../child/CollectionLayoutHiddenChildVm.java} | 41 +++++++--------
.../CollectionLayoutHiddenChildVm.layout.xml} | 15 ++++--
.../named/CollectionLayoutNamedPage.java | 36 ++++++++++----
.../named/CollectionLayoutNamedPage.layout.xml | 10 ++++
.../CollectionLayoutNamedChildVm-description.adoc} | 4 +-
.../child/CollectionLayoutNamedChildVm.java} | 41 +++++++--------
.../CollectionLayoutNamedChildVm.layout.xml} | 15 ++++--
.../paged/CollectionLayoutPagedPage.java | 36 ++++++++++----
.../paged/CollectionLayoutPagedPage.layout.xml | 10 ++++
.../CollectionLayoutPagedChildVm-description.adoc} | 4 +-
.../child/CollectionLayoutPagedChildVm.java} | 41 +++++++--------
.../child/CollectionLayoutPagedChildVm.layout.xml} | 15 ++++--
.../sequence/CollectionLayoutSequencePage.java | 46 +++++++++++++----
.../CollectionLayoutSequencePage.layout.xml | 11 ++++
...llectionLayoutSequenceChildVm-description.adoc} | 4 +-
.../CollectionLayoutSequenceChildVm.java} | 53 ++++++++------------
.../CollectionLayoutSequenceChildVm.layout.xml} | 15 ++++--
.../sortedBy/CollectionLayoutSortedByPage.java | 41 +++++++++++----
.../CollectionLayoutSortedByPage.layout.xml | 9 ++++
...llectionLayoutSortedByChildVm-description.adoc} | 4 +-
.../CollectionLayoutSortedByChildVm.java} | 41 +++++++--------
.../CollectionLayoutSortedByChildVm.layout.xml} | 15 ++++--
.../CollectionLayoutTableDecoratorPage.java | 26 ++++++----
.../CollectionLayoutTableDecoratorPage.layout.xml | 9 ++++
...onLayoutTableDecoratorChildVm-description.adoc} | 4 +-
.../CollectionLayoutTableDecoratorChildVm.java} | 41 +++++++--------
...llectionLayoutTableDecoratorChildVm.layout.xml} | 15 ++++--
.../PropertyLayout/PropertyLayoutMenu.java | 6 ++-
.../PropertyLayoutDescribedAsPage-description.adoc | 34 +++++++------
.../PropertyLayoutHiddenPage-description.adoc | 2 +-
41 files changed, 637 insertions(+), 323 deletions(-)
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java
index 49ef4dd77b..4a17e59968 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java
@@ -29,19 +29,26 @@ import org.apache.causeway.applib.annotation.PriorityPrecedence;
import org.apache.causeway.applib.annotation.SemanticsOf;
import demoapp.dom._infra.samples.NameSamples;
-import demoapp.dom.domain.collections.Collection.typeOf.child.CollectionTypeOfChildVm;
import demoapp.dom.domain.collections.CollectionLayout.cssClass.CollectionLayoutCssClassPage;
import demoapp.dom.domain.collections.CollectionLayout.cssClass.child.CollectionLayoutCssClassChildVm;
import demoapp.dom.domain.collections.CollectionLayout.defaultView.CollectionLayoutDefaultViewPage;
import demoapp.dom.domain.collections.CollectionLayout.defaultView.child.CollectionLayoutDefaultViewChildVm;
import demoapp.dom.domain.collections.CollectionLayout.describedAs.CollectionLayoutDescribedAsPage;
+import demoapp.dom.domain.collections.CollectionLayout.describedAs.child.CollectionLayoutDescribedAsChildVm;
import demoapp.dom.domain.collections.CollectionLayout.hidden.CollectionLayoutHiddenPage;
+import demoapp.dom.domain.collections.CollectionLayout.hidden.child.CollectionLayoutHiddenChildVm;
import demoapp.dom.domain.collections.CollectionLayout.named.CollectionLayoutNamedPage;
+import demoapp.dom.domain.collections.CollectionLayout.named.child.CollectionLayoutNamedChildVm;
import demoapp.dom.domain.collections.CollectionLayout.paged.CollectionLayoutPagedPage;
+import demoapp.dom.domain.collections.CollectionLayout.paged.child.CollectionLayoutPagedChildVm;
import demoapp.dom.domain.collections.CollectionLayout.sequence.CollectionLayoutSequencePage;
+import demoapp.dom.domain.collections.CollectionLayout.sequence.child.CollectionLayoutSequenceChildVm;
import demoapp.dom.domain.collections.CollectionLayout.sortedBy.CollectionLayoutSortedByPage;
+import demoapp.dom.domain.collections.CollectionLayout.sortedBy.child.CollectionLayoutSortedByChildVm;
import demoapp.dom.domain.collections.CollectionLayout.tableDecorator.CollectionLayoutTableDecoratorPage;
+import demoapp.dom.domain.collections.CollectionLayout.tableDecorator.child.CollectionLayoutTableDecoratorChildVm;
+
import lombok.RequiredArgsConstructor;
import lombok.val;
@@ -76,7 +83,7 @@ public class CollectionLayoutMenu {
@ActionLayout(cssClassFa="fa-atom",
describedAs = "View collection as a table, or collapsed, or some other representation if available")
public CollectionLayoutDefaultViewPage defaultView(){
- CollectionLayoutDefaultViewPage page = new CollectionLayoutDefaultViewPage();
+ val page = new CollectionLayoutDefaultViewPage();
samples.stream()
.map(CollectionLayoutDefaultViewChildVm::new)
.forEach(e -> page.getChildren().add(e));
@@ -93,49 +100,82 @@ public class CollectionLayoutMenu {
@ActionLayout(cssClassFa="fa-comment",
describedAs = "Description of the collection, shown as a tooltip")
public CollectionLayoutDescribedAsPage describedAs(){
- return new CollectionLayoutDescribedAsPage();
+ val page = new CollectionLayoutDescribedAsPage();
+ samples.stream()
+ .map(CollectionLayoutDescribedAsChildVm::new)
+ .forEach(e -> page.getChildren().add(e));
+ samples.stream()
+ .map(CollectionLayoutDescribedAsChildVm::new)
+ .forEach(e -> page.getMoreChildren().add(e));
+ return page;
}
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa="fa-glasses",
describedAs = "Visibility of the collection in different contexts")
public CollectionLayoutHiddenPage hidden(){
- return new CollectionLayoutHiddenPage();
+ val page = new CollectionLayoutHiddenPage();
+ samples.stream()
+ .map(CollectionLayoutHiddenChildVm::new)
+ .forEach(e -> page.getChildren().add(e));
+ return page;
}
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa="fa-signature",
describedAs = "Custom text for the collection's label")
public CollectionLayoutNamedPage named(){
- return new CollectionLayoutNamedPage();
+ val page = new CollectionLayoutNamedPage();
+ samples.stream()
+ .map(CollectionLayoutNamedChildVm::new)
+ .forEach(e -> page.getChildren().add(e));
+ return page;
}
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa="fa-fast-forward",
describedAs = "Number of domain objects per page in this collection")
public CollectionLayoutPagedPage paged(){
- return new CollectionLayoutPagedPage();
+ val page = new CollectionLayoutPagedPage();
+ samples.stream()
+ .map(CollectionLayoutPagedChildVm::new)
+ .forEach(e -> page.getChildren().add(e));
+ return page;
}
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa="fa-sharp fa-solid fa-sort",
describedAs = "Order of this member relative to other members in the same (layout) group.")
public CollectionLayoutSequencePage sequence(){
- return new CollectionLayoutSequencePage();
+ val page = new CollectionLayoutSequencePage();
+ samples.stream()
+ .map(CollectionLayoutSequenceChildVm::new)
+ .forEach(e -> page.getChildren().add(e));
+ return page;
}
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa="fa-solid fa-arrow-down-a-z",
describedAs = "Sort domain objects in this collection, overriding their default comparator")
public CollectionLayoutSortedByPage sortedBy(){
- return new CollectionLayoutSortedByPage();
+ val page = new CollectionLayoutSortedByPage();
+ samples.stream()
+ .map(CollectionLayoutSortedByChildVm::new)
+ .forEach(e -> page.getChildren().add(e));
+ return page;
+
}
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa="fa-solid fa-table-columns",
describedAs = "Allows to specify a custom client side table renderer.")
public CollectionLayoutTableDecoratorPage tableDecorator(){
- return new CollectionLayoutTableDecoratorPage();
+ val page = new CollectionLayoutTableDecoratorPage();
+ samples.stream()
+ .map(CollectionLayoutTableDecoratorChildVm::new)
+ .forEach(e -> page.getChildren().add(e));
+ return page;
+
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc
index d0a7f89de0..3449b78f66 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc
@@ -1,6 +1,34 @@
: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 `describedAs` attribute ...
+Often the end-user of your application will be a frequent user and will know by sight the purpose of the various properties, collections and actions that are displayed.
+But, for less experienced users, or for new features, providing a description to provide brief additional information to the user may be of help.
+
+The description of a collection can be specified using either the link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/CollectionLayout.html#describedas[@CollectionLayout#describedAs] annotation, or a meta-annotation, or using the `Xxx.layout.xml` layout file.
+
+In either case the description of the collection is used as the tooltip of the label in the UI, providing more information to the end-user.
+
+== How this demo works
+
+This page object has two collections, one of which has a description defined by the annotation, and the other using the `.layout.xml` file.
+In both cases this description is rendered as a tooltip of the collection's label.
+
+In terms of code:
+
+* For the `children` collection, its description is specified using `@PropertyLayout#describedAs()`:
++
+[source,java,indent=0]
+CollectionLayoutDescribedAsPage.java
+----
+include::CollectionLayoutDescribedAsPage.java[tags=children]
+----
+<.> explicitly specifies the description of the collection
+
+* For the `moreChildren` property, its description is specified using the `.layout.xml` file:
+
+[source,xml,indent=0,tabsize=4]
+----
+<cpt:collection id="moreChildren">
+ <cpt:describedAs>This is a collection of more children (provided by the .layout.xml file)</cpt:describedAs>
+</cpt:collection>
+----
-WARNING: TODO[CAUSEWAY-3311]
-Description of this collection, eg to be rendered in a tooltip.
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage.java
index a812f0b7f8..0272d5d284 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage.java
@@ -24,6 +24,8 @@ import java.util.List;
import javax.inject.Named;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
@@ -34,6 +36,10 @@ import org.apache.causeway.applib.annotation.DomainObject;
import org.apache.causeway.applib.annotation.Nature;
import org.apache.causeway.applib.annotation.ObjectSupport;
+import demoapp.dom.domain.collections.CollectionLayout.defaultView.child.CollectionLayoutDefaultViewChildVm;
+
+import demoapp.dom.domain.collections.CollectionLayout.describedAs.child.CollectionLayoutDescribedAsChildVm;
+
import lombok.Getter;
import lombok.Setter;
@@ -41,9 +47,8 @@ import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
import demoapp.dom.domain._entities.DemoEntity;
//tag::class[]
-@DomainObject(
- nature=Nature.VIEW_MODEL)
-@Named("demo.CollectionLayoutDescribedAsVm")
+@Named("demo.CollectionLayoutDescribedAsPage")
+@DomainObject(nature=Nature.VIEW_MODEL)
@XmlRootElement(name = "root")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
@@ -53,14 +58,26 @@ public class CollectionLayoutDescribedAsPage implements HasAsciiDocDescription {
return "@CollectionLayout#describedAs";
}
-//tag::collection[]
- @Collection
+//tag::children[]
+ @Collection()
@CollectionLayout(
- describedAs = "Description goes here")
- @XmlTransient
+ describedAs = "This is a collection of children", // <.>
+ paged = 5
+ )
+ @XmlElementWrapper(name = "children")
+ @XmlElement(name = "child")
+ @Getter @Setter
+ private List<CollectionLayoutDescribedAsChildVm> children = new ArrayList<>();
+//end::children[]
+
+//tag::more-children[]
+ @Collection()
+ @CollectionLayout(paged = 5)
+ @XmlElementWrapper(name = "moreChildren")
+ @XmlElement(name = "child")
@Getter @Setter
- private List<DemoEntity> collection = new ArrayList<>();
-//end::collection[]
+ private List<CollectionLayoutDescribedAsChildVm> moreChildren = new ArrayList<>();
+//end::more-children[]
}
//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage.layout.xml
index 9e55f97df5..9dcf2d4c85 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage.layout.xml
@@ -26,7 +26,19 @@
<bs3:row>
<bs3:col span="6">
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:collection id="children"/>
+ <cpt:collection id="moreChildren">
+ <cpt:describedAs>This is a collection of more children (provided by the .layout.xml file)</cpt:describedAs>
+ </cpt:collection>
+ </bs3:col>
+ </bs3:row>
+ <bs3:row>
+ <bs3:col span="12">
<cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </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/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/child/CollectionLayoutDescribedAsChildVm-description.adoc
similarity index 85%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/child/CollectionLayoutDescribedAsChildVm-description.adoc
index d0a7f89de0..3ab1389200 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/child/CollectionLayoutDescribedAsChildVm-description.adoc
@@ -1,6 +1,4 @@
: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 `describedAs` attribute ...
+This is a child object used in the demonstration of `CollectionLayout#describedAs()`.
-WARNING: TODO[CAUSEWAY-3311]
-Description of this collection, eg to be rendered in a tooltip.
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/child/CollectionLayoutDescribedAsChildVm.java
similarity index 54%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage.java
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/child/CollectionLayoutDescribedAsChildVm.java
index a812f0b7f8..591a341a1d 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/child/CollectionLayoutDescribedAsChildVm.java
@@ -16,51 +16,42 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.domain.collections.CollectionLayout.describedAs;
+package demoapp.dom.domain.collections.CollectionLayout.describedAs.child;
-import java.util.ArrayList;
-import java.util.List;
+import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import javax.inject.Named;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.*;
-import org.apache.causeway.applib.annotation.Collection;
-import org.apache.causeway.applib.annotation.CollectionLayout;
import org.apache.causeway.applib.annotation.DomainObject;
import org.apache.causeway.applib.annotation.Nature;
-import org.apache.causeway.applib.annotation.ObjectSupport;
-
-import lombok.Getter;
-import lombok.Setter;
-
-import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.domain._entities.DemoEntity;
+import org.apache.causeway.applib.annotation.Property;
+import org.apache.causeway.applib.annotation.Title;
//tag::class[]
-@DomainObject(
- nature=Nature.VIEW_MODEL)
-@Named("demo.CollectionLayoutDescribedAsVm")
-@XmlRootElement(name = "root")
+@Named("demo.CollectionLayoutDescribedAsChildVm")
+@XmlRootElement(name = "demo.CollectionLayoutDescribedAsChildVm")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
-public class CollectionLayoutDescribedAsPage implements HasAsciiDocDescription {
+@DomainObject(nature=Nature.VIEW_MODEL)
+@NoArgsConstructor
+public class CollectionLayoutDescribedAsChildVm implements HasAsciiDocDescription {
- @ObjectSupport public String title() {
- return "@CollectionLayout#describedAs";
+//end::class[]
+ public CollectionLayoutDescribedAsChildVm(final String value) {
+ this.value = value;
}
-//tag::collection[]
- @Collection
- @CollectionLayout(
- describedAs = "Description goes here")
- @XmlTransient
+//tag::class[]
+ @Title
+ @Property()
+ @XmlElement(required = true)
@Getter @Setter
- private List<DemoEntity> collection = new ArrayList<>();
-//end::collection[]
+ private String value;
}
//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/child/CollectionLayoutDescribedAsChildVm.layout.xml
similarity index 82%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/child/CollectionLayoutDescribedAsChildVm.layout.xml
index 9e55f97df5..a5d295bce2 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/child/CollectionLayoutDescribedAsChildVm.layout.xml
@@ -26,7 +26,14 @@
<bs3:row>
<bs3:col span="6">
- <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:fieldSet name="Properties" id="properties">
+ <cpt:property id="value"/>
+ </cpt:fieldSet>
+ <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </bs3:col>
+ </bs3:row>
</bs3:col>
<bs3:col span="6">
<cpt:fieldSet name="Description" id="description" >
@@ -36,9 +43,9 @@
<cpt:action id="inspectMetamodel" position="PANEL_DROPDOWN"/>
<cpt:action id="downloadMetamodelXml" position="PANEL_DROPDOWN"/>
<cpt:action id="downloadJdoMetamodel" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentExecutions" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentAuditTrailEntries" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentExecutions" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentAuditTrailEntries" position="PANEL_DROPDOWN"/>
<cpt:action id="impersonateWithRoles" position="PANEL_DROPDOWN"/>
<cpt:action id="openRestApi" position="PANEL_DROPDOWN" />
<cpt:property id="description"/>
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/CollectionLayoutHiddenPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/CollectionLayoutHiddenPage-description.adoc
index 43733c4a26..f83dcfbb39 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/CollectionLayoutHiddenPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/CollectionLayoutHiddenPage-description.adoc
@@ -1,8 +1,45 @@
: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 `hidden` attribute ...
+Sometimes an object may have a collection of related objects, but for whatever reason this collection should not be visible to the end-user.
-WARNING: TODO[CAUSEWAY-3311]
-Indicates where in the UI the collection should not not be visible.
-Only Where#NOWHERE NOWHERE or Where#EVERYWHERE EVERYWHERE / Where#ANYWHERE ANYWHERE apply for collections.
+One option is to simply annotate the collection with `@Programmatic` (or `@Domain.Exclude`, which amounts to the same thing); this means that the collection is _not_ part of the framework metamodel and so will not be rendered.
+
+An alternative approach is to annotate the collection as hidden, which can be done using either the link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/CollectionLayout.html#hidden[@CollectionLayout#hidden] annotation, or a meta-annotation, or using the `Xxx.layout.xml` layout file.
+
+== How this demo works
+
+This page has 3 collections, but only one of them -- `children` -- should be visible.
+This is because the other two collections have been hidden, one using an annotation and the other using the `.layout.xml` file.
+
+In terms of code:
+
+* the `children` collection is visible:
++
+[source,java,indent=0]
+.CollectionLayoutHiddenPage.java
+----
+include::CollectionLayoutHiddenPage.java[tags=children]
+----
+<.> explicitly specifies that the collection is _not_ hidden
+
+* the `moreChildren` collection is not visible:
++
+[source,java,indent=0]
+.CollectionLayoutHiddenPage.java
+----
+include::CollectionLayoutHiddenPage.java[tags=more-children]
+----
+<.> explicitly specifies that the collection should always be hidden
+
+
+* the `yetMoreChildren` collection is also not visible, but this time because it has been specified in the `.layout.xml` file:
++
+[source,xml,indent=0]
+.CollectionLayoutHiddenPage.layout.xml
+----
+<cpt:collection id="yetMoreChildren" hidden="EVERYWHERE"/>
+----
+
+Note that only `Where.EVERYWHERE` (or its alias, `Where.ANYWHERE`) and `Where.NOWHERE` are permitted for collections.
+The other values are for use by properties and/or collections.
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/CollectionLayoutHiddenPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/CollectionLayoutHiddenPage.java
index 212092afae..5048ee68db 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/CollectionLayoutHiddenPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/CollectionLayoutHiddenPage.java
@@ -24,6 +24,8 @@ import java.util.List;
import javax.inject.Named;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
@@ -35,6 +37,10 @@ import org.apache.causeway.applib.annotation.Nature;
import org.apache.causeway.applib.annotation.ObjectSupport;
import org.apache.causeway.applib.annotation.Where;
+import demoapp.dom.domain.collections.CollectionLayout.describedAs.child.CollectionLayoutDescribedAsChildVm;
+
+import demoapp.dom.domain.collections.CollectionLayout.hidden.child.CollectionLayoutHiddenChildVm;
+
import lombok.Getter;
import lombok.Setter;
@@ -42,9 +48,8 @@ import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
import demoapp.dom.domain._entities.DemoEntity;
//tag::class[]
-@DomainObject(
- nature=Nature.VIEW_MODEL)
-@Named("demo.CollectionLayoutHiddenVm")
+@Named("demo.CollectionLayoutHiddenPage")
+@DomainObject(nature=Nature.VIEW_MODEL)
@XmlRootElement(name = "root")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
@@ -54,14 +59,36 @@ public class CollectionLayoutHiddenPage implements HasAsciiDocDescription {
return "@CollectionLayout#hidden";
}
-//tag::collection[]
- @Collection
+//tag::children[]
+ @Collection()
@CollectionLayout(
- hidden = Where.REFERENCES_PARENT)
- @XmlTransient
+ hidden = Where.NOWHERE // <.>
+ )
+ @XmlElementWrapper(name = "children")
+ @XmlElement(name = "child")
+ @Getter @Setter
+ private List<CollectionLayoutHiddenChildVm> children = new ArrayList<>();
+//end::children[]
+
+//tag::more-children[]
+ @Collection()
+ @CollectionLayout(
+ hidden = Where.EVERYWHERE // <.>
+ )
+ @XmlElementWrapper(name = "moreChildren")
+ @XmlElement(name = "child")
+ @Getter @Setter
+ private List<CollectionLayoutHiddenChildVm> moreChildren = new ArrayList<>();
+//end::more-children[]
+
+//tag::yet-more-children[]
+ @Collection()
+ @CollectionLayout() // <.>
+ @XmlElementWrapper(name = "yetMoreChildren")
+ @XmlElement(name = "child")
@Getter @Setter
- private List<DemoEntity> collection = new ArrayList<>();
-//end::collection[]
+ private List<CollectionLayoutHiddenChildVm> yetMoreChildren = new ArrayList<>();
+//end::more-children[]
}
//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/CollectionLayoutHiddenPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/CollectionLayoutHiddenPage.layout.xml
index 9e55f97df5..c8ef58fc5c 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/CollectionLayoutHiddenPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/CollectionLayoutHiddenPage.layout.xml
@@ -26,7 +26,18 @@
<bs3:row>
<bs3:col span="6">
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:collection id="children"/>
+ <cpt:collection id="moreChildren"/>
+ <cpt:collection id="yetMoreChildren" hidden="EVERYWHERE"/>
+ </bs3:col>
+ </bs3:row>
+ <bs3:row>
+ <bs3:col span="12">
<cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </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/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/child/CollectionLayoutHiddenChildVm-description.adoc
similarity index 85%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/child/CollectionLayoutHiddenChildVm-description.adoc
index d0a7f89de0..da0ab699ad 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/child/CollectionLayoutHiddenChildVm-description.adoc
@@ -1,6 +1,4 @@
: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 `describedAs` attribute ...
+This is a child object used in the demonstration of `CollectionLayout#hidden()`.
-WARNING: TODO[CAUSEWAY-3311]
-Description of this collection, eg to be rendered in a tooltip.
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/child/CollectionLayoutHiddenChildVm.java
similarity index 61%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage.java
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/child/CollectionLayoutHiddenChildVm.java
index 3dac6bb3a9..bec2a25466 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/child/CollectionLayoutHiddenChildVm.java
@@ -16,51 +16,46 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.domain.collections.CollectionLayout.paged;
-
-import java.util.ArrayList;
-import java.util.List;
+package demoapp.dom.domain.collections.CollectionLayout.hidden.child;
import javax.inject.Named;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
-import org.apache.causeway.applib.annotation.Collection;
-import org.apache.causeway.applib.annotation.CollectionLayout;
import org.apache.causeway.applib.annotation.DomainObject;
import org.apache.causeway.applib.annotation.Nature;
-import org.apache.causeway.applib.annotation.ObjectSupport;
+import org.apache.causeway.applib.annotation.Property;
+import org.apache.causeway.applib.annotation.Title;
import lombok.Getter;
+import lombok.NoArgsConstructor;
import lombok.Setter;
import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.domain._entities.DemoEntity;
//tag::class[]
-@DomainObject(
- nature=Nature.VIEW_MODEL)
-@Named("demo.CollectionLayoutPagedVm")
-@XmlRootElement(name = "root")
+@Named("demo.CollectionLayoutHiddenChildVm")
+@XmlRootElement(name = "demo.CollectionLayoutHiddenChildVm")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
-public class CollectionLayoutPagedPage implements HasAsciiDocDescription {
+@DomainObject(nature=Nature.VIEW_MODEL)
+@NoArgsConstructor
+public class CollectionLayoutHiddenChildVm implements HasAsciiDocDescription {
- @ObjectSupport public String title() {
- return "@CollectionLayout#paged";
+//end::class[]
+ public CollectionLayoutHiddenChildVm(final String value) {
+ this.value = value;
}
-//tag::collection[]
- @Collection
- @CollectionLayout(
- paged = 2)
- @XmlTransient
+//tag::class[]
+ @Title
+ @Property()
+ @XmlElement(required = true)
@Getter @Setter
- private List<DemoEntity> collection = new ArrayList<>();
-//end::collection[]
+ private String value;
}
//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/child/CollectionLayoutHiddenChildVm.layout.xml
similarity index 82%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/child/CollectionLayoutHiddenChildVm.layout.xml
index 9e55f97df5..a5d295bce2 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/hidden/child/CollectionLayoutHiddenChildVm.layout.xml
@@ -26,7 +26,14 @@
<bs3:row>
<bs3:col span="6">
- <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:fieldSet name="Properties" id="properties">
+ <cpt:property id="value"/>
+ </cpt:fieldSet>
+ <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </bs3:col>
+ </bs3:row>
</bs3:col>
<bs3:col span="6">
<cpt:fieldSet name="Description" id="description" >
@@ -36,9 +43,9 @@
<cpt:action id="inspectMetamodel" position="PANEL_DROPDOWN"/>
<cpt:action id="downloadMetamodelXml" position="PANEL_DROPDOWN"/>
<cpt:action id="downloadJdoMetamodel" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentExecutions" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentAuditTrailEntries" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentExecutions" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentAuditTrailEntries" position="PANEL_DROPDOWN"/>
<cpt:action id="impersonateWithRoles" position="PANEL_DROPDOWN"/>
<cpt:action id="openRestApi" position="PANEL_DROPDOWN" />
<cpt:property id="description"/>
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.java
index 648801c842..cb23883730 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.java
@@ -24,6 +24,8 @@ import java.util.List;
import javax.inject.Named;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
@@ -33,6 +35,11 @@ import org.apache.causeway.applib.annotation.CollectionLayout;
import org.apache.causeway.applib.annotation.DomainObject;
import org.apache.causeway.applib.annotation.Nature;
import org.apache.causeway.applib.annotation.ObjectSupport;
+import org.apache.causeway.applib.annotation.Where;
+
+import demoapp.dom.domain.collections.CollectionLayout.hidden.child.CollectionLayoutHiddenChildVm;
+
+import demoapp.dom.domain.collections.CollectionLayout.named.child.CollectionLayoutNamedChildVm;
import lombok.Getter;
import lombok.Setter;
@@ -41,9 +48,8 @@ import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
import demoapp.dom.domain._entities.DemoEntity;
//tag::class[]
-@DomainObject(
- nature=Nature.VIEW_MODEL)
-@Named("demo.CollectionLayoutNamedVm")
+@Named("demo.CollectionLayoutNamedPage")
+@DomainObject(nature=Nature.VIEW_MODEL)
@XmlRootElement(name = "root")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
@@ -53,14 +59,26 @@ public class CollectionLayoutNamedPage implements HasAsciiDocDescription {
return "@CollectionLayout#named";
}
-//tag::collection[]
- @Collection
+//tag::children[]
+ @Collection()
@CollectionLayout(
- named = "Name goes here")
- @XmlTransient
+ named = "Collection of child objects" // <.>
+ )
+ @XmlElementWrapper(name = "children")
+ @XmlElement(name = "child")
@Getter @Setter
- private List<DemoEntity> collection = new ArrayList<>();
-//end::collection[]
+ private List<CollectionLayoutNamedChildVm> children = new ArrayList<>();
+//end::children[]
+
+//tag::more-children[]
+ @Collection()
+ @CollectionLayout() // <.>
+ @XmlElementWrapper(name = "moreChildren")
+ @XmlElement(name = "child")
+ @Getter @Setter
+ private List<CollectionLayoutNamedChildVm> moreChildren = new ArrayList<>();
+//end::more-children[]
+
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml
index 9e55f97df5..d7450c3c78 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml
@@ -26,7 +26,17 @@
<bs3:row>
<bs3:col span="6">
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:collection id="children"/>
+ <cpt:collection id="moreChildren"/>
+ </bs3:col>
+ </bs3:row>
+ <bs3:row>
+ <bs3:col span="12">
<cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </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/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/child/CollectionLayoutNamedChildVm-description.adoc
similarity index 85%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/child/CollectionLayoutNamedChildVm-description.adoc
index d0a7f89de0..39c6f4b00f 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/child/CollectionLayoutNamedChildVm-description.adoc
@@ -1,6 +1,4 @@
: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 `describedAs` attribute ...
+This is a child object used in the demonstration of `CollectionLayout#named()`.
-WARNING: TODO[CAUSEWAY-3311]
-Description of this collection, eg to be rendered in a tooltip.
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/child/CollectionLayoutNamedChildVm.java
similarity index 61%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.java
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/child/CollectionLayoutNamedChildVm.java
index 431831529f..814343721b 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/child/CollectionLayoutNamedChildVm.java
@@ -16,51 +16,46 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.domain.collections.CollectionLayout.sequence;
-
-import java.util.ArrayList;
-import java.util.List;
+package demoapp.dom.domain.collections.CollectionLayout.named.child;
import javax.inject.Named;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
-import org.apache.causeway.applib.annotation.Collection;
-import org.apache.causeway.applib.annotation.CollectionLayout;
import org.apache.causeway.applib.annotation.DomainObject;
import org.apache.causeway.applib.annotation.Nature;
-import org.apache.causeway.applib.annotation.ObjectSupport;
+import org.apache.causeway.applib.annotation.Property;
+import org.apache.causeway.applib.annotation.Title;
import lombok.Getter;
+import lombok.NoArgsConstructor;
import lombok.Setter;
import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.domain._entities.DemoEntity;
//tag::class[]
-@DomainObject(
- nature=Nature.VIEW_MODEL)
-@Named("demo.CollectionLayoutSequenceVm")
-@XmlRootElement(name = "root")
+@Named("demo.CollectionLayoutNamedChildVm")
+@XmlRootElement(name = "demo.CollectionLayoutNamedChildVm")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
-public class CollectionLayoutSequencePage implements HasAsciiDocDescription {
+@DomainObject(nature=Nature.VIEW_MODEL)
+@NoArgsConstructor
+public class CollectionLayoutNamedChildVm implements HasAsciiDocDescription {
- @ObjectSupport public String title() {
- return "@CollectionLayout#sequence";
+//end::class[]
+ public CollectionLayoutNamedChildVm(final String value) {
+ this.value = value;
}
-//tag::collection[]
- @Collection
- @CollectionLayout(
- sequence = "0")
- @XmlTransient
+//tag::class[]
+ @Title
+ @Property()
+ @XmlElement(required = true)
@Getter @Setter
- private List<DemoEntity> collection = new ArrayList<>();
-//end::collection[]
+ private String value;
}
//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/child/CollectionLayoutNamedChildVm.layout.xml
similarity index 82%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/child/CollectionLayoutNamedChildVm.layout.xml
index 9e55f97df5..a5d295bce2 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/child/CollectionLayoutNamedChildVm.layout.xml
@@ -26,7 +26,14 @@
<bs3:row>
<bs3:col span="6">
- <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:fieldSet name="Properties" id="properties">
+ <cpt:property id="value"/>
+ </cpt:fieldSet>
+ <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </bs3:col>
+ </bs3:row>
</bs3:col>
<bs3:col span="6">
<cpt:fieldSet name="Description" id="description" >
@@ -36,9 +43,9 @@
<cpt:action id="inspectMetamodel" position="PANEL_DROPDOWN"/>
<cpt:action id="downloadMetamodelXml" position="PANEL_DROPDOWN"/>
<cpt:action id="downloadJdoMetamodel" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentExecutions" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentAuditTrailEntries" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentExecutions" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentAuditTrailEntries" position="PANEL_DROPDOWN"/>
<cpt:action id="impersonateWithRoles" position="PANEL_DROPDOWN"/>
<cpt:action id="openRestApi" position="PANEL_DROPDOWN" />
<cpt:property id="description"/>
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage.java
index 3dac6bb3a9..01aff89897 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage.java
@@ -24,6 +24,8 @@ import java.util.List;
import javax.inject.Named;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
@@ -34,6 +36,11 @@ import org.apache.causeway.applib.annotation.DomainObject;
import org.apache.causeway.applib.annotation.Nature;
import org.apache.causeway.applib.annotation.ObjectSupport;
+import demoapp.dom.domain.collections.CollectionLayout.hidden.child.CollectionLayoutHiddenChildVm;
+
+import demoapp.dom.domain.collections.CollectionLayout.named.child.CollectionLayoutNamedChildVm;
+import demoapp.dom.domain.collections.CollectionLayout.paged.child.CollectionLayoutPagedChildVm;
+
import lombok.Getter;
import lombok.Setter;
@@ -41,9 +48,8 @@ import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
import demoapp.dom.domain._entities.DemoEntity;
//tag::class[]
-@DomainObject(
- nature=Nature.VIEW_MODEL)
-@Named("demo.CollectionLayoutPagedVm")
+@Named("demo.CollectionLayoutPagedPage")
+@DomainObject(nature=Nature.VIEW_MODEL)
@XmlRootElement(name = "root")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
@@ -53,14 +59,26 @@ public class CollectionLayoutPagedPage implements HasAsciiDocDescription {
return "@CollectionLayout#paged";
}
-//tag::collection[]
- @Collection
+//tag::children[]
+ @Collection()
@CollectionLayout(
- paged = 2)
- @XmlTransient
+ paged = 5 // <.>
+ )
+ @XmlElementWrapper(name = "children")
+ @XmlElement(name = "child")
@Getter @Setter
- private List<DemoEntity> collection = new ArrayList<>();
-//end::collection[]
+ private List<CollectionLayoutPagedChildVm> children = new ArrayList<>();
+//end::children[]
+
+//tag::more-children[]
+ @Collection()
+ @CollectionLayout() // <.>
+ @XmlElementWrapper(name = "moreChildren")
+ @XmlElement(name = "child")
+ @Getter @Setter
+ private List<CollectionLayoutPagedChildVm> moreChildren = new ArrayList<>();
+//end::more-children[]
+
}
//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage.layout.xml
index 9e55f97df5..d7450c3c78 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage.layout.xml
@@ -26,7 +26,17 @@
<bs3:row>
<bs3:col span="6">
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:collection id="children"/>
+ <cpt:collection id="moreChildren"/>
+ </bs3:col>
+ </bs3:row>
+ <bs3:row>
+ <bs3:col span="12">
<cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </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/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/child/CollectionLayoutPagedChildVm-description.adoc
similarity index 85%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/child/CollectionLayoutPagedChildVm-description.adoc
index d0a7f89de0..18de3445aa 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/child/CollectionLayoutPagedChildVm-description.adoc
@@ -1,6 +1,4 @@
: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 `describedAs` attribute ...
+This is a child object used in the demonstration of `CollectionLayout#paged()`.
-WARNING: TODO[CAUSEWAY-3311]
-Description of this collection, eg to be rendered in a tooltip.
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/child/CollectionLayoutPagedChildVm.java
similarity index 61%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.java
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/child/CollectionLayoutPagedChildVm.java
index 431831529f..6808269b2c 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/child/CollectionLayoutPagedChildVm.java
@@ -16,51 +16,46 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.domain.collections.CollectionLayout.sequence;
-
-import java.util.ArrayList;
-import java.util.List;
+package demoapp.dom.domain.collections.CollectionLayout.paged.child;
import javax.inject.Named;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
-import org.apache.causeway.applib.annotation.Collection;
-import org.apache.causeway.applib.annotation.CollectionLayout;
import org.apache.causeway.applib.annotation.DomainObject;
import org.apache.causeway.applib.annotation.Nature;
-import org.apache.causeway.applib.annotation.ObjectSupport;
+import org.apache.causeway.applib.annotation.Property;
+import org.apache.causeway.applib.annotation.Title;
import lombok.Getter;
+import lombok.NoArgsConstructor;
import lombok.Setter;
import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.domain._entities.DemoEntity;
//tag::class[]
-@DomainObject(
- nature=Nature.VIEW_MODEL)
-@Named("demo.CollectionLayoutSequenceVm")
-@XmlRootElement(name = "root")
+@Named("demo.CollectionLayoutPagedChildVm")
+@XmlRootElement(name = "demo.CollectionLayoutPagedChildVm")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
-public class CollectionLayoutSequencePage implements HasAsciiDocDescription {
+@DomainObject(nature=Nature.VIEW_MODEL)
+@NoArgsConstructor
+public class CollectionLayoutPagedChildVm implements HasAsciiDocDescription {
- @ObjectSupport public String title() {
- return "@CollectionLayout#sequence";
+//end::class[]
+ public CollectionLayoutPagedChildVm(final String value) {
+ this.value = value;
}
-//tag::collection[]
- @Collection
- @CollectionLayout(
- sequence = "0")
- @XmlTransient
+//tag::class[]
+ @Title
+ @Property()
+ @XmlElement(required = true)
@Getter @Setter
- private List<DemoEntity> collection = new ArrayList<>();
-//end::collection[]
+ private String value;
}
//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/child/CollectionLayoutPagedChildVm.layout.xml
similarity index 82%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/child/CollectionLayoutPagedChildVm.layout.xml
index 9e55f97df5..a5d295bce2 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/child/CollectionLayoutPagedChildVm.layout.xml
@@ -26,7 +26,14 @@
<bs3:row>
<bs3:col span="6">
- <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:fieldSet name="Properties" id="properties">
+ <cpt:property id="value"/>
+ </cpt:fieldSet>
+ <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </bs3:col>
+ </bs3:row>
</bs3:col>
<bs3:col span="6">
<cpt:fieldSet name="Description" id="description" >
@@ -36,9 +43,9 @@
<cpt:action id="inspectMetamodel" position="PANEL_DROPDOWN"/>
<cpt:action id="downloadMetamodelXml" position="PANEL_DROPDOWN"/>
<cpt:action id="downloadJdoMetamodel" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentExecutions" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentAuditTrailEntries" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentExecutions" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentAuditTrailEntries" position="PANEL_DROPDOWN"/>
<cpt:action id="impersonateWithRoles" position="PANEL_DROPDOWN"/>
<cpt:action id="openRestApi" position="PANEL_DROPDOWN" />
<cpt:property id="description"/>
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.java
index 431831529f..a746fc7388 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.java
@@ -24,6 +24,8 @@ import java.util.List;
import javax.inject.Named;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
@@ -34,6 +36,10 @@ import org.apache.causeway.applib.annotation.DomainObject;
import org.apache.causeway.applib.annotation.Nature;
import org.apache.causeway.applib.annotation.ObjectSupport;
+import demoapp.dom.domain.collections.CollectionLayout.paged.child.CollectionLayoutPagedChildVm;
+
+import demoapp.dom.domain.collections.CollectionLayout.sequence.child.CollectionLayoutSequenceChildVm;
+
import lombok.Getter;
import lombok.Setter;
@@ -41,9 +47,8 @@ import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
import demoapp.dom.domain._entities.DemoEntity;
//tag::class[]
-@DomainObject(
- nature=Nature.VIEW_MODEL)
-@Named("demo.CollectionLayoutSequenceVm")
+@Named("demo.CollectionLayoutSequencePage")
+@DomainObject(nature=Nature.VIEW_MODEL)
@XmlRootElement(name = "root")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
@@ -53,14 +58,37 @@ public class CollectionLayoutSequencePage implements HasAsciiDocDescription {
return "@CollectionLayout#sequence";
}
-//tag::collection[]
- @Collection
+//tag::children[]
+ @Collection()
+ @CollectionLayout(
+ sequence = "2" // <.>
+ )
+ @XmlElementWrapper(name = "children")
+ @XmlElement(name = "child")
+ @Getter @Setter
+ private List<CollectionLayoutSequenceChildVm> children = new ArrayList<>();
+//end::children[]
+
+//tag::more-children[]
+ @Collection()
@CollectionLayout(
- sequence = "0")
- @XmlTransient
+ sequence = "1" // <.>
+ )
+ @XmlElementWrapper(name = "moreChildren")
+ @XmlElement(name = "child")
+ @Getter @Setter
+ private List<CollectionLayoutSequenceChildVm> moreChildren = new ArrayList<>();
+//end::more-children[]
+
+//tag::yet-more-children[]
+ @Collection()
+ @CollectionLayout() // <.>
+ @XmlElementWrapper(name = "yetMoreChildren")
+ @XmlElement(name = "child")
@Getter @Setter
- private List<DemoEntity> collection = new ArrayList<>();
-//end::collection[]
+ private List<CollectionLayoutSequenceChildVm> yetMoreChildren = new ArrayList<>();
+//end::yet-more-children[]
+
}
//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.layout.xml
index 9e55f97df5..760d77407e 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.layout.xml
@@ -26,7 +26,18 @@
<bs3:row>
<bs3:col span="6">
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:collection id="children"/>
+ <cpt:collection id="moreChildren"/>
+ <cpt:collection id="yetMoreChildren"/>
+ </bs3:col>
+ </bs3:row>
+ <bs3:row>
+ <bs3:col span="12">
<cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </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/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/child/CollectionLayoutSequenceChildVm-description.adoc
similarity index 85%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/child/CollectionLayoutSequenceChildVm-description.adoc
index d0a7f89de0..3e724f98b6 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/child/CollectionLayoutSequenceChildVm-description.adoc
@@ -1,6 +1,4 @@
: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 `describedAs` attribute ...
+This is a child object used in the demonstration of `CollectionLayout#sequence()`.
-WARNING: TODO[CAUSEWAY-3311]
-Description of this collection, eg to be rendered in a tooltip.
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/child/CollectionLayoutSequenceChildVm.java
similarity index 55%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.java
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/child/CollectionLayoutSequenceChildVm.java
index 431831529f..84d9758515 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/CollectionLayoutSequencePage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/child/CollectionLayoutSequenceChildVm.java
@@ -16,51 +16,42 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.domain.collections.CollectionLayout.sequence;
+package demoapp.dom.domain.collections.CollectionLayout.sequence.child;
-import java.util.ArrayList;
-import java.util.List;
+import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+
+import lombok.Getter;
+import lombok.NoArgsConstructor;
+import lombok.Setter;
import javax.inject.Named;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.*;
-import org.apache.causeway.applib.annotation.Collection;
-import org.apache.causeway.applib.annotation.CollectionLayout;
import org.apache.causeway.applib.annotation.DomainObject;
import org.apache.causeway.applib.annotation.Nature;
-import org.apache.causeway.applib.annotation.ObjectSupport;
-
-import lombok.Getter;
-import lombok.Setter;
-
-import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.domain._entities.DemoEntity;
+import org.apache.causeway.applib.annotation.Property;
+import org.apache.causeway.applib.annotation.Title;
//tag::class[]
-@DomainObject(
- nature=Nature.VIEW_MODEL)
-@Named("demo.CollectionLayoutSequenceVm")
-@XmlRootElement(name = "root")
+@Named("demo.CollectionLayoutSequenceChildVm")
+@XmlRootElement(name = "demo.CollectionLayoutSequenceChildVm")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
-public class CollectionLayoutSequencePage implements HasAsciiDocDescription {
+@DomainObject(nature=Nature.VIEW_MODEL)
+@NoArgsConstructor
+public class CollectionLayoutSequenceChildVm implements HasAsciiDocDescription {
- @ObjectSupport public String title() {
- return "@CollectionLayout#sequence";
+//end::class[]
+ public CollectionLayoutSequenceChildVm(final String value) {
+ this.value = value;
}
-//tag::collection[]
- @Collection
- @CollectionLayout(
- sequence = "0")
- @XmlTransient
+//tag::class[]
+ @Title
+ @Property()
+ @XmlElement(required = true)
@Getter @Setter
- private List<DemoEntity> collection = new ArrayList<>();
-//end::collection[]
+ private String value;
}
//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/child/CollectionLayoutSequenceChildVm.layout.xml
similarity index 82%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/child/CollectionLayoutSequenceChildVm.layout.xml
index 9e55f97df5..a5d295bce2 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sequence/child/CollectionLayoutSequenceChildVm.layout.xml
@@ -26,7 +26,14 @@
<bs3:row>
<bs3:col span="6">
- <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:fieldSet name="Properties" id="properties">
+ <cpt:property id="value"/>
+ </cpt:fieldSet>
+ <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </bs3:col>
+ </bs3:row>
</bs3:col>
<bs3:col span="6">
<cpt:fieldSet name="Description" id="description" >
@@ -36,9 +43,9 @@
<cpt:action id="inspectMetamodel" position="PANEL_DROPDOWN"/>
<cpt:action id="downloadMetamodelXml" position="PANEL_DROPDOWN"/>
<cpt:action id="downloadJdoMetamodel" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentExecutions" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentAuditTrailEntries" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentExecutions" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentAuditTrailEntries" position="PANEL_DROPDOWN"/>
<cpt:action id="impersonateWithRoles" position="PANEL_DROPDOWN"/>
<cpt:action id="openRestApi" position="PANEL_DROPDOWN" />
<cpt:property id="description"/>
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage.java
index 1c68188558..3e27a8a73f 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage.java
@@ -19,13 +19,15 @@
package demoapp.dom.domain.collections.CollectionLayout.sortedBy;
import java.util.ArrayList;
+import java.util.Comparator;
import java.util.List;
import javax.inject.Named;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import org.apache.causeway.applib.annotation.Collection;
@@ -33,17 +35,20 @@ import org.apache.causeway.applib.annotation.CollectionLayout;
import org.apache.causeway.applib.annotation.DomainObject;
import org.apache.causeway.applib.annotation.Nature;
import org.apache.causeway.applib.annotation.ObjectSupport;
+import org.apache.causeway.applib.util.ObjectContracts;
+
+import demoapp.dom.domain.collections.CollectionLayout.sequence.child.CollectionLayoutSequenceChildVm;
+
+import demoapp.dom.domain.collections.CollectionLayout.sortedBy.child.CollectionLayoutSortedByChildVm;
import lombok.Getter;
import lombok.Setter;
import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.domain._entities.DemoEntity;
//tag::class[]
-@DomainObject(
- nature=Nature.VIEW_MODEL)
-@Named("demo.CollectionLayoutSortedByVm")
+@Named("demo.CollectionLayoutSortedByPage")
+@DomainObject(nature=Nature.VIEW_MODEL)
@XmlRootElement(name = "root")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
@@ -53,14 +58,28 @@ public class CollectionLayoutSortedByPage implements HasAsciiDocDescription {
return "@CollectionLayout#sortedBy";
}
-//tag::collection[]
- @Collection
+//tag::comparator[]
+ public static class ValueComparator implements Comparator<CollectionLayoutSequenceChildVm> {
+ @Override
+ public int compare(CollectionLayoutSequenceChildVm o1, CollectionLayoutSequenceChildVm o2) {
+ return ObjectContracts.contract(CollectionLayoutSequenceChildVm.class) // <.>
+ .thenUse("value", CollectionLayoutSequenceChildVm::getValue) // <.>
+ .compare(o1, o2);
+ }
+ }
+//end::comparator[]
+
+
+//tag::children[]
+ @Collection()
@CollectionLayout(
- sortedBy = CollectionLayoutSortedByComparator.class)
- @XmlTransient
+ sortedBy = ValueComparator.class // <.>
+ )
+ @XmlElementWrapper(name = "children")
+ @XmlElement(name = "child")
@Getter @Setter
- private List<DemoEntity> collection = new ArrayList<>();
-//end::collection[]
+ private List<CollectionLayoutSortedByChildVm> children = new ArrayList<>();
+//end::children[]
}
//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage.layout.xml
index 9e55f97df5..e8b09508e4 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage.layout.xml
@@ -26,7 +26,16 @@
<bs3:row>
<bs3:col span="6">
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:collection id="children"/>
+ </bs3:col>
+ </bs3:row>
+ <bs3:row>
+ <bs3:col span="12">
<cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </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/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/child/CollectionLayoutSortedByChildVm-description.adoc
similarity index 85%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/child/CollectionLayoutSortedByChildVm-description.adoc
index d0a7f89de0..5126df0322 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/child/CollectionLayoutSortedByChildVm-description.adoc
@@ -1,6 +1,4 @@
: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 `describedAs` attribute ...
+This is a child object used in the demonstration of `CollectionLayout#sortedBy()`.
-WARNING: TODO[CAUSEWAY-3311]
-Description of this collection, eg to be rendered in a tooltip.
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/child/CollectionLayoutSortedByChildVm.java
similarity index 63%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage.java
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/child/CollectionLayoutSortedByChildVm.java
index 1c68188558..c416eea810 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/child/CollectionLayoutSortedByChildVm.java
@@ -16,51 +16,46 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.domain.collections.CollectionLayout.sortedBy;
-
-import java.util.ArrayList;
-import java.util.List;
+package demoapp.dom.domain.collections.CollectionLayout.sortedBy.child;
import javax.inject.Named;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
-import org.apache.causeway.applib.annotation.Collection;
-import org.apache.causeway.applib.annotation.CollectionLayout;
import org.apache.causeway.applib.annotation.DomainObject;
import org.apache.causeway.applib.annotation.Nature;
-import org.apache.causeway.applib.annotation.ObjectSupport;
+import org.apache.causeway.applib.annotation.Property;
+import org.apache.causeway.applib.annotation.Title;
import lombok.Getter;
+import lombok.NoArgsConstructor;
import lombok.Setter;
import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.domain._entities.DemoEntity;
//tag::class[]
-@DomainObject(
- nature=Nature.VIEW_MODEL)
-@Named("demo.CollectionLayoutSortedByVm")
-@XmlRootElement(name = "root")
+@Named("demo.CollectionLayoutSortedByChildVm")
+@XmlRootElement(name = "demo.CollectionLayoutSortedByChildVm")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
-public class CollectionLayoutSortedByPage implements HasAsciiDocDescription {
+@DomainObject(nature=Nature.VIEW_MODEL)
+@NoArgsConstructor
+public class CollectionLayoutSortedByChildVm implements HasAsciiDocDescription {
- @ObjectSupport public String title() {
- return "@CollectionLayout#sortedBy";
+//end::class[]
+ public CollectionLayoutSortedByChildVm(final String value) {
+ this.value = value;
}
-//tag::collection[]
- @Collection
- @CollectionLayout(
- sortedBy = CollectionLayoutSortedByComparator.class)
- @XmlTransient
+//tag::class[]
+ @Title
+ @Property()
+ @XmlElement(required = true)
@Getter @Setter
- private List<DemoEntity> collection = new ArrayList<>();
-//end::collection[]
+ private String value;
}
//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/child/CollectionLayoutSortedByChildVm.layout.xml
similarity index 82%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/child/CollectionLayoutSortedByChildVm.layout.xml
index 9e55f97df5..a5d295bce2 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/child/CollectionLayoutSortedByChildVm.layout.xml
@@ -26,7 +26,14 @@
<bs3:row>
<bs3:col span="6">
- <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:fieldSet name="Properties" id="properties">
+ <cpt:property id="value"/>
+ </cpt:fieldSet>
+ <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </bs3:col>
+ </bs3:row>
</bs3:col>
<bs3:col span="6">
<cpt:fieldSet name="Description" id="description" >
@@ -36,9 +43,9 @@
<cpt:action id="inspectMetamodel" position="PANEL_DROPDOWN"/>
<cpt:action id="downloadMetamodelXml" position="PANEL_DROPDOWN"/>
<cpt:action id="downloadJdoMetamodel" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentExecutions" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentAuditTrailEntries" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentExecutions" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentAuditTrailEntries" position="PANEL_DROPDOWN"/>
<cpt:action id="impersonateWithRoles" position="PANEL_DROPDOWN"/>
<cpt:action id="openRestApi" position="PANEL_DROPDOWN" />
<cpt:property id="description"/>
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage.java
index 6638e13205..ac75f60c6e 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage.java
@@ -24,6 +24,8 @@ import java.util.List;
import javax.inject.Named;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
@@ -35,6 +37,11 @@ import org.apache.causeway.applib.annotation.Nature;
import org.apache.causeway.applib.annotation.ObjectSupport;
import org.apache.causeway.applib.annotation.TableDecorator;
+import demoapp.dom.domain.collections.CollectionLayout.sortedBy.CollectionLayoutSortedByPage;
+import demoapp.dom.domain.collections.CollectionLayout.sortedBy.child.CollectionLayoutSortedByChildVm;
+
+import demoapp.dom.domain.collections.CollectionLayout.tableDecorator.child.CollectionLayoutTableDecoratorChildVm;
+
import lombok.Getter;
import lombok.Setter;
@@ -42,9 +49,8 @@ import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
import demoapp.dom.domain._entities.DemoEntity;
//tag::class[]
-@DomainObject(
- nature=Nature.VIEW_MODEL)
-@Named("demo.CollectionLayoutTableDecoratorVm")
+@Named("demo.CollectionLayoutTableDecoratorPage")
+@DomainObject(nature=Nature.VIEW_MODEL)
@XmlRootElement(name = "root")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
@@ -54,14 +60,16 @@ public class CollectionLayoutTableDecoratorPage implements HasAsciiDocDescriptio
return "@CollectionLayout#tableDecorator";
}
-//tag::collection[]
- @Collection
+//tag::children[]
+ @Collection()
@CollectionLayout(
- tableDecorator = TableDecorator.DatatablesNet.class)
- @XmlTransient
+ tableDecorator = TableDecorator.DatatablesNet.class // <.>
+ )
+ @XmlElementWrapper(name = "children")
+ @XmlElement(name = "child")
@Getter @Setter
- private List<DemoEntity> collection = new ArrayList<>();
-//end::collection[]
+ private List<CollectionLayoutTableDecoratorChildVm> children = new ArrayList<>();
+//end::children[]
}
//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage.layout.xml
index 9e55f97df5..e8b09508e4 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage.layout.xml
@@ -26,7 +26,16 @@
<bs3:row>
<bs3:col span="6">
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:collection id="children"/>
+ </bs3:col>
+ </bs3:row>
+ <bs3:row>
+ <bs3:col span="12">
<cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </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/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm-description.adoc
similarity index 85%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm-description.adoc
index d0a7f89de0..d522045d62 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/describedAs/CollectionLayoutDescribedAsPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm-description.adoc
@@ -1,6 +1,4 @@
: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 `describedAs` attribute ...
+This is a child object used in the demonstration of `CollectionLayout#tableDecorator()`.
-WARNING: TODO[CAUSEWAY-3311]
-Description of this collection, eg to be rendered in a tooltip.
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm.java
similarity index 61%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage.java
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm.java
index 3dac6bb3a9..d17da85418 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm.java
@@ -16,51 +16,46 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.domain.collections.CollectionLayout.paged;
-
-import java.util.ArrayList;
-import java.util.List;
+package demoapp.dom.domain.collections.CollectionLayout.tableDecorator.child;
import javax.inject.Named;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
-import org.apache.causeway.applib.annotation.Collection;
-import org.apache.causeway.applib.annotation.CollectionLayout;
import org.apache.causeway.applib.annotation.DomainObject;
import org.apache.causeway.applib.annotation.Nature;
-import org.apache.causeway.applib.annotation.ObjectSupport;
+import org.apache.causeway.applib.annotation.Property;
+import org.apache.causeway.applib.annotation.Title;
import lombok.Getter;
+import lombok.NoArgsConstructor;
import lombok.Setter;
import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.domain._entities.DemoEntity;
//tag::class[]
-@DomainObject(
- nature=Nature.VIEW_MODEL)
-@Named("demo.CollectionLayoutPagedVm")
-@XmlRootElement(name = "root")
+@Named("demo.CollectionLayoutTableDecoratorChildVm")
+@XmlRootElement(name = "demo.CollectionLayoutTableDecoratorChildVm")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
-public class CollectionLayoutPagedPage implements HasAsciiDocDescription {
+@DomainObject(nature=Nature.VIEW_MODEL)
+@NoArgsConstructor
+public class CollectionLayoutTableDecoratorChildVm implements HasAsciiDocDescription {
- @ObjectSupport public String title() {
- return "@CollectionLayout#paged";
+//end::class[]
+ public CollectionLayoutTableDecoratorChildVm(final String value) {
+ this.value = value;
}
-//tag::collection[]
- @Collection
- @CollectionLayout(
- paged = 2)
- @XmlTransient
+//tag::class[]
+ @Title
+ @Property()
+ @XmlElement(required = true)
@Getter @Setter
- private List<DemoEntity> collection = new ArrayList<>();
-//end::collection[]
+ private String value;
}
//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm.layout.xml
similarity index 82%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm.layout.xml
index 9e55f97df5..a5d295bce2 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm.layout.xml
@@ -26,7 +26,14 @@
<bs3:row>
<bs3:col span="6">
- <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:fieldSet name="Properties" id="properties">
+ <cpt:property id="value"/>
+ </cpt:fieldSet>
+ <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </bs3:col>
+ </bs3:row>
</bs3:col>
<bs3:col span="6">
<cpt:fieldSet name="Description" id="description" >
@@ -36,9 +43,9 @@
<cpt:action id="inspectMetamodel" position="PANEL_DROPDOWN"/>
<cpt:action id="downloadMetamodelXml" position="PANEL_DROPDOWN"/>
<cpt:action id="downloadJdoMetamodel" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentExecutions" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentAuditTrailEntries" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentExecutions" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentAuditTrailEntries" position="PANEL_DROPDOWN"/>
<cpt:action id="impersonateWithRoles" position="PANEL_DROPDOWN"/>
<cpt:action id="openRestApi" position="PANEL_DROPDOWN" />
<cpt:property id="description"/>
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/PropertyLayoutMenu.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/PropertyLayoutMenu.java
index 57260086b0..906f4ca881 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/PropertyLayoutMenu.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/PropertyLayoutMenu.java
@@ -67,7 +67,11 @@ public class PropertyLayoutMenu {
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa="fa-comment", describedAs = "Description of the property, shown as a tooltip")
public PropertyLayoutDescribedAsPage describedAs(){
- return new PropertyLayoutDescribedAsPage();
+ val page = new PropertyLayoutDescribedAsPage();
+ page.setName("Joey");
+ page.setNotes("Favorite Friend");
+ page.setAddress("Apartment over the coffee shop\nNew York\nNew York");
+ return page;
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/describedAs/PropertyLayoutDescribedAsPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/describedAs/PropertyLayoutDescribedAsPage-description.adoc
index 798c164e13..e349573811 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/describedAs/PropertyLayoutDescribedAsPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/describedAs/PropertyLayoutDescribedAsPage-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 [...]
+WARNING: currently no tooltip is displayed for descriptions defined by layout.xml file; see link:https://issues.apache.org/jira/browse/CAUSEWAY-3441[CAUSEWAY-3441].
+
Often the end-user of your application will be a frequent user and will know by sight the purpose of the various properties, collections and actions that are displayed.
-But, for less experienced users, or for new features, defining a `description` which provides brief additional information for the user may help.
+But, for less experienced users, or for new features, providing a description to provide brief additional information to the user may be of help.
* for properties, the description can be specified using either the link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/PropertyLayout.html#describedas[@PropertyLayout#describedAs] annotation, or a meta-annotation, or using the `Xxx.layout.xml` layout file.
@@ -15,12 +17,19 @@ NOTE: If the label is suppressed (using link:https://causeway.apache.org/refguid
== How this demo works
-This page object has three properties, each of which has a description.
-The first property also has a corresponding action to update it.
+This page object has three properties, `name`, `notes` and `address`.
+Each of these has a description.
+For `name` and `notes`, this description should be visible as a tooltip.
+The `name` property also has a corresponding action to update it, whose parameter _also_ has a description (shown as a tooltip).
+
+The `address` property is a counter-example though: even though it has a description, no tooltip is displayed.
+See below for details as to why this is the case.
+
+In terms of code:
-For the `name` property:
+* For the `name` property:
-* its description is specified using `@PropertyLayout#describedAs()`:
+** its description is specified using `@PropertyLayout#describedAs()`:
+
[source,java,indent=0]
----
@@ -37,25 +46,22 @@ include::PropertyLayoutDescribedAsPage_updateName.java[tags=annotation]
----
<.> explicitly specifies the description of the parameter
-For the `notes property, its description is specified using the `.layout.xml` file:
-
+* For the `notes` property, its description is specified using the `.layout.xml` file:
++
[source,xml,indent=0,tabsize=4]
----
<cpt:property id="notes">
<cpt:describedAs>Notes about this object</cpt:describedAs>
</cpt:property>
----
-// for some reason this doesn't include correctly in the app...
-//include::PropertyLayoutDescribedAsPage.layout.xml[tags=layout-file]
-
-WARNING: currently no tooltip is displayed; see link:https://issues.apache.org/jira/browse/CAUSEWAY-3441[CAUSEWAY-3441].
-
-For the `address` property, even though it has a description, it will not be rendered because it _also_ has a `labelPosition` which results in the label being suppressed:
++
+WARNING: currently no tooltip is displayed for descriptions defined by layout.xml file; see link:https://issues.apache.org/jira/browse/CAUSEWAY-3441[CAUSEWAY-3441].
+* The `address` property is a counter-example: even though it has a description, it will not be rendered because it _also_ has a `labelPosition` which results in the label being suppressed:
++
[source,java,indent=0,tabsize=4]
----
include::PropertyLayoutDescribedAsPage.java[tags=label-position]
----
<.> A labelPosition of `NONE` suppresses the label and therefore also the description tooltip.
-
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/hidden/PropertyLayoutHiddenPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/hidden/PropertyLayoutHiddenPage-description.adoc
index 329705115e..6d25fe228b 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/hidden/PropertyLayoutHiddenPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/hidden/PropertyLayoutHiddenPage-description.adoc
@@ -44,7 +44,7 @@ include::PropertyLayoutHidden.java[tags=everywhere]
----
<.> property should never be visible for this entity
-If you navigate into these domain objects then different properties will be visble due to the changed context.
+If you navigate into these domain objects then different properties will be visible due to the changed context.
[TIP]
.What is the difference between a hidden property and one annotated with `@Programmatic` ?
[causeway] 02/08: CAUSEWAY-2485: fleshes out @CollectionLayout#defaultView
Posted by da...@apache.org.
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 e3ac5361a99186701b903ce14528dbf7a5c8d159
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Apr 30 11:07:16 2023 +0100
CAUSEWAY-2485: fleshes out @CollectionLayout#defaultView
---
.../CollectionLayout/CollectionLayoutMenu.java | 13 ++++-
.../CollectionLayoutCssClassPage-description.adoc | 4 +-
.../cssClass/CollectionLayoutCssClassPage.java | 8 +--
.../child/CollectionLayoutCssClassChildVm.java | 2 +-
...ollectionLayoutDefaultViewPage-description.adoc | 60 ++++++++++++++++++++--
.../CollectionLayoutDefaultViewPage.java | 46 +++++++++++++----
.../CollectionLayoutDefaultViewPage.layout.xml | 11 ++++
...ctionLayoutDefaultViewChildVm-description.adoc} | 7 +--
.../child/CollectionLayoutDefaultViewChildVm.java} | 10 ++--
.../CollectionLayoutDefaultViewChildVm.layout.xml} | 15 ++++--
10 files changed, 134 insertions(+), 42 deletions(-)
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java
index 8365219672..49ef4dd77b 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java
@@ -33,6 +33,7 @@ import demoapp.dom.domain.collections.Collection.typeOf.child.CollectionTypeOfCh
import demoapp.dom.domain.collections.CollectionLayout.cssClass.CollectionLayoutCssClassPage;
import demoapp.dom.domain.collections.CollectionLayout.cssClass.child.CollectionLayoutCssClassChildVm;
import demoapp.dom.domain.collections.CollectionLayout.defaultView.CollectionLayoutDefaultViewPage;
+import demoapp.dom.domain.collections.CollectionLayout.defaultView.child.CollectionLayoutDefaultViewChildVm;
import demoapp.dom.domain.collections.CollectionLayout.describedAs.CollectionLayoutDescribedAsPage;
import demoapp.dom.domain.collections.CollectionLayout.hidden.CollectionLayoutHiddenPage;
import demoapp.dom.domain.collections.CollectionLayout.named.CollectionLayoutNamedPage;
@@ -75,7 +76,17 @@ public class CollectionLayoutMenu {
@ActionLayout(cssClassFa="fa-atom",
describedAs = "View collection as a table, or collapsed, or some other representation if available")
public CollectionLayoutDefaultViewPage defaultView(){
- return new CollectionLayoutDefaultViewPage();
+ CollectionLayoutDefaultViewPage page = new CollectionLayoutDefaultViewPage();
+ samples.stream()
+ .map(CollectionLayoutDefaultViewChildVm::new)
+ .forEach(e -> page.getChildren().add(e));
+ samples.stream()
+ .map(CollectionLayoutDefaultViewChildVm::new)
+ .forEach(e -> page.getMoreChildren().add(e));
+ samples.stream()
+ .map(CollectionLayoutDefaultViewChildVm::new)
+ .forEach(e -> page.getYetMoreChildren().add(e));
+ return page;
}
@Action(semantics = SemanticsOf.SAFE)
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage-description.adoc
index bd77bd4dd9..c1a889cafe 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage-description.adoc
@@ -9,8 +9,8 @@ The `application.css` file is then be used to apply styling to that CSS class.
== How this demo works
-This page contains two properties.
-The `children` property uses `@CollectionLayout#cssClass` to specify a custom CSS class of "red", while the `childrenUsingLayout` collection specifies a custom CSS class using the `layout.xml` file.
+This page contains two collections.
+The `children` collection uses `@CollectionLayout#cssClass` to specify a custom CSS class of "red", while the `moreChildre` collection specifies a custom CSS class using the `layout.xml` file.
In terms of code:
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage.java
index 2bef2eeab8..734a5e63fd 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage.java
@@ -27,7 +27,6 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import org.apache.causeway.applib.annotation.Collection;
@@ -36,16 +35,11 @@ import org.apache.causeway.applib.annotation.DomainObject;
import org.apache.causeway.applib.annotation.Nature;
import org.apache.causeway.applib.annotation.ObjectSupport;
-import demoapp.dom.domain.collections.Collection.domainEvent.CollectionDomainEventPage;
-import demoapp.dom.domain.collections.Collection.domainEvent.child.CollectionDomainEventChildVm;
-
-import demoapp.dom.domain.collections.CollectionLayout.cssClass.child.CollectionLayoutCssClassChildVm;
-
import lombok.Getter;
import lombok.Setter;
import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.domain._entities.DemoEntity;
+import demoapp.dom.domain.collections.CollectionLayout.cssClass.child.CollectionLayoutCssClassChildVm;
//tag::class[]
@Named("demo.CollectionLayoutCssClassPage")
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/child/CollectionLayoutCssClassChildVm.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/child/CollectionLayoutCssClassChildVm.java
index 3be73c137d..d643d04a20 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/child/CollectionLayoutCssClassChildVm.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/child/CollectionLayoutCssClassChildVm.java
@@ -37,10 +37,10 @@ import lombok.Setter;
import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
//tag::class[]
+@Named("demo.CollectionLayoutCssClassChildVm")
@XmlRootElement(name = "demo.CollectionLayoutCssClassChildVm")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
-@Named("demo.CollectionLayoutCssClassChildVm")
@DomainObject(nature=Nature.VIEW_MODEL)
@NoArgsConstructor
public class CollectionLayoutCssClassChildVm implements HasAsciiDocDescription {
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage-description.adoc
index dcfac3a1b5..172d483a6e 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage-description.adoc
@@ -1,9 +1,59 @@
: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 `defaultView` attribute ...
-WARNING: TODO[CAUSEWAY-3311]
-Indicates which view is used by default to render the collection.
-This is a simple string; every available implementation is required to use a different string.
-The default is "table". Extensions provide also: "excel" (download as Excel spreadsheet), "calendar" and "map".
+The `defaultView` attribute is used to specify how each collection should be initially be presented.
+
+There are two built-in views:
+
+* "table", which shows all collection in a table view (an "expanded" view, if you like), and
+* "hidden", which shows only the name of the collection (in a "collapsed view)"
+
+One reason to hide collections is if they are seldom used.
+Another is to improve the load speed of the page by reducing the amount of data to be retrieved.
+
+Extensions can provide alternative views:
+
+* "excel" (download as Excel spreadsheet)
+* "calendar" (requires the implementation of an interface to indicate the date)
+//* "map".
+
+Every view is identified by a simple string, all of which must be unique.
+
+The `defaultView` attribute can be specified using either the link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/CollectionLayout.html#defaultView[@CollectionLayout#defaultView] annotation, or by using the link:https://causeway.apache.org/userguide/2.0.0-RC1/fun/ui.html#by-example[.layout.xml] layout file.
+
+If no `defaultView` is specified, then "table" is assumed.
+
+== How this demo works
+
+This page shows three collections, unimaginatively named `children`, `moreChildren` and `yetMoreChildren`.
+The first is shown using the normal "table" view, while the latter two use the "hidden" view; the last using the `.layout.xml` file to do so.
+
+In terms of code:
+
+* the `children` property is defined as:
++
+[source,java,indent=0]
+----
+include::CollectionLayoutDefaultViewPage.java[tags=children]
+----
+<.> explicitly specifies that the collection is shown expanded, as a table
+
+* the `moreChildren` property is defined as:
++
+[source,java,indent=0]
+----
+include::CollectionLayoutDefaultViewPage.java[tags=more-children]
+----
+<.> explicitly specifies that the collection is shown hidden/collapsed
+
+* the `yetMoreChildren` collection has no annotation but instead defines the `defaultView` attribute using `Xxx.layout.xml`:
++
+[source,xml,indent=0,tabsize=4]
+.CollectionLayoutDefaultViewPage.layout.xml
+----
+<cpt:collection id="yetMoreChildren" defaultView="hidden"/>
+----
+
+
+One advantage of the layout file over the annotation is that the layout file is dynamic: it can be modified and the changes reloaded in a running application.
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage.java
index 87f20f6b19..934b881fda 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage.java
@@ -24,8 +24,9 @@ import java.util.List;
import javax.inject.Named;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import org.apache.causeway.applib.annotation.Collection;
@@ -38,12 +39,11 @@ import lombok.Getter;
import lombok.Setter;
import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.domain._entities.DemoEntity;
+import demoapp.dom.domain.collections.CollectionLayout.defaultView.child.CollectionLayoutDefaultViewChildVm;
//tag::class[]
-@DomainObject(
- nature=Nature.VIEW_MODEL)
-@Named("demo.CollectionLayoutDefaultViewVm")
+@Named("demo.CollectionLayoutDefaultViewPage")
+@DomainObject(nature=Nature.VIEW_MODEL)
@XmlRootElement(name = "root")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
@@ -53,14 +53,38 @@ public class CollectionLayoutDefaultViewPage implements HasAsciiDocDescription {
return "@CollectionLayout#defaultView";
}
-//tag::collection[]
- @Collection
+//tag::children[]
+ @Collection()
@CollectionLayout(
- defaultView = "hidden")
- @XmlTransient
+ defaultView = "table", // <.>
+ paged = 5
+ )
+ @XmlElementWrapper(name = "children")
+ @XmlElement(name = "child")
@Getter @Setter
- private List<DemoEntity> collection = new ArrayList<>();
-//end::collection[]
+ private List<CollectionLayoutDefaultViewChildVm> children = new ArrayList<>();
+//end::children[]
+
+//tag::more-children[]
+ @Collection()
+ @CollectionLayout(
+ defaultView = "hidden", // <.>
+ paged = 5
+ )
+ @XmlElementWrapper(name = "moreChildren")
+ @XmlElement(name = "child")
+ @Getter @Setter
+ private List<CollectionLayoutDefaultViewChildVm> moreChildren = new ArrayList<>();
+//end::more-children[]
+
+//tag::yet-more-children[]
+ @Collection()
+ @CollectionLayout(paged = 5) // <.>
+ @XmlElementWrapper(name = "moreChildren")
+ @XmlElement(name = "child")
+ @Getter @Setter
+ private List<CollectionLayoutDefaultViewChildVm> yetMoreChildren = new ArrayList<>();
+//end::yet-more-children[]
}
//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage.layout.xml
index 9e55f97df5..0c4ae75069 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage.layout.xml
@@ -26,7 +26,18 @@
<bs3:row>
<bs3:col span="6">
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:collection id="children"/>
+ <cpt:collection id="moreChildren"/>
+ <cpt:collection id="yetMoreChildren" defaultView="hidden"/>
+ </bs3:col>
+ </bs3:row>
+ <bs3:row>
+ <bs3:col span="12">
<cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </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/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/child/CollectionLayoutDefaultViewChildVm-description.adoc
similarity index 69%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage-description.adoc
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/child/CollectionLayoutDefaultViewChildVm-description.adoc
index dcfac3a1b5..f6ae770285 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/child/CollectionLayoutDefaultViewChildVm-description.adoc
@@ -1,9 +1,4 @@
: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 `defaultView` attribute ...
-
-WARNING: TODO[CAUSEWAY-3311]
-Indicates which view is used by default to render the collection.
-This is a simple string; every available implementation is required to use a different string.
-The default is "table". Extensions provide also: "excel" (download as Excel spreadsheet), "calendar" and "map".
+This is a child object used in the demonstration of `CollectionLayout#defaultView()`.
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/child/CollectionLayoutCssClassChildVm.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/child/CollectionLayoutDefaultViewChildVm.java
similarity index 83%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/child/CollectionLayoutCssClassChildVm.java
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/child/CollectionLayoutDefaultViewChildVm.java
index 3be73c137d..b5fda85929 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/child/CollectionLayoutCssClassChildVm.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/child/CollectionLayoutDefaultViewChildVm.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.domain.collections.CollectionLayout.cssClass.child;
+package demoapp.dom.domain.collections.CollectionLayout.defaultView.child;
import javax.inject.Named;
import javax.xml.bind.annotation.XmlAccessType;
@@ -37,16 +37,16 @@ import lombok.Setter;
import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
//tag::class[]
-@XmlRootElement(name = "demo.CollectionLayoutCssClassChildVm")
+@Named("demo.CollectionLayoutDefaultViewChildVm")
+@XmlRootElement(name = "demo.CollectionLayoutDefaultViewChildVm")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
-@Named("demo.CollectionLayoutCssClassChildVm")
@DomainObject(nature=Nature.VIEW_MODEL)
@NoArgsConstructor
-public class CollectionLayoutCssClassChildVm implements HasAsciiDocDescription {
+public class CollectionLayoutDefaultViewChildVm implements HasAsciiDocDescription {
//end::class[]
- public CollectionLayoutCssClassChildVm(final String value) {
+ public CollectionLayoutDefaultViewChildVm(final String value) {
this.value = value;
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/child/CollectionLayoutDefaultViewChildVm.layout.xml
similarity index 82%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage.layout.xml
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/child/CollectionLayoutDefaultViewChildVm.layout.xml
index 9e55f97df5..a5d295bce2 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/child/CollectionLayoutDefaultViewChildVm.layout.xml
@@ -26,7 +26,14 @@
<bs3:row>
<bs3:col span="6">
- <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:fieldSet name="Properties" id="properties">
+ <cpt:property id="value"/>
+ </cpt:fieldSet>
+ <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </bs3:col>
+ </bs3:row>
</bs3:col>
<bs3:col span="6">
<cpt:fieldSet name="Description" id="description" >
@@ -36,9 +43,9 @@
<cpt:action id="inspectMetamodel" position="PANEL_DROPDOWN"/>
<cpt:action id="downloadMetamodelXml" position="PANEL_DROPDOWN"/>
<cpt:action id="downloadJdoMetamodel" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentExecutions" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentAuditTrailEntries" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentExecutions" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentAuditTrailEntries" position="PANEL_DROPDOWN"/>
<cpt:action id="impersonateWithRoles" position="PANEL_DROPDOWN"/>
<cpt:action id="openRestApi" position="PANEL_DROPDOWN" />
<cpt:property id="description"/>
[causeway] 01/08: CAUSEWAY-2485: fleshes out @CollectionLayout#cssClass
Posted by da...@apache.org.
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 6cf3bb26e3d5e9c02e9bb37d100c5a14482147f8
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Apr 30 10:19:59 2023 +0100
CAUSEWAY-2485: fleshes out @CollectionLayout#cssClass
---
.../ActionChoicesFromPage-description.adoc | 2 -
.../CollectionLayout/CollectionLayoutMenu.java | 22 ++++++++-
.../CollectionLayoutCssClassPage-description.adoc | 53 ++++++++++++++++++++--
.../cssClass/CollectionLayoutCssClassPage.java | 35 ++++++++++----
.../CollectionLayoutCssClassPage.layout.xml | 12 ++++-
...llectionLayoutCssClassChildVm-description.adoc} | 6 +--
.../CollectionLayoutCssClassChildVm.java} | 41 ++++++++---------
.../CollectionLayoutCssClassChildVm.layout.xml} | 15 ++++--
.../PropertyLayoutCssClassPage-description.adoc | 8 +---
.../cssClass/PropertyLayoutCssClassPage.layout.xml | 4 +-
.../src/main/resources/static/css/application.css | 17 +++++++
11 files changed, 156 insertions(+), 59 deletions(-)
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/choicesFrom/ActionChoicesFromPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/choicesFrom/ActionChoicesFromPage-description.adoc
index 71cd4d951b..3601fa5162 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/choicesFrom/ActionChoicesFromPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/Action/choicesFrom/ActionChoicesFromPage-description.adoc
@@ -1,7 +1,5 @@
: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 [...]
-CAUTION: this feature is currently broken in the demo (though it will work in most apps); see link:https://issues.apache.org/jira/browse/CAUSEWAY-3418[CAUSEWAY-3418].
-
Actions parameters can be either value types or reference types (typically entities), and can be either for single-valued (a scalar) or multi-valued (a list).
Scalar values can be entered directly, but other combinations require a supporting method or other mechanism to provide a list of candidates for the end-user to select:
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java
index 74700859d2..8365219672 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java
@@ -18,6 +18,7 @@
*/
package demoapp.dom.domain.collections.CollectionLayout;
+import javax.inject.Inject;
import javax.inject.Named;
import org.apache.causeway.applib.annotation.Action;
@@ -27,7 +28,10 @@ import org.apache.causeway.applib.annotation.NatureOfService;
import org.apache.causeway.applib.annotation.PriorityPrecedence;
import org.apache.causeway.applib.annotation.SemanticsOf;
+import demoapp.dom._infra.samples.NameSamples;
+import demoapp.dom.domain.collections.Collection.typeOf.child.CollectionTypeOfChildVm;
import demoapp.dom.domain.collections.CollectionLayout.cssClass.CollectionLayoutCssClassPage;
+import demoapp.dom.domain.collections.CollectionLayout.cssClass.child.CollectionLayoutCssClassChildVm;
import demoapp.dom.domain.collections.CollectionLayout.defaultView.CollectionLayoutDefaultViewPage;
import demoapp.dom.domain.collections.CollectionLayout.describedAs.CollectionLayoutDescribedAsPage;
import demoapp.dom.domain.collections.CollectionLayout.hidden.CollectionLayoutHiddenPage;
@@ -37,19 +41,34 @@ import demoapp.dom.domain.collections.CollectionLayout.sequence.CollectionLayout
import demoapp.dom.domain.collections.CollectionLayout.sortedBy.CollectionLayoutSortedByPage;
import demoapp.dom.domain.collections.CollectionLayout.tableDecorator.CollectionLayoutTableDecoratorPage;
+import lombok.RequiredArgsConstructor;
+import lombok.val;
+
@Named("demo.CollectionLayoutMenu")
@DomainService(
nature=NatureOfService.VIEW
)
@javax.annotation.Priority(PriorityPrecedence.EARLY)
+@RequiredArgsConstructor(onConstructor_ = {@Inject})
//@Log4j2
public class CollectionLayoutMenu {
+ final NameSamples samples;
+
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa="fa-pen-nib",
describedAs = "CSS class to wrap the UI component representing this collection")
public CollectionLayoutCssClassPage cssClass(){
- return new CollectionLayoutCssClassPage();
+ val page = new CollectionLayoutCssClassPage();
+ samples.stream()
+ .map(CollectionLayoutCssClassChildVm::new
+ )
+ .forEach(e -> page.getChildren().add(e));
+ samples.stream()
+ .map(CollectionLayoutCssClassChildVm::new)
+ .forEach(e -> page.getMoreChildren().add(e));
+
+ return page;
}
@Action(semantics = SemanticsOf.SAFE)
@@ -108,4 +127,5 @@ public class CollectionLayoutMenu {
return new CollectionLayoutTableDecoratorPage();
}
+
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage-description.adoc
index 5ce6020672..bd77bd4dd9 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage-description.adoc
@@ -1,8 +1,51 @@
: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 `cssClass` attribute indicates the CSS class
-that a collection should have,
-to allow more targeted styling in application.css.
+To highlight certain information on the page, it can sometimes be helpful to style individual collections.
+
+The `cssClass` attribute indicates the CSS class that a collection should have.
+This can be set using either the link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/CollectionLayout.html#cssclass[@CollectionLayout#cssClass] annotation, or by using the link:https://causeway.apache.org/userguide/2.0.0-RC1/fun/ui.html#by-example[.layout.xml] layout file.
+
+The `application.css` file is then be used to apply styling to that CSS class.
+
+== How this demo works
+
+This page contains two properties.
+The `children` property uses `@CollectionLayout#cssClass` to specify a custom CSS class of "red", while the `childrenUsingLayout` collection specifies a custom CSS class using the `layout.xml` file.
+
+In terms of code:
+
+* the `children` property is defined as:
++
+[source,java,indent=0]
+----
+include::CollectionLayoutCssClassPage.java[tags=children]
+----
+<.> explicitly specifies the CSS class to apply for the children `<div>`
+
+
+* the `moreChildren` collection defines a CSS class hint using the `Xxx.layout.xml` file:
++
+[source,xml,indent=0,tabsize=4]
+.CollectionLayoutCssClassPage.layout.xml
+----
+<cpt:collection id="moreChildren" cssClass="blue"/>
+----
+
+* the `application.css` contains these styles:
++
+[source,css]
+.application.css
+----
+.collections .red .card .card-header {
+ background-color: red;
+ color: white;
+}
+
+.collections .blue .card .card-header {
+ background-color: dodgerblue;
+ color: white;
+}
+----
+
+One advantage of the layout file over the annotation is that the layout file is dynamic: it can be modified and the changes reloaded in a running application.
-For the purpose of demonstration,
-the _Bootstrap_ predefined CSS class `bg-dark` is shown here.
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage.java
index b0c73e0684..2bef2eeab8 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage.java
@@ -24,6 +24,8 @@ import java.util.List;
import javax.inject.Named;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
@@ -34,6 +36,11 @@ import org.apache.causeway.applib.annotation.DomainObject;
import org.apache.causeway.applib.annotation.Nature;
import org.apache.causeway.applib.annotation.ObjectSupport;
+import demoapp.dom.domain.collections.Collection.domainEvent.CollectionDomainEventPage;
+import demoapp.dom.domain.collections.Collection.domainEvent.child.CollectionDomainEventChildVm;
+
+import demoapp.dom.domain.collections.CollectionLayout.cssClass.child.CollectionLayoutCssClassChildVm;
+
import lombok.Getter;
import lombok.Setter;
@@ -41,9 +48,8 @@ import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
import demoapp.dom.domain._entities.DemoEntity;
//tag::class[]
-@DomainObject(
- nature=Nature.VIEW_MODEL)
-@Named("demo.CollectionLayoutCssClassVm")
+@Named("demo.CollectionLayoutCssClassPage")
+@DomainObject(nature=Nature.VIEW_MODEL)
@XmlRootElement(name = "root")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
@@ -53,14 +59,23 @@ public class CollectionLayoutCssClassPage implements HasAsciiDocDescription {
return "@CollectionLayout#cssClass";
}
-//tag::collection[]
- @Collection
- @CollectionLayout(
- cssClass = "bg-dark")
- @XmlTransient
+//tag::children[]
+ @Collection()
+ @CollectionLayout(cssClass = "red") // <.>
+ @XmlElementWrapper(name = "children")
+ @XmlElement(name = "child")
+ @Getter @Setter
+ private List<CollectionLayoutCssClassChildVm> children = new ArrayList<>();
+//end::children[]
+
+//tag::more-children[]
+ @Collection()
+ @CollectionLayout() // <.>
+ @XmlElementWrapper(name = "moreChildren")
+ @XmlElement(name = "child")
@Getter @Setter
- private List<DemoEntity> collection = new ArrayList<>();
-//end::collection[]
+ private List<CollectionLayoutCssClassChildVm> moreChildren = new ArrayList<>();
+//end::more-children[]
}
//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage.layout.xml
index 9e55f97df5..dcbbdf1498 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage.layout.xml
@@ -26,7 +26,17 @@
<bs3:row>
<bs3:col span="6">
- <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:collection id="children"/>
+ <cpt:collection id="moreChildren" cssClass="blue"/>
+ </bs3:col>
+ </bs3:row>
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </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/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/child/CollectionLayoutCssClassChildVm-description.adoc
similarity index 76%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage-description.adoc
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/child/CollectionLayoutCssClassChildVm-description.adoc
index 5ce6020672..b647845933 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/child/CollectionLayoutCssClassChildVm-description.adoc
@@ -1,8 +1,4 @@
: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 `cssClass` attribute indicates the CSS class
-that a collection should have,
-to allow more targeted styling in application.css.
+This is a child object used in the demonstration of `CollectionLayout#cssClass()`.
-For the purpose of demonstration,
-the _Bootstrap_ predefined CSS class `bg-dark` is shown here.
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/child/CollectionLayoutCssClassChildVm.java
similarity index 64%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage.java
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/child/CollectionLayoutCssClassChildVm.java
index b0c73e0684..3be73c137d 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/child/CollectionLayoutCssClassChildVm.java
@@ -16,51 +16,46 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.domain.collections.CollectionLayout.cssClass;
-
-import java.util.ArrayList;
-import java.util.List;
+package demoapp.dom.domain.collections.CollectionLayout.cssClass.child;
import javax.inject.Named;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
-import org.apache.causeway.applib.annotation.Collection;
-import org.apache.causeway.applib.annotation.CollectionLayout;
import org.apache.causeway.applib.annotation.DomainObject;
import org.apache.causeway.applib.annotation.Nature;
-import org.apache.causeway.applib.annotation.ObjectSupport;
+import org.apache.causeway.applib.annotation.Property;
+import org.apache.causeway.applib.annotation.Title;
import lombok.Getter;
+import lombok.NoArgsConstructor;
import lombok.Setter;
import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.domain._entities.DemoEntity;
//tag::class[]
-@DomainObject(
- nature=Nature.VIEW_MODEL)
-@Named("demo.CollectionLayoutCssClassVm")
-@XmlRootElement(name = "root")
+@XmlRootElement(name = "demo.CollectionLayoutCssClassChildVm")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
-public class CollectionLayoutCssClassPage implements HasAsciiDocDescription {
+@Named("demo.CollectionLayoutCssClassChildVm")
+@DomainObject(nature=Nature.VIEW_MODEL)
+@NoArgsConstructor
+public class CollectionLayoutCssClassChildVm implements HasAsciiDocDescription {
- @ObjectSupport public String title() {
- return "@CollectionLayout#cssClass";
+//end::class[]
+ public CollectionLayoutCssClassChildVm(final String value) {
+ this.value = value;
}
-//tag::collection[]
- @Collection
- @CollectionLayout(
- cssClass = "bg-dark")
- @XmlTransient
+//tag::class[]
+ @Title
+ @Property()
+ @XmlElement(required = true)
@Getter @Setter
- private List<DemoEntity> collection = new ArrayList<>();
-//end::collection[]
+ private String value;
}
//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/child/CollectionLayoutCssClassChildVm.layout.xml
similarity index 82%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage.layout.xml
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/child/CollectionLayoutCssClassChildVm.layout.xml
index 9e55f97df5..a5d295bce2 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/CollectionLayoutCssClassPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/cssClass/child/CollectionLayoutCssClassChildVm.layout.xml
@@ -26,7 +26,14 @@
<bs3:row>
<bs3:col span="6">
- <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:fieldSet name="Properties" id="properties">
+ <cpt:property id="value"/>
+ </cpt:fieldSet>
+ <cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
+ </bs3:col>
+ </bs3:row>
</bs3:col>
<bs3:col span="6">
<cpt:fieldSet name="Description" id="description" >
@@ -36,9 +43,9 @@
<cpt:action id="inspectMetamodel" position="PANEL_DROPDOWN"/>
<cpt:action id="downloadMetamodelXml" position="PANEL_DROPDOWN"/>
<cpt:action id="downloadJdoMetamodel" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentExecutions" position="PANEL_DROPDOWN"/>
- <cpt:action id="recentAuditTrailEntries" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentCommands" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentExecutions" position="PANEL_DROPDOWN"/>
+ <cpt:action id="recentAuditTrailEntries" position="PANEL_DROPDOWN"/>
<cpt:action id="impersonateWithRoles" position="PANEL_DROPDOWN"/>
<cpt:action id="openRestApi" position="PANEL_DROPDOWN" />
<cpt:property id="description"/>
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/cssClass/PropertyLayoutCssClassPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/cssClass/PropertyLayoutCssClassPage-description.adoc
index b12f277a98..0f5ad164db 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/cssClass/PropertyLayoutCssClassPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/cssClass/PropertyLayoutCssClassPage-description.adoc
@@ -8,7 +8,7 @@ The `cssClass` attribute indicates that the `<div>` containing the property or p
* for parameters, the attribute can be specified using the link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/ParameterLayout.html#cssclass[@PropertyLayout#cssClass] annotation
-The `application.css` file can then be used to apply styling to that CSS class
+The `application.css` file is then be used to apply styling to that CSS class.
== How this demo works
@@ -40,7 +40,7 @@ include::PropertyLayoutCssClassPage_updateName.java[tags=annotation]
[source,xml,indent=0,tabsize=4]
.PropertyLayoutCssClassPage.layout.xml
----
-<cpt:property id="propertyUsingLayout" cssClass="red"/>
+<cpt:property id="notes" cssClass="blue"/>
----
* the `application.css` contains these styles:
@@ -71,7 +71,3 @@ include::PropertyLayoutCssClassPage_updateName.java[tags=annotation]
One advantage of the layout file over the annotation is that the layout file is dynamic: it can be modified and the changes reloaded in a running application.
-
-TIP: It is sometimes necessary to invoke the `Rebuild Metamodel` action to see this take effect.
-
-
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/cssClass/PropertyLayoutCssClassPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/cssClass/PropertyLayoutCssClassPage.layout.xml
index 64faac9ee9..7eba319438 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/cssClass/PropertyLayoutCssClassPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/cssClass/PropertyLayoutCssClassPage.layout.xml
@@ -30,9 +30,9 @@
<cpt:property id="name"/>
</cpt:fieldSet>
<cpt:fieldSet name="Layout File" id="layout-file">
-<!-- tag::layout-file[] -->
+<!--tag::layout-file[] -->
<cpt:property id="notes" cssClass="blue"/>
-<!-- end::layout-file[] -->
+<!--end::layout-file[] -->
</cpt:fieldSet>
<cpt:fieldSet name="Contributed" id="contributed"/>
<cpt:fieldSet name="Meta-annotated" id="meta-annotated"/>
diff --git a/examples/demo/domain/src/main/resources/static/css/application.css b/examples/demo/domain/src/main/resources/static/css/application.css
index bd64c5c956..ba441dea35 100644
--- a/examples/demo/domain/src/main/resources/static/css/application.css
+++ b/examples/demo/domain/src/main/resources/static/css/application.css
@@ -18,6 +18,23 @@
*
*/
+/*
+ * Demonstrates use of @CollectionLayout(cssClass='red')
+ */
+.collections .red .card .card-header {
+ background-color: red;
+ color: white;
+}
+
+/*
+ * Demonstrates use of @CollectionLayout(cssClass='blue')
+ */
+.collections .blue .card .card-header {
+ background-color: dodgerblue;
+ color: white;
+}
+
+
/*
* Demonstrates use of @PropertyLayout(cssClass='red')
*/
[causeway] 05/08: CAUSEWAY-2485: fleshes out @CollectionLayout#named and #paged
Posted by da...@apache.org.
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 f874de4719d0ef9fda210290d23d094835233b67
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Apr 30 16:42:46 2023 +0100
CAUSEWAY-2485: fleshes out @CollectionLayout#named and #paged
---
.../CollectionLayout/CollectionLayoutMenu.java | 3 ++
.../CollectionLayoutNamedPage-description.adoc | 4 +-
.../CollectionLayoutPagedPage-description.adoc | 50 +++++++++++++++++++---
.../paged/CollectionLayoutPagedPage.layout.xml | 2 +-
.../DomainObjectLayoutPagedPage-description.adoc | 3 +-
.../demo/domain/src/main/resources/application.yml | 2 +
6 files changed, 55 insertions(+), 9 deletions(-)
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java
index 4a17e59968..a2f04bd434 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java
@@ -140,6 +140,9 @@ public class CollectionLayoutMenu {
samples.stream()
.map(CollectionLayoutPagedChildVm::new)
.forEach(e -> page.getChildren().add(e));
+ samples.stream()
+ .map(CollectionLayoutPagedChildVm::new)
+ .forEach(e -> page.getMoreChildren().add(e));
return page;
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage-description.adoc
index c8b582ac6a..52676d1e14 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/named/CollectionLayoutNamedPage-description.adoc
@@ -13,7 +13,7 @@ This page object has two collections, and both has had their name explicitly spe
In terms of code:
-* the `children` property has its name specified using the `@CollectionLayout#named()` annotation:
+* the `children` collection has its name specified using the `@CollectionLayout#named()` annotation:
+
[source,java,indent=0]
----
@@ -21,7 +21,7 @@ include::CollectionLayoutNamedPage.java[tags=children]
----
<.> explicitly specifies the name of the collection
-* meanwhile, the `moreChildren` property has its name specified using the `Xxx.layout.xml` file:
+* meanwhile, the `moreChildren` collection has its name specified using the `Xxx.layout.xml` file:
+
[source,xml,indent=0,tabsize=4]
----
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage-description.adoc
index 531e92dc3c..3cb2e181cb 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage-description.adoc
@@ -1,9 +1,49 @@
: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 `paged` attribute ...
+If a collection contains many instances, then by default these are paged.
+The link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/DomainObjectLayout.html#paged[@DomainObjectLayout#paged] is used to specify how many instances of the domain object should be shown for parented collections (those belonging to an object).
+This can be overridden on a case-by-case basis using link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/CollectionLayout.html#paged[@CollectionLayout#paged].
-WARNING: TODO[CAUSEWAY-3311]
-The page size for instances of this class when rendered within a table.
-If annotated on a collection, then the page size refers to parented collections (eg Order#lineItems ).
-If annotated on a type, then the page size refers to standalone collections (eg as returned from a repository query).
+NOTE: the link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/DomainObjectLayout.html#paged[@DomainObjectLayout#paged] value is also used for standalone collections (those returned from an action invocation).
+
+== How this demo works
+
+This page object has two collections, with each having a custom value of `paged` of 5.
+Accordingly, only 5 objects are shown per page.
+
+The first uses the annotation, the second uses `.layout.xml`
+In terms of code:
+
+* the `children` collection is annotated:
++
+[source,java,indent=0]
+----
+include::CollectionLayoutPagedPage.java[tags=children]
+----
+<.> explicitly indicates only 5 instances per page
+
+* meanwhile, the `moreChildren` collection uses the `Xxx.layout.xml` file:
++
+[source,xml,indent=0,tabsize=4]
+----
+<cpt:collection id="moreChildren" paged="5"/>
+----
++
+One advantage of the layout file over the annotation is that the layout file is dynamic: it can be modified and the changes reloaded in a running application.
+
+
+
+== Related configuration property
+
+To set the global default for `paged` of parented collections, use this configuration property:
+
+[source,yaml]
+.application.yaml
+----
+causeway:
+ applib:
+ annotation:
+ collection-layout:
+ paged: 15
+----
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage.layout.xml
index d7450c3c78..913b2994ef 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage.layout.xml
@@ -29,7 +29,7 @@
<bs3:row>
<bs3:col span="12">
<cpt:collection id="children"/>
- <cpt:collection id="moreChildren"/>
+ <cpt:collection id="moreChildren" paged="5"/>
</bs3:col>
</bs3:row>
<bs3:row>
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 d2b3d48a7c..063c153d1a 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
@@ -1,6 +1,7 @@
: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 link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/DomainObjectLayout.html#paged[@DomainObjectLayout#paged] is used to specify how many instances of the domain object should be shown, per page, in both parented collections (those belonging to an object) and standalone collections (those returned from an action invocation).
+If a collection contains many instances, then by default these are paged.
+The link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/DomainObjectLayout.html#paged[@DomainObjectLayout#paged] is used to specify how many instances of the domain object should be shown for both parented collections (those belonging to an object) and standalone collections (those returned from an action invocation).
NOTE: for parented collections, the `paged` value can be overridden on a case-by-case basis using link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/CollectionLayout.html#paged[@CollectionLayout#paged].
diff --git a/examples/demo/domain/src/main/resources/application.yml b/examples/demo/domain/src/main/resources/application.yml
index 8878910ae7..e82e510d68 100644
--- a/examples/demo/domain/src/main/resources/application.yml
+++ b/examples/demo/domain/src/main/resources/application.yml
@@ -51,6 +51,8 @@ causeway:
label-position: left
parameter-layout:
label-position: left
+ collection-layout:
+ paged: 15
core:
meta-model:
[causeway] 08/08: CAUSEWAY-2485: updates @CollectionLayout#tableDecorator
Posted by da...@apache.org.
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 0a45d5550fc8f0977cb37ac37bc77ca02d771218
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Mon May 1 14:28:25 2023 +0100
CAUSEWAY-2485: updates @CollectionLayout#tableDecorator
---
.../CollectionLayout/CollectionLayoutMenu.java | 5 ++--
...ollectionLayoutDefaultViewPage-description.adoc | 7 +++++-
...ectionLayoutTableDecoratorPage-description.adoc | 8 -------
...ctionLayoutTableDecoratorPage-description.adoc} | 28 ++++++++++++----------
.../CollectionLayoutTableDecoratorPage.java | 10 ++------
.../CollectionLayoutTableDecoratorPage.layout.xml | 0
...ionLayoutTableDecoratorChildVm-description.adoc | 0
.../CollectionLayoutTableDecoratorChildVm.java | 2 +-
...ollectionLayoutTableDecoratorChildVm.layout.xml | 0
...ObjectLayoutTableDecoratorPage-description.adoc | 14 ++++++-----
.../demo/domain/src/main/resources/application.yml | 1 +
11 files changed, 35 insertions(+), 40 deletions(-)
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java
index a2f04bd434..b7ed76db9b 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java
@@ -45,9 +45,8 @@ import demoapp.dom.domain.collections.CollectionLayout.sequence.CollectionLayout
import demoapp.dom.domain.collections.CollectionLayout.sequence.child.CollectionLayoutSequenceChildVm;
import demoapp.dom.domain.collections.CollectionLayout.sortedBy.CollectionLayoutSortedByPage;
import demoapp.dom.domain.collections.CollectionLayout.sortedBy.child.CollectionLayoutSortedByChildVm;
-import demoapp.dom.domain.collections.CollectionLayout.tableDecorator.CollectionLayoutTableDecoratorPage;
-
-import demoapp.dom.domain.collections.CollectionLayout.tableDecorator.child.CollectionLayoutTableDecoratorChildVm;
+import demoapp.dom.domain.collections.CollectionLayout.tabledec.CollectionLayoutTableDecoratorPage;
+import demoapp.dom.domain.collections.CollectionLayout.tabledec.child.CollectionLayoutTableDecoratorChildVm;
import lombok.RequiredArgsConstructor;
import lombok.val;
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage-description.adoc
index 172d483a6e..b6fde9099d 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage-description.adoc
@@ -14,7 +14,12 @@ Another is to improve the load speed of the page by reducing the amount of data
Extensions can provide alternative views:
* "excel" (download as Excel spreadsheet)
-* "calendar" (requires the implementation of an interface to indicate the date)
++
+This demo app _does_ include this extension.
+* "calendar".
++
+This requires that the element type implements a certain interface to expose the appropriate date
+
//* "map".
Every view is identified by a simple string, all of which must be unique.
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage-description.adoc
deleted file mode 100644
index f3d1f0595e..0000000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage-description.adoc
+++ /dev/null
@@ -1,8 +0,0 @@
-: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 ...
-
-WARNING: TODO[CAUSEWAY-3311]
-Whether a parented collection when represented in a table form should additionally be "decorated" with client-side (javascript) enhancements, for example to enable paging and filtering.
-
-
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/collections/CollectionLayout/tabledec/CollectionLayoutTableDecoratorPage-description.adoc
similarity index 50%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage-description.adoc
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/CollectionLayoutTableDecoratorPage-description.adoc
index 93d266b4f9..c0d0df55d7 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/collections/CollectionLayout/tabledec/CollectionLayoutTableDecoratorPage-description.adoc
@@ -1,32 +1,32 @@
: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 link:https://causeway.apache.org/refguide/2.0.0-RC1/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).
+CAUTION: this annotation currently has no effect; tracked by XXX.
+However, `@DomainObjectLayout#tableDecorator` _does_ work correctly.
-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-RC1/applib/index/annotation/CollectionLayout.html#tabledecorator[@CollectionLayout#tableDecorator].
+The link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/CollectionLayout.html#tabledecorator[@CollectionLayout#tableDecorator] attribute can be used to specify a custom client side table renderer for a (parented) collection.
+
+TIP: The https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/DomainObjectLayout.html#tabledecorator[@DomainObjectLayout#tableDecorator] can be used to define a default for an object whenever it is shown in a collection, either parented or standalone.
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.
+If specified, the effect of `@CollectionLayout#paged` and `@DomainObjectLayout#paged` are 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.
+The collection on the left hand side shows a set of domain objects that have been annotated with a `tableDecorator` which enables client-side rendering using link:https://datatables.net/[datatables.net].
In terms of code:
[source,java,indent=0]
-.DomainObjectLayoutTableDecorator.java
+.CollectionLayoutTableDecoratorPage.java
----
-include::DomainObjectLayoutTableDecorator.java[tags=class]
+include::CollectionLayoutTableDecoratorPage.java[tags=children]
----
-<.> indicates that the "datatables" decoration is used.
+<.> indicates that the link:https://datatables.net[datatables.net] decoration is used.
== Related configuration property
-To set the global default for `tableDecorator`, use this configuration property:
+To set the global default for all collections, use this configuration property:
[source,yaml]
.application.yaml
@@ -34,7 +34,9 @@ To set the global default for `tableDecorator`, use this configuration property:
causeway:
applib:
annotation:
- domain-object-layout:
- table-decorator: org.apache.causeway.applib.annotation.TableDecorator.DatatablesNet
+ collection-layout:
+ table-decorator: ... #<.>
----
+<.> `org.apache.causeway.applib.annotation.TableDecorator.Default` | `org.apache.causeway.applib.annotation.TableDecorator.DatatablesNet`
+
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/CollectionLayoutTableDecoratorPage.java
similarity index 83%
rename from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage.java
rename to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/CollectionLayoutTableDecoratorPage.java
index ac75f60c6e..b0d82c1b0c 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/CollectionLayoutTableDecoratorPage.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.domain.collections.CollectionLayout.tableDecorator;
+package demoapp.dom.domain.collections.CollectionLayout.tabledec;
import java.util.ArrayList;
import java.util.List;
@@ -27,7 +27,6 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import org.apache.causeway.applib.annotation.Collection;
@@ -37,16 +36,11 @@ import org.apache.causeway.applib.annotation.Nature;
import org.apache.causeway.applib.annotation.ObjectSupport;
import org.apache.causeway.applib.annotation.TableDecorator;
-import demoapp.dom.domain.collections.CollectionLayout.sortedBy.CollectionLayoutSortedByPage;
-import demoapp.dom.domain.collections.CollectionLayout.sortedBy.child.CollectionLayoutSortedByChildVm;
-
-import demoapp.dom.domain.collections.CollectionLayout.tableDecorator.child.CollectionLayoutTableDecoratorChildVm;
-
import lombok.Getter;
import lombok.Setter;
import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-import demoapp.dom.domain._entities.DemoEntity;
+import demoapp.dom.domain.collections.CollectionLayout.tabledec.child.CollectionLayoutTableDecoratorChildVm;
//tag::class[]
@Named("demo.CollectionLayoutTableDecoratorPage")
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/CollectionLayoutTableDecoratorPage.layout.xml
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/CollectionLayoutTableDecoratorPage.layout.xml
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/child/CollectionLayoutTableDecoratorChildVm-description.adoc
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm-description.adoc
rename to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/child/CollectionLayoutTableDecoratorChildVm-description.adoc
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/child/CollectionLayoutTableDecoratorChildVm.java
similarity index 96%
rename from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm.java
rename to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/child/CollectionLayoutTableDecoratorChildVm.java
index d17da85418..29c0b4b5ab 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/child/CollectionLayoutTableDecoratorChildVm.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.domain.collections.CollectionLayout.tableDecorator.child;
+package demoapp.dom.domain.collections.CollectionLayout.tabledec.child;
import javax.inject.Named;
import javax.xml.bind.annotation.XmlAccessType;
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/child/CollectionLayoutTableDecoratorChildVm.layout.xml
similarity index 100%
rename from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm.layout.xml
rename to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/child/CollectionLayoutTableDecoratorChildVm.layout.xml
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 93d266b4f9..199483c93d 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,18 +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 link:https://causeway.apache.org/refguide/2.0.0-RC1/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).
+The link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/CollectionLayout.html#tabledecorator[@CollectionLayout#tableDecorator] attribute can be used to specify a custom client side table renderer, for when a collection of domain objects is shown in either a parented collection (belonging to an object) or a standalone collection (returned from an action).
+
+link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/DomainObjectLayout.html#tabledecorator[@DomainObjectLayout#tableDecorator]
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-RC1/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.
+If specified, the effect of `@DomainObjectLayout#paged` and `@CollectionLayout#paged` are 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 collection on the left hand side shows a set of domain objects that have been annotated with `tableDecorator` which enables client-side rendering using link:https://datatables.net/[datatables.net].
The associated action "actionReturningCollection" returns these same objects as a standalone collection.
-Here again the `tableDecorator` value _is_ honoured.
In terms of code:
@@ -21,7 +22,7 @@ In terms of code:
----
include::DomainObjectLayoutTableDecorator.java[tags=class]
----
-<.> indicates that the "datatables" decoration is used.
+<.> indicates that the link:https://datatables.net[datatables.net] decoration is used.
== Related configuration property
@@ -35,6 +36,7 @@ causeway:
applib:
annotation:
domain-object-layout:
- table-decorator: org.apache.causeway.applib.annotation.TableDecorator.DatatablesNet
+ table-decorator: ... #<.>
----
+<.> `org.apache.causeway.applib.annotation.TableDecorator.Default` | `org.apache.causeway.applib.annotation.TableDecorator.DatatablesNet`
diff --git a/examples/demo/domain/src/main/resources/application.yml b/examples/demo/domain/src/main/resources/application.yml
index e82e510d68..f4100519d7 100644
--- a/examples/demo/domain/src/main/resources/application.yml
+++ b/examples/demo/domain/src/main/resources/application.yml
@@ -53,6 +53,7 @@ causeway:
label-position: left
collection-layout:
paged: 15
+ table-decorator: org.apache.causeway.applib.annotation.TableDecorator.DatatablesNet
core:
meta-model:
[causeway] 07/08: CAUSEWAY-2485: fleshes out @CollectionLayout#sortedBy
Posted by da...@apache.org.
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 58f43aa156e436c77040388c7870a9d30f017db8
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Apr 30 19:06:57 2023 +0100
CAUSEWAY-2485: fleshes out @CollectionLayout#sortedBy
---
.../CollectionLayoutPagedPage-description.adoc | 8 +++--
.../CollectionLayoutSortedByPage-description.adoc | 39 ++++++++++++++++++----
.../sortedBy/CollectionLayoutSortedByPage.java | 16 +--------
.../CollectionLayoutSortedByPage.layout.xml | 6 ++--
...SortedByComparator.java => NameComparator.java} | 27 ++++++++-------
.../child/CollectionLayoutSortedByChildVm.java | 6 ++--
.../CollectionLayoutSortedByChildVm.layout.xml | 2 +-
7 files changed, 60 insertions(+), 44 deletions(-)
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage-description.adoc
index 3cb2e181cb..a922a4b21e 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/paged/CollectionLayoutPagedPage-description.adoc
@@ -2,9 +2,13 @@
If a collection contains many instances, then by default these are paged.
The link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/DomainObjectLayout.html#paged[@DomainObjectLayout#paged] is used to specify how many instances of the domain object should be shown for parented collections (those belonging to an object).
-This can be overridden on a case-by-case basis using link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/CollectionLayout.html#paged[@CollectionLayout#paged].
+(It is also used for standalone collections (those returned from an action invocation).
-NOTE: the link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/DomainObjectLayout.html#paged[@DomainObjectLayout#paged] value is also used for standalone collections (those returned from an action invocation).
+The deefault provided by `@DomainObject#paged` can be overridden on a case-by-case basis using link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/CollectionLayout.html#paged[@CollectionLayout#paged].
+
+IMPORTANT: the paging that occurs is at the application-layer, not the database layer.
+In other words, the framework resolves _all_ of the objects are meet the criteria, and then manages the paging.
+There could therefore be performance/memory issues if too many objects are returned by the Kquery.
== How this demo works
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage-description.adoc
index ca003f3fbb..5944a5feb1 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage-description.adoc
@@ -1,10 +1,37 @@
: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 `sortedBy` attribute ...
+When dealing with collections of entities, most commonly the entity type will implement `Comparable`, (ie to have a natural ordering), and the collection will be defined as a `java.util.SortedSet`.
+In such a set up, the collection will be render the objects in this order.
+
+If a collection is a standalone collection resulting from invoking an action, then the objects by default will be rendered in the order that the action populated the list.
+If the action is some sort of finder that ultimately invokes a repository query, then the order will be according to the JPA/JDO/SQL query.
+
+The purpose of the link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/DomainObjectLayout.html#sortedby[@DomainObjectLayout#sortedBy] `sortedBy` attribute is to override any existing sorting at the application/persistence layer and to instead sort the objects at the presentation layer.
+
+== How this demo works
+
+To the left is a collection of objects, where their displayed order is according to alphabetical `name` of these objects.
+This is accomplished using the `sortedBy` attribute, passing in a `NameComparator`.
+
+In terms of code:
+
+* the `children` collection is defined as:
++
+[source,java,indent=0]
+.CollectionLayoutSortedByPage.java
+----
+include::CollectionLayoutSortedByPage.java[tags=children]
+----
+<.> sort using the `NameComparator` class
+
+* while the `NameComparator` class is defined by:
++
+[source,java,indent=0]
+.NameComparator.java
+----
+include::NameComparator.java[tags=comparator]
+----
+<.> utility class provided by the framework (provides helpers for compareTo, equals, hashCode and toString)
+<.> compare by the `name` property of the child objects
-WARNING: TODO[CAUSEWAY-3311]
-Indicates that the elements in a ( java.util.SortedSet ) collection should be sorted according to a different order than the natural sort order, as defined by the specified java.util.Comparator .
-Whenever there is a collection of type java.util.SortedSet , the domain entity referenced is expected to implement Comparable , ie to have a natural ordering. In effect tis means that all domain entities should provide a natural ordering.
-However, in some circumstances the ordering of collection may be different to the entity’s natural ordering. For example, the entity may represent an interval of time sorted by its startDate ascending, but the collection may wish to sort by startDate .
-The purpose of this annotation is to provide a java.util.Comparator such that the collection may be sorted in an order more suitable to the context.
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage.java
index 3e27a8a73f..c2a442d2f7 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage.java
@@ -19,7 +19,6 @@
package demoapp.dom.domain.collections.CollectionLayout.sortedBy;
import java.util.ArrayList;
-import java.util.Comparator;
import java.util.List;
import javax.inject.Named;
@@ -35,9 +34,6 @@ import org.apache.causeway.applib.annotation.CollectionLayout;
import org.apache.causeway.applib.annotation.DomainObject;
import org.apache.causeway.applib.annotation.Nature;
import org.apache.causeway.applib.annotation.ObjectSupport;
-import org.apache.causeway.applib.util.ObjectContracts;
-
-import demoapp.dom.domain.collections.CollectionLayout.sequence.child.CollectionLayoutSequenceChildVm;
import demoapp.dom.domain.collections.CollectionLayout.sortedBy.child.CollectionLayoutSortedByChildVm;
@@ -58,22 +54,12 @@ public class CollectionLayoutSortedByPage implements HasAsciiDocDescription {
return "@CollectionLayout#sortedBy";
}
-//tag::comparator[]
- public static class ValueComparator implements Comparator<CollectionLayoutSequenceChildVm> {
- @Override
- public int compare(CollectionLayoutSequenceChildVm o1, CollectionLayoutSequenceChildVm o2) {
- return ObjectContracts.contract(CollectionLayoutSequenceChildVm.class) // <.>
- .thenUse("value", CollectionLayoutSequenceChildVm::getValue) // <.>
- .compare(o1, o2);
- }
- }
-//end::comparator[]
//tag::children[]
@Collection()
@CollectionLayout(
- sortedBy = ValueComparator.class // <.>
+ sortedBy = NameComparator.class // <.>
)
@XmlElementWrapper(name = "children")
@XmlElement(name = "child")
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage.layout.xml
index e8b09508e4..eeccc12157 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByPage.layout.xml
@@ -28,13 +28,13 @@
<bs3:col span="6">
<bs3:row>
<bs3:col span="12">
- <cpt:collection id="children"/>
+ <cpt:collection id="children" paged="5"/>
</bs3:col>
</bs3:row>
<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:col>
<bs3:col span="6">
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByComparator.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/NameComparator.java
similarity index 60%
rename from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByComparator.java
rename to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/NameComparator.java
index 153c6c8048..5409d9a8c3 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/CollectionLayoutSortedByComparator.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/NameComparator.java
@@ -18,23 +18,22 @@
*/
package demoapp.dom.domain.collections.CollectionLayout.sortedBy;
-import java.util.Comparator;
-import java.util.Objects;
-
-import lombok.val;
-
-import demoapp.dom.domain._entities.DemoEntity;
+import demoapp.dom.domain.collections.CollectionLayout.sortedBy.child.CollectionLayoutSortedByChildVm;
-public class CollectionLayoutSortedByComparator
-implements Comparator<DemoEntity> {
+import java.util.Comparator;
- //TODO[CAUSEWAY-3311] perhaps show that we support injection
+import org.apache.causeway.applib.util.ObjectContracts;
+//tag::comparator[]
+public class NameComparator implements Comparator<CollectionLayoutSortedByChildVm> {
@Override
- public int compare(final DemoEntity o1, final DemoEntity o2) {
- val prop1 = o1.getProperty();
- val prop2 = o2.getProperty();
- return Objects.compare(prop1, prop2, Comparator.nullsFirst(Comparator.naturalOrder()));
+ public int compare(
+ CollectionLayoutSortedByChildVm o1,
+ CollectionLayoutSortedByChildVm o2
+ ) {
+ return ObjectContracts.contract(CollectionLayoutSortedByChildVm.class) // <.>
+ .thenUse("name", CollectionLayoutSortedByChildVm::getName) // <.>
+ .compare(o1, o2);
}
-
}
+//end::comparator[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/child/CollectionLayoutSortedByChildVm.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/child/CollectionLayoutSortedByChildVm.java
index c416eea810..fd30effbd7 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/child/CollectionLayoutSortedByChildVm.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/child/CollectionLayoutSortedByChildVm.java
@@ -46,8 +46,8 @@ import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
public class CollectionLayoutSortedByChildVm implements HasAsciiDocDescription {
//end::class[]
- public CollectionLayoutSortedByChildVm(final String value) {
- this.value = value;
+ public CollectionLayoutSortedByChildVm(final String name) {
+ this.name = name;
}
//tag::class[]
@@ -55,7 +55,7 @@ public class CollectionLayoutSortedByChildVm implements HasAsciiDocDescription {
@Property()
@XmlElement(required = true)
@Getter @Setter
- private String value;
+ private String name;
}
//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/child/CollectionLayoutSortedByChildVm.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/child/CollectionLayoutSortedByChildVm.layout.xml
index a5d295bce2..392d8705e5 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/child/CollectionLayoutSortedByChildVm.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/sortedBy/child/CollectionLayoutSortedByChildVm.layout.xml
@@ -29,7 +29,7 @@
<bs3:row>
<bs3:col span="12">
<cpt:fieldSet name="Properties" id="properties">
- <cpt:property id="value"/>
+ <cpt:property id="name"/>
</cpt:fieldSet>
<cpt:fieldSet name="Other" id="other" unreferencedProperties="true"/>
</bs3:col>