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
The following commit(s) were added to refs/heads/CAUSEWAY-2485 by this push:
new 0d3a70435e CAUSEWAY-2485: reworks @Action#describedAs
0d3a70435e is described below
commit 0d3a70435e592336c75ac48791e791f2012c01d5
Author: danhaywood <[email protected]>
AuthorDate: Fri Apr 14 07:24:58 2023 +0100
CAUSEWAY-2485: reworks @Action#describedAs
---
.../actions/ActionLayout/ActionLayoutMenu.java | 2 +
.../ActionLayoutAssociateWithPage-description.adoc | 64 +++++++++++
.../ActionLayoutAssociateWithPage.layout.xml | 2 +-
.../ActionLayoutCssClassPage-description.adoc | 1 +
.../cssClass/ActionLayoutCssClassPage.java | 1 +
.../cssClass/ActionLayoutCssClassPage.layout.xml | 19 +--
.../ActionLayoutCssClassFaPage-description.adoc | 2 +-
.../ActionLayoutCssClassFaPage.layout.xml | 19 +--
.../ActionLayoutDescribedAsPage-description.adoc | 62 +++++++++-
.../describedAs/ActionLayoutDescribedAsPage.java | 128 ++++++++++++++++++---
.../ActionLayoutDescribedAsPage.layout.xml | 28 ++---
...ctionLayoutDescribedAsChildVm-description.adoc} | 9 +-
.../ActionLayoutDescribedAsChildVm.java} | 52 ++++-----
.../ActionLayoutDescribedAsChildVm.layout.xml} | 16 +--
14 files changed, 285 insertions(+), 120 deletions(-)
diff --git
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/ActionLayoutMenu.java
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/ActionLayoutMenu.java
index e7f8b5cd9b..6e5b5fb732 100644
---
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/ActionLayoutMenu.java
+++
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/ActionLayoutMenu.java
@@ -78,12 +78,14 @@ public class ActionLayoutMenu {
return new ActionLayoutCssClassFaPage();
}
+//tag::menu-item-described-as[]
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa="fa-comment",
describedAs = "Description of the action, shown as a tooltip")
public ActionLayoutDescribedAsPage describedAs(){
return new ActionLayoutDescribedAsPage();
}
+//end::menu-item-described-as[]
@Action(semantics = SemanticsOf.SAFE)
@ActionLayout(cssClassFa="fa-solid fa-vector-square",
diff --git
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/associateWith/ActionLayoutAssociateWithPage-description.adoc
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/associateWith/ActionLayoutAssociateWithPage-description.adoc
index 97d7b676ae..6ebad18dc8 100644
---
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/associateWith/ActionLayoutAssociateWithPage-description.adoc
+++
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/associateWith/ActionLayoutAssociateWithPage-description.adoc
@@ -36,3 +36,67 @@
include::ActionLayoutAssociateWithPage.java[tags=associate-with-collection]
TIP: Note that it is also possible to associate an action with a collection
using `Action#choicesFrom`,
which has the additional semantic of the rows of the element being used as
choices for that action’s collection parameter
of the same type as the elements of the collection.
+
+
+=== .layout.xml
+
+Instead of using `@ActionLayout#associateWith`, it is also possible to
associate actions with objects using the `<action id="..." cssClass="...">` in
the
link:https://causeway.apache.org/userguide/2.0.0-RC1/fun/ui.html#by-example[.layout.xml]
file.
+
+The general idea is that an action is associated with a property or collection
by being nested inside the corresponding element:
+
+* associating an action with (below) a property:
++
+[source,xml]
+.Xxx.layout.xml
+----
+...
+<cpt:property id="...">
+ <cpt:action id="..."/>
+</cpt:property>
+...
+----
+
+* associating an action with the panel of a property:
++
+[source,xml]
+.Xxx.layout.xml
+----
+...
+<cpt:fieldSet id="...">
+ <cpt:action id="..."/>
+ <cpt:property id="..."/>
+</cpt:fieldSet>
+...
+----
++
+The terms "fieldSet" and "panel" are synonymous.
+
+* associating an action with a collection:
++
+[source,xml]
+.Xxx.layout.xml
+----
+...
+<cpt:collection id="...">
+ <cpt:action id="..."/>
+</cpt:collection>
+...
+----
+
+* not associated with any member:
++
+[source,xml]
+.Xxx.layout.xml
+----
+...
+<bs3:col span="12" unreferencedActions="true">
+ <cpt:domainObject/>
+ <cpt:action id="..."/>
+</bs3:col>
+...
+----
+
+
+
+
+One advantage of using the `.layout.xml` file is that changes can be picked up
without having to restart the application.
diff --git
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/associateWith/ActionLayoutAssociateWithPage.layout.xml
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/associateWith/ActionLayoutAssociateWithPage.layout.xml
index 670bbc997d..ef53f1d2d2 100644
---
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/associateWith/ActionLayoutAssociateWithPage.layout.xml
+++
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/associateWith/ActionLayoutAssociateWithPage.layout.xml
@@ -29,7 +29,7 @@
<bs3:row>
<bs3:col span="12">
<cpt:fieldSet name="General"
id="general">
- <cpt:property id="property"/>
+ <cpt:property id="name"/>
</cpt:fieldSet>
<cpt:fieldSet name="Other" id="other"
unreferencedProperties="true"/>
</bs3:col>
diff --git
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/cssClass/ActionLayoutCssClassPage-description.adoc
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/cssClass/ActionLayoutCssClassPage-description.adoc
index 049a1f06f4..2a8ee3b9ac 100644
---
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/cssClass/ActionLayoutCssClassPage-description.adoc
+++
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/cssClass/ActionLayoutCssClassPage-description.adoc
@@ -91,6 +91,7 @@ One action:
----
include::ActionLayoutCssClassPage.java[tags=delete]
----
+<.> not explicitly positioned
Yhis last example has no `@ActionLayout#cssClass` defined, but it nevertheless
will be rendered with the _Bootstrap_ "btn-danger" class.
This is because it picks up the global configuration property, as described in
the next section.
diff --git
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/cssClass/ActionLayoutCssClassPage.java
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/cssClass/ActionLayoutCssClassPage.java
index 6873e2b804..daa3177ed4 100644
---
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/cssClass/ActionLayoutCssClassPage.java
+++
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/cssClass/ActionLayoutCssClassPage.java
@@ -132,6 +132,7 @@ public class ActionLayoutCssClassPage implements
HasAsciiDocDescription {
//tag::delete[]
@Action(semantics = SemanticsOf.IDEMPOTENT_ARE_YOU_SURE)
+ @ActionLayout() // <.>
public Object delete() {
return this;
}
diff --git
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/cssClass/ActionLayoutCssClassPage.layout.xml
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/cssClass/ActionLayoutCssClassPage.layout.xml
index b7b4ab6651..fa21af1b98 100644
---
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/cssClass/ActionLayoutCssClassPage.layout.xml
+++
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/cssClass/ActionLayoutCssClassPage.layout.xml
@@ -26,23 +26,8 @@
<bs3:row>
<bs3:col span="6">
- <cpt:fieldSet name="General" id="general"/>
- <cpt:fieldSet name="Annotated" id="annotated"/>
- <cpt:fieldSet name="Layout" id="layout">
- <cpt:action id="layoutPanel" position="PANEL">
- <cpt:named>Positioned on
panel</cpt:named>
- </cpt:action>
- <cpt:action id="layoutPanelDropDown"
position="PANEL_DROPDOWN">
- <cpt:named>Positioned on panel in drop
down</cpt:named>
- </cpt:action>
- <cpt:property id="readOnlyProperty2">
- <cpt:action id="layoutBelow"
position="BELOW">
- <cpt:named>Positioned
below</cpt:named>
- </cpt:action>
- <cpt:action id="layoutRight"
position="RIGHT">
- <cpt:named>Positioned
right</cpt:named>
- </cpt:action>
- </cpt:property>
+ <cpt:fieldSet name="General" id="general">
+ <cpt:property id="name"/>
</cpt:fieldSet>
<cpt:fieldSet name="Other" id="other"
unreferencedProperties="true"/>
</bs3:col>
diff --git
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/cssClassFa/ActionLayoutCssClassFaPage-description.adoc
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/cssClassFa/ActionLayoutCssClassFaPage-description.adoc
index b7a8323e1f..2707da1f79 100644
---
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/cssClassFa/ActionLayoutCssClassFaPage-description.adoc
+++
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/cssClassFa/ActionLayoutCssClassFaPage-description.adoc
@@ -8,7 +8,7 @@ This is used for whether the action is rendered as a button or
as a menu item.
=== How this demo works
This page has a `name` property and two actions, both of which can be used to
update that property.
-The two actions have different fa icons
+The two actions have different fa icons.
* `updateNameWithFaIconOnTheLeft`
+
diff --git
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/cssClassFa/ActionLayoutCssClassFaPage.layout.xml
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/cssClassFa/ActionLayoutCssClassFaPage.layout.xml
index b7b4ab6651..fa21af1b98 100644
---
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/cssClassFa/ActionLayoutCssClassFaPage.layout.xml
+++
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/cssClassFa/ActionLayoutCssClassFaPage.layout.xml
@@ -26,23 +26,8 @@
<bs3:row>
<bs3:col span="6">
- <cpt:fieldSet name="General" id="general"/>
- <cpt:fieldSet name="Annotated" id="annotated"/>
- <cpt:fieldSet name="Layout" id="layout">
- <cpt:action id="layoutPanel" position="PANEL">
- <cpt:named>Positioned on
panel</cpt:named>
- </cpt:action>
- <cpt:action id="layoutPanelDropDown"
position="PANEL_DROPDOWN">
- <cpt:named>Positioned on panel in drop
down</cpt:named>
- </cpt:action>
- <cpt:property id="readOnlyProperty2">
- <cpt:action id="layoutBelow"
position="BELOW">
- <cpt:named>Positioned
below</cpt:named>
- </cpt:action>
- <cpt:action id="layoutRight"
position="RIGHT">
- <cpt:named>Positioned
right</cpt:named>
- </cpt:action>
- </cpt:property>
+ <cpt:fieldSet name="General" id="general">
+ <cpt:property id="name"/>
</cpt:fieldSet>
<cpt:fieldSet name="Other" id="other"
unreferencedProperties="true"/>
</bs3:col>
diff --git
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/ActionLayoutDescribedAsPage-description.adoc
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/ActionLayoutDescribedAsPage-description.adoc
index 4b25c313dd..65ca267ab2 100644
---
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/ActionLayoutDescribedAsPage-description.adoc
+++
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/ActionLayoutDescribedAsPage-description.adoc
@@ -1,10 +1,68 @@
: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 indicates a description of this action, eg to be
rendered in a tooltip.
+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, the
link:https://causeway.apache.org/refguide/2.0.0-SNAPSHOT/applib/index/annotation/ActionLayout.html#describedas[@ActionLayout#describedAs]
allows you to provide brief additional information about all object members.
+For an action button, this description is displayed as a tooltip.
+
+
+=== How this demo works
+
+This page has a `name` property and a `children` collection.
+It also has with a number of actions, with the actions each having
descriptions.
+The actions are associated with members and positioned so that they appear in
different places in the UI.
+
+* action associated with the `name` property and positioned below that
property:
++
+[source,java,indent=0]
+----
+include::ActionLayoutDescribedAsPage.java[tags=below]
+----
+<.> in effect adds a tooltip to this action's button, that shows on _mouse
over_
+
+* action associated with the `name` property and positioned on its parent
panel:
++
+[source,java,indent=0]
+----
+include::ActionLayoutDescribedAsPage.java[tags=panel]
+----
+<.> in effect adds a tooltip to this action's button, that shows on _mouse
over_
+
+* action associated with the `name` property and positioned as panel drop-down:
++
+[source,java,indent=0]
+----
+include::ActionLayoutDescribedAsPage.java[tags=panel-dropdown]
+----
+<.> in effect adds a tooltip to this action's button, that shows on _mouse
over_
+
+* actions associated with the `children` collection:
++
[source,java,indent=0]
----
-include::ActionLayoutDescribedAsPage.java[tags=act]
+include::ActionLayoutDescribedAsPage.java[tags=collection]
----
+<.> in effect adds a tooltip to this action's button, that shows on _mouse
over_
+* actions not associated with any member (appear at the top)
++
+[source,java,indent=0]
+----
+include::ActionLayoutDescribedAsPage.java[tags=delete]
+----
<.> in effect adds a tooltip to this action's button, that shows on _mouse
over_
+
+In addition, actions that appear in menus can also have descriptions; for
example, the menu item used to obtain this page:
+
+[source,java,indent=0]
+----
+include::../ActionLayoutMenu.java[tags=menu-item-described-as]
+----
+
+
+=== .layout.xml
+
+Instead of using `@ActionLayout#describesAs`, it is also possible to specify a
tooltip using the `<action id="..." describedAs="...">` in the
link:https://causeway.apache.org/userguide/2.0.0-RC1/fun/ui.html#by-example[.layout.xml]
file.
+
+One advantage of using the `.layout.xml` file is that changes can be picked up
without having to restart the application.
+On the other hand, including descriptions can make that file rather large.
diff --git
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/ActionLayoutDescribedAsPage.java
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/ActionLayoutDescribedAsPage.java
index a1869ab902..c313613c14 100644
---
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/ActionLayoutDescribedAsPage.java
+++
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/ActionLayoutDescribedAsPage.java
@@ -19,41 +19,135 @@
package demoapp.dom.domain.actions.ActionLayout.describedAs;
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.XmlType;
+import javax.xml.bind.annotation.*;
-import org.apache.causeway.applib.annotation.Action;
-import org.apache.causeway.applib.annotation.ActionLayout;
-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.*;
import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+import
demoapp.dom.domain.actions.ActionLayout.associateWith.child.ActionLayoutAssociateWithChildVm;
+import
demoapp.dom.domain.actions.ActionLayout.describedAs.child.ActionLayoutDescribedAsChildVm;
+import lombok.Getter;
+import lombok.Setter;
-//tag::class[]
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Objects;
+
+@Named("demo.ActionLayoutDescribedAsPage")
@DomainObject(
nature=Nature.VIEW_MODEL)
-@Named("demo.ActionLayoutDescribedAsVm")
@XmlRootElement(name = "root")
-@XmlType
+@XmlType()
@XmlAccessorType(XmlAccessType.FIELD)
-public class ActionLayoutDescribedAsPage implements HasAsciiDocDescription {
+//tag::class[]
+//...
+public class ActionLayoutDescribedAsPage
+//end::class[]
+ implements HasAsciiDocDescription
+//tag::class[]
+{
+ @Property
+ @XmlElement
+ @Getter
+ @Setter
+ private String name;
+
+ @Collection()
+ @XmlElement
+ @Getter
+ private List<ActionLayoutDescribedAsChildVm> children = new ArrayList<>();
+
+ // ...
+//end::class[]
@ObjectSupport public String title() {
return "@ActionLayout#describedAs";
}
-//tag::act[]
+
+//tag::below[]
@Action
@ActionLayout(
- describedAs = "A good description could go here." // <.>
+ associateWith = "name",
+ describedAs = "Updates the name property. The new name must be
different from the old name" // <.>
)
- public Object act(final String arg) {
+ public Object updateName(final String newName) {
+ setName(newName);
+ return this;
+ }
+ public String default0UpdateName() {
+ return getName();
+ }
+ public String validate0UpdateName(final String proposedName) {
+ return Objects.equals(name, proposedName) ? "New name must be
different from current name" : null;
+ }
+//end::below[]
+
+//tag::panel[]
+ @Action
+ @ActionLayout(
+ associateWith = "name",
+ describedAs = "Updates the name property. This action has no
validation", // <.>
+ position = ActionLayout.Position.PANEL
+ )
+ public Object updateNameFromPanel(final String newName) {
+ setName(newName);
return this;
}
-//end::act[]
+//end::panel[]
+
+//tag::panel-dropdown[]
+ @Action
+ @ActionLayout(
+ associateWith = "name",
+ describedAs = "Updates the name property. This action also has no
validation", // <.>
+ position = ActionLayout.Position.PANEL_DROPDOWN
+ )
+ public Object updateNameFromPanelDropdown(final String newName) {
+ setName(newName);
+ return this;
+ }
+//end::panel-dropdown[]
+
+//tag::collection[]
+ @Action
+ @ActionLayout(
+ associateWith = "children",
+ describedAs = "Adds a child to the collection", // <.>
+ sequence = "1"
+ )
+ public Object addChild(final String newValue) {
+ getChildren().add(new ActionLayoutDescribedAsChildVm(newValue));
+ return this;
+ }
+
+ @Action
+ @ActionLayout(
+ associateWith = "children",
+ describedAs = "Removes a child from the collection", // <1>
+ sequence = "2"
+ )
+ public Object removeChild(final ActionLayoutDescribedAsChildVm child) {
+ getChildren().removeIf(x -> x.getValue().equals(child.getValue()));
+ return this;
+ }
+ public List<ActionLayoutDescribedAsChildVm> choices0RemoveChild() {
+ return getChildren();
+ }
+//end::collection[]
+
+
+//tag::delete[]
+ @Action(semantics = SemanticsOf.IDEMPOTENT_ARE_YOU_SURE)
+ @ActionLayout(
+ describedAs = "Despite its name, this action is a no-op" // <.>
+ )
+ public Object delete() {
+ return this;
+ }
+//end::delete[]
+
+//tag::class[]
}
//end::class[]
diff --git
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/ActionLayoutDescribedAsPage.layout.xml
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/ActionLayoutDescribedAsPage.layout.xml
index b7b4ab6651..c7b57f8994 100644
---
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/ActionLayoutDescribedAsPage.layout.xml
+++
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/ActionLayoutDescribedAsPage.layout.xml
@@ -26,25 +26,19 @@
<bs3:row>
<bs3:col span="6">
- <cpt:fieldSet name="General" id="general"/>
- <cpt:fieldSet name="Annotated" id="annotated"/>
- <cpt:fieldSet name="Layout" id="layout">
- <cpt:action id="layoutPanel" position="PANEL">
- <cpt:named>Positioned on
panel</cpt:named>
- </cpt:action>
- <cpt:action id="layoutPanelDropDown"
position="PANEL_DROPDOWN">
- <cpt:named>Positioned on panel in drop
down</cpt:named>
- </cpt:action>
- <cpt:property id="readOnlyProperty2">
- <cpt:action id="layoutBelow"
position="BELOW">
- <cpt:named>Positioned
below</cpt:named>
- </cpt:action>
- <cpt:action id="layoutRight"
position="RIGHT">
- <cpt:named>Positioned
right</cpt:named>
- </cpt:action>
- </cpt:property>
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:fieldSet name="General" id="general">
+ <cpt:property id="name"/>
</cpt:fieldSet>
<cpt:fieldSet name="Other" id="other"
unreferencedProperties="true"/>
+ </bs3:col>
+ </bs3:row>
+ <bs3:row>
+ <bs3:col span="12">
+ <cpt:collection id="children"/>
+ </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/actions/ActionLayout/describedAs/ActionLayoutDescribedAsPage-description.adoc
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/child/ActionLayoutDescribedAsChildVm-description.adoc
similarity index 73%
copy from
examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/ActionLayoutDescribedAsPage-description.adoc
copy to
examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/child/ActionLayoutDescribedAsChildVm-description.adoc
index 4b25c313dd..82bee43a72 100644
---
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/ActionLayoutDescribedAsPage-description.adoc
+++
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/child/ActionLayoutDescribedAsChildVm-description.adoc
@@ -1,10 +1,3 @@
: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 indicates a description of this action, eg to be
rendered in a tooltip.
-
-[source,java,indent=0]
-----
-include::ActionLayoutDescribedAsPage.java[tags=act]
-----
-
-<.> in effect adds a tooltip to this action's button, that shows on _mouse
over_
+This child object exists just to act as the element of the collections of the
`ActionLayoutDescribedAsPage` demo object.
diff --git
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/ActionLayoutDescribedAsPage.java
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/child/ActionLayoutDescribedAsChildVm.java
similarity index 51%
copy from
examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/ActionLayoutDescribedAsPage.java
copy to
examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/child/ActionLayoutDescribedAsChildVm.java
index a1869ab902..c4f11afb6c 100644
---
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/ActionLayoutDescribedAsPage.java
+++
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/child/ActionLayoutDescribedAsChildVm.java
@@ -16,44 +16,42 @@
* specific language governing permissions and limitations
* under the License.
*/
-package demoapp.dom.domain.actions.ActionLayout.describedAs;
+package demoapp.dom.domain.actions.ActionLayout.describedAs.child;
+
+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.XmlType;
+import javax.xml.bind.annotation.*;
-import org.apache.causeway.applib.annotation.Action;
-import org.apache.causeway.applib.annotation.ActionLayout;
-import org.apache.causeway.applib.annotation.DomainObject;
-import org.apache.causeway.applib.annotation.Nature;
-import org.apache.causeway.applib.annotation.ObjectSupport;
-
-import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
+import org.apache.causeway.applib.annotation.*;
//tag::class[]
-@DomainObject(
- nature=Nature.VIEW_MODEL)
-@Named("demo.ActionLayoutDescribedAsVm")
-@XmlRootElement(name = "root")
+@XmlRootElement(name = "child")
@XmlType
@XmlAccessorType(XmlAccessType.FIELD)
-public class ActionLayoutDescribedAsPage implements HasAsciiDocDescription {
+@Named("demo.ActionLayoutDescribedAsChildVm")
+@DomainObject(nature=Nature.VIEW_MODEL)
+@NoArgsConstructor
+public class ActionLayoutDescribedAsChildVm implements HasAsciiDocDescription {
- @ObjectSupport public String title() {
- return "@ActionLayout#describedAs";
+ public ActionLayoutDescribedAsChildVm(final String value) {
+ setValue(value);
}
-//tag::act[]
- @Action
- @ActionLayout(
- describedAs = "A good description could go here." // <.>
- )
- public Object act(final String arg) {
- return this;
+ @ObjectSupport public String title() {
+ return getValue();
}
-//end::act[]
+
+ @Property()
+ @PropertyLayout(fieldSetId = "annotation", sequence = "1")
+ @XmlElement(required = false)
+ @Getter @Setter
+ private String value;
+
+
}
//end::class[]
diff --git
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/associateWith/ActionLayoutAssociateWithPage.layout.xml
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/child/ActionLayoutDescribedAsChildVm.layout.xml
similarity index 87%
copy from
examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/associateWith/ActionLayoutAssociateWithPage.layout.xml
copy to
examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/child/ActionLayoutDescribedAsChildVm.layout.xml
index 670bbc997d..2441ccf9e7 100644
---
a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/associateWith/ActionLayoutAssociateWithPage.layout.xml
+++
b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/describedAs/child/ActionLayoutDescribedAsChildVm.layout.xml
@@ -15,6 +15,7 @@
xmlns:cpt="https://causeway.apache.org/applib/layout/component"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+
<bs3:row>
<bs3:col span="10" unreferencedActions="true">
<cpt:domainObject />
@@ -26,19 +27,8 @@
<bs3:row>
<bs3:col span="6">
- <bs3:row>
- <bs3:col span="12">
- <cpt:fieldSet name="General"
id="general">
- <cpt:property id="property"/>
- </cpt:fieldSet>
- <cpt:fieldSet name="Other" id="other"
unreferencedProperties="true"/>
- </bs3:col>
- </bs3:row>
- <bs3:row>
- <bs3:col span="12">
- <cpt:collection id="children"/>
- </bs3:col>
- </bs3:row>
+ <cpt:fieldSet name="Annotation" id="variants"/>
+ <cpt:fieldSet name="Other" id="other"
unreferencedProperties="true"/>
</bs3:col>
<bs3:col span="6">
<cpt:fieldSet name="Description" id="description" >