mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-08 18:30:42 +00:00
JavaDoc + move examples to bundle
This commit is contained in:
parent
eb33ce11bf
commit
f362f7f56a
@ -28,7 +28,7 @@ public class ErrorNotification extends Notification {
|
||||
/**
|
||||
* Creates a new ErrorNotification with a specific error.
|
||||
*
|
||||
* @param error the error
|
||||
* @param error the occurred error
|
||||
*/
|
||||
protected ErrorNotification(ParseError error) {
|
||||
VerticalLayout container = new VerticalLayout();
|
||||
|
@ -7,7 +7,6 @@ import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
||||
import com.vaadin.flow.i18n.LocaleChangeEvent;
|
||||
import com.vaadin.flow.i18n.LocaleChangeObserver;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
@ -21,11 +20,6 @@ public class ExampleDialog extends Dialog implements LocaleChangeObserver {
|
||||
|
||||
private static final String EXAMPLE_DIALOG_ID = "exampleDialog";
|
||||
|
||||
private static final List<String> EXAMPLES =
|
||||
List.of("λx.x", "λx.λy.y x", "λx.λy.y (x x)", "let f = λx. g y y in f 3", "let k = λx.λy. x in k a (k b c)",
|
||||
"(λx.x x) (λx.x x)",
|
||||
"(λx.λy.y (x y)) (λz. λa. z g a)", "let f = λx. let g = λy. y in g x in f 3",
|
||||
"let f = λx. let g = λy.5 5 in g x in f 3");
|
||||
private final H3 instruction;
|
||||
|
||||
/**
|
||||
@ -34,10 +28,11 @@ public class ExampleDialog extends Dialog implements LocaleChangeObserver {
|
||||
* @param callback function to handle the selected lambda term
|
||||
*/
|
||||
protected ExampleDialog(Consumer<String> callback) {
|
||||
String[] examples = getTranslation("root.exampleTerms").split(",");
|
||||
VerticalLayout layout = new VerticalLayout();
|
||||
instruction = new H3();
|
||||
layout.add(instruction);
|
||||
for (String term : EXAMPLES) {
|
||||
for (String term : examples) {
|
||||
Button button = new Button(term);
|
||||
button.addClickListener(click -> {
|
||||
callback.accept(term);
|
||||
|
@ -8,6 +8,10 @@ import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
|
||||
import com.vaadin.flow.i18n.LocaleChangeEvent;
|
||||
import com.vaadin.flow.i18n.LocaleChangeObserver;
|
||||
|
||||
/**
|
||||
* This class provides the layout for an AccordionPanel with either text or a button and text as its content.
|
||||
* These panels are used for the Accordion in the {@link edu.kit.typicalc.view.main.HelpDialog}.
|
||||
*/
|
||||
public class HelpContentField extends AccordionPanel implements LocaleChangeObserver {
|
||||
private static final String CLASSNAME = "help-field";
|
||||
|
||||
@ -17,6 +21,12 @@ public class HelpContentField extends AccordionPanel implements LocaleChangeObse
|
||||
private final String contentKey;
|
||||
private final Paragraph content;
|
||||
|
||||
/**
|
||||
* Create a HelpContentField with keys for the strings of the summary and the content of this AccordionPanel.
|
||||
*
|
||||
* @param summaryKey the key for the string of the summary
|
||||
* @param contentKey the key for the string of the content
|
||||
*/
|
||||
protected HelpContentField(String summaryKey, String contentKey) {
|
||||
this.summaryKey = summaryKey;
|
||||
this.contentKey = contentKey;
|
||||
@ -26,6 +36,14 @@ public class HelpContentField extends AccordionPanel implements LocaleChangeObse
|
||||
addThemeVariants(DetailsVariant.FILLED);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a HelpContentField with a button and keys for the string of the summary and the content of this
|
||||
* AccordionPanel.
|
||||
*
|
||||
* @param summaryKey the key for the string of the summary
|
||||
* @param button the button
|
||||
* @param contentKey the key for the string of the content
|
||||
*/
|
||||
protected HelpContentField(String summaryKey, Button button, String contentKey) {
|
||||
this(summaryKey, contentKey);
|
||||
HorizontalLayout layout = new HorizontalLayout(button, content);
|
||||
|
@ -1,6 +1,10 @@
|
||||
root.lambda=\u03BB
|
||||
root.typicalc=Typicalc
|
||||
root.examplebutton=\uD83D\uDCC2
|
||||
root.exampleTerms=\u03BBx.x,\u03BBx.\u03BBy.y x,\u03BBx.\u03BBy.y (x x),let f = \u03BBx. g y y in f 3,\
|
||||
let k = \u03BBx.\u03BBy. x in k a (k b c),(\u03BBx.x x) (\u03BBx.x x),\
|
||||
(\u03BBx.\u03BBy.y (x y)) (\u03BBz. \u03BBa. z g a),let f = \u03BBx. let g = \u03BBy. y in g x in f 3,\
|
||||
let f = \u03BBx. let g = \u03BBy.5 5 in g x in f 3
|
||||
root.termGrammar=\u2329Term\u232A ::= (\u2329Term\u232A) | \u2329App\u232A | \u2329Abs\u232A | \
|
||||
\u2329Let\u232A | \u2329Var\u232A | \u2329Const\u232A <br> \
|
||||
\u2329App\u232A ::= \u2329Term\u232A \u2329Term\u232A <br> \
|
||||
|
Loading…
Reference in New Issue
Block a user