add shortcuts demo

This commit is contained in:
ucrhh 2021-03-05 14:21:50 +01:00
parent efe4e5f243
commit e724aedebd
4 changed files with 18 additions and 0 deletions

View File

@ -1,5 +1,6 @@
package edu.kit.typicalc.view.main;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.accordion.AccordionPanel;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.details.DetailsVariant;
@ -57,6 +58,11 @@ public class HelpContentField extends AccordionPanel implements LocaleChangeObse
setContent(content);
}
protected HelpContentField(String summaryKey, Component contentComponent) {
this(summaryKey, "");
setContent(contentComponent);
}
@Override
public void localeChange(LocaleChangeEvent event) {
summaryText.setText(getTranslation(summaryKey));

View File

@ -1,5 +1,6 @@
package edu.kit.typicalc.view.main;
import com.vaadin.flow.component.Component;
import com.vaadin.flow.component.ItemLabelGenerator;
import com.vaadin.flow.component.UI;
import com.vaadin.flow.component.accordion.Accordion;
@ -7,6 +8,7 @@ import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.dependency.CssImport;
import com.vaadin.flow.component.dialog.Dialog;
import com.vaadin.flow.component.html.H3;
import com.vaadin.flow.component.html.Paragraph;
import com.vaadin.flow.component.icon.Icon;
import com.vaadin.flow.component.icon.VaadinIcon;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
@ -72,6 +74,7 @@ public class HelpDialog extends Dialog implements LocaleChangeObserver {
acc.add(new HelpContentField("root.typeInferButton", "root.helpTypeInferButton"));
acc.add(new HelpContentField("root.inputField", "root.helpInputField"));
acc.add(new HelpContentField("root.typeAssumptions", "root.helpTypeAssumptions"));
acc.add(new HelpContentField("root.shortcuts", createShortcutComponent()));
acc.add(new HelpContentField("root.drawer",
new Button(new Icon(VaadinIcon.MENU)), "root.helpDrawer"));
acc.add(new HelpContentField("root.example",
@ -89,6 +92,13 @@ public class HelpDialog extends Dialog implements LocaleChangeObserver {
return acc;
}
private Component createShortcutComponent() {
VerticalLayout layout = new VerticalLayout();
layout.add(new Paragraph("CTRL + Left = First Step"));
layout.add(new Paragraph("Left = Previous Step")); // todo
return layout;
}
@Override
public void localeChange(LocaleChangeEvent event) {
heading.setText(getTranslation("root.operatingHelp"));

View File

@ -26,6 +26,7 @@ root.title404=404 - Seite nicht gefunden
root.message404=Versuche /infer/<term> oder gebe deinen Lieblingsterm in das Eingabefeld ein
root.drawer=Drawer (Ableitungsregeln)
root.example=Beispiele
root.shortcuts=Shortcuts
root.inputField=Eingabefeld
root.typeInferButton=Typisieren-Knopf
root.firstStepButton=Erster-Schritt-Knopf

View File

@ -26,6 +26,7 @@ root.title404=404 - Not Found
root.message404=Try /infer/<term> or type your favourite term into the input field
root.drawer=Drawer (type inference rules)
root.example=Examples
root.shortcuts=Shortcuts
root.inputField=Input Field
root.typeInferButton=Type Button
root.firstStepButton=First-Step Button