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 <[email protected]> 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` ?
