You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by ah...@apache.org on 2023/03/15 06:28:24 UTC

[causeway] branch master updated: CAUSEWAY-3310: [Demo] Action Layout Annotation - flesh out redirectPolicy

This is an automated email from the ASF dual-hosted git repository.

ahuber pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/causeway.git


The following commit(s) were added to refs/heads/master by this push:
     new 8c1d00a37c CAUSEWAY-3310: [Demo] Action Layout Annotation - flesh out redirectPolicy
8c1d00a37c is described below

commit 8c1d00a37c8bc85dc5e6b544c2eb4d47e401ea15
Author: Andi Huber <ah...@apache.org>
AuthorDate: Wed Mar 15 07:28:19 2023 +0100

    CAUSEWAY-3310: [Demo] Action Layout Annotation - flesh out
    redirectPolicy
---
 .../ActionLayoutRedirectPolicyVm-description.adoc    | 20 ++++++++++++++++----
 .../redirectPolicy/ActionLayoutRedirectPolicyVm.java | 18 +++++++++++++++---
 2 files changed, 31 insertions(+), 7 deletions(-)

diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/redirectPolicy/ActionLayoutRedirectPolicyVm-description.adoc b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/redirectPolicy/ActionLayoutRedirectPolicyVm-description.adoc
index 72a1647a2d..6044c048ac 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/redirectPolicy/ActionLayoutRedirectPolicyVm-description.adoc
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/redirectPolicy/ActionLayoutRedirectPolicyVm-description.adoc
@@ -1,8 +1,20 @@
 :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 `redirectPolicy` attribute ...
+If an action returns its target, then the `redirectPolicy` attribute determines 
+whether to update the page or instead to redirect (forcing a re-rendering of a new page).
 
-WARNING: TODO[CAUSEWAY-3310]
-If the action returns its target, then determines whether to update the page or instead to redirect (forcing a re-rendering of a new page).
 Not re-rendering can provide a smoother UI experience.
-Supported by the Wicket viewer.
+
+[WARNING]
+==== 
+This feature is currently *not* supported by the _Wicket Viewer_ https://issues.apache.org/jira/browse/CAUSEWAY-1659
+
+(Perhaps a feasible showcase could be to render a local time property, then demonstrate that its UI would not update after action invocation.) 
+====
+
+[source,java,indent=0]
+----
+include::ActionLayoutRedirectPolicyVm.java[tags=act]
+----
+
+<.> this action returns its target, and so setting `ONLY_IF_DIFFERS` instructs the _viewer_ to not re-render the current page
\ No newline at end of file
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/redirectPolicy/ActionLayoutRedirectPolicyVm.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/redirectPolicy/ActionLayoutRedirectPolicyVm.java
index 2e0dbf68b7..db566e337a 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/redirectPolicy/ActionLayoutRedirectPolicyVm.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/ActionLayout/redirectPolicy/ActionLayoutRedirectPolicyVm.java
@@ -40,18 +40,30 @@ import demoapp.dom._infra.asciidocdesc.HasAsciiDocDescription;
 @XmlRootElement(name = "root")
 @XmlType
 @XmlAccessorType(XmlAccessType.FIELD)
-public class ActionLayoutRedirectPolicyVm implements HasAsciiDocDescription {
+//tag::act[]
+public class ActionLayoutRedirectPolicyVm
+//end::act[]
+implements HasAsciiDocDescription
+//tag::act[]
+{
+//end::act[]
 
     @ObjectSupport public String title() {
         return "ActionLayout#redirectPolicy";
     }
 
+//tag::act[]
     @Action
     @ActionLayout(
-            redirectPolicy = Redirect.ONLY_IF_DIFFERS)
-    public Object act(final String arg) {
+            redirectPolicy = Redirect.ONLY_IF_DIFFERS // <.>
+//end::act[]
+            ,describedAs = "@ActionLayout(redirectPolicy = Redirect.ONLY_IF_DIFFERS)"
+//tag::act[]
+            )
+    public ActionLayoutRedirectPolicyVm act(final String arg) {
         return this;
     }
 
 }
+//end::act[]
 //end::class[]