From 0db8069c6029553961b482c1e862e7384b52b38b Mon Sep 17 00:00:00 2001 From: marmoure Date: Wed, 8 Nov 2023 11:48:15 +0100 Subject: [PATCH 1/2] [fix] always show the custom lookup --- .../java/org/humanistika/oxygen/tei/completer/TeiCompleter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/humanistika/oxygen/tei/completer/TeiCompleter.java b/src/main/java/org/humanistika/oxygen/tei/completer/TeiCompleter.java index 188f0f6..abba7af 100755 --- a/src/main/java/org/humanistika/oxygen/tei/completer/TeiCompleter.java +++ b/src/main/java/org/humanistika/oxygen/tei/completer/TeiCompleter.java @@ -93,7 +93,7 @@ public List filterAttributeValues(final List list, final WhatP if(autoCompleteSuggestions != null) { list.addAll(autoCompleteSuggestions.getSuggestions()); } - if(autoCompleteSuggestions != null && autoCompleteSuggestions.getSuggestions().size() == 0) { + if(autoCompleteSuggestions != null) { // the value needs to be prefixed with a space character to bump it to the top of the list list.add(new CustomCIValue(" Custom lookup...", this, autoCompleteSuggestions.autoCompleteContext)); } From 5c54d0987ae89bab75d8be008105c4c3decfb75f Mon Sep 17 00:00:00 2001 From: marmoure Date: Wed, 8 Nov 2023 12:49:25 +0100 Subject: [PATCH 2/2] [feature] better ordering --- .../oxygen/tei/completer/TeiCompleter.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/humanistika/oxygen/tei/completer/TeiCompleter.java b/src/main/java/org/humanistika/oxygen/tei/completer/TeiCompleter.java index abba7af..8f07a30 100755 --- a/src/main/java/org/humanistika/oxygen/tei/completer/TeiCompleter.java +++ b/src/main/java/org/humanistika/oxygen/tei/completer/TeiCompleter.java @@ -55,6 +55,7 @@ import java.awt.*; import java.util.List; +import java.util.stream.Collectors; /** * TEI-Completer @@ -90,12 +91,19 @@ public String getDescription() { public List filterAttributeValues(final List list, final WhatPossibleValuesHasAttributeContext context) { if (context != null) { final AutoCompleteSuggestions autoCompleteSuggestions = getAutoCompleteSuggestions(context); + if(autoCompleteSuggestions != null) { - list.addAll(autoCompleteSuggestions.getSuggestions()); + List spacePrefixedList = autoCompleteSuggestions.getSuggestions().stream().map(ciValue -> { + ciValue.setValue(" " + ciValue.getValue()); + return ciValue; + }).collect(Collectors.toList()); + + list.addAll(spacePrefixedList); } + if(autoCompleteSuggestions != null) { // the value needs to be prefixed with a space character to bump it to the top of the list - list.add(new CustomCIValue(" Custom lookup...", this, autoCompleteSuggestions.autoCompleteContext)); + list.add(new CustomCIValue("\uD83D\uDC49 Custom lookup...", this, autoCompleteSuggestions.autoCompleteContext)); } }