You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by da...@apache.org on 2023/04/23 13:13:29 UTC
[causeway] 01/02: CAUSEWAY-2485: minor tidyup of @Property#navigable
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 30cf7158029337993190704a1661255958a99010
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Apr 23 13:46:44 2023 +0100
CAUSEWAY-2485: minor tidyup of @Property#navigable
---
.../PropertyLayout/named/NamedMetaAnnotation.java | 43 --------------
.../named/PropertyLayoutNamedPage-description.adoc | 68 +++-------------------
.../named/PropertyLayoutNamedPage.java | 39 ++-----------
.../named/PropertyLayoutNamedPage.layout.xml | 4 +-
.../PropertyLayoutNamedPage_mixinProperty.java | 47 ---------------
...tNamedPage_mixinPropertyWithMetaAnnotation.java | 47 ---------------
..._mixinPropertyWithMetaAnnotationOverridden.java | 48 ---------------
...tyLayoutNamedPage_updateWithMetaAnnotation.java | 58 ------------------
...medPage_updateWithMetaAnnotationOverridden.java | 60 -------------------
...yLayoutNamedPage_updateWithParameterLayout.java | 2 -
.../navigable/FileNodeVm-description.adoc | 39 ++++++++-----
.../PropertyLayout/navigable/FileNodeVm.java | 19 ++----
...odeVm_returnsTree.java => FileNodeVm_tree.java} | 16 ++---
13 files changed, 49 insertions(+), 441 deletions(-)
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/NamedMetaAnnotation.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/NamedMetaAnnotation.java
deleted file mode 100644
index a23e83b63f..0000000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/NamedMetaAnnotation.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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 agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package demoapp.dom.domain.properties.PropertyLayout.named;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-import org.apache.causeway.applib.annotation.ParameterLayout;
-import org.apache.causeway.applib.annotation.PropertyLayout;
-
-//tag::class[]
-@PropertyLayout(named = "Named from meta-annotation") // <.>
-@ParameterLayout(named = "Named from meta-annotation") // <.>
-@Inherited
-@Target({
- ElementType.METHOD, ElementType.FIELD, // <.>
- ElementType.PARAMETER, // <.>
- ElementType.TYPE // <.>
-})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface NamedMetaAnnotation {
-
-}
-//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage-description.adoc
index 072332f898..63fe04444a 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage-description.adoc
@@ -4,17 +4,16 @@ The name of a property or parameter is used as the label of the field in the UI.
Normally the name is inferred from the name of the corresponding field or parameter in code.
This inferred name can be however be overridden using various mechanisms with an explicit value:
-* for properties, the name can be specified using either the `@PropertyLayout` annotation, or a meta-annotation, or using the `Xxx.layout.xml` layout file.
+* for properties, the name can be specified using the link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/PropertyLayout.html#named[@PropertyLayout#named] attribute, or using the link:https://causeway.apache.org/userguide/2.0.0-RC1/fun/ui.html#by-example[.layout.xml] layout file.
-* for parameters, the name can be specified using either the `@ParameterLayout` annotation, or a meta-annotation.
+* for parameters, the attribute can be specified using the link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/PropertyLayout.html#named[@ParameterLayout#named] annotation.
This is useful for example if the desired name is a Java keyword (such as "default", or "package").
-Names can also include HTML markup.
-This can optionally be escaped.
+== How this demo works
-== Annotated
+=== Annotated
The name can be specified explicitly using an annotation:
@@ -34,9 +33,11 @@ include::PropertyLayoutNamedPage_updateWithParameterLayout.java[tags=annotation]
----
<.> explicitly specifies the name of the parameter
-== Layout File
+=== Layout File
-For properties (not parameters), the name can be specified using the `Xxx.layout.xml` file:
+The name can be specified using the `Xxx.layout.xml` file:
+
+WARNING: currently this does not work; link:https://issues.apache.org/jira/browse/CAUSEWAY-3443[CAUSEWAY-3443].
* property definition:
+
@@ -59,57 +60,4 @@ include::PropertyLayoutNamedPage.java[tags=layout-file]
One advantage of the layout file over the annotation is that the layout file is dynamic: it can be modified and the changes reloaded in a running application.
-TIP: It is sometimes necessary to invoke the `Rebuild Metamodel` action to see this take effect.
-
-== Meta-annotated
-
-The name can also be specified using a custom meta-annotation:
-
-* the meta-annotation is defined as:
-+
-[source,java]
-----
-include::NamedMetaAnnotation.java[tags=class]
-----
-<.> annotated for a property ...
-<.> \... and for a parameter.
-<.> annotation can be applied to a property (either its getter or if using link:https://projectlombok.org/[Lombok] the field directly)
-<.> annotation can be applied to a parameter
-<.> annotation can be applied to a type (ie, meta-meta annotations recursively)
-
-* and can be applied to a property:
-+
-[source,java,indent=0]
-----
-include::PropertyLayoutNamedPage.java[tags=meta-annotated]
-----
-<.> property's name is inherited from the meta-annotation
-
-* or can be applied to a parameter:
-+
-[source,java,indent=0]
-----
-include::PropertyLayoutNamedPAge_updateWithMetaAnnotation.java[tags=meta-annotation]
-----
-<.> parameter's name is inherited from the meta-annotation
-
-The meta-annotation can itself be overridden:
-
-* in a property:
-+
-[source,java,indent=0]
-----
-include::PropertyLayoutNamedPage.java[tags=meta-annotated-overridden]
-----
-<.> name from meta-annotation ...
-<.> \... is overridden by the `@PropertyLayout` annotation
-
-* or a parameter:
-+
-[source,java,indent=0]
-----
-include::PropertyLayoutNamedPage_updateWithMetaAnnotationOverridden.java[tags=meta-annotation-overridden]
-----
-<.> name from meta-annotation ...
-<.> \... is overridden by the `@PropertyLayout` annotation
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage.java
index dd29e751fd..30e120c134 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage.java
@@ -42,7 +42,7 @@ import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
@XmlRootElement(name = "root")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
-@Named("demo.PropertyLayoutNamedVm")
+@Named("demo.PropertyLayoutNamedPage")
@DomainObject(
nature=Nature.VIEW_MODEL,
editing = Editing.ENABLED)
@@ -55,10 +55,8 @@ public class PropertyLayoutNamedPage implements HasAsciiDocDescription {
//tag::annotation[]
@Property(optionality = Optionality.OPTIONAL)
@PropertyLayout(
- named = "Named using @PropertyLayout" // <.>
- , describedAs =
- "@PropertyLayout(named= \"...\")",
- fieldSetId = "annotation", sequence = "1")
+ named = "Named using @PropertyLayout"
+ )
@XmlElement(required = false)
@Getter @Setter
private String propertyUsingAnnotation;
@@ -66,41 +64,12 @@ public class PropertyLayoutNamedPage implements HasAsciiDocDescription {
//tag::layout-file[]
@Property(optionality = Optionality.OPTIONAL)
- @PropertyLayout( // <.>
- describedAs =
- "<cpt:property id=\"...\">" +
- "<cpt:named>...</cpt:named>" +
- "</cpt:property>",
- fieldSetId = "layout-file", sequence = "1")
+ @PropertyLayout() // <.>
@XmlElement(required = false)
@Getter @Setter
private String propertyUsingLayout;
//end::layout-file[]
-//tag::meta-annotated[]
- @Property(optionality = Optionality.OPTIONAL)
- @NamedMetaAnnotation // <.>
- @PropertyLayout(
- describedAs = "@NamedMetaAnnotation",
- fieldSetId = "meta-annotated", sequence = "1")
- @XmlElement(required = false)
- @Getter @Setter
- private String propertyUsingMetaAnnotation;
-//end::meta-annotated[]
-
-//tag::meta-annotated-overridden[]
- @NamedMetaAnnotation // <.>
- @Property(optionality = Optionality.OPTIONAL)
- @PropertyLayout(
- named = "@PropertyLayout name " +
- "overrides meta-annotation" // <.>
- , describedAs =
- "@NamedMetaAnnotation @PropertyLayout(...)",
- fieldSetId = "meta-annotated-overridden", sequence = "1")
- @XmlElement(required = false)
- @Getter @Setter
- private String propertyUsingMetaAnnotationButOverridden;
-//end::meta-annotated-overridden[]
}
//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage.layout.xml
index 69b8589a34..d186b5b76b 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage.layout.xml
@@ -26,7 +26,9 @@
<bs3:row>
<bs3:col span="6">
- <cpt:fieldSet name="Annotated" id="annotation"/>
+ <cpt:fieldSet name="Annotated" id="annotation">
+ <cpt:property id="propertyUsingAnnotation"/>
+ </cpt:fieldSet>
<cpt:fieldSet name="Layout File" id="layout-file">
<!-- tag::layout-file[] -->
<cpt:property id="propertyUsingLayout">
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage_mixinProperty.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage_mixinProperty.java
deleted file mode 100644
index b0da9f6626..0000000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage_mixinProperty.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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 agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package demoapp.dom.domain.properties.PropertyLayout.named;
-
-import org.apache.causeway.applib.annotation.Property;
-import org.apache.causeway.applib.annotation.PropertyLayout;
-
-import lombok.RequiredArgsConstructor;
-
-//tag::class[]
-@Property()
-@PropertyLayout(
- named = "Mixin named using @PropertyLayout" // <.>
- , describedAs =
- "@PropertyLayout(named = \"...\")",
- fieldSetId = "contributed", sequence = "1"
-)
-@RequiredArgsConstructor
-public class PropertyLayoutNamedPage_mixinProperty {
- // ...
-//end::class[]
-
- private final PropertyLayoutNamedPage page;
-
- public String prop() {
- return page.getPropertyUsingAnnotation();
- }
-
-//tag::class[]
-}
-//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage_mixinPropertyWithMetaAnnotation.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage_mixinPropertyWithMetaAnnotation.java
deleted file mode 100644
index 77aa671509..0000000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage_mixinPropertyWithMetaAnnotation.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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 agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package demoapp.dom.domain.properties.PropertyLayout.named;
-
-import org.apache.causeway.applib.annotation.Property;
-import org.apache.causeway.applib.annotation.PropertyLayout;
-
-import lombok.RequiredArgsConstructor;
-
-//tag::class[]
-@Property()
-@NamedMetaAnnotation // <.>
-@PropertyLayout(
- describedAs =
- "@NamedMetaAnnotation",
- fieldSetId = "meta-annotated", sequence = "2"
-)
-@RequiredArgsConstructor
-public class PropertyLayoutNamedPage_mixinPropertyWithMetaAnnotation {
- // ...
-//end::class[]
-
- private final PropertyLayoutNamedPage page;
-
- public String prop() {
- return page.getPropertyUsingAnnotation();
- }
-
-//tag::class[]
-}
-//end::class[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage_mixinPropertyWithMetaAnnotationOverridden.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage_mixinPropertyWithMetaAnnotationOverridden.java
deleted file mode 100644
index 8e4907acd9..0000000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage_mixinPropertyWithMetaAnnotationOverridden.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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 agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package demoapp.dom.domain.properties.PropertyLayout.named;
-
-import org.apache.causeway.applib.annotation.Property;
-import org.apache.causeway.applib.annotation.PropertyLayout;
-
-import lombok.RequiredArgsConstructor;
-
-//tag::meta-annotation-overridden[]
-@NamedMetaAnnotation // <.>
-@Property()
-@PropertyLayout(
- named = "@PropertyLayout overrides meta-annotation for mixin" // <.>
- , describedAs =
- "@NamedMetaAnnotation @PropertyLayout(...)",
- fieldSetId = "meta-annotated-overridden", sequence = "2"
-)
-@RequiredArgsConstructor
-public class PropertyLayoutNamedPage_mixinPropertyWithMetaAnnotationOverridden {
- // ...
-//end::meta-annotation-overridden[]
-
- private final PropertyLayoutNamedPage page;
-
- public String prop() {
- return page.getPropertyUsingAnnotation();
- }
-
-//tag::meta-annotation-overridden[]
-}
-//end::meta-annotation-overridden[]
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage_updateWithMetaAnnotation.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage_updateWithMetaAnnotation.java
deleted file mode 100644
index 05b7137348..0000000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage_updateWithMetaAnnotation.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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 agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package demoapp.dom.domain.properties.PropertyLayout.named;
-
-import org.apache.causeway.applib.annotation.Action;
-import org.apache.causeway.applib.annotation.ActionLayout;
-import org.apache.causeway.applib.annotation.MemberSupport;
-import org.apache.causeway.applib.annotation.Optionality;
-import org.apache.causeway.applib.annotation.Parameter;
-import org.apache.causeway.applib.annotation.ParameterLayout;
-import org.apache.causeway.applib.annotation.SemanticsOf;
-
-import lombok.RequiredArgsConstructor;
-
-@Action(
- semantics = SemanticsOf.IDEMPOTENT
-)
-@ActionLayout(
- associateWith = "propertyUsingMetaAnnotation"
- , sequence = "1")
-@RequiredArgsConstructor
-public class PropertyLayoutNamedPage_updateWithMetaAnnotation {
-
- private final PropertyLayoutNamedPage page;
-
-//tag::meta-annotation[]
- @MemberSupport public PropertyLayoutNamedPage act(
- @Parameter(optionality = Optionality.OPTIONAL)
- @NamedMetaAnnotation // <.>
- @ParameterLayout(
- describedAs = "@NamedMetaAnnotation"
- )
- final String parameterUsingMetaAnnotation) {
- page.setPropertyUsingMetaAnnotation(parameterUsingMetaAnnotation);
- return page;
- }
-//end::meta-annotation[]
- @MemberSupport public String default0Act() {
- return page.getPropertyUsingMetaAnnotation();
- }
-
-}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage_updateWithMetaAnnotationOverridden.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage_updateWithMetaAnnotationOverridden.java
deleted file mode 100644
index 2bdd920f56..0000000000
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage_updateWithMetaAnnotationOverridden.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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 agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package demoapp.dom.domain.properties.PropertyLayout.named;
-
-import org.apache.causeway.applib.annotation.Action;
-import org.apache.causeway.applib.annotation.ActionLayout;
-import org.apache.causeway.applib.annotation.MemberSupport;
-import org.apache.causeway.applib.annotation.Optionality;
-import org.apache.causeway.applib.annotation.Parameter;
-import org.apache.causeway.applib.annotation.ParameterLayout;
-import org.apache.causeway.applib.annotation.SemanticsOf;
-
-import lombok.RequiredArgsConstructor;
-
-@Action(
- semantics = SemanticsOf.IDEMPOTENT
-)
-@ActionLayout(
- associateWith = "propertyUsingMetaAnnotationButOverridden"
- , sequence = "1")
-@RequiredArgsConstructor
-public class PropertyLayoutNamedPage_updateWithMetaAnnotationOverridden {
-
- private final PropertyLayoutNamedPage page;
-
-//tag::meta-annotation-overridden[]
- @MemberSupport public PropertyLayoutNamedPage act(
- @NamedMetaAnnotation // <.>
- @Parameter(optionality = Optionality.OPTIONAL)
- @ParameterLayout(
- named = "@ParameterLayout overrides meta-annotation" // <.>
- , describedAs =
- "@NamedMetaAnnotation @ParameterLayout(...)"
- )
- final String parameterUsingMetaAnnotationButOverridden) {
- page.setPropertyUsingMetaAnnotationButOverridden(parameterUsingMetaAnnotationButOverridden);
- return page;
- }
-//end::meta-annotation-overridden[]
- @MemberSupport public String default0Act() {
- return page.getPropertyUsingMetaAnnotationButOverridden();
- }
-
-}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage_updateWithParameterLayout.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage_updateWithParameterLayout.java
index 4fc443fb7b..fdbee7376d 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage_updateWithParameterLayout.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/named/PropertyLayoutNamedPage_updateWithParameterLayout.java
@@ -44,8 +44,6 @@ public class PropertyLayoutNamedPage_updateWithParameterLayout {
@Parameter(optionality = Optionality.OPTIONAL)
@ParameterLayout(
named = "Named using @ParameterLayout" // <.>
- , describedAs =
- "@ParameterLayout(named = \"...\")"
)
final String parameterUsingAnnotation) {
page.setPropertyUsingAnnotation(parameterUsingAnnotation);
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/navigable/FileNodeVm-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/navigable/FileNodeVm-description.adoc
index 61efeb3264..df1acc72f3 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/navigable/FileNodeVm-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/navigable/FileNodeVm-description.adoc
@@ -1,22 +1,26 @@
: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 `navigable` attribute allows the viewer to construct a breadcrumb trail.
+The link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/PropertyLayout.html#navigable[@PropertyLayout#navigable] attribute allows the viewer to construct a breadcrumb trail.
It is commonly used with objects forming a hierarchy, and so often is used in conjunction with the `TreeNode` value type.
-This app uses the filesystem of the host computer to illustrate the idea:
+== How this demo works
-* The view model object you are viewing -- `FileNode` -- represents either a directory or a file within that filesystem.
+This demo app uses the filesystem of the host computer to illustrate the idea:
+
+* This page you are viewing is a view model object, called `FileNodeVm`.
+It represents either a directory or a file within that filesystem.
* Every instance of `FileNode` shows the same `TreeNode` instance, on the left hand side.
-This allows the user to drill into the tree and inspect the individual files, without "losing their place".
+This is contributed by a mixin property, and is cached on HTTP session.
+You can use this to navigate into the tree and inspect the individual files, without "losing your place".
-The mechanics of creating the tree are shown below.
-But first, let's discuss the `navigable` attribute as a means to construct breadcrumbs.
+* When you have drilled into the tree, a breadcrumb panel will appear near the top of the page.
++
+This occurs because the `FileNodeVm` uses `@PropertyLayout#navigable`.
-== Navigable (Breadcrumbs)
+=== Navigable (Breadcrumbs)
-For all ``FileNode``s a breadcrumb trail is rendered.
-The one node where this is not visible is the initial root node (see the `path` property), because it has no parent.
+For all ``FileNode``s except the initial root node, a breadcrumb trail is rendered.
The framework constructs the breadcrumbs using the value returned by the property with the `navigable` attribute.
This hint should be used on no more than one property of the object, and points back to the logical parent of the domain object:
@@ -25,16 +29,19 @@ This hint should be used on no more than one property of the object, and points
----
include::FileNodeVm.java[tags=navigable]
----
+<.> indicates that this property returns a reference to its "parent" within some hierarchy
+<.> there is no requirement for the property to be visible.
In the case of this demo app, the parent also happens to be a `FileNode`.
However, in general, any type of the parent can be different from the type of the child.
+
The returned parent is itself queried recursively, until eventually an object is returned that has no parent.
The framework renders the breadcrumbs from this sequence of parents.
TIP: For a domain entity, the implementation above would be a lookup of the parent entity from a repository.
-For a view model, we can simply instantiate the parent (view models have value semantics in this respect).
-
+For a view model, we can simply instantiate the parent because view models have value semantics in this respect.
+=== Icon
It's common for hierarchical objects to indicate their nature using an icon:
@@ -53,13 +60,15 @@ include::FileNodeType.java[tags=class]
Note that there are SVG files for each of the instances of this enum, namely `FileNodeVm-FILE_SYSTEM_ROOT.svg`, `FileNodeVm-DIRECTORY.svg` and `FileNodeVm-FILE.svg`.
-== Tree
+=== Tree
-As described above, every `FileNode` renders the same tree:
+As described above, every `FileNode` renders the same tree.
+This is contributed by a mixin property:
[source,java,indent=0]
+.FileNodeVm_tree.java
----
-include::FileNodeVm.java[tags=tree]
+include::FileNodeVm_tree.java[tags=tree]
----
The tree instance itself is cached by a `FileTreeNodeService`, so that there is no need to track the state of the tree (which nodes are expanded etc).
@@ -79,7 +88,7 @@ include::FileTreeNodeService.java[tags=newTree]
This requires an implementation of the `TreeAdapter<T>` SPI, discussed next.
-=== TreeAdapter SPI
+==== TreeAdapter SPI
To render a `TreeNode`, the application must provide an implementation of the `TreeAdapter<T>` SPI:
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/navigable/FileNodeVm.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/navigable/FileNodeVm.java
index 14c1801511..18bff48202 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/navigable/FileNodeVm.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/navigable/FileNodeVm.java
@@ -42,8 +42,8 @@ import lombok.val;
import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
-@XmlRootElement(name="FileNode")
-@Named("demo.FileNode")
+@Named("demo.FileNodeVm")
+@XmlRootElement(name="FileNodeVm")
@DomainObject(nature=Nature.VIEW_MODEL)
@ToString
@NoArgsConstructor
@@ -74,17 +74,12 @@ public class FileNodeVm implements HasAsciiDocDescription {
}
//end::iconName[]
-//tag::tree[]
- @Property
- @PropertyLayout(labelPosition = LabelPosition.NONE, fieldSetId = "tree", sequence = "1")
- public TreeNode<FileNodeVm> getTree() {
- return fileTreeNodeService.sessionTree();
- }
-//end::tree[]
-
//tag::navigable[]
@Property
- @PropertyLayout(navigable=Navigable.PARENT, hidden=Where.EVERYWHERE, fieldSetId = "detail", sequence = "1")
+ @PropertyLayout(
+ navigable=Navigable.PARENT, // <.>
+ hidden=Where.EVERYWHERE // <.>
+ )
public FileNodeVm getParent() {
val parentFile = asFile().getParentFile();
return parentFile != null
@@ -108,6 +103,4 @@ public class FileNodeVm implements HasAsciiDocDescription {
return new File(path);
}
- @Inject
- FileTreeNodeService fileTreeNodeService;
}
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/navigable/FileNodeVm_returnsTree.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/navigable/FileNodeVm_tree.java
similarity index 74%
rename from examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/navigable/FileNodeVm_returnsTree.java
rename to examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/navigable/FileNodeVm_tree.java
index b844198fc1..5bb2ef6127 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/navigable/FileNodeVm_returnsTree.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/properties/PropertyLayout/navigable/FileNodeVm_tree.java
@@ -20,27 +20,19 @@ package demoapp.dom.domain.properties.PropertyLayout.navigable;
import javax.inject.Inject;
-import org.apache.causeway.applib.annotation.Action;
-import org.apache.causeway.applib.annotation.ActionLayout;
-import org.apache.causeway.applib.annotation.SemanticsOf;
+import org.apache.causeway.applib.annotation.Property;
import org.apache.causeway.applib.graph.tree.TreeNode;
import lombok.RequiredArgsConstructor;
//tag::class[]
-@Action(
- semantics = SemanticsOf.SAFE
-)
-@ActionLayout(
- cssClassFa="fa-sitemap",
- position = ActionLayout.Position.PANEL,
- associateWith = "tree")
+@Property
@RequiredArgsConstructor
-public class FileNodeVm_returnsTree {
+public class FileNodeVm_tree {
private final FileNodeVm fileNodeVm;
- public TreeNode<FileNodeVm> act(){
+ public TreeNode<FileNodeVm> prop(){
return fileTreeNodeService.sessionTree();
}