From 7ba30b4ef5687503e8eea665a24e271a584bf740 Mon Sep 17 00:00:00 2001 From: Johanna Stuber Date: Sun, 14 Mar 2021 13:02:34 +0100 Subject: [PATCH] add sentence to error view --- .../typicalc/view/content/errorcontent/ErrorView.java | 11 +++++++++-- src/main/resources/language/translation_de.properties | 2 ++ src/main/resources/language/translation_en.properties | 2 ++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/edu/kit/typicalc/view/content/errorcontent/ErrorView.java b/src/main/java/edu/kit/typicalc/view/content/errorcontent/ErrorView.java index 8e1c462..f032dcb 100644 --- a/src/main/java/edu/kit/typicalc/view/content/errorcontent/ErrorView.java +++ b/src/main/java/edu/kit/typicalc/view/content/errorcontent/ErrorView.java @@ -27,16 +27,22 @@ public class ErrorView extends VerticalLayout implements LocaleChangeObserver { private final H3 heading; private final Div errorMessage; private final ParseError error; + private final Paragraph hint; public ErrorView(ParseError error) { this.error = error; VerticalLayout container = new VerticalLayout(); + container.setId(ERROR_CONTENT_ID); heading = new H3(); heading.getStyle().set("color", "white"); errorMessage = new Div(); 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) { @@ -94,5 +100,6 @@ public class ErrorView extends VerticalLayout implements LocaleChangeObserver { heading.setText(getTranslation("error.heading")); errorMessage.removeAll(); errorMessage.add(buildErrorMessage(error)); + hint.setText(getTranslation("error.hint")); } } diff --git a/src/main/resources/language/translation_de.properties b/src/main/resources/language/translation_de.properties index bf38df4..5562cb6 100644 --- a/src/main/resources/language/translation_de.properties +++ b/src/main/resources/language/translation_de.properties @@ -103,6 +103,8 @@ error.heading=Syntaktisch falsche Eingabe! root.wrongCharacter=Falsches Zeichen: \u0020 root.position=An Position: \u0020 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.VARIABLE=Variable tokentype.LET=let diff --git a/src/main/resources/language/translation_en.properties b/src/main/resources/language/translation_en.properties index 44949f7..c904062 100644 --- a/src/main/resources/language/translation_en.properties +++ b/src/main/resources/language/translation_en.properties @@ -96,6 +96,8 @@ error.heading=Input is syntactically wrong! root.wrongCharacter=Wrong character: \u0020 root.position=At Position: \u0020 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.VARIABLE=Variable tokentype.LET=let