New example button in help dialog

This commit is contained in:
Arne Keller 2021-03-11 15:07:38 +01:00
parent 1dab9a3996
commit 6b84aa5402
5 changed files with 13 additions and 6 deletions

View File

@ -36,6 +36,9 @@ public class TypicalcI18NProvider implements I18NProvider {
@Override
public String getTranslation(String key, Locale locale, Object... params) {
if (key.equals("")) {
return "";
}
ResourceBundle bundle = ResourceBundle.getBundle(LANGUAGE_BUNDLE_PREFIX, locale);
String result;

View File

@ -82,8 +82,8 @@ public class HelpDialog extends Dialog implements LocaleChangeObserver {
acc.add(new HelpContentField("root.inferenceViewFeatures", "root.helpInferenceViewFeatures"));
acc.add(new HelpContentField("root.shortcuts", "root.helpShortcuts"));
acc.add(new HelpContentField("root.drawer", "root.helpDrawer"));
acc.add(new HelpContentField("root.example",
new Button(new Icon(VaadinIcon.PAPERCLIP)), "root.helpExample"));
acc.add(new HelpContentField("",
InputBar.createExampleButton(), "root.helpExample"));
acc.add(new HelpContentField("root.firstStepButton",
new Button(new Icon(VaadinIcon.ANGLE_DOUBLE_LEFT)), "root.helpFirstStepButton"));
acc.add(new HelpContentField("root.previousStepButton",

View File

@ -77,8 +77,8 @@ public class InputBar extends HorizontalLayout implements LocaleChangeObserver {
typeAssumptions = new Button("", event -> onTypeAssumptionsButton());
typeAssumptions.setId(ASS_BUTTON_ID);
typeAssumptionsArea = new TypeAssumptionsArea();
exampleButton = new Button(getTranslation("root.exampleButton"), event -> onExampleButtonClick());
exampleButton.setId(EXAMPLE_BUTTON_ID);
exampleButton = createExampleButton();
exampleButton.addClickListener(event -> onExampleButtonClick());
inferTypeButton = new Button("", event -> onTypeInferButtonClick());
inferTypeButton.addClickShortcut(Key.ENTER).listenOn(this);
inferTypeButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
@ -87,6 +87,12 @@ public class InputBar extends HorizontalLayout implements LocaleChangeObserver {
add(infoIcon, typeAssumptions, lambdaButton, inputField, exampleButton, inferTypeButton);
}
public static Button createExampleButton() {
Button button = new Button(UI.getCurrent().getTranslation("root.exampleButton"));
button.setId(EXAMPLE_BUTTON_ID);
return button;
}
/**
* Sets the provided string as the value of the inputField.
*

View File

@ -27,7 +27,6 @@ root.type=Typ
root.title404=404 - Seite nicht gefunden
root.message404=Versuche /infer/<term> oder gib deinen Lieblingsterm in das Eingabefeld ein.
root.drawer=Ableitungsregeln-Knopf
root.example=Beispiele
root.shortcuts=Tastaturbefehle
root.inputField=Eingabefeld
root.typeInferButton=Typisieren-Knopf

View File

@ -27,7 +27,6 @@ root.type=Type
root.title404=404 - Not Found
root.message404=Try /infer/<term> or type your favourite term into the input field.
root.drawer=Type Inference Rules Button
root.example=Examples
root.shortcuts=Shortcuts
root.inputField=Input Field
root.typeInferButton=Type Button