mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-08 18:30:42 +00:00
Kommentare hinzugefügt
This commit is contained in:
parent
c19e3dbd0e
commit
61f1dd937e
@ -6,6 +6,9 @@ import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
|||||||
import com.vaadin.flow.i18n.LocaleChangeEvent;
|
import com.vaadin.flow.i18n.LocaleChangeEvent;
|
||||||
import com.vaadin.flow.i18n.LocaleChangeObserver;
|
import com.vaadin.flow.i18n.LocaleChangeObserver;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Container for the components displayed in the drawer area of the web page.
|
||||||
|
*/
|
||||||
@CssImport("./styles/view/main/drawer-content.css")
|
@CssImport("./styles/view/main/drawer-content.css")
|
||||||
public class DrawerContent extends VerticalLayout implements LocaleChangeObserver {
|
public class DrawerContent extends VerticalLayout implements LocaleChangeObserver {
|
||||||
|
|
||||||
@ -20,7 +23,10 @@ public class DrawerContent extends VerticalLayout implements LocaleChangeObserve
|
|||||||
private final H3 heading;
|
private final H3 heading;
|
||||||
private final VerticalLayout ruleContainer;
|
private final VerticalLayout ruleContainer;
|
||||||
|
|
||||||
public DrawerContent() {
|
/**
|
||||||
|
* Creates a new DrawerContent.
|
||||||
|
*/
|
||||||
|
protected DrawerContent() {
|
||||||
heading = new H3(getTranslation("root.inferenceRules"));
|
heading = new H3(getTranslation("root.inferenceRules"));
|
||||||
ruleContainer = new VerticalLayout();
|
ruleContainer = new VerticalLayout();
|
||||||
ruleContainer.setId(RULE_CONTAINER_ID);
|
ruleContainer.setId(RULE_CONTAINER_ID);
|
||||||
|
@ -10,6 +10,11 @@ import com.vaadin.flow.i18n.LocaleChangeObserver;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains all predefined examples as buttons. Clicking on a button inserts the example string into
|
||||||
|
* the input bar.
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class ExampleDialog extends Dialog implements LocaleChangeObserver {
|
public class ExampleDialog extends Dialog implements LocaleChangeObserver {
|
||||||
|
|
||||||
private static final long serialVersionUID = 8718432784530464215L;
|
private static final long serialVersionUID = 8718432784530464215L;
|
||||||
@ -18,13 +23,22 @@ public class ExampleDialog extends Dialog implements LocaleChangeObserver {
|
|||||||
List.of("λx.x", "λx.λy.y x", "λx.λy.y (x x)", "let f = λx. g y y in f 3", "(λx.x x) (λx.x x)");
|
List.of("λx.x", "λx.λy.y x", "λx.λy.y (x x)", "let f = λx. g y y in f 3", "(λx.x x) (λx.x x)");
|
||||||
private final Paragraph instruction;
|
private final Paragraph instruction;
|
||||||
|
|
||||||
public ExampleDialog(Consumer<String> callback) {
|
/**
|
||||||
|
* Creates a new ExampleDialog with a callback method to insert the example string into the input
|
||||||
|
* bar.
|
||||||
|
*
|
||||||
|
* @param callback inserts the string of the chosen example into the input bar
|
||||||
|
*/
|
||||||
|
protected ExampleDialog(Consumer<String> callback) {
|
||||||
VerticalLayout layout = new VerticalLayout();
|
VerticalLayout layout = new VerticalLayout();
|
||||||
instruction = new Paragraph(getTranslation("root.selectExample"));
|
instruction = new Paragraph(getTranslation("root.selectExample"));
|
||||||
layout.add(instruction);
|
layout.add(instruction);
|
||||||
for (String term : EXAMPLES) {
|
for (String term : EXAMPLES) {
|
||||||
Button button = new Button(term);
|
Button button = new Button(term);
|
||||||
button.addClickListener(click -> callback.accept(term));
|
button.addClickListener(click -> {
|
||||||
|
callback.accept(term);
|
||||||
|
this.close();
|
||||||
|
});
|
||||||
layout.add(button);
|
layout.add(button);
|
||||||
}
|
}
|
||||||
add(layout);
|
add(layout);
|
||||||
|
@ -9,6 +9,9 @@ import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
|||||||
import com.vaadin.flow.i18n.LocaleChangeEvent;
|
import com.vaadin.flow.i18n.LocaleChangeEvent;
|
||||||
import com.vaadin.flow.i18n.LocaleChangeObserver;
|
import com.vaadin.flow.i18n.LocaleChangeObserver;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains information on how to use the application.
|
||||||
|
*/
|
||||||
@CssImport("./styles/view/main/help-dialog.css")
|
@CssImport("./styles/view/main/help-dialog.css")
|
||||||
public class HelpDialog extends Dialog implements LocaleChangeObserver {
|
public class HelpDialog extends Dialog implements LocaleChangeObserver {
|
||||||
private static final long serialVersionUID = 4470277770276296164L;
|
private static final long serialVersionUID = 4470277770276296164L;
|
||||||
@ -22,7 +25,10 @@ public class HelpDialog extends Dialog implements LocaleChangeObserver {
|
|||||||
private final H3 heading;
|
private final H3 heading;
|
||||||
private final H5 inputSyntax;
|
private final H5 inputSyntax;
|
||||||
|
|
||||||
public HelpDialog() {
|
/**
|
||||||
|
* Create a new HelpDialog.
|
||||||
|
*/
|
||||||
|
protected HelpDialog() {
|
||||||
final HorizontalLayout headingLayout = new HorizontalLayout();
|
final HorizontalLayout headingLayout = new HorizontalLayout();
|
||||||
heading = new H3(getTranslation("root.operatingHelp"));
|
heading = new H3(getTranslation("root.operatingHelp"));
|
||||||
headingLayout.setId(HEADING_LAYOUT_ID);
|
headingLayout.setId(HEADING_LAYOUT_ID);
|
||||||
|
@ -12,6 +12,11 @@ import com.vaadin.flow.component.orderedlayout.VerticalLayout;
|
|||||||
import com.vaadin.flow.i18n.LocaleChangeEvent;
|
import com.vaadin.flow.i18n.LocaleChangeEvent;
|
||||||
import com.vaadin.flow.i18n.LocaleChangeObserver;
|
import com.vaadin.flow.i18n.LocaleChangeObserver;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visual representation of an inference rule. The component is composed of the rule itself (displayed
|
||||||
|
* in LaTeX rendered by MathJax), the name of the rule and a button to copy the LaTeX-code to the
|
||||||
|
* clipboard. Each InferenceRuleField is displayed in drawer area of the web page.
|
||||||
|
*/
|
||||||
@CssImport("./styles/view/main/inference-rule-field.css")
|
@CssImport("./styles/view/main/inference-rule-field.css")
|
||||||
@JsModule("./src/copy-to-clipboard.js")
|
@JsModule("./src/copy-to-clipboard.js")
|
||||||
public class InferenceRuleField extends VerticalLayout implements LocaleChangeObserver {
|
public class InferenceRuleField extends VerticalLayout implements LocaleChangeObserver {
|
||||||
@ -31,7 +36,14 @@ public class InferenceRuleField extends VerticalLayout implements LocaleChangeOb
|
|||||||
private final H4 ruleName;
|
private final H4 ruleName;
|
||||||
private final MathjaxDisplay rule;
|
private final MathjaxDisplay rule;
|
||||||
|
|
||||||
public InferenceRuleField(final String latex, final String nameKey) {
|
/**
|
||||||
|
* Initializes an InferenceRuleField with a key to get the name of the inference rule and the LaTeX-code
|
||||||
|
* for its visual representation.
|
||||||
|
*
|
||||||
|
* @param latex the LaTeX-code
|
||||||
|
* @param nameKey the key to get the name of the inference rule
|
||||||
|
*/
|
||||||
|
protected InferenceRuleField(final String latex, final String nameKey) {
|
||||||
this.nameKey = nameKey;
|
this.nameKey = nameKey;
|
||||||
|
|
||||||
final HorizontalLayout header = new HorizontalLayout();
|
final HorizontalLayout header = new HorizontalLayout();
|
||||||
|
Loading…
Reference in New Issue
Block a user