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/isis.git
commit 6e55da5015b6e84f176d71dbeeb85761554a0106 Author: Andi Huber <ahu...@apache.org> AuthorDate: Thu Apr 30 07:21:01 2020 +0200 ISIS-2340: update demo to use proposed new PPM style --- .../DependentArgsActionDemo_useAutoComplete.java | 15 ++++++++++++--- .../depargs/DependentArgsActionDemo_useChoices.java | 17 ++++++++++++----- .../depargs/DependentArgsActionDemo_useDefault.java | 15 +++++++++++++-- .../depargs/DependentArgsActionDemo_useDisable.java | 10 +++++++++- .../depargs/DependentArgsActionDemo_useHide.java | 17 +++++++++++++++-- 5 files changed, 61 insertions(+), 13 deletions(-) diff --git a/examples/demo/src/main/java/demoapp/dom/actions/depargs/DependentArgsActionDemo_useAutoComplete.java b/examples/demo/src/main/java/demoapp/dom/actions/depargs/DependentArgsActionDemo_useAutoComplete.java index 9ae3b20..b7d6ac8 100644 --- a/examples/demo/src/main/java/demoapp/dom/actions/depargs/DependentArgsActionDemo_useAutoComplete.java +++ b/examples/demo/src/main/java/demoapp/dom/actions/depargs/DependentArgsActionDemo_useAutoComplete.java @@ -33,6 +33,9 @@ import org.apache.isis.applib.services.message.MessageService; import org.apache.isis.incubator.model.applib.annotation.Model; import lombok.RequiredArgsConstructor; +import lombok.Value; +import lombok.val; +import lombok.experimental.Accessors; @ActionLayout(named="Auto Complete", promptStyle = PromptStyle.DIALOG_MODAL) @Action @@ -42,6 +45,12 @@ public class DependentArgsActionDemo_useAutoComplete { @Inject MessageService messageService; private final DependentArgsActionDemo holder; + + @Value @Accessors(fluent = true) // fluent so we can replace this with Java(14+) records later + static class Parameters { + Parity parity; + DemoItem item1; + } public DependentArgsActionDemo act( @@ -70,10 +79,10 @@ public class DependentArgsActionDemo_useAutoComplete { @Model public Collection<DemoItem> autoComplete1Act( - - Parity parity, // <-- the refining parameter from the dialog above - + Parameters params, @MinLength(3) String search) { + + val parity = params.parity(); // <-- the refining parameter from the dialog above if(parity == null) { return holder.getItems() diff --git a/examples/demo/src/main/java/demoapp/dom/actions/depargs/DependentArgsActionDemo_useChoices.java b/examples/demo/src/main/java/demoapp/dom/actions/depargs/DependentArgsActionDemo_useChoices.java index 9046f13..bdf65a6 100644 --- a/examples/demo/src/main/java/demoapp/dom/actions/depargs/DependentArgsActionDemo_useChoices.java +++ b/examples/demo/src/main/java/demoapp/dom/actions/depargs/DependentArgsActionDemo_useChoices.java @@ -33,6 +33,9 @@ import org.apache.isis.applib.services.message.MessageService; import org.apache.isis.incubator.model.applib.annotation.Model; import lombok.RequiredArgsConstructor; +import lombok.Value; +import lombok.val; +import lombok.experimental.Accessors; @ActionLayout(named="Choices", promptStyle = PromptStyle.DIALOG_MODAL) @Action(semantics = SemanticsOf.SAFE) @@ -42,6 +45,12 @@ public class DependentArgsActionDemo_useChoices { @Inject MessageService messageService; private final DependentArgsActionDemo holder; + + @Value @Accessors(fluent = true) // fluent so we can replace this with Java(14+) records later + static class Parameters { + Parity parity; + DemoItem item1; + } public DependentArgsActionDemo act( @@ -69,11 +78,9 @@ public class DependentArgsActionDemo_useChoices { // -- PARAM 1 (DemoItem) @Model - public Collection<DemoItem> choices1Act( - - Parity parity // <-- the refining parameter from the dialog above - - ) { + public Collection<DemoItem> choices1Act(Parameters params) { + + val parity = params.parity(); // <-- the refining parameter from the dialog above if(parity == null) { return holder.getItems(); diff --git a/examples/demo/src/main/java/demoapp/dom/actions/depargs/DependentArgsActionDemo_useDefault.java b/examples/demo/src/main/java/demoapp/dom/actions/depargs/DependentArgsActionDemo_useDefault.java index d0e12c1..ffb27d9 100644 --- a/examples/demo/src/main/java/demoapp/dom/actions/depargs/DependentArgsActionDemo_useDefault.java +++ b/examples/demo/src/main/java/demoapp/dom/actions/depargs/DependentArgsActionDemo_useDefault.java @@ -30,6 +30,9 @@ import org.apache.isis.applib.services.message.MessageService; import org.apache.isis.incubator.model.applib.annotation.Model; import lombok.RequiredArgsConstructor; +import lombok.Value; +import lombok.val; +import lombok.experimental.Accessors; @ActionLayout(named="Default", promptStyle = PromptStyle.DIALOG_MODAL) @Action @@ -38,8 +41,13 @@ public class DependentArgsActionDemo_useDefault { @Inject MessageService messageService; - private final DependentArgsActionDemo holder; + + @Value @Accessors(fluent = true) // fluent so we can replace this with Java(14+) records later + static class Parameters { + Parity parity; + String message; + } public DependentArgsActionDemo act( @@ -68,7 +76,10 @@ public class DependentArgsActionDemo_useDefault { // -- PARAM 1 (String message) @Model - public String default1Act(Parity parity) { + public String default1Act(Parameters params) { + + val parity = params.parity(); // <-- the refining parameter from the dialog above + if(parity == null) { return "no parity selected"; } diff --git a/examples/demo/src/main/java/demoapp/dom/actions/depargs/DependentArgsActionDemo_useDisable.java b/examples/demo/src/main/java/demoapp/dom/actions/depargs/DependentArgsActionDemo_useDisable.java index 8382761..369cefe 100644 --- a/examples/demo/src/main/java/demoapp/dom/actions/depargs/DependentArgsActionDemo_useDisable.java +++ b/examples/demo/src/main/java/demoapp/dom/actions/depargs/DependentArgsActionDemo_useDisable.java @@ -30,6 +30,8 @@ import org.apache.isis.applib.services.message.MessageService; import org.apache.isis.incubator.model.applib.annotation.Model; import lombok.RequiredArgsConstructor; +import lombok.Value; +import lombok.experimental.Accessors; @ActionLayout(named="Disable", promptStyle = PromptStyle.DIALOG_MODAL) @Action @@ -40,6 +42,12 @@ public class DependentArgsActionDemo_useDisable { private final DependentArgsActionDemo holder; + @Value @Accessors(fluent = true) // fluent so we can replace this with Java(14+) records later + static class Parameters { + boolean disableMessageField; + String message; + } + public DependentArgsActionDemo act( // PARAM 0 @@ -57,7 +65,7 @@ public class DependentArgsActionDemo_useDisable { return holder; } - // -- PARAM 0 (Parity) + // -- PARAM 0 (boolean disableMessageField) @Model public boolean default0Act() { diff --git a/examples/demo/src/main/java/demoapp/dom/actions/depargs/DependentArgsActionDemo_useHide.java b/examples/demo/src/main/java/demoapp/dom/actions/depargs/DependentArgsActionDemo_useHide.java index 570cc43..2c3061c 100644 --- a/examples/demo/src/main/java/demoapp/dom/actions/depargs/DependentArgsActionDemo_useHide.java +++ b/examples/demo/src/main/java/demoapp/dom/actions/depargs/DependentArgsActionDemo_useHide.java @@ -30,6 +30,8 @@ import org.apache.isis.applib.services.message.MessageService; import org.apache.isis.incubator.model.applib.annotation.Model; import lombok.RequiredArgsConstructor; +import lombok.Value; +import lombok.experimental.Accessors; @ActionLayout(named="Hide", promptStyle = PromptStyle.DIALOG_MODAL) @Action @@ -39,6 +41,12 @@ public class DependentArgsActionDemo_useHide { @Inject MessageService messageService; private final DependentArgsActionDemo holder; + + @Value @Accessors(fluent = true) // fluent so we can replace this with Java(14+) records later + static class Parameters { + boolean hideMessageField; + String message; + } public DependentArgsActionDemo act( @@ -57,7 +65,7 @@ public class DependentArgsActionDemo_useHide { return holder; } - // -- PARAM 0 (Parity) + // -- PARAM 0 (boolean hideMessageField) @Model public boolean default0Act() { @@ -71,6 +79,11 @@ public class DependentArgsActionDemo_useHide { return hideMessageField; } - + + public boolean hide1Act(Parameters params) { + return params.hideMessageField(); + } + + }