You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by ah...@apache.org on 2022/05/19 04:35:02 UTC
[isis] branch master updated: ISIS-3054: adds Demo showcase to reproduce issue
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
The following commit(s) were added to refs/heads/master by this push:
new f47594c300 ISIS-3054: adds Demo showcase to reproduce issue
f47594c300 is described below
commit f47594c3005812e45f010176f24bbd507cbf1b0b
Author: Andi Huber <ah...@apache.org>
AuthorDate: Thu May 19 06:34:55 2022 +0200
ISIS-3054: adds Demo showcase to reproduce issue
---
.../depargs/DependentArgsActionDemo.layout.xml | 1 +
.../DependentArgsActionDemo_useAutoComplete.java | 2 +-
... DependentArgsActionDemo_useAutoComplete2.java} | 44 +++++++++++-----------
3 files changed, 25 insertions(+), 22 deletions(-)
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/progmodel/depargs/DependentArgsActionDemo.layout.xml b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/progmodel/depargs/DependentArgsActionDemo.layout.xml
index e25c976711..246fee7b03 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/progmodel/depargs/DependentArgsActionDemo.layout.xml
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/progmodel/depargs/DependentArgsActionDemo.layout.xml
@@ -33,6 +33,7 @@
<cpt:action id="useChoices"/>
<cpt:action id="useChoices2"/>
<cpt:action id="useAutoComplete"/>
+ <cpt:action id="useAutoComplete2"/>
<cpt:action id="useDefault"/>
<cpt:property id="dependentText1"/>
<cpt:property id="dialogParityDefault" />
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/progmodel/depargs/DependentArgsActionDemo_useAutoComplete.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/progmodel/depargs/DependentArgsActionDemo_useAutoComplete.java
index 78e6c65bee..36d08beafb 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/progmodel/depargs/DependentArgsActionDemo_useAutoComplete.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/progmodel/depargs/DependentArgsActionDemo_useAutoComplete.java
@@ -78,7 +78,7 @@ public class DependentArgsActionDemo_useAutoComplete {
@MemberSupport public Collection<DemoItem> autoComplete1Act(
final Parameters params,
- @MinLength(3) final String search) {
+ @MinLength(2) final String search) {
val parity = params.parity(); // <-- the refining parameter from the dialog above
diff --git a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/progmodel/depargs/DependentArgsActionDemo_useAutoComplete.java b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/progmodel/depargs/DependentArgsActionDemo_useAutoComplete2.java
similarity index 67%
copy from examples/demo/domain/src/main/java/demoapp/dom/domain/actions/progmodel/depargs/DependentArgsActionDemo_useAutoComplete.java
copy to examples/demo/domain/src/main/java/demoapp/dom/domain/actions/progmodel/depargs/DependentArgsActionDemo_useAutoComplete2.java
index 78e6c65bee..2c4eaf1e2a 100644
--- a/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/progmodel/depargs/DependentArgsActionDemo_useAutoComplete.java
+++ b/examples/demo/domain/src/main/java/demoapp/dom/domain/actions/progmodel/depargs/DependentArgsActionDemo_useAutoComplete2.java
@@ -18,7 +18,8 @@
*/
package demoapp.dom.domain.actions.progmodel.depargs;
-import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
import java.util.stream.Collectors;
import javax.inject.Inject;
@@ -31,16 +32,20 @@ import org.apache.isis.applib.annotation.Optionality;
import org.apache.isis.applib.annotation.Parameter;
import org.apache.isis.applib.annotation.PromptStyle;
import org.apache.isis.applib.services.message.MessageService;
+import org.apache.isis.commons.internal.base._NullSafe;
+import org.apache.isis.commons.internal.collections._Lists;
import lombok.RequiredArgsConstructor;
import lombok.Value;
import lombok.val;
import lombok.experimental.Accessors;
-@ActionLayout(named="Auto Complete", promptStyle = PromptStyle.DIALOG_MODAL)
+@ActionLayout(
+ named="Auto Complete (Multi)",
+ promptStyle = PromptStyle.DIALOG_MODAL)
@Action
@RequiredArgsConstructor
-public class DependentArgsActionDemo_useAutoComplete {
+public class DependentArgsActionDemo_useAutoComplete2 {
@Inject MessageService messageService;
@@ -48,50 +53,47 @@ public class DependentArgsActionDemo_useAutoComplete {
@Value @Accessors(fluent = true) // fluent so we can replace this with Java(14+) records later
static class Parameters {
- Parity parity;
- DemoItem item1;
+ List<Parity> parities;
+ List<DemoItem> items;
}
@MemberSupport public DependentArgsActionDemo act(
// PARAM 0
@Parameter(optionality = Optionality.MANDATORY) final
- Parity parity,
+ List<Parity> parities,
// PARAM 1
@Parameter(optionality = Optionality.MANDATORY) final
- DemoItem item
+ List<DemoItem> items
) {
- messageService.informUser(item.getName());
+ _NullSafe.stream(items)
+ .forEach(item->messageService.informUser(item.getName()));
return holder;
}
- // -- PARAM 0 (Parity)
+ // -- PARAM 0 (Parities)
- @MemberSupport public Parity default0Act() {
- return holder.getDialogParityDefault();
+ @MemberSupport public List<Parity> defaultParities(final Parameters params) {
+ return _Lists.of(holder.getDialogParityDefault());
}
// -- PARAM 1 (DemoItem)
- @MemberSupport public Collection<DemoItem> autoComplete1Act(
+ @MemberSupport public List<DemoItem> autoCompleteItems(
final Parameters params,
- @MinLength(3) final String search) {
+ @MinLength(2) final String search) {
- val parity = params.parity(); // <-- the refining parameter from the dialog above
+ val paritiesFromDialog = params.parities(); // <-- the refining parameter from the dialog above
- if(parity == null) {
- return holder.getItems()
- .stream()
- .filter(item->item.getName().toLowerCase().contains(search.toLowerCase()))
- .collect(Collectors.toList());
+ if(_NullSafe.isEmpty(paritiesFromDialog)) {
+ return Collections.emptyList();
}
-
return holder.getItems()
.stream()
- .filter(item->parity == item.getParity())
+ .filter(item->paritiesFromDialog.contains(item.getParity()))
.filter(item->item.getName().toLowerCase().contains(search.toLowerCase()))
.collect(Collectors.toList());
}