From 8f8b9e967df599a015c11831b87bb8cd39721e7c Mon Sep 17 00:00:00 2001 From: Moritz Dieing <63721811+moritzdieing@users.noreply.github.com> Date: Sun, 7 Mar 2021 14:17:21 +0100 Subject: [PATCH] Use client value for the algorithm --- src/main/java/edu/kit/typicalc/view/main/InputBar.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/edu/kit/typicalc/view/main/InputBar.java b/src/main/java/edu/kit/typicalc/view/main/InputBar.java index 82c7309..1fc9135 100644 --- a/src/main/java/edu/kit/typicalc/view/main/InputBar.java +++ b/src/main/java/edu/kit/typicalc/view/main/InputBar.java @@ -13,7 +13,6 @@ import com.vaadin.flow.component.orderedlayout.HorizontalLayout; import com.vaadin.flow.component.textfield.TextField; import com.vaadin.flow.i18n.LocaleChangeEvent; import com.vaadin.flow.i18n.LocaleChangeObserver; -import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; import java.util.Map; @@ -118,9 +117,12 @@ public class InputBar extends HorizontalLayout implements LocaleChangeObserver { } private void onTypeInferButtonClick() { - String currentInput = inputField.getOptionalValue().orElse(StringUtils.EMPTY); - inputField.blur(); - callback.accept(Pair.of(currentInput, typeAssumptionsArea.getTypeAssumptions())); + UI.getCurrent().getPage() + .executeJs("return document.getElementById($0).shadowRoot.querySelector('input').value", INPUT_FIELD_ID) + .then(String.class, value -> { + inputField.blur(); + callback.accept(Pair.of(value, typeAssumptionsArea.getTypeAssumptions())); + }); } private void onTypeAssumptionsButton() {