mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-10 03:10:44 +00:00
Extends content of infoDialog
This commit is contained in:
parent
4fc610c75e
commit
4c98976059
@ -7,7 +7,7 @@
|
||||
}
|
||||
|
||||
#infoContent {
|
||||
align-items: center;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
#inputSyntax {
|
||||
@ -18,5 +18,5 @@
|
||||
#closeIcon {
|
||||
right: 0;
|
||||
position: absolute;
|
||||
bottom: 0.45em;
|
||||
bottom: 2.1em;
|
||||
}
|
@ -35,7 +35,7 @@
|
||||
|
||||
@media (min-width: 1000px) {
|
||||
#inputBar {
|
||||
margin-left: 22em;
|
||||
margin-left: 15em;
|
||||
}
|
||||
|
||||
#viewTitle {
|
||||
|
@ -9,14 +9,12 @@ import com.vaadin.flow.component.icon.Icon;
|
||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.i18n.LocaleChangeEvent;
|
||||
import com.vaadin.flow.i18n.LocaleChangeObserver;
|
||||
|
||||
/**
|
||||
* Dialog which contains information on the correct syntax for the users input.
|
||||
*/
|
||||
@CssImport("./styles/view/main/info-dialog.css")
|
||||
public class InfoDialog extends Dialog implements LocaleChangeObserver {
|
||||
public class InfoDialog extends Dialog {
|
||||
private static final long serialVersionUID = 2914411566361539614L;
|
||||
|
||||
/*
|
||||
@ -24,7 +22,7 @@ public class InfoDialog extends Dialog implements LocaleChangeObserver {
|
||||
*/
|
||||
private static final String INFO_HEADER_ID = "infoHeader";
|
||||
private static final String INFO_CONTENT_ID = "infoContent";
|
||||
private static final String INPUT_SYNATX_ID = "inputSyntax";
|
||||
private static final String GRAMMAR_ID = "inputSyntax";
|
||||
private static final String CLOSE_ICON_ID = "closeIcon";
|
||||
|
||||
private final H4 heading;
|
||||
@ -41,20 +39,23 @@ public class InfoDialog extends Dialog implements LocaleChangeObserver {
|
||||
infoHeader.setId(INFO_HEADER_ID);
|
||||
infoHeader.add(closeIcon);
|
||||
|
||||
//TODO fill with content
|
||||
VerticalLayout infoContent = new VerticalLayout();
|
||||
VerticalLayout infoContent = createInfoContent();
|
||||
infoContent.setId(INFO_CONTENT_ID);
|
||||
Span explanation = new Span(getTranslation("root.infoExplanation"));
|
||||
Paragraph inputSyntax = new Paragraph();
|
||||
String paragraphContent = getTranslation("root.inputGrammar");
|
||||
inputSyntax.getElement().setProperty("innerHTML", paragraphContent);
|
||||
inputSyntax.setId(INPUT_SYNATX_ID);
|
||||
infoContent.add(explanation, inputSyntax);
|
||||
|
||||
add(infoHeader, infoContent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void localeChange(LocaleChangeEvent event) {
|
||||
heading.setText(getTranslation("root.inputSyntax"));
|
||||
|
||||
private VerticalLayout createInfoContent() {
|
||||
Span termExplanation = new Span(getTranslation("root.termExplanation"));
|
||||
Paragraph termSyntax = new Paragraph();
|
||||
String termSyntaxContent = getTranslation("root.termGrammar");
|
||||
termSyntax.getElement().setProperty("innerHTML", termSyntaxContent);
|
||||
termSyntax.setId(GRAMMAR_ID);
|
||||
Span assExplanation = new Span(getTranslation("root.assExplanation"));
|
||||
Paragraph assSyntax = new Paragraph();
|
||||
String assSyntaxContent = getTranslation("root.assGrammar");
|
||||
assSyntax.getElement().setProperty("innerHTML", assSyntaxContent);
|
||||
assSyntax.setId(GRAMMAR_ID);
|
||||
return new VerticalLayout(termExplanation, termSyntax, assExplanation, assSyntax);
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ public class InputBar extends HorizontalLayout implements LocaleChangeObserver {
|
||||
private final TextField inputField;
|
||||
private final TypeAssumptionsArea typeAssumptionsArea;
|
||||
private final Button inferTypeButton;
|
||||
private final Button typeAssumptions;
|
||||
|
||||
/**
|
||||
* Creates an InputBar with a Consumer-object to call the inferType()-method in UpperBar.
|
||||
@ -57,7 +58,7 @@ public class InputBar extends HorizontalLayout implements LocaleChangeObserver {
|
||||
inputField.setValueChangeMode(ValueChangeMode.EAGER);
|
||||
inputField.addValueChangeListener(event -> onInputFieldValueChange());
|
||||
Button lambdaButton = new Button(getTranslation("root.lambda"), event -> onLambdaButtonClick());
|
||||
Button typeAssumptions = new Button(
|
||||
typeAssumptions = new Button(
|
||||
getTranslation("root.typeAssumptions"),
|
||||
event -> onTypeAssumptionsButton()
|
||||
); // TODO
|
||||
@ -69,7 +70,7 @@ public class InputBar extends HorizontalLayout implements LocaleChangeObserver {
|
||||
inferTypeButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
|
||||
inferTypeButton.setId(INFER_BUTTON_ID);
|
||||
|
||||
add(infoIcon, exampleButton, lambdaButton, typeAssumptions, inputField, inferTypeButton);
|
||||
add(infoIcon, typeAssumptions, lambdaButton, inputField, exampleButton, inferTypeButton);
|
||||
setId(INPUT_BAR_ID);
|
||||
}
|
||||
|
||||
@ -129,5 +130,6 @@ public class InputBar extends HorizontalLayout implements LocaleChangeObserver {
|
||||
@Override
|
||||
public void localeChange(LocaleChangeEvent event) {
|
||||
inferTypeButton.setText(getTranslation("root.typeInfer"));
|
||||
typeAssumptions.setText(getTranslation("root.typeAssumptions"));
|
||||
}
|
||||
}
|
||||
|
@ -3,14 +3,18 @@ root.lambda=\u03BB
|
||||
root.home=home
|
||||
root.typicalc=Typicalc
|
||||
root.examplebutton=\uD83D\uDCC2
|
||||
root.inputGrammar=\u2329Term\u232A ::= \u2329App\u232A | \u2329Abs\u232A | (\u2329Term\u232A) | \
|
||||
root.termGrammar=\u2329Term\u232A ::= \u2329App\u232A | \u2329Abs\u232A | (\u2329Term\u232A) | \
|
||||
\u2329Let\u232A | \u2329Var\u232A | \u2329Const\u232A <br> \
|
||||
\u2329App\u232A ::= \u2329Term\u232A \u2329Term\u232A <br> \
|
||||
\u2329Abs\u232A ::= \u03BB\u2329Var\u232A.\u2329Term\u232A <br> \
|
||||
\u2329Let\u232A ::= <b>let</b> \u2329Var\u232A = \u2329Term\u232A <b>in</b> \u2329Term\u232A <br> \
|
||||
\u2329Var\u232A ::= [a-zA-Z] [a-zA-Z0-9]* <br> \
|
||||
\u2329Var\u232A ::= [a-zA-Z][a-zA-Z0-9]* <br> \
|
||||
\u2329Const\u232A ::= [0-9]+ | true | false
|
||||
|
||||
root.assGrammar=\u2329Type\u232A ::= \u2329NamedType\u232A | \u2329FunctionType\u232A | \
|
||||
(\u2329Type\u232A) <br> \
|
||||
\u2329FunctionType\u232A ::= \u2329Type\u232A -> \u2329Type\u232A <br> \
|
||||
\u2329NamedType\u232A ::= [a-zA-Z\u03B1-\u03C9A-\u2126][a-zA-Z\u03B1-\u03C9A-\u21260-9]*
|
||||
|
||||
root.appLatex=\
|
||||
\\begin{prooftree}\
|
||||
|
@ -16,7 +16,9 @@ root.varRuleLet=Var-Regel mit Let
|
||||
root.german=Deutsch
|
||||
root.english=Englisch
|
||||
root.selectLanguage=Sprache
|
||||
root.infoExplanation=Die folgende Grammatik beschreibt den Aufbau eines gültigen Terms:
|
||||
root.termExplanation=Die folgende Grammatik beschreibt den Aufbau eines gültigen Terms:
|
||||
root.assExplanation=Die folgende Grammatik beschreibt die Syntax eines gültigen Typs:
|
||||
root.typeAssumptions=Typannahmen
|
||||
|
||||
root.absLetLatex=\
|
||||
\\begin{prooftree}\
|
||||
|
@ -16,7 +16,9 @@ root.varRuleLet=Var rule with Let
|
||||
root.german=German
|
||||
root.english=English
|
||||
root.selectLanguage=Language
|
||||
root.infoExplanation=The following grammar specifies the structure of a valid term:
|
||||
root.termExplanation=The following grammar specifies the structure of a valid term:
|
||||
root.assExplanation=The following grammar specifies the syntax of a valid type:
|
||||
root.typeAssumptions=Type Assumptions
|
||||
|
||||
root.absLetLatex=\
|
||||
\\begin{prooftree}\
|
||||
|
Loading…
Reference in New Issue
Block a user