add sentence to error view

This commit is contained in:
Johanna Stuber 2021-03-14 13:02:34 +01:00
parent 4e10893448
commit 7ba30b4ef5
3 changed files with 13 additions and 2 deletions

View File

@ -27,16 +27,22 @@ public class ErrorView extends VerticalLayout implements LocaleChangeObserver {
private final H3 heading; private final H3 heading;
private final Div errorMessage; private final Div errorMessage;
private final ParseError error; private final ParseError error;
private final Paragraph hint;
public ErrorView(ParseError error) { public ErrorView(ParseError error) {
this.error = error; this.error = error;
VerticalLayout container = new VerticalLayout(); VerticalLayout container = new VerticalLayout();
container.setId(ERROR_CONTENT_ID);
heading = new H3(); heading = new H3();
heading.getStyle().set("color", "white"); heading.getStyle().set("color", "white");
errorMessage = new Div(); errorMessage = new Div();
container.add(heading, errorMessage); container.add(heading, errorMessage);
add(container, new InfoContent());
container.setId(ERROR_CONTENT_ID); InfoContent infoContent = new InfoContent();
hint = new Paragraph();
infoContent.addComponentAsFirst(hint);
add(container, infoContent);
} }
private Component buildErrorMessage(ParseError error) { private Component buildErrorMessage(ParseError error) {
@ -94,5 +100,6 @@ public class ErrorView extends VerticalLayout implements LocaleChangeObserver {
heading.setText(getTranslation("error.heading")); heading.setText(getTranslation("error.heading"));
errorMessage.removeAll(); errorMessage.removeAll();
errorMessage.add(buildErrorMessage(error)); errorMessage.add(buildErrorMessage(error));
hint.setText(getTranslation("error.hint"));
} }
} }

View File

@ -103,6 +103,8 @@ error.heading=Syntaktisch falsche Eingabe!
root.wrongCharacter=Falsches Zeichen: \u0020 root.wrongCharacter=Falsches Zeichen: \u0020
root.position=An Position: \u0020 root.position=An Position: \u0020
error.expectedToken=Erwartet: {0} error.expectedToken=Erwartet: {0}
error.hint=Die Grammatiken, die die korrekte Syntax eines Terms und der Typannahmen beschreiben, \
sind auch über das Info-Symbol zu erreichen.
tokentype.LAMBDA=λ tokentype.LAMBDA=λ
tokentype.VARIABLE=Variable tokentype.VARIABLE=Variable
tokentype.LET=let tokentype.LET=let

View File

@ -96,6 +96,8 @@ error.heading=Input is syntactically wrong!
root.wrongCharacter=Wrong character: \u0020 root.wrongCharacter=Wrong character: \u0020
root.position=At Position: \u0020 root.position=At Position: \u0020
error.expectedToken=Expected: {0} error.expectedToken=Expected: {0}
error.hint=The grammars describing the correct syntax of a term or a type assumption can also be reached \
via the info icon.
tokentype.LAMBDA=λ tokentype.LAMBDA=λ
tokentype.VARIABLE=Variable tokentype.VARIABLE=Variable
tokentype.LET=let tokentype.LET=let