From 5ea0a2f0c82bf8d505df9b1bfb107d00211ca13a Mon Sep 17 00:00:00 2001 From: Miroslav Pokorny Date: Wed, 15 Jan 2025 21:20:45 +1100 Subject: [PATCH] SpreadsheetSuggestBoxComponent.addXXXListener suggestBox.addEventListener --- .../value/SpreadsheetSuggestBoxComponent.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/main/java/walkingkooka/spreadsheet/dominokit/value/SpreadsheetSuggestBoxComponent.java b/src/main/java/walkingkooka/spreadsheet/dominokit/value/SpreadsheetSuggestBoxComponent.java index d2dae9394..50f2c3eca 100644 --- a/src/main/java/walkingkooka/spreadsheet/dominokit/value/SpreadsheetSuggestBoxComponent.java +++ b/src/main/java/walkingkooka/spreadsheet/dominokit/value/SpreadsheetSuggestBoxComponent.java @@ -276,39 +276,42 @@ public SpreadsheetSuggestBoxComponent addChangeListener(final ChangeListener< @Override public SpreadsheetSuggestBoxComponent addClickListener(final EventListener listener) { - this.suggestBox.addEventListener( + return this.addEventListener( EventType.click, listener ); - return this; } @Override public SpreadsheetSuggestBoxComponent addFocusListener(final EventListener listener) { - this.suggestBox.addEventListener( + return this.addEventListener( EventType.focus, listener ); - return this; } @Override public SpreadsheetSuggestBoxComponent addKeydownListener(final EventListener listener) { - Objects.requireNonNull(listener, "listener"); - - this.suggestBox.addEventListener( + return this.addEventListener( EventType.keydown, listener ); - return this; } @Override public SpreadsheetSuggestBoxComponent addKeyupListener(final EventListener listener) { + return this.addEventListener( + EventType.keyup, + listener + ); + } + + private SpreadsheetSuggestBoxComponent addEventListener(final EventType eventType, + final EventListener listener) { Objects.requireNonNull(listener, "listener"); this.suggestBox.addEventListener( - EventType.keyup, + eventType, listener ); return this;