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 5ae7e680094807ad199d723dd077c5460eccd54b
Author: danhaywood <[email protected]>
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>

Reply via email to