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 609a0bc82f99796a75416713044dd0c271ecac94
Author: danhaywood <[email protected]>
AuthorDate: Sun May 21 17:28:02 2023 +0100

    CAUSEWAY-2485: cleans up tooltip demo
---
 ...ollectionLayoutDescribedAsPage-description.adoc |  4 +-
 .../java/demoapp/dom/featured/FeaturedMenu.java    |  7 ++--
 .../describedAs/DescribedAsVm-description.adoc     | 47 ----------------------
 .../layout/tooltip/TooltipPage-description.adoc    | 31 ++++++++++++++
 .../TooltipPage.java}                              | 41 ++++++++++---------
 .../TooltipPage.layout.xml}                        |  0
 .../services/extensions/secman/ExtSecManMenu.java  |  6 +--
 ...iption.adoc => AppTenancyPage-description.adoc} |  4 +-
 .../{AppTenancyVm.java => AppTenancyPage.java}     |  6 +--
 ...ancyVm.layout.xml => AppTenancyPage.layout.xml} |  0
 10 files changed, 68 insertions(+), 78 deletions(-)

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 3449b78f66..0376dcc50d 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
@@ -17,14 +17,14 @@ In terms of code:
 * For the `children` collection, its description is specified using 
`@PropertyLayout#describedAs()`:
 +
 [source,java,indent=0]
-CollectionLayoutDescribedAsPage.java
+.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">
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/featured/FeaturedMenu.java 
b/examples/demo/domain/src/main/java/demoapp/dom/featured/FeaturedMenu.java
index 17f6882a48..7d9c93d87d 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/featured/FeaturedMenu.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/featured/FeaturedMenu.java
@@ -39,7 +39,7 @@ import lombok.val;
 import demoapp.dom.featured.customui.geocoding.GeoapifyClient;
 import demoapp.dom.featured.customui.latlng.Zoom;
 import demoapp.dom.featured.customui.vm.WhereInTheWorldVm;
-import demoapp.dom.featured.layout.describedAs.DescribedAsVm;
+import demoapp.dom.featured.layout.tooltip.TooltipPage;
 import demoapp.dom.featured.layout.tabs.TabDemo;
 
 @Named("demo.FeaturedMenu")
@@ -52,6 +52,7 @@ public class FeaturedMenu {
 
     final FactoryService factoryService;
 
+
 //tag::whereInTheWorldAction[]
     @Inject
     private GeoapifyClient geoapifyClient;
@@ -89,8 +90,8 @@ public class FeaturedMenu {
 
     @Action(semantics = SemanticsOf.SAFE)
     @ActionLayout(cssClassFa="fa-comment", describedAs="Opens the Tooltip-Demo 
page.")
-    public DescribedAsVm toolTips(){
-        val demo = factoryService.viewModel(new DescribedAsVm());
+    public TooltipPage toolTips(){
+        val demo = factoryService.viewModel(new TooltipPage());
 
         demo.getCollection().add(DemoItem.of("first"));
         demo.getCollection().add(DemoItem.of("second"));
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/featured/layout/describedAs/DescribedAsVm-description.adoc
 
b/examples/demo/domain/src/main/java/demoapp/dom/featured/layout/describedAs/DescribedAsVm-description.adoc
deleted file mode 100644
index 80e78b8caa..0000000000
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/featured/layout/describedAs/DescribedAsVm-description.adoc
+++ /dev/null
@@ -1,47 +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 [...]
-
-(since 2.0.0-M2)
-
-The framework supports for different targets to be associated with
-tooltip effects, that trigger on `mouse-over`. These effects utilize
-`java-script` and are rendered without delay. Targets are
-
-* Action Buttons
-* Action Parameters
-* Menu Actions _(mouse-over the `Tooltip Demo` menu entry)_
-* Entity Properties and Collections
-* Table Column Headers
-
-*Described As* (Targets: Action, Parameter, Property, Collection)
-
-[source,java]
-----
-@ActionLayout(describedAs="tooltip text goes here")
-@ParameterLayout(describedAs="tooltip text goes here")
-@PropertyLayout(describedAs="tooltip text goes here")
-----
-
-*Disabled Reason* (Targets: Action)
-
-[source,java]
-----
-@Action
-public void anAction(){
-    // do something
-}
-
-public String disableAnAction() {
-    return "tooltip text goes here";
-}
-----
-
-*Editing Disabled Reason* (Targets: Property)
-
-[source,java]
-----
-@Property(
-    editingDisabledReason="tooltip text goes here")
-----
-
-See the sources for this demo here:
-link:${SOURCES_DEMO}/demoapp/dom/tooltip[sources]
\ No newline at end of file
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/featured/layout/tooltip/TooltipPage-description.adoc
 
b/examples/demo/domain/src/main/java/demoapp/dom/featured/layout/tooltip/TooltipPage-description.adoc
new file mode 100644
index 0000000000..bb32c9b1c6
--- /dev/null
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/featured/layout/tooltip/TooltipPage-description.adoc
@@ -0,0 +1,31 @@
+: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 [...]
+
+Tooltips appear in the UI for two different reasons:
+
+* to describe the purpose of an action, property or collection
+* to explain why an action or property cannot be invoked/edited.
+
+The former corresponds to the `describedAs` attribute 
(link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/ActionLayout.html#describedAs[@ActionLayout],
 
link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/PropertyLayout.html#describedAs[PropertyLayout],
 
link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/index/annotation/ParameterLayout.html#describedAs[@ParameterLayout],
 link:https://causeway.apache.org/refguide/2.0.0-RC1/applib/ind [...]
+
+== How this demo works
+
+This demo shows examples of each of the members with a tooltip (implemented 
using `#describedAs`), and it also includes examples of disabled actions or 
properties.
+
+In terms of code:
+
+* For actions, where there is both a description but is also disabled, then 
the disabled reason is used for the tooltip:
++
+[source,java,indent=0]
+.TooltipPage.java
+----
+include::TooltipPage.java[tags=disabledAction]
+----
+
+* For disabled properties that have a tooltip, both are shown; the tooltip 
from the label, while the disabled reason from the disabled icon after the 
value:
++
+[source,java,indent=0]
+.TooltipPage.java
+----
+include::TooltipPage.java[tags=disabledProperty]
+----
+
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/featured/layout/describedAs/DescribedAsVm.java
 
b/examples/demo/domain/src/main/java/demoapp/dom/featured/layout/tooltip/TooltipPage.java
similarity index 92%
rename from 
examples/demo/domain/src/main/java/demoapp/dom/featured/layout/describedAs/DescribedAsVm.java
rename to 
examples/demo/domain/src/main/java/demoapp/dom/featured/layout/tooltip/TooltipPage.java
index fb24fcdfca..9715645e12 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/featured/layout/describedAs/DescribedAsVm.java
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/featured/layout/tooltip/TooltipPage.java
@@ -16,7 +16,7 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-package demoapp.dom.featured.layout.describedAs;
+package demoapp.dom.featured.layout.tooltip;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -60,45 +60,43 @@ import demoapp.dom.featured.DemoItem;
 @XmlAccessorType(XmlAccessType.FIELD)
 @Named("demo.Tooltip")
 @DomainObject(nature=Nature.VIEW_MODEL)
-public class DescribedAsVm implements HasAsciiDocDescription {
+public class TooltipPage implements HasAsciiDocDescription {
 
-    @XmlTransient
-    @Inject MessageService messageService;
+    @Inject @XmlTransient MessageService messageService;
 
     @ObjectSupport public String title() {
         return "Tooltip Demo";
     }
 
-    // -- NO ARG
-
     @Action
     @ActionLayout(
             named = "No Arguments",
             describedAs="This is a no-arg action with a tooltip.")
-    public DescribedAsVm noArgAction(){
+    public TooltipPage noArgAction(){
         messageService.informUser("clicked on noArgAction");
         return this;
     }
 
+
     @Action(semantics=SemanticsOf.IDEMPOTENT_ARE_YOU_SURE)
     @ActionLayout(
             named = "No Arguments With Confirm",
             cssClass="btn-danger",
             describedAs="This is a no-arg action with a tooltip and 'are you 
sure' semantics."
             )
-    public DescribedAsVm noArgActionWithConfirm(){
+    public TooltipPage noArgActionWithConfirm(){
         messageService.informUser("clicked on noArgActionWithConfirm");
         return this;
     }
 
-    // -- WITH ARG
+
 
     @Action
     @ActionLayout(
             named = "With Arguments",
             describedAs="This is an action with arguments and a tooltip.",
             promptStyle=PromptStyle.DIALOG_MODAL)
-    public DescribedAsVm biArgAction(
+    public TooltipPage biArgAction(
 
             @Parameter(optionality=Optionality.MANDATORY)
             @ParameterLayout(
@@ -116,17 +114,17 @@ public class DescribedAsVm implements 
HasAsciiDocDescription {
 
         return this;
     }
-
     @MemberSupport public String validateBiArgAction(final String firstArg, 
final String secondArg) {
         return "always fail for demonstration";
     }
 
+
     @Action(semantics=SemanticsOf.IDEMPOTENT_ARE_YOU_SURE)
     @ActionLayout(
             named = "With Arguments And Confirm",
             describedAs="This is an action with arguments, a tooltip and 'are 
you sure' semantics.",
             promptStyle=PromptStyle.DIALOG_MODAL)
-    public DescribedAsVm biArgActionWithConfirm(
+    public TooltipPage biArgActionWithConfirm(
 
             @Parameter(optionality=Optionality.MANDATORY)
             @ParameterLayout(
@@ -150,19 +148,21 @@ public class DescribedAsVm implements 
HasAsciiDocDescription {
     }
 
 
-    // -- DISABLED
-
+//tag::disabledAction[]
     @Action
     @ActionLayout(
             named="Disabled",
             describedAs="This is a disabled action with a tooltip.")
-    public DescribedAsVm disabledAction(){
+    public TooltipPage disabledAction(){
         return this;
     }
 
     @MemberSupport public String disableDisabledAction() {
         return "Disabled for demonstration.";
     }
+//end::disabledAction[]
+
+
 
     @Action
     @ActionLayout(
@@ -170,7 +170,7 @@ public class DescribedAsVm implements 
HasAsciiDocDescription {
             cssClass="btn-danger",
             describedAs="This is a disabled action with a tooltip and 'are you 
sure' "
                     + "semantics.")
-    public DescribedAsVm disabledActionWithConfirmation(){
+    public TooltipPage disabledActionWithConfirmation(){
         return this;
     }
 
@@ -178,21 +178,26 @@ public class DescribedAsVm implements 
HasAsciiDocDescription {
         return "Disabled for demonstration.";
     }
 
-    // -- PROPERTIES
+
 
     @Property(editing=Editing.ENABLED)
     @PropertyLayout(describedAs="This is a property with a tooltip.")
     @Getter @Setter private String stringProperty;
 
+
     @Property
     @PropertyLayout(describedAs="This is a readonly property with a tooltip.")
     @Getter private String readonlyStringProperty = "readonly";
 
+
+//tag::disabledProperty[]
     @Property(
             editing=Editing.DISABLED,
             editingDisabledReason="Editing disabled for demonstration.")
     @PropertyLayout(describedAs="This is a 'editing-disabled' property with a 
tooltip.")
     @Getter @Setter private String editingDisabledStringProperty = "editing 
disabled";
+//end::disabledProperty[]
+
 
     // -- COLLECTION
 
@@ -224,7 +229,7 @@ public class DescribedAsVm implements 
HasAsciiDocDescription {
 
     @PropertyLayout(labelPosition=LabelPosition.NONE)
     public Markup getText4() {
-        return new Markup("Mouse-over below property lables, then tooltips 
should "
+        return new Markup("Mouse-over below property labels, then tooltips 
should "
                 + "pop up.<p>Mouse-over the disabled/readonly property value 
form-field,"
                 + " then the 'editing disabled reason' should pop up.</p>");
     }
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/featured/layout/describedAs/DescribedAsVm.layout.xml
 
b/examples/demo/domain/src/main/java/demoapp/dom/featured/layout/tooltip/TooltipPage.layout.xml
similarity index 100%
rename from 
examples/demo/domain/src/main/java/demoapp/dom/featured/layout/describedAs/DescribedAsVm.layout.xml
rename to 
examples/demo/domain/src/main/java/demoapp/dom/featured/layout/tooltip/TooltipPage.layout.xml
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/ExtSecManMenu.java
 
b/examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/ExtSecManMenu.java
index 98f18d4580..c61f162576 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/ExtSecManMenu.java
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/ExtSecManMenu.java
@@ -28,7 +28,7 @@ import org.apache.causeway.applib.annotation.NatureOfService;
 import org.apache.causeway.applib.annotation.PriorityPrecedence;
 import org.apache.causeway.applib.annotation.SemanticsOf;
 
-import demoapp.dom.services.extensions.secman.apptenancy.AppTenancyVm;
+import demoapp.dom.services.extensions.secman.apptenancy.AppTenancyPage;
 
 @Named("demo.ExtSecManMenu")
 @DomainService(
@@ -42,8 +42,8 @@ public class ExtSecManMenu {
 
     @Action(semantics = SemanticsOf.SAFE)
     @ActionLayout(cssClassFa="fa-home", describedAs = "Restricts access to 
objects dependent upon who \"owns\" those objects")
-    public AppTenancyVm appTenancy(){
-        return new AppTenancyVm();
+    public AppTenancyPage appTenancy(){
+        return new AppTenancyPage();
     }
 
 
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/AppTenancyVm-description.adoc
 
b/examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/AppTenancyPage-description.adoc
similarity index 98%
rename from 
examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/AppTenancyVm-description.adoc
rename to 
examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/AppTenancyPage-description.adoc
index 85c4fbfb0f..1c0c7900d5 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/AppTenancyVm-description.adoc
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/AppTenancyPage-description.adoc
@@ -41,9 +41,9 @@ This demo application deals only with the `TenantedEntity` 
entity type.
 * the page object has actions that set a pattern on the service.
 +
 [source,java]
-.AppTenancyVm.java
+.AppTenancyPage.java
 ----
-include::AppTenancyVm.java[tags=hideRegex]
+include::AppTenancyPage.java[tags=hideRegex]
 ----
 
 
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/AppTenancyVm.java
 
b/examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/AppTenancyPage.java
similarity index 95%
rename from 
examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/AppTenancyVm.java
rename to 
examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/AppTenancyPage.java
index 2e40e4a606..cef6ddb678 100644
--- 
a/examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/AppTenancyVm.java
+++ 
b/examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/AppTenancyPage.java
@@ -49,7 +49,7 @@ import 
demoapp.dom.services.extensions.secman.apptenancy.persistence.TenantedEnt
 @Named("demo.SecManVm")
 @DomainObject(
         nature=Nature.VIEW_MODEL)
-public class AppTenancyVm implements HasAsciiDocDescription {
+public class AppTenancyPage implements HasAsciiDocDescription {
 
     @ObjectSupport public String title() {
         return "Tenancy demo";
@@ -67,7 +67,7 @@ public class AppTenancyVm implements HasAsciiDocDescription {
     @ActionLayout(
             associateWith = "hideRegex",
             promptStyle = PromptStyle.INLINE_AS_IF_EDIT)
-    public AppTenancyVm updateHideRegex(
+    public AppTenancyPage updateHideRegex(
             @Parameter(optionality = Optionality.OPTIONAL) final
             String regex) {
         applicationTenancyEvaluatorForDemo.setHideRegex(regex);
@@ -86,7 +86,7 @@ public class AppTenancyVm implements HasAsciiDocDescription {
     @ActionLayout(
             associateWith = "disableRegex",
             promptStyle = PromptStyle.INLINE_AS_IF_EDIT)
-    public AppTenancyVm updateDisableRegex(
+    public AppTenancyPage updateDisableRegex(
             @Parameter(optionality = Optionality.OPTIONAL) final
             String regex) {
         applicationTenancyEvaluatorForDemo.setDisableRegex(regex);
diff --git 
a/examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/AppTenancyVm.layout.xml
 
b/examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/AppTenancyPage.layout.xml
similarity index 100%
rename from 
examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/AppTenancyVm.layout.xml
rename to 
examples/demo/domain/src/main/java/demoapp/dom/services/extensions/secman/apptenancy/AppTenancyPage.layout.xml

Reply via email to