This is an automated email from the ASF dual-hosted git repository. danhaywood pushed a commit to branch CAUSEWAY-2485 in repository https://gitbox.apache.org/repos/asf/causeway.git
commit 0a45d5550fc8f0977cb37ac37bc77ca02d771218 Author: danhaywood <[email protected]> AuthorDate: Mon May 1 14:28:25 2023 +0100 CAUSEWAY-2485: updates @CollectionLayout#tableDecorator --- .../CollectionLayout/CollectionLayoutMenu.java | 5 ++-- ...ollectionLayoutDefaultViewPage-description.adoc | 7 +++++- ...ectionLayoutTableDecoratorPage-description.adoc | 8 ------- ...ctionLayoutTableDecoratorPage-description.adoc} | 28 ++++++++++++---------- .../CollectionLayoutTableDecoratorPage.java | 10 ++------ .../CollectionLayoutTableDecoratorPage.layout.xml | 0 ...ionLayoutTableDecoratorChildVm-description.adoc | 0 .../CollectionLayoutTableDecoratorChildVm.java | 2 +- ...ollectionLayoutTableDecoratorChildVm.layout.xml | 0 ...ObjectLayoutTableDecoratorPage-description.adoc | 14 ++++++----- .../demo/domain/src/main/resources/application.yml | 1 + 11 files changed, 35 insertions(+), 40 deletions(-) diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java index a2f04bd434..b7ed76db9b 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/CollectionLayoutMenu.java @@ -45,9 +45,8 @@ import demoapp.dom.domain.collections.CollectionLayout.sequence.CollectionLayout import demoapp.dom.domain.collections.CollectionLayout.sequence.child.CollectionLayoutSequenceChildVm; import demoapp.dom.domain.collections.CollectionLayout.sortedBy.CollectionLayoutSortedByPage; import demoapp.dom.domain.collections.CollectionLayout.sortedBy.child.CollectionLayoutSortedByChildVm; -import demoapp.dom.domain.collections.CollectionLayout.tableDecorator.CollectionLayoutTableDecoratorPage; - -import demoapp.dom.domain.collections.CollectionLayout.tableDecorator.child.CollectionLayoutTableDecoratorChildVm; +import demoapp.dom.domain.collections.CollectionLayout.tabledec.CollectionLayoutTableDecoratorPage; +import demoapp.dom.domain.collections.CollectionLayout.tabledec.child.CollectionLayoutTableDecoratorChildVm; import lombok.RequiredArgsConstructor; import lombok.val; diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage-description.adoc index 172d483a6e..b6fde9099d 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage-description.adoc +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/defaultView/CollectionLayoutDefaultViewPage-description.adoc @@ -14,7 +14,12 @@ Another is to improve the load speed of the page by reducing the amount of data Extensions can provide alternative views: * "excel" (download as Excel spreadsheet) -* "calendar" (requires the implementation of an interface to indicate the date) ++ +This demo app _does_ include this extension. +* "calendar". ++ +This requires that the element type implements a certain interface to expose the appropriate date + //* "map". Every view is identified by a simple string, all of which must be unique. diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage-description.adoc deleted file mode 100644 index f3d1f0595e..0000000000 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage-description.adoc +++ /dev/null @@ -1,8 +0,0 @@ -:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or ag [...] - -The `tableDecorator` attribute ... - -WARNING: TODO[CAUSEWAY-3311] -Whether a parented collection when represented in a table form should additionally be "decorated" with client-side (javascript) enhancements, for example to enable paging and filtering. - - diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/CollectionLayoutTableDecoratorPage-description.adoc similarity index 50% copy from examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage-description.adoc copy to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/CollectionLayoutTableDecoratorPage-description.adoc index 93d266b4f9..c0d0df55d7 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage-description.adoc +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/CollectionLayoutTableDecoratorPage-description.adoc @@ -1,32 +1,32 @@ :Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or ag [...] -The link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/DomainObjectLayout.html#tabledecorator[@DomainObjectLayout#tableDecorator] attribute allows to specify a custom client side table renderer to be specified for when a collection of domain objects are shown in either a parented collection (belonging to an object) or a standalone collection (returned from an action). +CAUTION: this annotation currently has no effect; tracked by XXX. +However, `@DomainObjectLayout#tableDecorator` _does_ work correctly. -NOTE: for parented collections, the `tableDecorator` value can be overridden on a case-by-case basis using link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/CollectionLayout.html#tabledecorator[@CollectionLayout#tableDecorator]. +The link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/CollectionLayout.html#tabledecorator[@CollectionLayout#tableDecorator] attribute can be used to specify a custom client side table renderer for a (parented) collection. + +TIP: The https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/DomainObjectLayout.html#tabledecorator[@DomainObjectLayout#tableDecorator] can be used to define a default for an object whenever it is shown in a collection, either parented or standalone. There is currently just one decorator available, for link:https://datatables.net/[datatables.net]. -If specified, the effect of `@DomainObjectLayout#paged` or `@CollectionLayout#paged` is ignored. +If specified, the effect of `@CollectionLayout#paged` and `@DomainObjectLayout#paged` are ignored. == How this demo works -The collection on the left hand side shows a set of domain objects that have been annotated with `tableDecorator` of "datatables". - -The associated action "actionReturningCollection" returns these same objects as a standalone collection. -Here again the `tableDecorator` value _is_ honoured. +The collection on the left hand side shows a set of domain objects that have been annotated with a `tableDecorator` which enables client-side rendering using link:https://datatables.net/[datatables.net]. In terms of code: [source,java,indent=0] -.DomainObjectLayoutTableDecorator.java +.CollectionLayoutTableDecoratorPage.java ---- -include::DomainObjectLayoutTableDecorator.java[tags=class] +include::CollectionLayoutTableDecoratorPage.java[tags=children] ---- -<.> indicates that the "datatables" decoration is used. +<.> indicates that the link:https://datatables.net[datatables.net] decoration is used. == Related configuration property -To set the global default for `tableDecorator`, use this configuration property: +To set the global default for all collections, use this configuration property: [source,yaml] .application.yaml @@ -34,7 +34,9 @@ To set the global default for `tableDecorator`, use this configuration property: causeway: applib: annotation: - domain-object-layout: - table-decorator: org.apache.causeway.applib.annotation.TableDecorator.DatatablesNet + collection-layout: + table-decorator: ... #<.> ---- +<.> `org.apache.causeway.applib.annotation.TableDecorator.Default` | `org.apache.causeway.applib.annotation.TableDecorator.DatatablesNet` + diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/CollectionLayoutTableDecoratorPage.java similarity index 83% rename from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage.java rename to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/CollectionLayoutTableDecoratorPage.java index ac75f60c6e..b0d82c1b0c 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/CollectionLayoutTableDecoratorPage.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package demoapp.dom.domain.collections.CollectionLayout.tableDecorator; +package demoapp.dom.domain.collections.CollectionLayout.tabledec; import java.util.ArrayList; import java.util.List; @@ -27,7 +27,6 @@ import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; import org.apache.causeway.applib.annotation.Collection; @@ -37,16 +36,11 @@ import org.apache.causeway.applib.annotation.Nature; import org.apache.causeway.applib.annotation.ObjectSupport; import org.apache.causeway.applib.annotation.TableDecorator; -import demoapp.dom.domain.collections.CollectionLayout.sortedBy.CollectionLayoutSortedByPage; -import demoapp.dom.domain.collections.CollectionLayout.sortedBy.child.CollectionLayoutSortedByChildVm; - -import demoapp.dom.domain.collections.CollectionLayout.tableDecorator.child.CollectionLayoutTableDecoratorChildVm; - import lombok.Getter; import lombok.Setter; import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription; -import demoapp.dom.domain._entities.DemoEntity; +import demoapp.dom.domain.collections.CollectionLayout.tabledec.child.CollectionLayoutTableDecoratorChildVm; //tag::class[] @Named("demo.CollectionLayoutTableDecoratorPage") diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/CollectionLayoutTableDecoratorPage.layout.xml similarity index 100% rename from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/CollectionLayoutTableDecoratorPage.layout.xml rename to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/CollectionLayoutTableDecoratorPage.layout.xml diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/child/CollectionLayoutTableDecoratorChildVm-description.adoc similarity index 100% rename from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm-description.adoc rename to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/child/CollectionLayoutTableDecoratorChildVm-description.adoc diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/child/CollectionLayoutTableDecoratorChildVm.java similarity index 96% rename from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm.java rename to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/child/CollectionLayoutTableDecoratorChildVm.java index d17da85418..29c0b4b5ab 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm.java +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/child/CollectionLayoutTableDecoratorChildVm.java @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -package demoapp.dom.domain.collections.CollectionLayout.tableDecorator.child; +package demoapp.dom.domain.collections.CollectionLayout.tabledec.child; import javax.inject.Named; import javax.xml.bind.annotation.XmlAccessType; diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/child/CollectionLayoutTableDecoratorChildVm.layout.xml similarity index 100% rename from examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tableDecorator/child/CollectionLayoutTableDecoratorChildVm.layout.xml rename to examples/demo/domain/src/main/java/demoapp/dom/domain/collections/CollectionLayout/tabledec/child/CollectionLayoutTableDecoratorChildVm.layout.xml diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage-description.adoc index 93d266b4f9..199483c93d 100644 --- a/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage-description.adoc +++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/objects/DomainObjectLayout/tabledec/DomainObjectLayoutTableDecoratorPage-description.adoc @@ -1,18 +1,19 @@ :Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or ag [...] -The link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/DomainObjectLayout.html#tabledecorator[@DomainObjectLayout#tableDecorator] attribute allows to specify a custom client side table renderer to be specified for when a collection of domain objects are shown in either a parented collection (belonging to an object) or a standalone collection (returned from an action). +The link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/CollectionLayout.html#tabledecorator[@CollectionLayout#tableDecorator] attribute can be used to specify a custom client side table renderer, for when a collection of domain objects is shown in either a parented collection (belonging to an object) or a standalone collection (returned from an action). + +link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/DomainObjectLayout.html#tabledecorator[@DomainObjectLayout#tableDecorator] NOTE: for parented collections, the `tableDecorator` value can be overridden on a case-by-case basis using link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/CollectionLayout.html#tabledecorator[@CollectionLayout#tableDecorator]. There is currently just one decorator available, for link:https://datatables.net/[datatables.net]. -If specified, the effect of `@DomainObjectLayout#paged` or `@CollectionLayout#paged` is ignored. +If specified, the effect of `@DomainObjectLayout#paged` and `@CollectionLayout#paged` are ignored. == How this demo works -The collection on the left hand side shows a set of domain objects that have been annotated with `tableDecorator` of "datatables". +The collection on the left hand side shows a set of domain objects that have been annotated with `tableDecorator` which enables client-side rendering using link:https://datatables.net/[datatables.net]. The associated action "actionReturningCollection" returns these same objects as a standalone collection. -Here again the `tableDecorator` value _is_ honoured. In terms of code: @@ -21,7 +22,7 @@ In terms of code: ---- include::DomainObjectLayoutTableDecorator.java[tags=class] ---- -<.> indicates that the "datatables" decoration is used. +<.> indicates that the link:https://datatables.net[datatables.net] decoration is used. == Related configuration property @@ -35,6 +36,7 @@ causeway: applib: annotation: domain-object-layout: - table-decorator: org.apache.causeway.applib.annotation.TableDecorator.DatatablesNet + table-decorator: ... #<.> ---- +<.> `org.apache.causeway.applib.annotation.TableDecorator.Default` | `org.apache.causeway.applib.annotation.TableDecorator.DatatablesNet` diff --git a/examples/demo/domain/src/main/resources/application.yml b/examples/demo/domain/src/main/resources/application.yml index e82e510d68..f4100519d7 100644 --- a/examples/demo/domain/src/main/resources/application.yml +++ b/examples/demo/domain/src/main/resources/application.yml @@ -53,6 +53,7 @@ causeway: label-position: left collection-layout: paged: 15 + table-decorator: org.apache.causeway.applib.annotation.TableDecorator.DatatablesNet core: meta-model:
