navigate to startpage when empty term is entered

This commit is contained in:
ucrhh 2021-03-05 12:36:47 +01:00
parent 7a689d12a9
commit d4a6acbc07
2 changed files with 8 additions and 1 deletions

View File

@ -94,6 +94,11 @@ public class MainViewImpl extends AppLayout
private void setTermInURL(Pair<String, Map<String, String>> lambdaTermAndAssumptions) {
String lambdaTerm = lambdaTermAndAssumptions.getLeft();
if ("".equals(lambdaTerm)) {
UI.getCurrent().getPage().getHistory().pushState(null, new Location(""));
setContent(new StartPageView());
return;
}
StringBuilder types = new StringBuilder();
for (Map.Entry<String, String> type : lambdaTermAndAssumptions.getRight().entrySet()) {
if (types.length() > 0) {

View File

@ -69,8 +69,10 @@ public class UpperBar extends HorizontalLayout {
*/
protected void typeInfer(Pair<String, Map<String, String>> termAndAssumptions) {
setTermInURL.accept(termAndAssumptions);
if (!"".equals(termAndAssumptions.getLeft())) {
startInfer(termAndAssumptions.getLeft(), termAndAssumptions.getRight());
}
}
private void startInfer(String term, Map<String, String> typeAssumptions) {
presenter.typeInferLambdaString(term, typeAssumptions);