Use client value for the algorithm

This commit is contained in:
Moritz Dieing 2021-03-07 14:17:21 +01:00
parent 7a28facd83
commit 8f8b9e967d

View File

@ -13,7 +13,6 @@ import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.textfield.TextField; import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.i18n.LocaleChangeEvent; import com.vaadin.flow.i18n.LocaleChangeEvent;
import com.vaadin.flow.i18n.LocaleChangeObserver; import com.vaadin.flow.i18n.LocaleChangeObserver;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
import java.util.Map; import java.util.Map;
@ -118,9 +117,12 @@ public class InputBar extends HorizontalLayout implements LocaleChangeObserver {
} }
private void onTypeInferButtonClick() { private void onTypeInferButtonClick() {
String currentInput = inputField.getOptionalValue().orElse(StringUtils.EMPTY); UI.getCurrent().getPage()
inputField.blur(); .executeJs("return document.getElementById($0).shadowRoot.querySelector('input').value", INPUT_FIELD_ID)
callback.accept(Pair.of(currentInput, typeAssumptionsArea.getTypeAssumptions())); .then(String.class, value -> {
inputField.blur();
callback.accept(Pair.of(value, typeAssumptionsArea.getTypeAssumptions()));
});
} }
private void onTypeAssumptionsButton() { private void onTypeAssumptionsButton() {