mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-08 18:30:42 +00:00
Added hint to type assumptions
This commit is contained in:
parent
26caed074d
commit
53243f7f43
@ -6,6 +6,7 @@ import com.vaadin.flow.component.button.ButtonVariant;
|
|||||||
import com.vaadin.flow.component.dependency.CssImport;
|
import com.vaadin.flow.component.dependency.CssImport;
|
||||||
import com.vaadin.flow.component.dialog.Dialog;
|
import com.vaadin.flow.component.dialog.Dialog;
|
||||||
import com.vaadin.flow.component.html.H3;
|
import com.vaadin.flow.component.html.H3;
|
||||||
|
import com.vaadin.flow.component.html.Label;
|
||||||
import com.vaadin.flow.component.icon.Icon;
|
import com.vaadin.flow.component.icon.Icon;
|
||||||
import com.vaadin.flow.component.icon.VaadinIcon;
|
import com.vaadin.flow.component.icon.VaadinIcon;
|
||||||
import com.vaadin.flow.component.notification.Notification;
|
import com.vaadin.flow.component.notification.Notification;
|
||||||
@ -48,6 +49,7 @@ public class TypeAssumptionsArea extends Dialog implements LocaleChangeObserver
|
|||||||
private final Button deleteAll;
|
private final Button deleteAll;
|
||||||
private final Button saveAssumptions;
|
private final Button saveAssumptions;
|
||||||
private final Notification invalidInputNotification;
|
private final Notification invalidInputNotification;
|
||||||
|
private final Label hintLabel;
|
||||||
|
|
||||||
private final List<TypeAssumptionField> fields = new ArrayList<>();
|
private final List<TypeAssumptionField> fields = new ArrayList<>();
|
||||||
|
|
||||||
@ -62,25 +64,20 @@ public class TypeAssumptionsArea extends Dialog implements LocaleChangeObserver
|
|||||||
|
|
||||||
VerticalLayout layout = new VerticalLayout();
|
VerticalLayout layout = new VerticalLayout();
|
||||||
layout.setId(ASS_LAYOUT_ID);
|
layout.setId(ASS_LAYOUT_ID);
|
||||||
HorizontalLayout buttons = new HorizontalLayout();
|
|
||||||
buttons.setId(ASS_BUTTONS_ID);
|
|
||||||
addAssumption = new Button("", new Icon(VaadinIcon.PLUS_CIRCLE));
|
addAssumption = new Button("", new Icon(VaadinIcon.PLUS_CIRCLE));
|
||||||
addAssumption.setIconAfterText(true);
|
|
||||||
addAssumption.addClickListener(event -> onAddAssumptionClicked());
|
|
||||||
deleteAll = new Button("", new Icon(VaadinIcon.TRASH));
|
deleteAll = new Button("", new Icon(VaadinIcon.TRASH));
|
||||||
deleteAll.addClickListener(event -> onDeleteAllClick());
|
|
||||||
deleteAll.setIconAfterText(true);
|
|
||||||
deleteAll.addThemeVariants(ButtonVariant.LUMO_ERROR);
|
|
||||||
saveAssumptions = new Button(getTranslation("root.save"), event -> closeAction());
|
saveAssumptions = new Button(getTranslation("root.save"), event -> closeAction());
|
||||||
saveAssumptions.addThemeVariants(ButtonVariant.LUMO_SUCCESS);
|
HorizontalLayout buttons = makeButtons();
|
||||||
saveAssumptions.addClickShortcut(Key.ENTER);
|
buttons.setId(ASS_BUTTONS_ID);
|
||||||
buttons.add(addAssumption, deleteAll, saveAssumptions);
|
|
||||||
|
|
||||||
assumptionContainer = new VerticalLayout();
|
assumptionContainer = new VerticalLayout();
|
||||||
assumptionContainer.setId(ASS_CONTAINER_ID);
|
assumptionContainer.setId(ASS_CONTAINER_ID);
|
||||||
|
|
||||||
|
hintLabel = new Label("");
|
||||||
|
|
||||||
initializeWithAssumptions(types);
|
initializeWithAssumptions(types);
|
||||||
layout.add(buttons, assumptionContainer);
|
layout.add(hintLabel, buttons, assumptionContainer);
|
||||||
HorizontalLayout headingLayout = makeHeader();
|
HorizontalLayout headingLayout = makeHeader();
|
||||||
add(headingLayout, layout);
|
add(headingLayout, layout);
|
||||||
addDialogCloseActionListener(event -> closeAction());
|
addDialogCloseActionListener(event -> closeAction());
|
||||||
@ -125,6 +122,20 @@ public class TypeAssumptionsArea extends Dialog implements LocaleChangeObserver
|
|||||||
headingLayout.add(closeIcon);
|
headingLayout.add(closeIcon);
|
||||||
return headingLayout;
|
return headingLayout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private HorizontalLayout makeButtons() {
|
||||||
|
HorizontalLayout buttons = new HorizontalLayout();
|
||||||
|
buttons.setId(ASS_BUTTONS_ID);
|
||||||
|
addAssumption.setIconAfterText(true);
|
||||||
|
addAssumption.addClickListener(event -> onAddAssumptionClicked());
|
||||||
|
deleteAll.addClickListener(event -> onDeleteAllClick());
|
||||||
|
deleteAll.setIconAfterText(true);
|
||||||
|
deleteAll.addThemeVariants(ButtonVariant.LUMO_ERROR);
|
||||||
|
saveAssumptions.addThemeVariants(ButtonVariant.LUMO_SUCCESS);
|
||||||
|
saveAssumptions.addClickShortcut(Key.ENTER);
|
||||||
|
buttons.add(addAssumption, deleteAll, saveAssumptions);
|
||||||
|
return buttons;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Creates a new empty TypeAssumptionsArea.
|
* Creates a new empty TypeAssumptionsArea.
|
||||||
*/
|
*/
|
||||||
@ -180,5 +191,6 @@ public class TypeAssumptionsArea extends Dialog implements LocaleChangeObserver
|
|||||||
deleteAll.setText(getTranslation("root.deleteAll"));
|
deleteAll.setText(getTranslation("root.deleteAll"));
|
||||||
saveAssumptions.setText(getTranslation("root.save"));
|
saveAssumptions.setText(getTranslation("root.save"));
|
||||||
invalidInputNotification.setText(getTranslation("root.correctAssumptions"));
|
invalidInputNotification.setText(getTranslation("root.correctAssumptions"));
|
||||||
|
hintLabel.setText(getTranslation("root.typeAssumptionsHint"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,7 @@ root.selectLanguage=Sprache
|
|||||||
root.termExplanation=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.assExplanation=Die folgende Grammatik beschreibt die Syntax eines gültigen Typs:
|
||||||
root.typeAssumptions=Typannahmen
|
root.typeAssumptions=Typannahmen
|
||||||
|
root.typeAssumptionsHint=Um die Typannahmen auf den Term anzuwenden, muss neu typisiert werden.
|
||||||
root.addAssumption=Typannahme hinzufügen
|
root.addAssumption=Typannahme hinzufügen
|
||||||
root.deleteAll=Alle löschen
|
root.deleteAll=Alle löschen
|
||||||
root.variable=Variable
|
root.variable=Variable
|
||||||
|
@ -18,6 +18,7 @@ root.selectLanguage=Language
|
|||||||
root.termExplanation=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.assExplanation=The following grammar specifies the syntax of a valid type:
|
||||||
root.typeAssumptions=Type Assumptions
|
root.typeAssumptions=Type Assumptions
|
||||||
|
root.typeAssumptionsHint=To apply the type assumptions to the current term, you need to press "Type".
|
||||||
root.addAssumption=Add Type Assumption
|
root.addAssumption=Add Type Assumption
|
||||||
root.deleteAll=Delete All
|
root.deleteAll=Delete All
|
||||||
root.variable=Variable
|
root.variable=Variable
|
||||||
|
Loading…
Reference in New Issue
Block a user