From 65bad2170a4672d10302a19baba93ab802d49335 Mon Sep 17 00:00:00 2001 From: "Ahmad K. Bawaneh" Date: Mon, 15 Jul 2024 01:16:55 +0300 Subject: [PATCH] fix #935 expose some members from AbstractSuggestBox class --- .../domino/ui/config/DelayedActionConfig.java | 29 +++++++++++++++ .../ui/forms/suggest/AbstractSuggestBox.java | 35 ++++++++++++++++++- 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/config/DelayedActionConfig.java b/domino-ui/src/main/java/org/dominokit/domino/ui/config/DelayedActionConfig.java index 04bcd5b3e..4653b86b7 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/config/DelayedActionConfig.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/config/DelayedActionConfig.java @@ -26,22 +26,51 @@ default int getDelayedExecutionDefaultDelay() { return 200; } + /** + * Use to globally configure select/suggest box search box typeahead delay. + * + * @return the delay in milliseconds, default to 1000ms + */ default int getDefaultSelectableBoxTypeAheadDelay() { return 1000; } + /** + * Use to globally configure Suggest box search box typeahead delay. + * + * @return the delay in milliseconds, default to {@link + * DelayedActionConfig#getDefaultSelectableBoxTypeAheadDelay()} + */ default int getSuggestBoxTypeAheadDelay() { return getDefaultSelectableBoxTypeAheadDelay(); } + /** + * Use to globally configure Select box search box typeahead delay. + * + * @return the delay in milliseconds, default to {@link + * DelayedActionConfig#getDefaultSelectableBoxTypeAheadDelay()} + */ default int getSelectBoxTypeAheadDelay() { return getDefaultSelectableBoxTypeAheadDelay(); } + /** + * Use to globally configure notification duration. + * + * @return the delay in milliseconds, default to 4000ms. + */ default int getDefaultNotificationDuration() { return 4000; } + /** + * Use to globally configure the delay before a datebox start parsing the value while tying in the + * date box input. + * + * @return the delay in milliseconds, default to {@link + * DelayedActionConfig#getDelayedExecutionDefaultDelay()}. + */ default int getDateBoxDefaultInputParseDelay() { return getDelayedExecutionDefaultDelay(); } diff --git a/domino-ui/src/main/java/org/dominokit/domino/ui/forms/suggest/AbstractSuggestBox.java b/domino-ui/src/main/java/org/dominokit/domino/ui/forms/suggest/AbstractSuggestBox.java index 5808c46c7..3b5d83c91 100644 --- a/domino-ui/src/main/java/org/dominokit/domino/ui/forms/suggest/AbstractSuggestBox.java +++ b/domino-ui/src/main/java/org/dominokit/domino/ui/forms/suggest/AbstractSuggestBox.java @@ -299,7 +299,7 @@ public void setTypeAheadDelay(int typeAheadDelayInMillis) { * the suggestions from the store, highlighting the matched portions, and updating the options * menu. */ - private void search() { + protected void search() { if (store != null) { loader.start(); optionsMenu.removeAll(); @@ -716,6 +716,39 @@ public C withOptionsMenu(ChildHandler> handler) { return (C) this; } + /** + * Use to change the default search loader of a suggest box. + * + * @param loader + * @return same component instance + */ + public C setLoader(Loader loader) { + this.loader = loader; + return (C) this; + } + + /** + * Use to apply a function on search loader of a suggest box. + * + * @param handler + * @return same component instance + */ + public C withLoader(ChildHandler handler) { + handler.apply((C) this, loader); + return (C) this; + } + + /** + * Use to apply a function on element hosting the suggest box search loader. + * + * @param handler + * @return same component instance + */ + public C withLoaderElement(ChildHandler> handler) { + handler.apply((C) this, loaderElement); + return (C) this; + } + /** * An interface for rendering the value of a suggestion option in a suggest box. *